summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml4
-rw-r--r--.gdbinit23
-rw-r--r--.gitignore11
-rw-r--r--.travis.yml6
-rw-r--r--CONTRIBUTING.md10
-rw-r--r--EXTENSIONS11
-rw-r--r--NEWS549
-rw-r--r--README.md8
-rw-r--r--TSRM/TSRM.c186
-rw-r--r--TSRM/TSRM.h58
-rw-r--r--TSRM/tsrm.m474
-rw-r--r--TSRM/tsrm_win32.c2
-rw-r--r--TSRM/tsrm_win32.h2
-rw-r--r--UPGRADING979
-rw-r--r--UPGRADING.INTERNALS374
-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/bug78239.phpt17
-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/typed_properties_class_loading.phpt4
-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.h176
-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.c1154
-rw-r--r--Zend/zend_execute.h24
-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
-rw-r--r--azure-pipelines.yml34
-rw-r--r--azure/community_job.yml1
-rw-r--r--azure/i386/job.yml5
-rw-r--r--azure/job.yml8
-rw-r--r--azure/macos/job.yml5
-rw-r--r--azure/msan_job.yml1
-rw-r--r--build/Makefile.global8
-rw-r--r--build/libtool.m45
-rw-r--r--build/php.m421
-rw-r--r--configure.ac37
-rw-r--r--docs/parameter-parsing-api.md1
-rw-r--r--docs/release-process.md2
-rw-r--r--docs/unix-build-system.md2
-rw-r--r--ext/bcmath/bcmath.c72
-rw-r--r--ext/bcmath/bcmath.stub.php22
-rw-r--r--ext/bcmath/bcmath_arginfo.h47
-rw-r--r--ext/bcmath/php_bcmath.h2
-rw-r--r--ext/bz2/bz2.c54
-rw-r--r--ext/bz2/bz2.stub.php54
-rw-r--r--ext/bz2/bz2_arginfo.h46
-rw-r--r--ext/bz2/bz2_filter.c2
-rw-r--r--ext/bz2/php_bz2.h2
-rw-r--r--ext/bz2/tests/001.phpt4
-rw-r--r--ext/bz2/tests/003-mb.phpt7
-rw-r--r--ext/bz2/tests/003.phpt7
-rw-r--r--ext/bz2/tests/004.phpt42
-rw-r--r--ext/bz2/tests/005.phpt11
-rw-r--r--ext/calendar/cal_unix.c2
-rw-r--r--ext/calendar/calendar.c125
-rw-r--r--ext/calendar/calendar.stub.php46
-rw-r--r--ext/calendar/calendar_arginfo.h77
-rw-r--r--ext/calendar/easter.c2
-rw-r--r--ext/calendar/tests/jdtomonthname.phpt23
-rw-r--r--ext/com_dotnet/com_com.c14
-rw-r--r--ext/com_dotnet/com_dotnet.c3
-rw-r--r--ext/com_dotnet/com_extension.c130
-rw-r--r--ext/com_dotnet/com_extension.stub.php67
-rw-r--r--ext/com_dotnet/com_extension_arginfo.h110
-rw-r--r--ext/com_dotnet/com_handlers.c158
-rw-r--r--ext/com_dotnet/com_iterator.c2
-rw-r--r--ext/com_dotnet/com_misc.c2
-rw-r--r--ext/com_dotnet/com_olechar.c2
-rw-r--r--ext/com_dotnet/com_persist.c12
-rw-r--r--ext/com_dotnet/com_saproxy.c82
-rw-r--r--ext/com_dotnet/com_typeinfo.c2
-rw-r--r--ext/com_dotnet/com_variant.c3
-rw-r--r--ext/com_dotnet/com_wrapper.c2
-rw-r--r--ext/com_dotnet/php_com_dotnet.h2
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h6
-rw-r--r--ext/ctype/ctype.c49
-rw-r--r--ext/ctype/ctype.stub.php23
-rw-r--r--ext/ctype/ctype_arginfo.h25
-rw-r--r--ext/ctype/php_ctype.h2
-rw-r--r--ext/curl/curl.stub.php147
-rw-r--r--ext/curl/curl_arginfo.h132
-rw-r--r--ext/curl/curl_file.c27
-rw-r--r--ext/curl/curl_file.stub.php24
-rw-r--r--ext/curl/curl_file_arginfo.h22
-rw-r--r--ext/curl/interface.c177
-rw-r--r--ext/curl/multi.c26
-rw-r--r--ext/curl/php_curl.h2
-rw-r--r--ext/curl/share.c8
-rw-r--r--ext/curl/tests/curl_multi_close_basic001.phpt12
-rw-r--r--ext/curl/tests/curl_setopt_error.phpt32
-rw-r--r--ext/date/php_date.c826
-rw-r--r--ext/date/php_date.h2
-rw-r--r--ext/date/php_date.stub.php298
-rw-r--r--ext/date/php_date_arginfo.h360
-rw-r--r--ext/date/tests/005.phpt9
-rw-r--r--ext/date/tests/006.phpt5
-rw-r--r--ext/date/tests/007.phpt3
-rw-r--r--ext/date/tests/008.phpt3
-rw-r--r--ext/date/tests/009.phpt9
-rw-r--r--ext/date/tests/009_win32.phpt9
-rw-r--r--ext/date/tests/011.phpt5
-rw-r--r--ext/date/tests/012.phpt13
-rw-r--r--ext/date/tests/013.phpt12
-rw-r--r--ext/date/tests/014.phpt6
-rw-r--r--ext/date/tests/68062.phpt12
-rw-r--r--ext/date/tests/DateTimeImmutable_createFromMutable.phpt13
-rw-r--r--ext/date/tests/DateTime_createFromImmutable.phpt11
-rw-r--r--ext/date/tests/ExtendDateTime.phpt2
-rw-r--r--ext/date/tests/bug36988.phpt10
-rw-r--r--ext/date/tests/bug48476.phpt32
-rw-r--r--ext/date/tests/bug52062.phpt9
-rw-r--r--ext/date/tests/bug62500.phpt2
-rw-r--r--ext/date/tests/bug67118.phpt8
-rw-r--r--ext/date/tests/bug70245.phpt9
-rw-r--r--ext/date/tests/bug74852.phpt2
-rw-r--r--ext/date/tests/bug75232.phpt4
-rw-r--r--ext/date/tests/date_default_timezone_set_error.phpt17
-rw-r--r--ext/date/tests/date_parse_001.phpt4
-rw-r--r--ext/date/tests/date_parse_error.phpt18
-rw-r--r--ext/date/tests/date_sun_info_001.phpt4
-rw-r--r--ext/date/tests/date_sun_info_002.phpt4
-rw-r--r--ext/date/tests/date_sunrise_variation9.phpt61
-rw-r--r--ext/date/tests/date_sunset_variation9.phpt61
-rw-r--r--ext/date/tests/getdate_variation7.phpt37
-rw-r--r--ext/date/tests/gmdate_variation14.phpt40
-rw-r--r--ext/date/tests/gmmktime_basic.phpt6
-rw-r--r--ext/date/tests/idate_variation3.phpt41
-rw-r--r--ext/date/tests/localtime_variation3.phpt50
-rw-r--r--ext/date/tests/microtime_error.phpt26
-rw-r--r--ext/date/tests/mktime_error.phpt20
-rw-r--r--ext/date/tests/oo_001.phpt24
-rw-r--r--ext/date/tests/strftime_variation23.phpt42
-rw-r--r--ext/date/tests/timezone_offset_get_error.phpt54
-rw-r--r--ext/dba/dba.c83
-rw-r--r--ext/dba/dba.stub.php67
-rw-r--r--ext/dba/dba_arginfo.h58
-rw-r--r--ext/dba/dba_cdb.c2
-rw-r--r--ext/dba/dba_db1.c2
-rw-r--r--ext/dba/dba_db2.c2
-rw-r--r--ext/dba/dba_db3.c2
-rw-r--r--ext/dba/dba_db4.c2
-rw-r--r--ext/dba/dba_dbm.c2
-rw-r--r--ext/dba/dba_flatfile.c2
-rw-r--r--ext/dba/dba_gdbm.c2
-rw-r--r--ext/dba/dba_inifile.c2
-rw-r--r--ext/dba/dba_lmdb.c2
-rw-r--r--ext/dba/dba_ndbm.c2
-rw-r--r--ext/dba/dba_qdbm.c2
-rw-r--r--ext/dba/dba_tcadb.c2
-rw-r--r--ext/dba/libcdb/cdb.c2
-rw-r--r--ext/dba/libcdb/cdb.h2
-rw-r--r--ext/dba/libcdb/cdb_make.c2
-rw-r--r--ext/dba/libcdb/cdb_make.h2
-rw-r--r--ext/dba/libcdb/uint32.c2
-rw-r--r--ext/dba/libcdb/uint32.h2
-rw-r--r--ext/dba/libflatfile/flatfile.c2
-rw-r--r--ext/dba/libflatfile/flatfile.h2
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/dba/libinifile/inifile.h2
-rw-r--r--ext/dba/php_dba.h2
-rw-r--r--ext/dba/php_tcadb.h2
-rw-r--r--ext/dba/tests/dba011.phpt4
-rw-r--r--ext/dba/tests/dba_handlers.phpt11
-rw-r--r--ext/dba/tests/dba_optimize.phpt8
-rw-r--r--ext/dba/tests/dba_split.phpt3
-rw-r--r--ext/dba/tests/dba_sync.phpt8
-rw-r--r--ext/dom/attr.c2
-rw-r--r--ext/dom/cdatasection.c2
-rw-r--r--ext/dom/characterdata.c2
-rw-r--r--ext/dom/comment.c2
-rw-r--r--ext/dom/config.m414
-rw-r--r--ext/dom/config.w3214
-rw-r--r--ext/dom/document.c27
-rw-r--r--ext/dom/documentfragment.c2
-rw-r--r--ext/dom/documenttype.c2
-rw-r--r--ext/dom/dom_ce.h13
-rw-r--r--ext/dom/dom_fe.h48
-rw-r--r--ext/dom/dom_iterators.c2
-rw-r--r--ext/dom/dom_properties.h32
-rw-r--r--ext/dom/domconfiguration.c92
-rw-r--r--ext/dom/domerror.c122
-rw-r--r--ext/dom/domerrorhandler.c60
-rw-r--r--ext/dom/domexception.c2
-rw-r--r--ext/dom/domimplementation.c10
-rw-r--r--ext/dom/domimplementationlist.c73
-rw-r--r--ext/dom/domimplementationsource.c76
-rw-r--r--ext/dom/domlocator.c109
-rw-r--r--ext/dom/domstringlist.c73
-rw-r--r--ext/dom/element.c2
-rw-r--r--ext/dom/entity.c2
-rw-r--r--ext/dom/entityreference.c2
-rw-r--r--ext/dom/namednodemap.c63
-rw-r--r--ext/dom/namelist.c84
-rw-r--r--ext/dom/node.c67
-rw-r--r--ext/dom/nodelist.c2
-rw-r--r--ext/dom/notation.c2
-rw-r--r--ext/dom/php_dom.c147
-rw-r--r--ext/dom/php_dom.h5
-rw-r--r--ext/dom/processinginstruction.c2
-rw-r--r--ext/dom/string_extend.c75
-rw-r--r--ext/dom/tests/DOMAttr_ownerElement_error_001.phpt2
-rw-r--r--ext/dom/tests/bug36756.phpt2
-rw-r--r--ext/dom/tests/bug47430.phpt13
-rw-r--r--ext/dom/tests/bug55700.phpt40
-rw-r--r--ext/dom/tests/bug67949.phpt12
-rw-r--r--ext/dom/text.c17
-rw-r--r--ext/dom/typeinfo.c70
-rw-r--r--ext/dom/xml_common.h2
-rw-r--r--ext/dom/xpath.c36
-rw-r--r--ext/enchant/enchant.c120
-rw-r--r--ext/enchant/enchant.stub.php79
-rw-r--r--ext/enchant/enchant_arginfo.h93
-rw-r--r--ext/enchant/php_enchant.h2
-rw-r--r--ext/enchant/tests/broker_dict_exists.phpt2
-rw-r--r--ext/enchant/tests/broker_free_02.phpt2
-rw-r--r--ext/enchant/tests/broker_free_dict.phpt2
-rw-r--r--ext/enchant/tests/broker_request_dict.phpt2
-rw-r--r--ext/enchant/tests/broker_request_dict_01.phpt2
-rw-r--r--ext/enchant/tests/broker_set_ordering.phpt2
-rw-r--r--ext/enchant/tests/dict_add_to_personal.phpt2
-rw-r--r--ext/enchant/tests/dict_add_to_session.phpt2
-rw-r--r--ext/enchant/tests/dict_check.phpt2
-rw-r--r--ext/enchant/tests/dict_describe.phpt2
-rw-r--r--ext/enchant/tests/dict_get_error.phpt2
-rw-r--r--ext/enchant/tests/dict_is_in_session.phpt2
-rw-r--r--ext/enchant/tests/dict_quick_check.phpt2
-rw-r--r--ext/enchant/tests/dict_quick_check_01.phpt2
-rw-r--r--ext/enchant/tests/dict_store_replacement.phpt2
-rw-r--r--ext/enchant/tests/dict_suggest.phpt2
-rw-r--r--ext/enchant/tests/enchant_broker_set_dict_path.phpt2
-rw-r--r--ext/exif/exif.c33
-rw-r--r--ext/exif/exif.stub.php13
-rw-r--r--ext/exif/exif_arginfo.h23
-rw-r--r--ext/exif/php_exif.h2
-rw-r--r--ext/exif/tests/exif_imagetype_error.phpt17
-rw-r--r--ext/exif/tests/exif_read_exif_data_basic-mb.phpt64
-rw-r--r--ext/exif/tests/exif_read_exif_data_basic.phpt64
-rwxr-xr-xext/ext_skel.php4
-rw-r--r--ext/ffi/ffi.c304
-rw-r--r--ext/ffi/ffi.g4
-rw-r--r--ext/ffi/ffi.stub.php96
-rw-r--r--ext/ffi/ffi_arginfo.h73
-rw-r--r--ext/ffi/ffi_parser.c2
-rw-r--r--ext/ffi/php_ffi.h2
-rw-r--r--ext/ffi/tests/045.phpt4
-rw-r--r--ext/ffi/tests/200.phpt1
-rw-r--r--ext/fileinfo/fileinfo.c84
-rw-r--r--ext/fileinfo/fileinfo.stub.php54
-rw-r--r--ext/fileinfo/fileinfo_arginfo.h51
-rw-r--r--ext/fileinfo/php_fileinfo.h2
-rw-r--r--ext/fileinfo/tests/bug61173.phpt2
-rw-r--r--ext/fileinfo/tests/bug71527-mb.phpt5
-rw-r--r--ext/fileinfo/tests/bug71527.phpt5
-rw-r--r--ext/fileinfo/tests/finfo_close_error.phpt33
-rw-r--r--ext/fileinfo/tests/finfo_open_001.phpt10
-rw-r--r--ext/fileinfo/tests/finfo_open_002.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_open_error.phpt29
-rw-r--r--ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt8
-rw-r--r--ext/fileinfo/tests/finfo_set_flags_basic.phpt8
-rw-r--r--ext/filter/callback_filter.c2
-rw-r--r--ext/filter/filter.c55
-rw-r--r--ext/filter/filter.stub.php35
-rw-r--r--ext/filter/filter_arginfo.h38
-rw-r--r--ext/filter/filter_private.h2
-rw-r--r--ext/filter/logical_filters.c7
-rw-r--r--ext/filter/php_filter.h2
-rw-r--r--ext/filter/sanitizing_filters.c2
-rw-r--r--ext/filter/tests/007.phpt27
-rw-r--r--ext/filter/tests/008.phpt4
-rw-r--r--ext/filter/tests/009.phpt10
-rw-r--r--ext/filter/tests/010.phpt4
-rw-r--r--ext/filter/tests/011.phpt18
-rw-r--r--ext/filter/tests/039.phpt4
-rw-r--r--ext/filter/tests/040.phpt13
-rw-r--r--ext/filter/tests/deprecated.phpt19
-rw-r--r--ext/ftp/ftp.c2
-rw-r--r--ext/ftp/ftp.h2
-rw-r--r--ext/ftp/ftp.stub.php149
-rw-r--r--ext/ftp/ftp_arginfo.h191
-rw-r--r--ext/ftp/php_ftp.c282
-rw-r--r--ext/ftp/php_ftp.h2
-rw-r--r--ext/ftp/tests/004.phpt58
-rw-r--r--ext/ftp/tests/006.phpt108
-rw-r--r--ext/ftp/tests/007.phpt331
-rw-r--r--ext/ftp/tests/ftp_get_basic.phpt6
-rw-r--r--ext/ftp/tests/ftp_ssl_connect_error.phpt20
-rw-r--r--ext/gd/CREDITS2
-rw-r--r--ext/gd/gd.c2019
-rw-r--r--ext/gd/gd.stub.php276
-rw-r--r--ext/gd/gd_arginfo.h566
-rw-r--r--ext/gd/gd_ctx.c217
-rw-r--r--ext/gd/libgd/gd_xbm.c2
-rw-r--r--ext/gd/php_gd.h6
-rw-r--r--ext/gd/tests/bug38212-mb.phpt14
-rw-r--r--ext/gd/tests/bug38212.phpt14
-rw-r--r--ext/gd/tests/bug39286-mb.phpt12
-rw-r--r--ext/gd/tests/bug39286.phpt12
-rw-r--r--ext/gd/tests/bug41442.phpt8
-rw-r--r--ext/gd/tests/bug66356.phpt16
-rw-r--r--ext/gd/tests/bug67248.phpt28
-rw-r--r--ext/gd/tests/bug70976.phpt3
-rw-r--r--ext/gd/tests/bug72494.phpt14
-rw-r--r--ext/gd/tests/bug72697.phpt12
-rw-r--r--ext/gd/tests/bug72709.phpt14
-rw-r--r--ext/gd/tests/bug72730.phpt15
-rw-r--r--ext/gd/tests/bug73968.phpt7
-rw-r--r--ext/gd/tests/bug74435.phpt7
-rw-r--r--ext/gd/tests/bug77269.phpt5
-rw-r--r--ext/gd/tests/bug77391.phpt7
-rw-r--r--ext/gd/tests/func.inc18
-rw-r--r--ext/gd/tests/gdimage_prevent_cloning.phpt20
-rw-r--r--ext/gd/tests/gdimage_prevent_serialization.phpt21
-rw-r--r--ext/gd/tests/image2wbmp_error.phpt20
-rw-r--r--ext/gd/tests/imageantialias_error1.phpt18
-rw-r--r--ext/gd/tests/imagebmp_nullbyte_injection.phpt13
-rw-r--r--ext/gd/tests/imagechar_error2.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error2.phpt17
-rw-r--r--ext/gd/tests/imagecolorallocate_variation5.phpt39
-rw-r--r--ext/gd/tests/imagecolorallocate_variation6.phpt91
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error1.phpt25
-rw-r--r--ext/gd/tests/imagecolordeallocate_error1.phpt22
-rw-r--r--ext/gd/tests/imagecolordeallocate_error3.phpt13
-rw-r--r--ext/gd/tests/imagecolordeallocate_error4.phpt13
-rw-r--r--ext/gd/tests/imagecolorstotal_error.phpt54
-rw-r--r--ext/gd/tests/imageconvolution_error2.phpt12
-rw-r--r--ext/gd/tests/imageconvolution_error3.phpt20
-rw-r--r--ext/gd/tests/imagecreate_error.phpt21
-rw-r--r--ext/gd/tests/imagecreatetruecolor_error2.phpt19
-rw-r--r--ext/gd/tests/imageellipse_error7.phpt20
-rw-r--r--ext/gd/tests/imagefilledpolygon_negative.phpt12
-rw-r--r--ext/gd/tests/imagefilltoborder_error6.phpt27
-rw-r--r--ext/gd/tests/imagefilter_error1.phpt11
-rw-r--r--ext/gd/tests/imagefilter_error10.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error11.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error12.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error15.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error17.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error18.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error20.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error4.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error6.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error7.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error8.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error9.phpt18
-rw-r--r--ext/gd/tests/imagegammacorrect_error2.phpt17
-rw-r--r--ext/gd/tests/imagegd2_nullbyte_injection.phpt11
-rw-r--r--ext/gd/tests/imagegd_nullbyte_injection.phpt11
-rw-r--r--ext/gd/tests/imagegif_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imageinterlace_error2.phpt17
-rw-r--r--ext/gd/tests/imageistruecolor_error1.phpt24
-rw-r--r--ext/gd/tests/imagejpeg_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagelayereffect_error3.phpt17
-rw-r--r--ext/gd/tests/imagepalettetotruecolor_basic.phpt2
-rw-r--r--ext/gd/tests/imagepalettetotruecolor_error3.phpt15
-rw-r--r--ext/gd/tests/imagepng_nullbyte_injection.phpt13
-rw-r--r--ext/gd/tests/imagepolygon_negative.phpt12
-rw-r--r--ext/gd/tests/imagerectangle_error2.phpt19
-rw-r--r--ext/gd/tests/imagesetthickness_error1.phpt22
-rw-r--r--ext/gd/tests/imagestring_error2.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error2.phpt17
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error1.phpt26
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error3.phpt20
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error4.phpt15
-rw-r--r--ext/gd/tests/imagewbmp_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagewebp_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagexbm_nullbyte_injection.phpt11
-rw-r--r--ext/gd/tests/jpeg2wbmp_error1.phpt46
-rw-r--r--ext/gd/tests/jpeg2wbmp_error2-mb.phpt37
-rw-r--r--ext/gd/tests/jpeg2wbmp_error2.phpt37
-rw-r--r--ext/gd/tests/jpeg2wbmp_error3.phpt49
-rw-r--r--ext/gd/tests/lines.phpt5
-rw-r--r--ext/gd/tests/png2wbmp_error1-mb.phpt46
-rw-r--r--ext/gd/tests/png2wbmp_error1.phpt46
-rw-r--r--ext/gd/tests/png2wbmp_error2.phpt37
-rw-r--r--ext/gd/tests/png2wbmp_error3.phpt49
-rw-r--r--ext/gettext/gettext.c63
-rw-r--r--ext/gettext/gettext.stub.php36
-rw-r--r--ext/gettext/gettext_arginfo.h59
-rw-r--r--ext/gettext/php_gettext.h2
-rw-r--r--ext/gettext/tests/dcngettext.phpt5
-rw-r--r--ext/gmp/gmp.c240
-rw-r--r--ext/gmp/gmp.stub.php307
-rw-r--r--ext/gmp/gmp_arginfo.h166
-rw-r--r--ext/gmp/php_gmp.h2
-rw-r--r--ext/gmp/tests/gmp_abs.phpt8
-rw-r--r--ext/gmp/tests/gmp_and.phpt8
-rw-r--r--ext/gmp/tests/gmp_clrbit.phpt18
-rw-r--r--ext/gmp/tests/gmp_cmp.phpt12
-rw-r--r--ext/gmp/tests/gmp_com.phpt6
-rw-r--r--ext/gmp/tests/gmp_div_q.phpt8
-rw-r--r--ext/gmp/tests/gmp_div_qr.phpt8
-rw-r--r--ext/gmp/tests/gmp_div_r.phpt8
-rw-r--r--ext/gmp/tests/gmp_divexact.phpt8
-rw-r--r--ext/gmp/tests/gmp_export.phpt6
-rw-r--r--ext/gmp/tests/gmp_fact.phpt8
-rw-r--r--ext/gmp/tests/gmp_gcd.phpt14
-rw-r--r--ext/gmp/tests/gmp_gcdext.phpt12
-rw-r--r--ext/gmp/tests/gmp_hamdist.phpt8
-rw-r--r--ext/gmp/tests/gmp_import.phpt6
-rw-r--r--ext/gmp/tests/gmp_init.phpt14
-rw-r--r--ext/gmp/tests/gmp_intval.phpt3
-rw-r--r--ext/gmp/tests/gmp_invert.phpt8
-rw-r--r--ext/gmp/tests/gmp_jacobi.phpt13
-rw-r--r--ext/gmp/tests/gmp_legendre.phpt13
-rw-r--r--ext/gmp/tests/gmp_mod.phpt8
-rw-r--r--ext/gmp/tests/gmp_neg.phpt8
-rw-r--r--ext/gmp/tests/gmp_or.phpt8
-rw-r--r--ext/gmp/tests/gmp_perfect_square.phpt4
-rw-r--r--ext/gmp/tests/gmp_popcount.phpt4
-rw-r--r--ext/gmp/tests/gmp_pow.phpt26
-rw-r--r--ext/gmp/tests/gmp_pown.phpt12
-rw-r--r--ext/gmp/tests/gmp_prob_prime.phpt4
-rw-r--r--ext/gmp/tests/gmp_random.phpt60
-rw-r--r--ext/gmp/tests/gmp_random_bits.phpt4
-rw-r--r--ext/gmp/tests/gmp_random_range.phpt8
-rw-r--r--ext/gmp/tests/gmp_random_seed-32bit.phpt232
-rw-r--r--ext/gmp/tests/gmp_random_seed.phpt154
-rw-r--r--ext/gmp/tests/gmp_remroot.phpt4
-rw-r--r--ext/gmp/tests/gmp_root.phpt4
-rw-r--r--ext/gmp/tests/gmp_scan0.phpt8
-rw-r--r--ext/gmp/tests/gmp_scan1.phpt8
-rw-r--r--ext/gmp/tests/gmp_setbit.phpt27
-rw-r--r--ext/gmp/tests/gmp_sign.phpt8
-rw-r--r--ext/gmp/tests/gmp_sqrt.phpt8
-rw-r--r--ext/gmp/tests/gmp_sqrtrem.phpt4
-rw-r--r--ext/gmp/tests/gmp_strval.phpt20
-rw-r--r--ext/gmp/tests/gmp_sub.phpt12
-rw-r--r--ext/gmp/tests/gmp_testbit.phpt5
-rw-r--r--ext/gmp/tests/gmp_xor.phpt8
-rw-r--r--ext/hash/config.m43
-rw-r--r--ext/hash/config.w323
-rw-r--r--ext/hash/hash.c250
-rw-r--r--ext/hash/hash.stub.php60
-rw-r--r--ext/hash/hash_adler32.c2
-rw-r--r--ext/hash/hash_arginfo.h114
-rw-r--r--ext/hash/hash_crc32.c2
-rw-r--r--ext/hash/hash_fnv.c2
-rw-r--r--ext/hash/hash_gost.c2
-rw-r--r--ext/hash/hash_haval.c2
-rw-r--r--ext/hash/hash_joaat.c2
-rw-r--r--ext/hash/hash_md.c351
-rw-r--r--ext/hash/hash_ripemd.c2
-rw-r--r--ext/hash/hash_sha.c329
-rw-r--r--ext/hash/hash_sha3.c2
-rw-r--r--ext/hash/hash_snefru.c2
-rw-r--r--ext/hash/hash_tiger.c2
-rw-r--r--ext/hash/hash_whirlpool.c2
-rw-r--r--ext/hash/php_hash.h2
-rw-r--r--ext/hash/php_hash_adler32.h2
-rw-r--r--ext/hash/php_hash_crc32.h2
-rw-r--r--ext/hash/php_hash_crc32_tables.h2
-rw-r--r--ext/hash/php_hash_fnv.h2
-rw-r--r--ext/hash/php_hash_gost.h2
-rw-r--r--ext/hash/php_hash_haval.h2
-rw-r--r--ext/hash/php_hash_joaat.h2
-rw-r--r--ext/hash/php_hash_md.h52
-rw-r--r--ext/hash/php_hash_ripemd.h2
-rw-r--r--ext/hash/php_hash_sha.h27
-rw-r--r--ext/hash/php_hash_sha3.h2
-rw-r--r--ext/hash/php_hash_snefru.h2
-rw-r--r--ext/hash/php_hash_snefru_tables.h2
-rw-r--r--ext/hash/php_hash_tiger.h2
-rw-r--r--ext/hash/php_hash_tiger_tables.h2
-rw-r--r--ext/hash/php_hash_whirlpool.h2
-rw-r--r--ext/hash/php_hash_whirlpool_tables.h2
-rw-r--r--ext/hash/tests/hash_equals.phpt67
-rw-r--r--ext/hash/tests/hash_error.phpt21
-rw-r--r--ext/hash/tests/hash_file_error.phpt17
-rw-r--r--ext/hash/tests/hash_hkdf_edges.phpt12
-rw-r--r--ext/hash/tests/hash_hkdf_error.phpt113
-rw-r--r--ext/hash/tests/hash_hmac_error.phpt49
-rw-r--r--ext/hash/tests/hash_hmac_file_basic.phpt12
-rw-r--r--ext/hash/tests/hash_hmac_file_error.phpt56
-rw-r--r--ext/hash/tests/hash_init_error.phpt59
-rw-r--r--ext/hash/tests/hash_pbkdf2_error.phpt87
-rw-r--r--ext/hash/tests/reuse.phpt12
-rw-r--r--ext/iconv/iconv.c85
-rw-r--r--ext/iconv/iconv.stub.php30
-rw-r--r--ext/iconv/iconv_arginfo.h59
-rw-r--r--ext/iconv/php_iconv.h2
-rw-r--r--ext/iconv/tests/iconv_mime_decode.phpt2
-rw-r--r--ext/iconv/tests/iconv_mime_encode.phpt2
-rw-r--r--ext/iconv/tests/iconv_strpos.phpt2
-rw-r--r--ext/iconv/tests/iconv_strrpos.phpt2
-rw-r--r--ext/iconv/tests/iconv_substr.phpt3
-rw-r--r--ext/imap/php_imap.c380
-rw-r--r--ext/imap/php_imap.h6
-rw-r--r--ext/imap/php_imap.stub.php359
-rw-r--r--ext/imap/php_imap_arginfo.h323
-rw-r--r--ext/imap/tests/bug63126.phpt2
-rw-r--r--ext/imap/tests/bug75774.phpt8
-rw-r--r--ext/imap/tests/bug77020.phpt2
-rw-r--r--ext/imap/tests/imap_close_variation3.phpt47
-rw-r--r--ext/imap/tests/imap_fetch_overview_variation4.phpt46
-rw-r--r--ext/imap/tests/imap_fetchbody_variation5.phpt46
-rw-r--r--ext/imap/tests/imap_fetchheader_variation4.phpt45
-rw-r--r--ext/imap/tests/imap_mutf7_to_utf8.phpt4
-rw-r--r--ext/imap/tests/imap_utf8.phpt4
-rw-r--r--ext/imap/tests/imap_utf8_to_mutf7_basic.phpt4
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp19
-rw-r--r--ext/intl/breakiterator/breakiterator_class.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp4
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.cpp29
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.cpp2
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.cpp4
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp12
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.h2
-rw-r--r--ext/intl/calendar/calendar_class.cpp14
-rw-r--r--ext/intl/calendar/calendar_class.h2
-rw-r--r--ext/intl/calendar/calendar_methods.cpp92
-rw-r--r--ext/intl/calendar/calendar_methods.h2
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp17
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.h2
-rw-r--r--ext/intl/collator/collator.c2
-rw-r--r--ext/intl/collator/collator.h2
-rw-r--r--ext/intl/collator/collator_attr.c14
-rw-r--r--ext/intl/collator/collator_attr.h2
-rw-r--r--ext/intl/collator/collator_class.c2
-rw-r--r--ext/intl/collator/collator_class.h2
-rw-r--r--ext/intl/collator/collator_compare.c5
-rw-r--r--ext/intl/collator/collator_compare.h2
-rw-r--r--ext/intl/collator/collator_convert.c28
-rw-r--r--ext/intl/collator/collator_convert.h2
-rw-r--r--ext/intl/collator/collator_create.c13
-rw-r--r--ext/intl/collator/collator_create.h2
-rw-r--r--ext/intl/collator/collator_error.c8
-rw-r--r--ext/intl/collator/collator_error.h2
-rw-r--r--ext/intl/collator/collator_is_numeric.c2
-rw-r--r--ext/intl/collator/collator_is_numeric.h2
-rw-r--r--ext/intl/collator/collator_locale.c5
-rw-r--r--ext/intl/collator/collator_locale.h2
-rw-r--r--ext/intl/collator/collator_sort.c11
-rw-r--r--ext/intl/collator/collator_sort.h2
-rw-r--r--ext/intl/common/common_date.cpp2
-rw-r--r--ext/intl/common/common_date.h2
-rw-r--r--ext/intl/common/common_enum.cpp12
-rw-r--r--ext/intl/common/common_enum.h2
-rw-r--r--ext/intl/common/common_error.c8
-rw-r--r--ext/intl/common/common_error.h2
-rw-r--r--ext/intl/converter/converter.c18
-rw-r--r--ext/intl/converter/converter.h2
-rw-r--r--ext/intl/dateformat/dateformat.c7
-rw-r--r--ext/intl/dateformat/dateformat.h2
-rw-r--r--ext/intl/dateformat/dateformat_attr.c16
-rw-r--r--ext/intl/dateformat/dateformat_attr.h2
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.cpp15
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.h2
-rw-r--r--ext/intl/dateformat/dateformat_class.c8
-rw-r--r--ext/intl/dateformat/dateformat_class.h2
-rw-r--r--ext/intl/dateformat/dateformat_create.cpp13
-rw-r--r--ext/intl/dateformat/dateformat_create.h2
-rw-r--r--ext/intl/dateformat/dateformat_data.c2
-rw-r--r--ext/intl/dateformat/dateformat_data.h2
-rw-r--r--ext/intl/dateformat/dateformat_format.c2
-rw-r--r--ext/intl/dateformat/dateformat_format.h2
-rw-r--r--ext/intl/dateformat/dateformat_format_object.cpp2
-rw-r--r--ext/intl/dateformat/dateformat_format_object.h2
-rw-r--r--ext/intl/dateformat/dateformat_helpers.cpp2
-rw-r--r--ext/intl/dateformat/dateformat_helpers.h2
-rw-r--r--ext/intl/dateformat/dateformat_parse.c4
-rw-r--r--ext/intl/dateformat/dateformat_parse.h2
-rw-r--r--ext/intl/formatter/formatter.c2
-rw-r--r--ext/intl/formatter/formatter.h2
-rw-r--r--ext/intl/formatter/formatter_attr.c29
-rw-r--r--ext/intl/formatter/formatter_attr.h2
-rw-r--r--ext/intl/formatter/formatter_class.c8
-rw-r--r--ext/intl/formatter/formatter_class.h2
-rw-r--r--ext/intl/formatter/formatter_data.c2
-rw-r--r--ext/intl/formatter/formatter_data.h2
-rw-r--r--ext/intl/formatter/formatter_format.c8
-rw-r--r--ext/intl/formatter/formatter_format.h2
-rw-r--r--ext/intl/formatter/formatter_main.c19
-rw-r--r--ext/intl/formatter/formatter_main.h2
-rw-r--r--ext/intl/formatter/formatter_parse.c8
-rw-r--r--ext/intl/formatter/formatter_parse.h2
-rw-r--r--ext/intl/grapheme/grapheme.h2
-rw-r--r--ext/intl/grapheme/grapheme_string.c20
-rw-r--r--ext/intl/grapheme/grapheme_util.c2
-rw-r--r--ext/intl/grapheme/grapheme_util.h2
-rw-r--r--ext/intl/idn/idn.c105
-rw-r--r--ext/intl/idn/idn.h2
-rw-r--r--ext/intl/intl_common.h2
-rw-r--r--ext/intl/intl_convert.c2
-rw-r--r--ext/intl/intl_convert.h2
-rw-r--r--ext/intl/intl_convertcpp.cpp2
-rw-r--r--ext/intl/intl_convertcpp.h2
-rw-r--r--ext/intl/intl_cppshims.h2
-rw-r--r--ext/intl/intl_data.h2
-rw-r--r--ext/intl/intl_error.c2
-rw-r--r--ext/intl/intl_error.h2
-rw-r--r--ext/intl/locale/locale.c2
-rw-r--r--ext/intl/locale/locale.h2
-rw-r--r--ext/intl/locale/locale_class.c2
-rw-r--r--ext/intl/locale/locale_class.h2
-rw-r--r--ext/intl/locale/locale_methods.c29
-rw-r--r--ext/intl/locale/locale_methods.h2
-rw-r--r--ext/intl/msgformat/msgformat.c19
-rw-r--r--ext/intl/msgformat/msgformat.h2
-rw-r--r--ext/intl/msgformat/msgformat_attr.c9
-rw-r--r--ext/intl/msgformat/msgformat_attr.h2
-rw-r--r--ext/intl/msgformat/msgformat_class.c8
-rw-r--r--ext/intl/msgformat/msgformat_class.h2
-rw-r--r--ext/intl/msgformat/msgformat_data.c2
-rw-r--r--ext/intl/msgformat/msgformat_data.h2
-rw-r--r--ext/intl/msgformat/msgformat_format.c8
-rw-r--r--ext/intl/msgformat/msgformat_format.h2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.h2
-rw-r--r--ext/intl/msgformat/msgformat_parse.c8
-rw-r--r--ext/intl/msgformat/msgformat_parse.h2
-rw-r--r--ext/intl/normalizer/normalizer.c3
-rw-r--r--ext/intl/normalizer/normalizer.h4
-rw-r--r--ext/intl/normalizer/normalizer_class.c2
-rw-r--r--ext/intl/normalizer/normalizer_class.h2
-rw-r--r--ext/intl/normalizer/normalizer_normalize.c34
-rw-r--r--ext/intl/normalizer/normalizer_normalize.h2
-rw-r--r--ext/intl/php_intl.c2
-rw-r--r--ext/intl/php_intl.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c36
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.c8
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.h2
-rw-r--r--ext/intl/tests/breakiter_createCodePointInstance_error.phpt16
-rw-r--r--ext/intl/tests/breakiter_factories_error.phpt40
-rw-r--r--ext/intl/tests/breakiter_first_last_previous_current_error.phpt37
-rw-r--r--ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt49
-rw-r--r--ext/intl/tests/breakiter_getLocale_error.phpt31
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_error.phpt12
-rw-r--r--ext/intl/tests/breakiter_getText_error.phpt17
-rw-r--r--ext/intl/tests/breakiter_next_error.phpt25
-rw-r--r--ext/intl/tests/breakiter_setText_error.phpt42
-rw-r--r--ext/intl/tests/calendar_add_error.phpt27
-rw-r--r--ext/intl/tests/calendar_before_after_error.phpt33
-rw-r--r--ext/intl/tests/calendar_clear_error.phpt8
-rw-r--r--ext/intl/tests/calendar_createInstance_error.phpt18
-rw-r--r--ext/intl/tests/calendar_equals_error.phpt13
-rw-r--r--ext/intl/tests/calendar_fieldDifference_error.phpt31
-rw-r--r--ext/intl/tests/calendar_fromDateTime_error.phpt23
-rw-r--r--ext/intl/tests/calendar_getAvailableLocales_error.phpt22
-rw-r--r--ext/intl/tests/calendar_getDayOfWeekType_error.phpt20
-rw-r--r--ext/intl/tests/calendar_getErrorCode_error.phpt11
-rw-r--r--ext/intl/tests/calendar_getErrorMessage_error.phpt11
-rw-r--r--ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt22
-rw-r--r--ext/intl/tests/calendar_getLocale_error.phpt27
-rw-r--r--ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getNow_error.phpt22
-rw-r--r--ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt30
-rw-r--r--ext/intl/tests/calendar_getTimeZone_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getTime_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getType_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getWeekendTransition_error.phpt21
-rw-r--r--ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt33
-rw-r--r--ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt57
-rw-r--r--ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt36
-rw-r--r--ext/intl/tests/calendar_inDaylightTime_error.phpt17
-rw-r--r--ext/intl/tests/calendar_isEquivalentTo_error.phpt18
-rw-r--r--ext/intl/tests/calendar_isLenient_error.phpt17
-rw-r--r--ext/intl/tests/calendar_isSet_error.phpt20
-rw-r--r--ext/intl/tests/calendar_isWeekend_error.phpt23
-rw-r--r--ext/intl/tests/calendar_roll_error.phpt16
-rw-r--r--ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt14
-rw-r--r--ext/intl/tests/calendar_setLenient_error.phpt29
-rw-r--r--ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt14
-rw-r--r--ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt54
-rw-r--r--ext/intl/tests/calendar_setTimeZone_error.phpt17
-rw-r--r--ext/intl/tests/calendar_setTime_error.phpt23
-rw-r--r--ext/intl/tests/calendar_set_error.phpt12
-rw-r--r--ext/intl/tests/calendar_toDateTime_error.phpt17
-rw-r--r--ext/intl/tests/cpbi_getLastCodePoint_error.phpt17
-rw-r--r--ext/intl/tests/dateformat_formatObject_error.phpt22
-rw-r--r--ext/intl/tests/dateformat_getCalendarObject_error.phpt42
-rw-r--r--ext/intl/tests/dateformat_getTimeZone_error.phpt42
-rw-r--r--ext/intl/tests/dateformat_setTimeZone_error.phpt26
-rw-r--r--ext/intl/tests/dateformat_set_timezone_id2.phpt1
-rw-r--r--ext/intl/tests/dateformat_set_timezone_id3.phpt1
-rw-r--r--ext/intl/tests/formatter_fail.phpt54
-rw-r--r--ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt18
-rw-r--r--ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt36
-rw-r--r--ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt45
-rw-r--r--ext/intl/tests/idn_uts46_errors.phpt28
-rw-r--r--ext/intl/tests/intl_get_error_code.phpt2
-rw-r--r--ext/intl/tests/intl_get_error_message.phpt4
-rw-r--r--ext/intl/tests/locale_accept.phpt7
-rw-r--r--ext/intl/tests/msgfmt_fail2.phpt82
-rw-r--r--ext/intl/tests/normalizer_normalize.phpt24
-rw-r--r--ext/intl/tests/normalizer_normalize_kc_cf.phpt7
-rw-r--r--ext/intl/tests/timezone_countEquivalentIDs_error.phpt18
-rw-r--r--ext/intl/tests/timezone_createDefault_error.phpt16
-rw-r--r--ext/intl/tests/timezone_createEnumeration_error.phpt7
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt24
-rw-r--r--ext/intl/tests/timezone_createTimeZone_error.phpt19
-rw-r--r--ext/intl/tests/timezone_fromDateTimeZone_error.phpt32
-rw-r--r--ext/intl/tests/timezone_getCanonicalID_error.phpt13
-rw-r--r--ext/intl/tests/timezone_getDSTSavings_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getDisplayName_error.phpt26
-rw-r--r--ext/intl/tests/timezone_getEquivalentID_error.phpt19
-rw-r--r--ext/intl/tests/timezone_getErrorCode_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getErrorMessage_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getGMT_error.phpt16
-rw-r--r--ext/intl/tests/timezone_getID_error.phpt10
-rw-r--r--ext/intl/tests/timezone_getOffset_error.phpt15
-rw-r--r--ext/intl/tests/timezone_getRawOffset_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getRegion_error.phpt19
-rw-r--r--ext/intl/tests/timezone_getTZDataVersion_error.phpt16
-rw-r--r--ext/intl/tests/timezone_getUnknown_error.phpt25
-rw-r--r--ext/intl/tests/timezone_hasSameRules_error.phpt4
-rw-r--r--ext/intl/tests/timezone_toDateTimeZone_error.phpt14
-rw-r--r--ext/intl/tests/timezone_useDaylightTime_error.phpt10
-rw-r--r--ext/intl/tests/transliterator_create_from_rule_error.phpt16
-rw-r--r--ext/intl/tests/transliterator_create_inverse_error.phpt11
-rw-r--r--ext/intl/tests/transliterator_get_error_code_error.phpt16
-rw-r--r--ext/intl/tests/transliterator_get_error_message_error.phpt16
-rw-r--r--ext/intl/tests/transliterator_list_ids_error.phpt17
-rw-r--r--ext/intl/tests/transliterator_transliterate_error.phpt32
-rw-r--r--ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt8
-rw-r--r--ext/intl/timezone/timezone_class.cpp19
-rw-r--r--ext/intl/timezone/timezone_class.h2
-rw-r--r--ext/intl/timezone/timezone_methods.cpp46
-rw-r--r--ext/intl/timezone/timezone_methods.h2
-rw-r--r--ext/intl/transliterator/transliterator.c2
-rw-r--r--ext/intl/transliterator/transliterator.h2
-rw-r--r--ext/intl/transliterator/transliterator_class.c56
-rw-r--r--ext/intl/transliterator/transliterator_class.h2
-rw-r--r--ext/intl/transliterator/transliterator_methods.c25
-rw-r--r--ext/intl/transliterator/transliterator_methods.h2
-rw-r--r--ext/json/json.c30
-rw-r--r--ext/json/json.stub.php16
-rw-r--r--ext/json/json_arginfo.h23
-rw-r--r--ext/json/json_encoder.c2
-rw-r--r--ext/json/json_parser.y6
-rw-r--r--ext/json/json_scanner.re2
-rw-r--r--ext/json/php_json.h2
-rw-r--r--ext/json/php_json_encoder.h2
-rw-r--r--ext/json/php_json_parser.h2
-rw-r--r--ext/json/php_json_scanner.h2
-rw-r--r--ext/json/tests/001.phpt3
-rw-r--r--ext/json/tests/json_decode_error.phpt17
-rw-r--r--ext/json/tests/json_last_error_error.phpt17
-rw-r--r--ext/json/tests/json_last_error_msg_error.phpt15
-rw-r--r--ext/ldap/config.m42
-rw-r--r--ext/ldap/config.w321
-rw-r--r--ext/ldap/ldap.c551
-rw-r--r--ext/ldap/ldap.stub.php370
-rw-r--r--ext/ldap/ldap_arginfo.h347
-rw-r--r--ext/ldap/php_ldap.h2
-rw-r--r--ext/ldap/tests/bug48696.phpt15
-rw-r--r--ext/ldap/tests/ldap_add_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_bind_error.phpt6
-rw-r--r--ext/ldap/tests/ldap_compare_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_connect_error.phpt4
-rw-r--r--ext/ldap/tests/ldap_count_entries_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_delete_error.phpt16
-rw-r--r--ext/ldap/tests/ldap_dn2ufn.phpt7
-rw-r--r--ext/ldap/tests/ldap_err2str_error.phpt28
-rw-r--r--ext/ldap/tests/ldap_errno_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_error_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_explode_dn.phpt10
-rw-r--r--ext/ldap/tests/ldap_first_attribute_error.phpt15
-rw-r--r--ext/ldap/tests/ldap_first_entry_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_first_reference_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_free_result_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_get_attributes_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_get_dn_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_get_entries_error.phpt33
-rw-r--r--ext/ldap/tests/ldap_get_option_error.phpt40
-rw-r--r--ext/ldap/tests/ldap_get_values_len_error.phpt14
-rw-r--r--ext/ldap/tests/ldap_list_error.phpt35
-rw-r--r--ext/ldap/tests/ldap_mod_add_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_mod_del_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_mod_replace_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_modify_batch_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_modify_error.phpt20
-rw-r--r--ext/ldap/tests/ldap_next_attribute_error.phpt8
-rw-r--r--ext/ldap/tests/ldap_next_entry_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_next_reference_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_parse_reference_error.phpt31
-rw-r--r--ext/ldap/tests/ldap_parse_result_error.phpt17
-rw-r--r--ext/ldap/tests/ldap_read_error.phpt35
-rw-r--r--ext/ldap/tests/ldap_read_variation1.phpt4
-rw-r--r--ext/ldap/tests/ldap_rename_error.phpt7
-rw-r--r--ext/ldap/tests/ldap_sasl_bind_error.phpt6
-rw-r--r--ext/ldap/tests/ldap_search_error.phpt12
-rw-r--r--ext/ldap/tests/ldap_set_option_error.phpt19
-rw-r--r--ext/ldap/tests/ldap_set_rebind_proc_error.phpt10
-rw-r--r--ext/ldap/tests/ldap_sort_basic.phpt201
-rw-r--r--ext/ldap/tests/ldap_sort_error.phpt45
-rw-r--r--ext/ldap/tests/ldap_sort_variation.phpt201
-rw-r--r--ext/ldap/tests/ldap_start_tls_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_unbind_error.phpt42
-rw-r--r--ext/libxml/libxml.c42
-rw-r--r--ext/libxml/libxml.stub.php17
-rw-r--r--ext/libxml/libxml_arginfo.h26
-rw-r--r--ext/libxml/php_libxml.h2
-rw-r--r--ext/libxml/tests/001.phpt8
-rw-r--r--ext/libxml/tests/002.phpt2
-rw-r--r--ext/libxml/tests/003.phpt2
-rw-r--r--ext/libxml/tests/004.phpt28
-rw-r--r--ext/libxml/tests/bug42112.phpt2
-rw-r--r--ext/libxml/tests/bug61367-read.phpt7
-rw-r--r--ext/libxml/tests/bug61367-write.phpt2
-rw-r--r--ext/libxml/tests/bug63389.phpt12
-rw-r--r--ext/libxml/tests/bug76777.phpt2
-rw-r--r--ext/libxml/tests/libxml_disable_entity_loader.phpt5
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt2
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt14
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt2
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt2
-rw-r--r--ext/mbstring/mb_gpc.c2
-rw-r--r--ext/mbstring/mb_gpc.h2
-rw-r--r--ext/mbstring/mbstring.c534
-rw-r--r--ext/mbstring/mbstring.h14
-rw-r--r--ext/mbstring/mbstring.stub.php179
-rw-r--r--ext/mbstring/mbstring_arginfo.h297
-rw-r--r--ext/mbstring/php_mbregex.c81
-rw-r--r--ext/mbstring/php_mbregex.h18
-rw-r--r--ext/mbstring/php_unicode.c2
-rw-r--r--ext/mbstring/php_unicode.h2
-rw-r--r--ext/mbstring/tests/bug20087.phpt20
-rw-r--r--ext/mbstring/tests/bug43301.phpt33
-rw-r--r--ext/mbstring/tests/bug43841.phpt4
-rw-r--r--ext/mbstring/tests/bug45923.phpt8
-rw-r--r--ext/mbstring/tests/bug48697.phpt9
-rw-r--r--ext/mbstring/tests/bug52931.phpt24
-rw-r--r--ext/mbstring/tests/bug72164.phpt4
-rw-r--r--ext/mbstring/tests/bug72994.phpt21
-rw-r--r--ext/mbstring/tests/bug73646.phpt7
-rw-r--r--ext/mbstring/tests/mb_convert_encoding.phpt8
-rw-r--r--ext/mbstring/tests/mb_decode_numericentity.phpt12
-rw-r--r--ext/mbstring/tests/mb_detect_encoding.phpt8
-rw-r--r--ext/mbstring/tests/mb_encode_numericentity.phpt12
-rw-r--r--ext/mbstring/tests/mb_encoding_aliases.phpt2
-rw-r--r--ext/mbstring/tests/mb_ereg1.phpt19
-rw-r--r--ext/mbstring/tests/mb_ereg2.phpt13
-rw-r--r--ext/mbstring/tests/mb_ereg3.phpt52
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_variation1.phpt58
-rw-r--r--ext/mbstring/tests/mb_ereg_variation1.phpt178
-rw-r--r--ext/mbstring/tests/mb_get_info.phpt87
-rw-r--r--ext/mbstring/tests/mb_http_output.phpt18
-rw-r--r--ext/mbstring/tests/mb_internal_encoding.phpt18
-rw-r--r--ext/mbstring/tests/mb_parse_str.phpt25
-rw-r--r--ext/mbstring/tests/mb_parse_str02.phpt34
-rw-r--r--ext/mbstring/tests/mb_split.phpt2
-rw-r--r--ext/mbstring/tests/mb_str_unknown_encoding.phpt2
-rw-r--r--ext/mbstring/tests/mb_stripos.phpt25
-rw-r--r--ext/mbstring/tests/mb_strlen.phpt16
-rw-r--r--ext/mbstring/tests/mb_strpos.phpt25
-rw-r--r--ext/mbstring/tests/mb_substitute_character_variation1.phpt4
-rw-r--r--ext/mbstring/tests/mb_substr.phpt1
-rw-r--r--ext/mbstring/tests/overload01.phpt23
-rw-r--r--ext/mbstring/tests/overload02.phpt34
-rw-r--r--ext/mysqli/config.m42
-rw-r--r--ext/mysqli/mysqli.c71
-rw-r--r--ext/mysqli/mysqli_api.c4
-rw-r--r--ext/mysqli/mysqli_driver.c2
-rw-r--r--ext/mysqli/mysqli_exception.c2
-rw-r--r--ext/mysqli/mysqli_fe.c2
-rw-r--r--ext/mysqli/mysqli_fe.h2
-rw-r--r--ext/mysqli/mysqli_libmysql.h2
-rw-r--r--ext/mysqli/mysqli_mysqlnd.h2
-rw-r--r--ext/mysqli/mysqli_nonapi.c2
-rw-r--r--ext/mysqli/mysqli_priv.h2
-rw-r--r--ext/mysqli/mysqli_prop.c2
-rw-r--r--ext/mysqli/mysqli_report.c2
-rw-r--r--ext/mysqli/mysqli_result_iterator.c2
-rw-r--r--ext/mysqli/mysqli_warning.c2
-rw-r--r--ext/mysqli/php_mysqli.h2
-rw-r--r--ext/mysqli/php_mysqli_structs.h2
-rw-r--r--ext/mysqli/tests/057.phpt4
-rw-r--r--ext/mysqli/tests/mysqli_affected_rows.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_autocommit.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_begin_transaction.phpt21
-rw-r--r--ext/mysqli/tests/mysqli_change_user.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_character_set_name.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_character_set_name_oo.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt122
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt13
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_close.phpt13
-rw-r--r--ext/mysqli/tests/mysqli_close_oo.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_commit.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_connect.phpt4
-rw-r--r--ext/mysqli/tests/mysqli_data_seek.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_data_seek_oo.phpt13
-rw-r--r--ext/mysqli/tests/mysqli_debug.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_dump_debug_info.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_errno.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_error.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_error_unicode.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt3
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_direct.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_oo.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_fetch_fields.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_fetch_lengths.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object.phpt13
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_oo.phpt17
-rw-r--r--ext/mysqli/tests/mysqli_fetch_row.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_field_count.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_field_seek.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_field_tell.phpt17
-rw-r--r--ext/mysqli/tests/mysqli_free_result.phpt21
-rw-r--r--ext/mysqli/tests/mysqli_get_charset.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats.phpt4
-rw-r--r--ext/mysqli/tests/mysqli_get_connection_stats.phpt7
-rw-r--r--ext/mysqli/tests/mysqli_get_host_info.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_get_proto_info.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_get_server_info.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_get_server_version.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_info.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_insert_id.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_kill.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_max_links.phpt28
-rw-r--r--ext/mysqli/tests/mysqli_more_results.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_multi_query.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_next_result.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_num_fields.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_num_rows.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_options.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_ping.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_poll.phpt23
-rw-r--r--ext/mysqli/tests/mysqli_prepare.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_query.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_query_unicode.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_real_connect.phpt27
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_real_query.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_reap_async_query.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_release_savepoint.phpt13
-rw-r--r--ext/mysqli/tests/mysqli_report.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_rollback.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_savepoint.phpt15
-rw-r--r--ext/mysqli/tests/mysqli_select_db.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_set_charset.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_set_opt.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_sqlstate.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_ssl_set.phpt21
-rw-r--r--ext/mysqli/tests/mysqli_stat.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_stmt_affected_rows.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_get.phpt15
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_set.phpt17
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_stmt_close.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_data_seek.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_errno.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_error.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_stmt_field_count.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_free_result.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result2.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt5
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_warnings.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_init.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_stmt_insert_id.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_stmt_num_rows.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_param_count.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_stmt_prepare.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_stmt_reset.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_stmt_result_metadata.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data.phpt24
-rw-r--r--ext/mysqli/tests/mysqli_stmt_sqlstate.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_stmt_store_result.phpt12
-rw-r--r--ext/mysqli/tests/mysqli_store_result.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_thread_id.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_use_result.phpt9
-rw-r--r--ext/mysqli/tests/mysqli_warning_count.phpt12
-rw-r--r--ext/mysqlnd/mysql_float_to_double.h2
-rw-r--r--ext/mysqlnd/mysqlnd.h2
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.c2
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.h2
-rw-r--r--ext/mysqlnd/mysqlnd_auth.c2
-rw-r--r--ext/mysqlnd/mysqlnd_auth.h2
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.c2
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.h2
-rw-r--r--ext/mysqlnd/mysqlnd_charset.c2
-rw-r--r--ext/mysqlnd/mysqlnd_charset.h2
-rw-r--r--ext/mysqlnd/mysqlnd_commands.c2
-rw-r--r--ext/mysqlnd/mysqlnd_commands.h2
-rw-r--r--ext/mysqlnd/mysqlnd_connection.c2
-rw-r--r--ext/mysqlnd/mysqlnd_connection.h2
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c2
-rw-r--r--ext/mysqlnd/mysqlnd_debug.h2
-rw-r--r--ext/mysqlnd/mysqlnd_driver.c2
-rw-r--r--ext/mysqlnd/mysqlnd_enum_n_def.h2
-rw-r--r--ext/mysqlnd/mysqlnd_ext_plugin.c2
-rw-r--r--ext/mysqlnd/mysqlnd_ext_plugin.h2
-rw-r--r--ext/mysqlnd/mysqlnd_libmysql_compat.h2
-rw-r--r--ext/mysqlnd/mysqlnd_loaddata.c2
-rw-r--r--ext/mysqlnd/mysqlnd_net.c2
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.c2
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.h2
-rw-r--r--ext/mysqlnd/mysqlnd_priv.h2
-rw-r--r--ext/mysqlnd/mysqlnd_protocol_frame_codec.c2
-rw-r--r--ext/mysqlnd/mysqlnd_protocol_frame_codec.h2
-rw-r--r--ext/mysqlnd/mysqlnd_ps.c2
-rw-r--r--ext/mysqlnd/mysqlnd_ps.h2
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c2
-rw-r--r--ext/mysqlnd/mysqlnd_read_buffer.c2
-rw-r--r--ext/mysqlnd/mysqlnd_read_buffer.h2
-rw-r--r--ext/mysqlnd/mysqlnd_result.c2
-rw-r--r--ext/mysqlnd/mysqlnd_result.h2
-rw-r--r--ext/mysqlnd/mysqlnd_result_meta.c2
-rw-r--r--ext/mysqlnd/mysqlnd_result_meta.h2
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.c2
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.h2
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.c2
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.h2
-rw-r--r--ext/mysqlnd/mysqlnd_structs.h2
-rw-r--r--ext/mysqlnd/mysqlnd_vio.c2
-rw-r--r--ext/mysqlnd/mysqlnd_vio.h2
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c2
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.h2
-rw-r--r--ext/mysqlnd/php_mysqlnd.c2
-rw-r--r--ext/mysqlnd/php_mysqlnd.h2
-rw-r--r--ext/oci8/oci8.c2
-rw-r--r--ext/oci8/oci8_collection.c2
-rw-r--r--ext/oci8/oci8_failover.c2
-rw-r--r--ext/oci8/oci8_interface.c2
-rw-r--r--ext/oci8/oci8_lob.c2
-rw-r--r--ext/oci8/oci8_statement.c2
-rw-r--r--ext/oci8/php_oci8.h2
-rw-r--r--ext/oci8/php_oci8_int.h2
-rw-r--r--ext/odbc/odbc.stub.php231
-rw-r--r--ext/odbc/odbc_arginfo.h242
-rw-r--r--ext/odbc/php_odbc.c338
-rw-r--r--ext/odbc/php_odbc.h2
-rw-r--r--ext/odbc/php_odbc_includes.h2
-rw-r--r--ext/odbc/tests/bug78473.phpt8
-rw-r--r--ext/odbc/tests/odbc_data_source_001.phpt4
-rw-r--r--ext/odbc/tests/odbc_free_result_001.phpt34
-rw-r--r--ext/opcache/Optimizer/block_pass.c1081
-rw-r--r--ext/opcache/Optimizer/compact_literals.c15
-rw-r--r--ext/opcache/Optimizer/dce.c2
-rw-r--r--ext/opcache/Optimizer/dfa_pass.c112
-rw-r--r--ext/opcache/Optimizer/escape_analysis.c8
-rw-r--r--ext/opcache/Optimizer/optimize_func_calls.c6
-rw-r--r--ext/opcache/Optimizer/pass1.c (renamed from ext/opcache/Optimizer/pass1_5.c)186
-rw-r--r--ext/opcache/Optimizer/pass2.c225
-rw-r--r--ext/opcache/Optimizer/pass3.c563
-rw-r--r--ext/opcache/Optimizer/sccp.c14
-rw-r--r--ext/opcache/Optimizer/ssa_integrity.c2
-rw-r--r--ext/opcache/Optimizer/zend_call_graph.c19
-rw-r--r--ext/opcache/Optimizer/zend_call_graph.h3
-rw-r--r--ext/opcache/Optimizer/zend_cfg.h7
-rw-r--r--ext/opcache/Optimizer/zend_dfg.c4
-rw-r--r--ext/opcache/Optimizer/zend_dump.c32
-rw-r--r--ext/opcache/Optimizer/zend_func_info.c1131
-rw-r--r--ext/opcache/Optimizer/zend_func_info.h5
-rw-r--r--ext/opcache/Optimizer/zend_inference.c223
-rw-r--r--ext/opcache/Optimizer/zend_inference.h24
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c352
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.h6
-rw-r--r--ext/opcache/Optimizer/zend_optimizer_internal.h3
-rw-r--r--ext/opcache/Optimizer/zend_ssa.c25
-rw-r--r--ext/opcache/Optimizer/zend_ssa.h4
-rw-r--r--ext/opcache/ZendAccelerator.c101
-rw-r--r--ext/opcache/ZendAccelerator.h24
-rw-r--r--ext/opcache/config.m479
-rw-r--r--ext/opcache/config.w3225
-rw-r--r--ext/opcache/jit/Makefile.frag17
-rw-r--r--ext/opcache/jit/Makefile.frag.w3216
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm.h456
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm.lua1125
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm64.h518
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm64.lua1166
-rw-r--r--ext/opcache/jit/dynasm/dasm_mips.h419
-rw-r--r--ext/opcache/jit/dynasm/dasm_mips.lua1008
-rw-r--r--ext/opcache/jit/dynasm/dasm_mips64.lua12
-rw-r--r--ext/opcache/jit/dynasm/dasm_ppc.h419
-rw-r--r--ext/opcache/jit/dynasm/dasm_ppc.lua1919
-rw-r--r--ext/opcache/jit/dynasm/dasm_proto.h83
-rw-r--r--ext/opcache/jit/dynasm/dasm_x64.lua12
-rw-r--r--ext/opcache/jit/dynasm/dasm_x86.h500
-rw-r--r--ext/opcache/jit/dynasm/dasm_x86.lua2274
-rw-r--r--ext/opcache/jit/dynasm/dynasm.lua1094
-rw-r--r--ext/opcache/jit/dynasm/minilua.c7770
-rw-r--r--ext/opcache/jit/libudis86/LICENSE22
-rw-r--r--ext/opcache/jit/libudis86/decode.c1266
-rw-r--r--ext/opcache/jit/libudis86/decode.h197
-rw-r--r--ext/opcache/jit/libudis86/extern.h113
-rw-r--r--ext/opcache/jit/libudis86/itab.c5946
-rw-r--r--ext/opcache/jit/libudis86/itab.h939
-rw-r--r--ext/opcache/jit/libudis86/syn-att.c228
-rw-r--r--ext/opcache/jit/libudis86/syn-intel.c224
-rw-r--r--ext/opcache/jit/libudis86/syn.c258
-rw-r--r--ext/opcache/jit/libudis86/syn.h53
-rw-r--r--ext/opcache/jit/libudis86/types.h260
-rw-r--r--ext/opcache/jit/libudis86/udint.h99
-rw-r--r--ext/opcache/jit/libudis86/udis86.c458
-rw-r--r--ext/opcache/jit/vtune/ittnotify_config.h596
-rw-r--r--ext/opcache/jit/vtune/ittnotify_types.h115
-rw-r--r--ext/opcache/jit/vtune/jitprofiling.c312
-rw-r--r--ext/opcache/jit/vtune/jitprofiling.h694
-rw-r--r--ext/opcache/jit/zend_elf.c109
-rw-r--r--ext/opcache/jit/zend_elf.h115
-rw-r--r--ext/opcache/jit/zend_jit.c3263
-rw-r--r--ext/opcache/jit/zend_jit.h109
-rw-r--r--ext/opcache/jit/zend_jit_disasm_x86.c518
-rw-r--r--ext/opcache/jit/zend_jit_gdb.c493
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c1479
-rw-r--r--ext/opcache/jit/zend_jit_internal.h119
-rw-r--r--ext/opcache/jit/zend_jit_oprofile.c (renamed from ext/dom/userdatahandler.c)59
-rw-r--r--ext/opcache/jit/zend_jit_perf_dump.c246
-rw-r--r--ext/opcache/jit/zend_jit_vm_helpers.c270
-rw-r--r--ext/opcache/jit/zend_jit_vtune.c42
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc10313
-rw-r--r--ext/opcache/jit/zend_jit_x86.h256
-rw-r--r--ext/opcache/opcache.stub.php15
-rw-r--r--ext/opcache/opcache_arginfo.h24
-rw-r--r--ext/opcache/shared_alloc_mmap.c62
-rw-r--r--ext/opcache/shared_alloc_win32.c30
-rw-r--r--ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt12
-rw-r--r--ext/opcache/tests/block_pass_001.phpt2
-rw-r--r--ext/opcache/tests/bug66251.phpt9
-rw-r--r--ext/opcache/tests/bug66338.phpt2
-rw-r--r--ext/opcache/tests/bug68252.phpt21
-rw-r--r--ext/opcache/tests/bug68644.phpt17
-rw-r--r--ext/opcache/tests/bug70207.phpt4
-rw-r--r--ext/opcache/tests/bug71843.phpt9
-rw-r--r--ext/opcache/tests/bug73668.phpt2
-rw-r--r--ext/opcache/tests/bug75729.phpt21
-rw-r--r--ext/opcache/tests/bug75893.phpt24
-rw-r--r--ext/opcache/tests/bug76446.phpt2
-rw-r--r--ext/opcache/tests/bug77058.phpt2
-rw-r--r--ext/opcache/tests/bug78015.phpt2
-rw-r--r--ext/opcache/tests/issue0115.phpt1
-rw-r--r--ext/opcache/tests/issue0140.phpt1
-rw-r--r--ext/opcache/tests/issue0149.phpt1
-rw-r--r--ext/opcache/tests/jit/assign_001.phpt27
-rw-r--r--ext/opcache/tests/jit/assign_002.phpt29
-rw-r--r--ext/opcache/tests/jit/assign_003.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_004.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_005.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_006.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_007.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_008.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_009.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_010.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_011.phpt28
-rw-r--r--ext/opcache/tests/jit/assign_012.phpt28
-rw-r--r--ext/opcache/tests/jit/assign_013.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_014.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_015.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_016.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_017.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_018.phpt26
-rw-r--r--ext/opcache/tests/jit/assign_019.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_020.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_021.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_022.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_023.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_024.phpt23
-rw-r--r--ext/opcache/tests/jit/assign_025.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_026.phpt25
-rw-r--r--ext/opcache/tests/jit/assign_027.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_028.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_029.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_030.phpt23
-rw-r--r--ext/opcache/tests/jit/assign_031.phpt19
-rw-r--r--ext/opcache/tests/jit/assign_032.phpt27
-rw-r--r--ext/opcache/tests/jit/assign_033.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_034.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_035.phpt39
-rw-r--r--ext/opcache/tests/jit/assign_036.phpt43
-rw-r--r--ext/opcache/tests/jit/assign_dim_002.phpt137
-rw-r--r--ext/opcache/tests/jit/bug77857.phpt27
-rw-r--r--ext/opcache/tests/jit/cmp_001.phpt24
-rw-r--r--ext/opcache/tests/jit/cmp_002.phpt24
-rw-r--r--ext/opcache/tests/jit/cmp_003.phpt194
-rw-r--r--ext/opcache/tests/jit/cmp_004.phpt22
-rw-r--r--ext/opcache/tests/jit/const_001.phpt26
-rw-r--r--ext/opcache/tests/jit/defined_001.phpt38
-rw-r--r--ext/opcache/tests/jit/fetch_dim_func_args_001.phpt26
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_001.phpt45
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_002.phpt45
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_003.phpt61
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_004.phpt61
-rw-r--r--ext/opcache/tests/jit/fetch_dim_rw_001.phpt27
-rw-r--r--ext/opcache/tests/jit/fetch_obj_001.phpt137
-rw-r--r--ext/opcache/tests/jit/fetch_obj_002.phpt41
-rw-r--r--ext/opcache/tests/jit/fetch_obj_003.phpt46
-rw-r--r--ext/opcache/tests/jit/fetch_obj_004.phpt43
-rw-r--r--ext/opcache/tests/jit/inc_001.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_002.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_003.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_004.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_005.phpt23
-rw-r--r--ext/opcache/tests/jit/inc_006.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_007.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_008.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_009.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_010.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_011.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_012.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_013.phpt23
-rw-r--r--ext/opcache/tests/jit/inc_014.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_015.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_016.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_017.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_018.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_019.phpt27
-rw-r--r--ext/opcache/tests/jit/inc_020.phpt28
-rw-r--r--ext/opcache/tests/jit/jmpz_001.phpt26
-rw-r--r--ext/opcache/tests/jit/jmpz_ex_001.phpt32
-rw-r--r--ext/opcache/tests/jit/mod_001.phpt41
-rw-r--r--ext/opcache/tests/jit/mod_002.phpt53
-rw-r--r--ext/opcache/tests/jit/noval_001.phpt34
-rw-r--r--ext/opcache/tests/jit/recv_001.phpt23
-rw-r--r--ext/opcache/tests/jit/reg_alloc_001.phpt39
-rw-r--r--ext/opcache/tests/jit/reg_alloc_002.phpt28
-rw-r--r--ext/opcache/tests/jit/reg_alloc_003.phpt23
-rw-r--r--ext/opcache/tests/jit/send_val_001.phpt23
-rw-r--r--ext/opcache/tests/jit/send_var_ex_001.phpt30
-rw-r--r--ext/opcache/tests/jit/shift_left_001.phpt37
-rw-r--r--ext/opcache/tests/jit/shift_left_002.phpt49
-rw-r--r--ext/opcache/tests/jit/shift_right_001.phpt43
-rw-r--r--ext/opcache/tests/jit/shift_right_002.phpt55
-rw-r--r--ext/opcache/tests/jit/shift_right_003.phpt26
-rw-r--r--ext/opcache/tests/jit/skipif.inc3
-rw-r--r--ext/opcache/tests/jit/switch_jumptable.phpt40
-rw-r--r--ext/opcache/tests/jit/unreachable_block.phpt25
-rw-r--r--ext/opcache/tests/jmpz_jmp_elim.phpt2
-rw-r--r--ext/opcache/tests/opt/block_pass_001.phpt24
-rw-r--r--ext/opcache/tests/opt/block_pass_002.phpt19
-rw-r--r--ext/opcache/tests/optimize_static_001.phpt10
-rw-r--r--ext/opcache/tests/revalidate_path_01.phpt1
-rw-r--r--ext/opcache/tests/wrong_inlining_002.phpt9
-rw-r--r--ext/opcache/tests/wrong_inlining_003.phpt2
-rw-r--r--ext/opcache/zend_accelerator_module.c53
-rw-r--r--ext/opcache/zend_file_cache.c7
-rw-r--r--ext/opcache/zend_persist.c27
-rw-r--r--ext/opcache/zend_shared_alloc.c33
-rw-r--r--ext/opcache/zend_shared_alloc.h7
-rw-r--r--ext/openssl/openssl.c131
-rw-r--r--ext/openssl/openssl.stub.php24
-rw-r--r--ext/openssl/openssl_arginfo.h49
-rw-r--r--ext/openssl/php_openssl.h2
-rw-r--r--ext/openssl/tests/bug38255.phpt20
-rw-r--r--ext/openssl/tests/bug38261.phpt4
-rw-r--r--ext/openssl/tests/bug68912.phpt12
-rw-r--r--ext/openssl/tests/openssl_csr_export_bacis.phpt28
-rw-r--r--ext/openssl/tests/openssl_csr_export_to_file_basic.phpt28
-rw-r--r--ext/openssl/tests/openssl_csr_new_basic.phpt9
-rw-r--r--ext/openssl/tests/openssl_csr_sign_basic.phpt12
-rw-r--r--ext/openssl/tests/openssl_decrypt_error.phpt12
-rw-r--r--ext/openssl/tests/openssl_encrypt_error.phpt24
-rw-r--r--ext/openssl/tests/openssl_pkcs12_export_basic.phpt10
-rw-r--r--ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt10
-rw-r--r--ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt10
-rw-r--r--ext/openssl/tests/openssl_pkcs7_read_basic.phpt9
-rw-r--r--ext/openssl/tests/openssl_pkcs7_sign_basic.phpt8
-rw-r--r--ext/openssl/tests/openssl_pkey_new_error.phpt28
-rw-r--r--ext/openssl/tests/openssl_seal_basic.phpt12
-rw-r--r--ext/openssl/tests/openssl_sign_basic.phpt4
-rw-r--r--ext/openssl/tests/openssl_x509_fingerprint_basic.phpt7
-rw-r--r--ext/openssl/tests/openssl_x509_free_basic.phpt3
-rw-r--r--ext/openssl/xp_ssl.c2
-rw-r--r--ext/pcntl/pcntl.c226
-rw-r--r--ext/pcntl/pcntl.stub.php74
-rw-r--r--ext/pcntl/pcntl_arginfo.h117
-rw-r--r--ext/pcntl/php_pcntl.h2
-rw-r--r--ext/pcntl/php_signal.c2
-rw-r--r--ext/pcntl/php_signal.h2
-rw-r--r--ext/pcntl/tests/pcntl_alarm.phpt3
-rw-r--r--ext/pcntl/tests/pcntl_exec_3.phpt4
-rw-r--r--ext/pcntl/tests/pcntl_signal.phpt4
-rw-r--r--ext/pcntl/tests/pcntl_wait.phpt33
-rw-r--r--ext/pcre/config.w321
-rw-r--r--ext/pcre/config0.m41
-rw-r--r--ext/pcre/php_pcre.c97
-rw-r--r--ext/pcre/php_pcre.h2
-rw-r--r--ext/pcre/php_pcre.stub.php52
-rw-r--r--ext/pcre/php_pcre_arginfo.h59
-rw-r--r--ext/pcre/tests/002.phpt18
-rw-r--r--ext/pcre/tests/bug21732.phpt10
-rw-r--r--ext/pcre/tests/bug44925.phpt4
-rw-r--r--ext/pcre/tests/grep2.phpt10
-rw-r--r--ext/pcre/tests/pcre_extra.phpt5
-rw-r--r--ext/pcre/tests/preg_grep_error1.phpt23
-rw-r--r--ext/pcre/tests/preg_match_all_error1.phpt23
-rw-r--r--ext/pcre/tests/preg_match_all_error2.phpt20
-rw-r--r--ext/pcre/tests/preg_match_error1.phpt23
-rw-r--r--ext/pcre/tests/preg_match_error2.phpt23
-rw-r--r--ext/pcre/tests/preg_replace2.phpt6
-rw-r--r--ext/pcre/tests/preg_replace_callback2.phpt2
-rw-r--r--ext/pcre/tests/preg_replace_callback3.phpt22
-rw-r--r--ext/pcre/tests/preg_replace_callback_array2.phpt33
-rw-r--r--ext/pcre/tests/preg_replace_callback_error1.phpt9
-rw-r--r--ext/pcre/tests/preg_replace_error1.phpt3
-rw-r--r--ext/pcre/tests/preg_replace_error2.phpt13
-rw-r--r--ext/pcre/tests/preg_split_error1.phpt23
-rw-r--r--ext/pcre/tests/split.phpt6
-rw-r--r--ext/pcre/tests/split2.phpt4
-rw-r--r--ext/pdo/pdo.c2
-rw-r--r--ext/pdo/pdo_dbh.c30
-rw-r--r--ext/pdo/pdo_sql_parser.re2
-rw-r--r--ext/pdo/pdo_sqlstate.c2
-rw-r--r--ext/pdo/pdo_stmt.c150
-rw-r--r--ext/pdo/php_pdo.h2
-rw-r--r--ext/pdo/php_pdo_driver.h2
-rw-r--r--ext/pdo/php_pdo_error.h2
-rw-r--r--ext/pdo/php_pdo_int.h2
-rw-r--r--ext/pdo/tests/bug_44173.phpt8
-rw-r--r--ext/pdo/tests/pdo_drivers_error.phpt15
-rw-r--r--ext/pdo_dblib/dblib_driver.c2
-rw-r--r--ext/pdo_dblib/dblib_stmt.c2
-rw-r--r--ext/pdo_dblib/pdo_dblib.c2
-rw-r--r--ext/pdo_dblib/php_pdo_dblib.h2
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h2
-rw-r--r--ext/pdo_firebird/firebird_driver.c2
-rw-r--r--ext/pdo_firebird/firebird_statement.c2
-rw-r--r--ext/pdo_firebird/pdo_firebird.c2
-rw-r--r--ext/pdo_firebird/php_pdo_firebird.h2
-rw-r--r--ext/pdo_firebird/php_pdo_firebird_int.h2
-rw-r--r--ext/pdo_mysql/config.m42
-rw-r--r--ext/pdo_mysql/mysql_driver.c2
-rw-r--r--ext/pdo_mysql/mysql_statement.c2
-rw-r--r--ext/pdo_mysql/pdo_mysql.c2
-rw-r--r--ext/pdo_mysql/php_pdo_mysql.h2
-rw-r--r--ext/pdo_mysql/php_pdo_mysql_int.h2
-rw-r--r--ext/pdo_mysql/tests/bug44327.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt3
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt11
-rw-r--r--ext/pdo_oci/oci_driver.c2
-rw-r--r--ext/pdo_oci/oci_statement.c2
-rw-r--r--ext/pdo_oci/pdo_oci.c2
-rw-r--r--ext/pdo_oci/php_pdo_oci.h2
-rw-r--r--ext/pdo_oci/php_pdo_oci_int.h2
-rw-r--r--ext/pdo_odbc/odbc_driver.c2
-rw-r--r--ext/pdo_odbc/odbc_stmt.c2
-rw-r--r--ext/pdo_odbc/pdo_odbc.c36
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h2
-rw-r--r--ext/pdo_odbc/php_pdo_odbc_int.h2
-rw-r--r--ext/pdo_pgsql/pdo_pgsql.c2
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c2
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c2
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql.h2
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql_int.h2
-rw-r--r--ext/pdo_sqlite/pdo_sqlite.c2
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite.h2
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite_int.h2
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c8
-rw-r--r--ext/pdo_sqlite/sqlite_statement.c2
-rw-r--r--ext/pdo_sqlite/tests/bug43831.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt11
-rw-r--r--ext/pgsql/pgsql.c2
-rw-r--r--ext/pgsql/php_pgsql.h2
-rw-r--r--ext/pgsql/tests/01createdb.phpt4
-rw-r--r--ext/pgsql/tests/bug72197.phpt8
-rw-r--r--ext/phar/dirstream.c5
-rw-r--r--ext/phar/phar_object.c24
-rw-r--r--ext/phar/tests/002.phpt12
-rw-r--r--ext/phar/tests/badparameters.phpt273
-rw-r--r--ext/phar/tests/bug64931/bug64931.phpt5
-rw-r--r--ext/phar/tests/create_path_error.phpt5
-rw-r--r--ext/phar/tests/fatal_error_webphar.phpt2
-rw-r--r--ext/phar/tests/fgc_edgecases.phpt8
-rw-r--r--ext/phar/tests/fopen.phpt2
-rw-r--r--ext/phar/tests/fopen_edgecases2.phpt8
-rw-r--r--ext/phar/tests/open_for_write_existing_b.phpt9
-rw-r--r--ext/phar/tests/open_for_write_existing_c.phpt9
-rw-r--r--ext/phar/tests/open_for_write_newfile_b.phpt9
-rw-r--r--ext/phar/tests/open_for_write_newfile_c.phpt9
-rw-r--r--ext/phar/tests/opendir_edgecases.phpt8
-rw-r--r--ext/phar/tests/phar_bz2.phpt3
-rw-r--r--ext/phar/tests/phar_commitwrite.phpt10
-rw-r--r--ext/phar/tests/phar_create_in_cwd.phpt10
-rw-r--r--ext/phar/tests/phar_decompress.phpt11
-rw-r--r--ext/phar/tests/phar_extract.phpt9
-rw-r--r--ext/phar/tests/phar_isvalidpharfilename.phpt4
-rw-r--r--ext/phar/tests/phar_oo_006.phpt2
-rw-r--r--ext/phar/tests/phar_running.phpt2
-rw-r--r--ext/phar/tests/phar_unlinkarchive.phpt9
-rw-r--r--ext/phar/tests/pharfileinfo_chmod.phpt3
-rw-r--r--ext/phar/tests/pharfileinfo_compression.phpt2
-rw-r--r--ext/phar/tests/pharfileinfo_setmetadata.phpt4
-rw-r--r--ext/phar/tests/readfile_edgecases.phpt2
-rw-r--r--ext/phar/tests/stat2_5.3.phpt5
-rw-r--r--ext/phar/tests/tar/open_for_write_existing_b.phpt9
-rw-r--r--ext/phar/tests/tar/open_for_write_existing_c.phpt9
-rw-r--r--ext/phar/tests/tar/open_for_write_newfile_b.phpt9
-rw-r--r--ext/phar/tests/tar/open_for_write_newfile_c.phpt9
-rw-r--r--ext/phar/tests/tar/phar_commitwrite.phpt10
-rw-r--r--ext/phar/tests/zip/open_for_write_existing_b.phpt9
-rw-r--r--ext/phar/tests/zip/open_for_write_existing_c.phpt9
-rw-r--r--ext/phar/tests/zip/open_for_write_newfile_b.phpt9
-rw-r--r--ext/phar/tests/zip/open_for_write_newfile_c.phpt9
-rw-r--r--ext/phar/tests/zip/phar_commitwrite.phpt10
-rw-r--r--ext/posix/php_posix.h2
-rw-r--r--ext/posix/posix.c207
-rw-r--r--ext/posix/posix.stub.php118
-rw-r--r--ext/posix/posix_arginfo.h158
-rw-r--r--ext/posix/tests/posix_errno_error.phpt24
-rw-r--r--ext/posix/tests/posix_getcwd.phpt4
-rw-r--r--ext/posix/tests/posix_getgrgid_error.phpt21
-rw-r--r--ext/posix/tests/posix_getpgid_error.phpt18
-rw-r--r--ext/posix/tests/posix_getpwuid_error.phpt18
-rw-r--r--ext/posix/tests/posix_getsid_error.phpt7
-rw-r--r--ext/posix/tests/posix_initgroups.phpt3
-rw-r--r--ext/posix/tests/posix_kill_error.phpt20
-rw-r--r--ext/posix/tests/posix_seteuid_variation4.phpt46
-rw-r--r--ext/posix/tests/posix_setgid_variation4.phpt46
-rw-r--r--ext/posix/tests/posix_setuid_variation4.phpt46
-rw-r--r--ext/posix/tests/posix_strerror_error.phpt18
-rw-r--r--ext/posix/tests/posix_ttyname_error_wrongparams.phpt28
-rw-r--r--ext/posix/tests/posix_ttyname_variation6.phpt2
-rw-r--r--ext/pspell/php_pspell.h2
-rw-r--r--ext/pspell/pspell.c107
-rw-r--r--ext/pspell/pspell.stub.php43
-rw-r--r--ext/pspell/pspell_arginfo.h92
-rw-r--r--ext/pspell/tests/002.phpt8
-rw-r--r--ext/readline/php_readline.h2
-rw-r--r--ext/readline/readline.c59
-rw-r--r--ext/readline/readline.stub.php42
-rw-r--r--ext/readline/readline_arginfo.h58
-rw-r--r--ext/readline/readline_cli.c2
-rw-r--r--ext/readline/readline_cli.h2
-rw-r--r--ext/readline/tests/bug77812-libedit.phpt5
-rw-r--r--ext/readline/tests/bug77812-readline.phpt5
-rw-r--r--ext/readline/tests/libedit_callback_handler_install_001.phpt4
-rw-r--r--ext/readline/tests/readline_add_history_001.phpt4
-rw-r--r--ext/readline/tests/readline_callback_handler_install_001.phpt4
-rw-r--r--ext/readline/tests/readline_clear_history_001.phpt4
-rw-r--r--ext/readline/tests/readline_list_history_001.phpt4
-rw-r--r--ext/reflection/php_reflection.c152
-rw-r--r--ext/reflection/php_reflection.h2
-rw-r--r--ext/reflection/tests/004.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_002.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_error.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_002.phpt26
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass.phpt7
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass_001.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_002.phpt26
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_002.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt29
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_001.phpt37
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt25
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstance_001.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt25
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_001.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_bug66218.phpt1
-rw-r--r--ext/reflection/tests/ReflectionMethod_006.phpt74
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt70
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_error.phpt25
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionNamedType.phpt18
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionObject_getName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt37
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionParameter_003.phpt2
-rw-r--r--ext/reflection/tests/ReflectionProperty_error.phpt33
-rw-r--r--ext/reflection/tests/ReflectionProperty_export_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_getValue_error.phpt30
-rw-r--r--ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt7
-rw-r--r--ext/reflection/tests/ReflectionProperty_setValue_error.phpt59
-rw-r--r--ext/reflection/tests/ReflectionProperty_typed_static.phpt2
-rw-r--r--ext/reflection/tests/bug30148.phpt36
-rw-r--r--ext/reflection/tests/bug38942.phpt35
-rw-r--r--ext/reflection/tests/bug47254.phpt5
-rw-r--r--ext/reflection/tests/bug72661.phpt3
-rw-r--r--ext/reflection/tests/bug74673.phpt11
-rw-r--r--ext/reflection/tests/bug76536.phpt2
-rw-r--r--ext/reflection/tests/request38992.phpt21
-rw-r--r--ext/session/config.m44
-rw-r--r--ext/session/mod_files.c2
-rw-r--r--ext/session/mod_files.h2
-rw-r--r--ext/session/mod_mm.c2
-rw-r--r--ext/session/mod_mm.h2
-rw-r--r--ext/session/mod_user.c2
-rw-r--r--ext/session/mod_user.h2
-rw-r--r--ext/session/mod_user_class.c2
-rw-r--r--ext/session/php_session.h2
-rw-r--r--ext/session/session.c181
-rw-r--r--ext/session/session.stub.php92
-rw-r--r--ext/session/session_arginfo.h116
-rw-r--r--ext/session/tests/session_cache_expire_error.phpt169
-rw-r--r--ext/session/tests/session_cache_limiter_error.phpt8
-rw-r--r--ext/session/tests/session_decode_variation3.phpt2
-rw-r--r--ext/session/tests/session_encode_error2.phpt11
-rw-r--r--ext/session/tests/session_regenerate_id_cookie.phpt2
-rw-r--r--ext/session/tests/session_set_save_handler_class_012.phpt22
-rw-r--r--ext/session/tests/session_set_save_handler_class_013.phpt9
-rw-r--r--ext/session/tests/session_set_save_handler_class_017.phpt12
-rw-r--r--ext/session/tests/session_set_save_handler_class_018.phpt16
-rw-r--r--ext/session/tests/session_set_save_handler_iface_002.phpt11
-rw-r--r--ext/session/tests/session_set_save_handler_iface_003.phpt14
-rw-r--r--ext/session/tests/session_set_save_handler_sid_001.phpt14
-rw-r--r--ext/shmop/php_shmop.h2
-rw-r--r--ext/shmop/shmop.c45
-rw-r--r--ext/shmop/shmop.stub.php31
-rw-r--r--ext/shmop/shmop_arginfo.h32
-rw-r--r--ext/shmop/tests/002.phpt42
-rw-r--r--ext/simplexml/php_simplexml.h2
-rw-r--r--ext/simplexml/php_simplexml_exports.h2
-rw-r--r--ext/simplexml/simplexml.c338
-rw-r--r--ext/simplexml/simplexml.stub.php53
-rw-r--r--ext/simplexml/simplexml_arginfo.h76
-rw-r--r--ext/simplexml/sxe.c22
-rw-r--r--ext/simplexml/sxe.h2
-rw-r--r--ext/simplexml/sxe.stub.php25
-rw-r--r--ext/simplexml/sxe_arginfo.h16
-rw-r--r--ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt20
-rw-r--r--ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt2
-rw-r--r--ext/simplexml/tests/bug37565.phpt4
-rw-r--r--ext/simplexml/tests/bug38406.phpt2
-rw-r--r--ext/snmp/php_snmp.h2
-rw-r--r--ext/snmp/snmp.c354
-rw-r--r--ext/snmp/snmp.stub.php162
-rw-r--r--ext/snmp/snmp_arginfo.h146
-rw-r--r--ext/snmp/tests/reflection.phpt35
-rw-r--r--ext/snmp/tests/skipif.inc2
-rw-r--r--ext/snmp/tests/snmp-object-error.phpt24
-rw-r--r--ext/snmp/tests/snmp-object-setSecurity_error.phpt4
-rw-r--r--ext/snmp/tests/snmp2_get.phpt8
-rw-r--r--ext/snmp/tests/snmp2_real_walk.phpt11
-rw-r--r--ext/snmp/tests/snmp2_set.phpt8
-rw-r--r--ext/snmp/tests/snmp2_walk.phpt11
-rw-r--r--ext/snmp/tests/snmp3-error.phpt9
-rw-r--r--ext/snmp/tests/snmp_get_quick_print.phpt15
-rw-r--r--ext/snmp/tests/snmp_get_valueretrieval.phpt12
-rw-r--r--ext/snmp/tests/snmp_read_mib.phpt4
-rw-r--r--ext/snmp/tests/snmp_set_enum_print.phpt7
-rw-r--r--ext/snmp/tests/snmp_set_oid_output_format.phpt4
-rw-r--r--ext/snmp/tests/snmpget.phpt11
-rw-r--r--ext/snmp/tests/snmprealwalk.phpt11
-rw-r--r--ext/snmp/tests/snmpset.phpt8
-rw-r--r--ext/snmp/tests/snmpwalk.phpt11
-rw-r--r--ext/soap/php_encoding.c2
-rw-r--r--ext/soap/php_encoding.h2
-rw-r--r--ext/soap/php_http.c2
-rw-r--r--ext/soap/php_http.h2
-rw-r--r--ext/soap/php_packet_soap.c2
-rw-r--r--ext/soap/php_packet_soap.h2
-rw-r--r--ext/soap/php_schema.c2
-rw-r--r--ext/soap/php_schema.h2
-rw-r--r--ext/soap/php_sdl.c2
-rw-r--r--ext/soap/php_sdl.h2
-rw-r--r--ext/soap/php_soap.h2
-rw-r--r--ext/soap/php_xml.c2
-rw-r--r--ext/soap/php_xml.h2
-rw-r--r--ext/soap/soap.c272
-rw-r--r--ext/soap/soap.stub.php101
-rw-r--r--ext/soap/soap_arginfo.h133
-rw-r--r--ext/soap/tests/bug77088.phpt21
-rw-r--r--ext/soap/tests/bugs/bug31422.phpt5
-rw-r--r--ext/soap/tests/bugs/bug31755.phpt2
-rw-r--r--ext/soap/tests/fault_warning.phpt8
-rw-r--r--ext/sockets/multicast.c2
-rw-r--r--ext/sockets/multicast.h2
-rw-r--r--ext/sockets/php_sockets.h2
-rw-r--r--ext/sockets/sendrecvmsg.c6
-rw-r--r--ext/sockets/sockets.c313
-rw-r--r--ext/sockets/sockets.stub.php173
-rw-r--r--ext/sockets/sockets_arginfo.h199
-rw-r--r--ext/sockets/tests/ai_idn_deprecation.phpt20
-rw-r--r--ext/sockets/tests/mcast_ipv4_recv.phpt2
-rw-r--r--ext/sockets/tests/socket_connect_params.phpt11
-rw-r--r--ext/sockets/tests/socket_create_listen_used.phpt3
-rw-r--r--ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt9
-rw-r--r--ext/sockets/tests/socket_create_pair-wrongparams.phpt12
-rw-r--r--ext/sockets/tests/socket_export_stream-2.phpt46
-rw-r--r--ext/sockets/tests/socket_export_stream-4-win.phpt30
-rw-r--r--ext/sockets/tests/socket_export_stream-4.phpt30
-rw-r--r--ext/sockets/tests/socket_import_stream-2.phpt38
-rw-r--r--ext/sockets/tests/socket_import_stream-4-win.phpt30
-rw-r--r--ext/sockets/tests/socket_import_stream-4.phpt30
-rw-r--r--ext/sockets/tests/socket_listen-wrongparams.phpt4
-rw-r--r--ext/sockets/tests/socket_select-wrongparams-2.phpt3
-rw-r--r--ext/sockets/tests/socket_select-wrongparams-3.phpt28
-rw-r--r--ext/sockets/tests/socket_select_error.phpt17
-rw-r--r--ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt4
-rw-r--r--ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt9
-rw-r--r--ext/sockets/tests/socket_sentto_recvfrom_unix.phpt3
-rw-r--r--ext/sockets/tests/socket_set_block-retval.phpt12
-rw-r--r--ext/sockets/tests/socket_set_nonblock-retval.phpt12
-rw-r--r--ext/sockets/tests/socket_strerror.phpt2
-rw-r--r--ext/sockets/unix_socket_constants.h2
-rw-r--r--ext/sockets/win32_socket_constants.h2
-rw-r--r--ext/sockets/windows_common.h2
-rw-r--r--ext/sodium/libsodium.c353
-rw-r--r--ext/sodium/libsodium.stub.php194
-rw-r--r--ext/sodium/libsodium_arginfo.h380
-rw-r--r--ext/sodium/php_libsodium.h2
-rw-r--r--ext/sodium/sodium_pwhash.c2
-rw-r--r--ext/spl/php_spl.c20
-rw-r--r--ext/spl/php_spl.h2
-rw-r--r--ext/spl/spl_array.c152
-rw-r--r--ext/spl/spl_array.h2
-rw-r--r--ext/spl/spl_directory.c110
-rw-r--r--ext/spl/spl_directory.h2
-rw-r--r--ext/spl/spl_dllist.c30
-rw-r--r--ext/spl/spl_dllist.h2
-rw-r--r--ext/spl/spl_engine.c2
-rw-r--r--ext/spl/spl_engine.h6
-rw-r--r--ext/spl/spl_exceptions.c2
-rw-r--r--ext/spl/spl_exceptions.h2
-rw-r--r--ext/spl/spl_fixedarray.c44
-rw-r--r--ext/spl/spl_fixedarray.h2
-rw-r--r--ext/spl/spl_functions.c2
-rw-r--r--ext/spl/spl_functions.h2
-rw-r--r--ext/spl/spl_heap.c50
-rw-r--r--ext/spl/spl_heap.h2
-rw-r--r--ext/spl/spl_iterators.c102
-rw-r--r--ext/spl/spl_iterators.h2
-rw-r--r--ext/spl/spl_observer.c109
-rw-r--r--ext/spl/spl_observer.h2
-rw-r--r--ext/spl/tests/CallbackFilterIteratorTest-002.phpt2
-rw-r--r--ext/spl/tests/SplFileInfo_setFileClass_error.phpt2
-rw-r--r--ext/spl/tests/SplFileInfo_setInfoClass_error.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fputcsv_002.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_seek_error_001.phpt9
-rw-r--r--ext/spl/tests/arrayObject___construct_basic2.phpt4
-rw-r--r--ext/spl/tests/arrayObject___construct_basic3.phpt4
-rw-r--r--ext/spl/tests/arrayObject_asort_basic1.phpt10
-rw-r--r--ext/spl/tests/arrayObject_count_basic1.phpt14
-rw-r--r--ext/spl/tests/arrayObject_exchangeArray_basic3.phpt14
-rw-r--r--ext/spl/tests/arrayObject_ksort_basic1.phpt10
-rw-r--r--ext/spl/tests/arrayObject_magicMethods2.phpt2
-rw-r--r--ext/spl/tests/arrayObject_setIteratorClass_error1.phpt15
-rw-r--r--ext/spl/tests/array_026.phpt4
-rw-r--r--ext/spl/tests/bug45216.phpt25
-rw-r--r--ext/spl/tests/bug46051.phpt4
-rw-r--r--ext/spl/tests/bug54323.phpt2
-rw-r--r--ext/spl/tests/bug62978.phpt4
-rw-r--r--ext/spl/tests/bug65545.phpt6
-rw-r--r--ext/spl/tests/bug72888.phpt2
-rw-r--r--ext/spl/tests/class_implements_variation1.phpt4
-rw-r--r--ext/spl/tests/class_uses_variation1.phpt4
-rw-r--r--ext/spl/tests/fileobject_005.phpt12
-rw-r--r--ext/spl/tests/iterator_026.phpt4
-rw-r--r--ext/spl/tests/iterator_042.phpt2
-rw-r--r--ext/spl/tests/iterator_044.phpt37
-rw-r--r--ext/spl/tests/iterator_045.phpt13
-rw-r--r--ext/spl/tests/iterator_047.phpt8
-rw-r--r--ext/spl/tests/iterator_count.phpt12
-rw-r--r--ext/spl/tests/iterator_to_array.phpt11
-rw-r--r--ext/spl/tests/iterator_to_array_nonscalar_keys.phpt22
-rw-r--r--ext/spl/tests/recursive_tree_iterator_001.phpt16
-rw-r--r--ext/spl/tests/recursive_tree_iterator_006.phpt16
-rw-r--r--ext/spl/tests/regexIterator_setMode_error.phpt4
-rw-r--r--ext/spl/tests/spl_004.phpt24
-rw-r--r--ext/spl/tests/spl_autoload_005.phpt2
-rw-r--r--ext/spl/tests/spl_autoload_007.phpt4
-rw-r--r--ext/spl/tests/spl_autoload_008.phpt4
-rw-r--r--ext/spl/tests/spl_heap_is_empty_basic.phpt3
-rw-r--r--ext/spl/tests/spl_object_id.phpt8
-rw-r--r--ext/sqlite3/php_sqlite3.h2
-rw-r--r--ext/sqlite3/php_sqlite3_structs.h2
-rw-r--r--ext/sqlite3/sqlite3.c258
-rw-r--r--ext/sqlite3/sqlite3.stub.php128
-rw-r--r--ext/sqlite3/sqlite3_arginfo.h143
-rw-r--r--ext/sqlite3/tests/sqlite3_33_reset.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_enable_exceptions.phpt4
-rw-r--r--ext/standard/array.c370
-rw-r--r--ext/standard/assert.c91
-rw-r--r--ext/standard/base64.c4
-rw-r--r--ext/standard/base64.h2
-rwxr-xr-x[-rw-r--r--]ext/standard/basic_functions.c1203
-rw-r--r--ext/standard/basic_functions.h10
-rwxr-xr-xext/standard/basic_functions.stub.php598
-rwxr-xr-xext/standard/basic_functions_arginfo.h807
-rw-r--r--ext/standard/browscap.c2
-rw-r--r--ext/standard/config.m422
-rw-r--r--ext/standard/crc32.c2
-rw-r--r--ext/standard/crc32.h2
-rw-r--r--ext/standard/credits.c2
-rw-r--r--ext/standard/credits.h2
-rw-r--r--ext/standard/crypt.c2
-rw-r--r--ext/standard/css.c2
-rw-r--r--ext/standard/css.h2
-rw-r--r--ext/standard/cyr_convert.c2
-rw-r--r--ext/standard/cyr_convert.h2
-rw-r--r--ext/standard/datetime.c4
-rw-r--r--ext/standard/datetime.h2
-rw-r--r--ext/standard/dir.c44
-rw-r--r--ext/standard/dl.c2
-rw-r--r--ext/standard/dl.h2
-rw-r--r--ext/standard/dns.c8
-rw-r--r--ext/standard/dns_win32.c2
-rw-r--r--ext/standard/exec.c27
-rw-r--r--ext/standard/exec.h2
-rw-r--r--ext/standard/file.c113
-rw-r--r--ext/standard/file.h3
-rw-r--r--ext/standard/filestat.c8
-rw-r--r--ext/standard/filters.c133
-rw-r--r--ext/standard/flock_compat.c2
-rw-r--r--ext/standard/flock_compat.h2
-rw-r--r--ext/standard/formatted_print.c26
-rw-r--r--ext/standard/fsock.c4
-rw-r--r--ext/standard/fsock.h2
-rw-r--r--ext/standard/ftok.c2
-rw-r--r--ext/standard/ftp_fopen_wrapper.c2
-rw-r--r--ext/standard/head.c2
-rw-r--r--ext/standard/head.h2
-rw-r--r--ext/standard/hrtime.c4
-rw-r--r--ext/standard/hrtime.h2
-rw-r--r--ext/standard/html.c2
-rw-r--r--ext/standard/html.h2
-rw-r--r--ext/standard/html_tables.h2
-rwxr-xr-xext/standard/html_tables/html_table_gen.php4
-rw-r--r--ext/standard/http.c6
-rw-r--r--ext/standard/http_fopen_wrapper.c2
-rw-r--r--ext/standard/image.c30
-rw-r--r--ext/standard/incomplete_class.c32
-rw-r--r--ext/standard/info.c18
-rw-r--r--ext/standard/info.h2
-rw-r--r--ext/standard/iptc.c6
-rw-r--r--ext/standard/lcg.c2
-rw-r--r--ext/standard/levenshtein.c2
-rw-r--r--ext/standard/link.c10
-rw-r--r--ext/standard/mail.c4
-rw-r--r--ext/standard/math.c101
-rw-r--r--ext/standard/md5.c2
-rw-r--r--ext/standard/md5.h2
-rw-r--r--ext/standard/metaphone.c4
-rw-r--r--ext/standard/microtime.c4
-rw-r--r--ext/standard/microtime.h2
-rw-r--r--ext/standard/mt_rand.c2
-rw-r--r--ext/standard/net.c2
-rw-r--r--ext/standard/pack.c4
-rw-r--r--ext/standard/pack.h2
-rw-r--r--ext/standard/pageinfo.c2
-rw-r--r--ext/standard/pageinfo.h2
-rw-r--r--ext/standard/password.c84
-rw-r--r--ext/standard/php_array.h2
-rw-r--r--ext/standard/php_assert.h2
-rw-r--r--ext/standard/php_browscap.h2
-rw-r--r--ext/standard/php_crypt.h2
-rw-r--r--ext/standard/php_crypt_r.c2
-rw-r--r--ext/standard/php_crypt_r.h2
-rw-r--r--ext/standard/php_dir.h2
-rw-r--r--ext/standard/php_dns.h2
-rw-r--r--ext/standard/php_ext_syslog.h2
-rw-r--r--ext/standard/php_filestat.h2
-rw-r--r--ext/standard/php_fopen_wrapper.c2
-rw-r--r--ext/standard/php_fopen_wrappers.h2
-rw-r--r--ext/standard/php_ftok.h2
-rw-r--r--ext/standard/php_http.h2
-rw-r--r--ext/standard/php_image.h4
-rw-r--r--ext/standard/php_incomplete_class.h6
-rw-r--r--ext/standard/php_iptc.h2
-rw-r--r--ext/standard/php_lcg.h2
-rw-r--r--ext/standard/php_link.h2
-rw-r--r--ext/standard/php_mail.h2
-rw-r--r--ext/standard/php_math.h5
-rw-r--r--ext/standard/php_metaphone.h2
-rw-r--r--ext/standard/php_mt_rand.h2
-rw-r--r--ext/standard/php_net.h2
-rw-r--r--ext/standard/php_password.h2
-rw-r--r--ext/standard/php_rand.h2
-rw-r--r--ext/standard/php_random.h2
-rw-r--r--ext/standard/php_smart_string.h2
-rw-r--r--ext/standard/php_smart_string_public.h2
-rw-r--r--ext/standard/php_standard.h2
-rw-r--r--ext/standard/php_string.h2
-rw-r--r--ext/standard/php_type.h2
-rw-r--r--ext/standard/php_uuencode.h2
-rw-r--r--ext/standard/php_var.h2
-rw-r--r--ext/standard/php_versioning.h2
-rw-r--r--ext/standard/proc_open.c16
-rw-r--r--ext/standard/proc_open.h2
-rw-r--r--ext/standard/quot_print.c2
-rw-r--r--ext/standard/quot_print.h2
-rw-r--r--ext/standard/rand.c2
-rw-r--r--ext/standard/random.c6
-rw-r--r--ext/standard/scanf.c2
-rw-r--r--ext/standard/scanf.h2
-rw-r--r--ext/standard/sha1.c2
-rw-r--r--ext/standard/sha1.h2
-rw-r--r--ext/standard/soundex.c2
-rw-r--r--ext/standard/streamsfuncs.c97
-rw-r--r--ext/standard/streamsfuncs.h2
-rw-r--r--ext/standard/string.c491
-rw-r--r--ext/standard/syslog.c2
-rw-r--r--ext/standard/tests/array/002.phpt44
-rw-r--r--ext/standard/tests/array/005.phpt24
-rw-r--r--ext/standard/tests/array/009.phpt125
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk.phpt21
-rw-r--r--ext/standard/tests/array/array_chunk2.phpt24
-rw-r--r--ext/standard/tests/array/array_chunk_variation10.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation11.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation12.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation13.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation14.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation15.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation16.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation17.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation18.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation19.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation20.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation21.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation22.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation23.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation24.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation25.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation26.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation27.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation28.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation29.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation30.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation31.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation32.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation5.phpt52
-rw-r--r--ext/standard/tests/array/array_chunk_variation8.phpt13
-rw-r--r--ext/standard/tests/array/array_chunk_variation9.phpt13
-rw-r--r--ext/standard/tests/array/array_column_error.phpt80
-rw-r--r--ext/standard/tests/array/array_combine_error2.phpt39
-rw-r--r--ext/standard/tests/array/array_combine_variation4.phpt16
-rw-r--r--ext/standard/tests/array/array_count_values2.phpt6
-rw-r--r--ext/standard/tests/array/array_diff_1.phpt8
-rw-r--r--ext/standard/tests/array/array_diff_assoc_error.phpt21
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation1.phpt116
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation2.phpt116
-rw-r--r--ext/standard/tests/array/array_diff_error.phpt20
-rw-r--r--ext/standard/tests/array/array_diff_key_error.phpt20
-rw-r--r--ext/standard/tests/array/array_diff_key_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_diff_key_variation2.phpt224
-rw-r--r--ext/standard/tests/array/array_diff_key_variation3.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_error.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation1.phpt114
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation2.phpt114
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation4.phpt246
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation10.phpt30
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation2.phpt224
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation3.phpt240
-rw-r--r--ext/standard/tests/array/array_diff_variation1.phpt116
-rw-r--r--ext/standard/tests/array/array_diff_variation2.phpt116
-rw-r--r--ext/standard/tests/array/array_diff_variation9.phpt28
-rw-r--r--ext/standard/tests/array/array_fill_error.phpt45
-rw-r--r--ext/standard/tests/array/array_fill_keys.phpt5
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation1.phpt2
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation3.phpt20
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_filter.phpt12
-rw-r--r--ext/standard/tests/array/array_filter_variation10.phpt17
-rw-r--r--ext/standard/tests/array/array_filter_variation9.phpt28
-rw-r--r--ext/standard/tests/array/array_flip.phpt6
-rw-r--r--ext/standard/tests/array/array_flip_variation4.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_error.phpt22
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation1.phpt218
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation2.phpt220
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation9.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_error.phpt22
-rw-r--r--ext/standard/tests/array/array_intersect_key_error.phpt22
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation2.phpt224
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation3.phpt235
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation2.phpt224
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation3.phpt243
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation2.phpt224
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation4.phpt321
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation8.phpt27
-rw-r--r--ext/standard/tests/array/array_intersect_variation1.phpt218
-rw-r--r--ext/standard/tests/array/array_intersect_variation2.phpt220
-rw-r--r--ext/standard/tests/array/array_intersect_variation9.phpt80
-rw-r--r--ext/standard/tests/array/array_key_exists.phpt40
-rw-r--r--ext/standard/tests/array/array_keys_error.phpt42
-rw-r--r--ext/standard/tests/array/array_map_error.phpt13
-rw-r--r--ext/standard/tests/array/array_map_object1.phpt44
-rw-r--r--ext/standard/tests/array/array_map_object2.phpt20
-rw-r--r--ext/standard/tests/array/array_map_object3.phpt20
-rw-r--r--ext/standard/tests/array/array_map_variation10.phpt12
-rw-r--r--ext/standard/tests/array/array_map_variation12.phpt31
-rw-r--r--ext/standard/tests/array/array_map_variation14.phpt20
-rw-r--r--ext/standard/tests/array/array_map_variation15.phpt12
-rw-r--r--ext/standard/tests/array/array_map_variation16.phpt40
-rw-r--r--ext/standard/tests/array/array_map_variation17.phpt70
-rw-r--r--ext/standard/tests/array/array_map_variation4.phpt12
-rw-r--r--ext/standard/tests/array/array_merge.phpt18
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation2.phpt108
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation4.phpt6
-rw-r--r--ext/standard/tests/array/array_merge_variation1.phpt131
-rw-r--r--ext/standard/tests/array/array_merge_variation2.phpt108
-rw-r--r--ext/standard/tests/array/array_multisort_error.phpt31
-rw-r--r--ext/standard/tests/array/array_multisort_variation1.phpt87
-rw-r--r--ext/standard/tests/array/array_multisort_variation2.phpt92
-rw-r--r--ext/standard/tests/array/array_multisort_variation3.phpt90
-rw-r--r--ext/standard/tests/array/array_multisort_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_pad.phpt30
-rw-r--r--ext/standard/tests/array/array_push.phpt22
-rw-r--r--ext/standard/tests/array/array_push_error2.phpt11
-rw-r--r--ext/standard/tests/array/array_rand.phpt62
-rw-r--r--ext/standard/tests/array/array_rand_variation5.phpt48
-rw-r--r--ext/standard/tests/array/array_replace.phpt24
-rw-r--r--ext/standard/tests/array/array_reverse_variation4.phpt12
-rw-r--r--ext/standard/tests/array/array_search1.phpt9
-rw-r--r--ext/standard/tests/array/array_search_variation3.phpt20
-rw-r--r--ext/standard/tests/array/array_slice.phpt40
-rw-r--r--ext/standard/tests/array/array_slice_variation1.phpt20
-rw-r--r--ext/standard/tests/array/array_slice_variation2.phpt303
-rw-r--r--ext/standard/tests/array/array_splice_basic.phpt19
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation1.phpt110
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation2.phpt110
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation1.phpt110
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation2.phpt110
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_udiff_variation1.phpt110
-rw-r--r--ext/standard/tests/array/array_udiff_variation2.phpt110
-rw-r--r--ext/standard/tests/array/array_udiff_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation1.phpt110
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation2.phpt110
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt110
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt110
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_uintersect_variation1.phpt110
-rw-r--r--ext/standard/tests/array/array_uintersect_variation2.phpt110
-rw-r--r--ext/standard/tests/array/array_uintersect_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_unique_variation3.phpt6
-rw-r--r--ext/standard/tests/array/array_unique_variation8.phpt8
-rw-r--r--ext/standard/tests/array/array_unshift.phpt9
-rw-r--r--ext/standard/tests/array/array_unshift_variation4.phpt12
-rw-r--r--ext/standard/tests/array/array_walk.phpt14
-rw-r--r--ext/standard/tests/array/array_walk_closure.phpt16
-rw-r--r--ext/standard/tests/array/array_walk_error2.phpt4
-rw-r--r--ext/standard/tests/array/array_walk_objects.phpt9
-rw-r--r--ext/standard/tests/array/array_walk_rec_objects.phpt9
-rw-r--r--ext/standard/tests/array/array_walk_recursive1.phpt14
-rw-r--r--ext/standard/tests/array/array_walk_recursive_error2.phpt4
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation7.phpt7
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation8.phpt10
-rw-r--r--ext/standard/tests/array/array_walk_variation7.phpt7
-rw-r--r--ext/standard/tests/array/array_walk_variation8.phpt10
-rw-r--r--ext/standard/tests/array/bug30074.phpt4
-rw-r--r--ext/standard/tests/array/bug31158.phpt4
-rw-r--r--ext/standard/tests/array/bug35014.phpt5
-rw-r--r--ext/standard/tests/array/bug35014_64bit.phpt5
-rw-r--r--ext/standard/tests/array/bug40191.phpt12
-rw-r--r--ext/standard/tests/array/bug42177.phpt10
-rw-r--r--ext/standard/tests/array/bug43495.phpt17
-rw-r--r--ext/standard/tests/array/bug61058.phpt11
-rw-r--r--ext/standard/tests/array/bug65251.phpt10
-rw-r--r--ext/standard/tests/array/bug67693.phpt4
-rw-r--r--ext/standard/tests/array/bug70713.phpt11
-rw-r--r--ext/standard/tests/array/bug71220.phpt12
-rw-r--r--ext/standard/tests/array/bug77395.phpt9
-rw-r--r--ext/standard/tests/array/bug77931.phpt28
-rw-r--r--ext/standard/tests/array/compact_variation1.phpt43
-rw-r--r--ext/standard/tests/array/count_recursive.phpt28
-rw-r--r--ext/standard/tests/array/each.phptbin9679 -> 0 bytes
-rw-r--r--ext/standard/tests/array/each_basic.phpt76
-rw-r--r--ext/standard/tests/array/each_error.phpt41
-rw-r--r--ext/standard/tests/array/each_variation1.phpt223
-rw-r--r--ext/standard/tests/array/each_variation2.phpt249
-rw-r--r--ext/standard/tests/array/each_variation3.phpt254
-rw-r--r--ext/standard/tests/array/each_variation4.phpt60
-rw-r--r--ext/standard/tests/array/each_variation5.phpt97
-rw-r--r--ext/standard/tests/array/each_variation6.phpt52
-rw-r--r--ext/standard/tests/array/end.phpt30
-rw-r--r--ext/standard/tests/array/end_64bit.phpt30
-rw-r--r--ext/standard/tests/array/extract_error.phpt54
-rw-r--r--ext/standard/tests/array/extract_error_variation1.phpt14
-rw-r--r--ext/standard/tests/array/in_array_variation3.phpt20
-rw-r--r--ext/standard/tests/array/max.phpt38
-rw-r--r--ext/standard/tests/array/min.phpt38
-rw-r--r--ext/standard/tests/array/negative_index.phpt31
-rw-r--r--ext/standard/tests/array/range_bug70239_0.phpt10
-rw-r--r--ext/standard/tests/array/range_bug70239_1.phpt10
-rw-r--r--ext/standard/tests/array/range_bug70239_2.phpt9
-rw-r--r--ext/standard/tests/array/range_bug70239_3.phpt9
-rw-r--r--ext/standard/tests/array/range_errors.phpt165
-rw-r--r--ext/standard/tests/array/range_variation.phpt19
-rw-r--r--ext/standard/tests/array/sizeof_variation4.phpt120
-rw-r--r--ext/standard/tests/array/uasort_variation8.phpt16
-rw-r--r--ext/standard/tests/array/usort_variation8.phpt18
-rw-r--r--ext/standard/tests/assert/assert.phpt23
-rw-r--r--ext/standard/tests/assert/assert02.phpt64
-rw-r--r--ext/standard/tests/assert/assert03.phpt25
-rw-r--r--ext/standard/tests/assert/assert04.phpt16
-rw-r--r--ext/standard/tests/assert/assert_basic.phpt19
-rw-r--r--ext/standard/tests/assert/assert_basic1.phpt11
-rw-r--r--ext/standard/tests/assert/assert_basic2.phpt1
-rw-r--r--ext/standard/tests/assert/assert_basic3.phpt8
-rw-r--r--ext/standard/tests/assert/assert_basic4.phpt5
-rw-r--r--ext/standard/tests/assert/assert_basic5.phpt13
-rw-r--r--ext/standard/tests/assert/assert_basic6.phpt27
-rw-r--r--ext/standard/tests/assert/assert_closures.phpt1
-rw-r--r--ext/standard/tests/assert/assert_error.phpt31
-rw-r--r--ext/standard/tests/assert/assert_error2.phpt15
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt27
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt28
-rw-r--r--ext/standard/tests/assert/assert_options_error.phpt13
-rw-r--r--ext/standard/tests/assert/assert_variation.phpt36
-rw-r--r--ext/standard/tests/assert/bug73303.phpt24
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/get_class_variation_001.phpt116
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_002.phpt20
-rw-r--r--ext/standard/tests/class_object/is_a_variation_001.phpt4
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_004.phpt20
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/property_exists_error.phpt23
-rw-r--r--ext/standard/tests/dir/bug41693.phpt14
-rw-r--r--ext/standard/tests/dir/closedir_error-win32-mb.phpt51
-rw-r--r--ext/standard/tests/dir/closedir_variation2-win32-mb.phpt10
-rw-r--r--ext/standard/tests/dir/closedir_variation2.phpt10
-rw-r--r--ext/standard/tests/dir/closedir_variation3.phpt11
-rw-r--r--ext/standard/tests/dir/dir_basic-win32-mb.phpt11
-rw-r--r--ext/standard/tests/dir/dir_basic.phpt11
-rw-r--r--ext/standard/tests/dir/readdir_variation7.phpt10
-rw-r--r--ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt10
-rw-r--r--ext/standard/tests/dir/rewinddir_variation2.phpt10
-rw-r--r--ext/standard/tests/dir/rewinddir_variation3.phpt11
-rw-r--r--ext/standard/tests/dir/scandir_variation3-win32-mb.phpt244
-rw-r--r--ext/standard/tests/directory/DirectoryClass_basic_001.phpt11
-rw-r--r--ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt77
-rw-r--r--ext/standard/tests/directory/DirectoryClass_error_001.phpt78
-rw-r--r--ext/standard/tests/file/005_error.phpt75
-rw-r--r--ext/standard/tests/file/006_error.phpt34
-rw-r--r--ext/standard/tests/file/006_variation2.phpt66
-rw-r--r--ext/standard/tests/file/007_basic.phpt220
-rw-r--r--ext/standard/tests/file/007_error.phpt185
-rw-r--r--ext/standard/tests/file/basename-win32.phpt46
-rw-r--r--ext/standard/tests/file/basename.phptbin8212 -> 6843 bytes
-rw-r--r--ext/standard/tests/file/bug39863.phpt17
-rw-r--r--ext/standard/tests/file/bug41693.phpt13
-rw-r--r--ext/standard/tests/file/bug52820.phpt2
-rw-r--r--ext/standard/tests/file/bug72035.phpt1
-rw-r--r--ext/standard/tests/file/chmod_error.phpt23
-rw-r--r--ext/standard/tests/file/copy_error.phpt16
-rw-r--r--ext/standard/tests/file/copy_variation4.phptbin4939 -> 4250 bytes
-rw-r--r--ext/standard/tests/file/disk.phpt9
-rw-r--r--ext/standard/tests/file/disk_free_space_error-win32.phpt18
-rw-r--r--ext/standard/tests/file/disk_free_space_error.phpt18
-rw-r--r--ext/standard/tests/file/disk_free_space_variation.phpt44
-rw-r--r--ext/standard/tests/file/disk_total_space_error-win32.phpt10
-rw-r--r--ext/standard/tests/file/disk_total_space_error.phpt10
-rw-r--r--ext/standard/tests/file/disk_total_space_variation.phpt24
-rw-r--r--ext/standard/tests/file/fclose_variation1.phpt10
-rw-r--r--ext/standard/tests/file/feof_basic.phpt11
-rw-r--r--ext/standard/tests/file/fgetc_variation2.phpt27
-rw-r--r--ext/standard/tests/file/fgets_error.phpt72
-rw-r--r--ext/standard/tests/file/fgets_variation2.phpt43
-rw-r--r--ext/standard/tests/file/fgetss.phpt144
-rw-r--r--ext/standard/tests/file/fgetss1.phpt73
-rw-r--r--ext/standard/tests/file/fgetss_basic1.phpt137
-rw-r--r--ext/standard/tests/file/fgetss_basic2-win32-mb.phpt218
-rw-r--r--ext/standard/tests/file/fgetss_basic2-win32.phpt218
-rw-r--r--ext/standard/tests/file/fgetss_basic2.phpt216
-rw-r--r--ext/standard/tests/file/fgetss_error.phpt108
-rw-r--r--ext/standard/tests/file/fgetss_variation1-win32.phpt192
-rw-r--r--ext/standard/tests/file/fgetss_variation1.phpt188
-rw-r--r--ext/standard/tests/file/fgetss_variation2.phpt436
-rw-r--r--ext/standard/tests/file/fgetss_variation3-win32.phpt573
-rw-r--r--ext/standard/tests/file/fgetss_variation3.phpt569
-rw-r--r--ext/standard/tests/file/fgetss_variation4.phpt170
-rw-r--r--ext/standard/tests/file/fgetss_variation5-win32.phpt222
-rw-r--r--ext/standard/tests/file/fgetss_variation5.phpt219
-rw-r--r--ext/standard/tests/file/file_error.phpt14
-rw-r--r--ext/standard/tests/file/file_get_contents_error.phpt14
-rw-r--r--ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt22
-rw-r--r--ext/standard/tests/file/file_get_contents_variation8-win32.phpt14
-rw-r--r--ext/standard/tests/file/file_get_contents_variation8.phpt14
-rw-r--r--ext/standard/tests/file/file_put_contents.phpt21
-rw-r--r--ext/standard/tests/file/file_put_contents_variation2.phpt12
-rw-r--r--ext/standard/tests/file/file_put_contents_variation8-win32.phpt28
-rw-r--r--ext/standard/tests/file/file_put_contents_variation8.phptbin2473 -> 2396 bytes
-rw-r--r--ext/standard/tests/file/filegroup_error.phpt10
-rw-r--r--ext/standard/tests/file/filegroup_variation2.phpt6
-rw-r--r--ext/standard/tests/file/filegroup_variation3.phpt14
-rw-r--r--ext/standard/tests/file/fileinode_error.phpt12
-rw-r--r--ext/standard/tests/file/fileinode_variation2.phpt6
-rw-r--r--ext/standard/tests/file/fileinode_variation3.phpt14
-rw-r--r--ext/standard/tests/file/fileowner_error.phpt10
-rw-r--r--ext/standard/tests/file/fileowner_variation2.phpt6
-rw-r--r--ext/standard/tests/file/fileowner_variation3.phpt14
-rw-r--r--ext/standard/tests/file/fileperms_variation2.phpt6
-rw-r--r--ext/standard/tests/file/fileperms_variation3.phpt14
-rw-r--r--ext/standard/tests/file/filesize_error.phpt14
-rw-r--r--ext/standard/tests/file/filetype_error.phpt10
-rw-r--r--ext/standard/tests/file/flock.phpt18
-rw-r--r--ext/standard/tests/file/flock_error.phpt52
-rw-r--r--ext/standard/tests/file/fnmatch_variation.phpt146
-rw-r--r--ext/standard/tests/file/fputcsv_002.phpt2
-rw-r--r--ext/standard/tests/file/fread_error.phpt80
-rw-r--r--ext/standard/tests/file/fscanf.phpt12
-rw-r--r--ext/standard/tests/file/fscanf_error.phpt34
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error1.phpt83
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error2.phpt79
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error3.phpt79
-rw-r--r--ext/standard/tests/file/fstat.phpt10
-rw-r--r--ext/standard/tests/file/ftruncate_error.phpt93
-rw-r--r--ext/standard/tests/file/fwrite.phpt22
-rw-r--r--ext/standard/tests/file/fwrite_error.phpt82
-rw-r--r--ext/standard/tests/file/get_current_user.phpt3
-rw-r--r--ext/standard/tests/file/glob_variation-win32-mb.phpt45
-rw-r--r--ext/standard/tests/file/glob_variation-win32.phpt45
-rw-r--r--ext/standard/tests/file/glob_variation.phpt45
-rw-r--r--ext/standard/tests/file/is_dir_variation3.phpt7
-rw-r--r--ext/standard/tests/file/is_dir_variation4.phpt14
-rw-r--r--ext/standard/tests/file/is_executable_error.phpt13
-rw-r--r--ext/standard/tests/file/is_executable_variation1.phpt14
-rw-r--r--ext/standard/tests/file/is_executable_variation3.phpt4
-rw-r--r--ext/standard/tests/file/is_file_variation3.phpt8
-rw-r--r--ext/standard/tests/file/is_file_variation4.phpt14
-rw-r--r--ext/standard/tests/file/is_readable_error.phpt12
-rw-r--r--ext/standard/tests/file/is_readable_variation1.phpt18
-rw-r--r--ext/standard/tests/file/is_readable_variation3.phpt4
-rw-r--r--ext/standard/tests/file/is_uploaded_file_basic.phpt10
-rw-r--r--ext/standard/tests/file/is_writable_error.phpt24
-rw-r--r--ext/standard/tests/file/is_writable_variation1.phpt36
-rw-r--r--ext/standard/tests/file/is_writable_variation3.phpt7
-rw-r--r--ext/standard/tests/file/lchown_error.phpt23
-rw-r--r--ext/standard/tests/file/lstat_stat_error.phpt29
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_error.phpt36
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation2.phpt20
-rw-r--r--ext/standard/tests/file/move_uploaded_file_basic.phpt12
-rw-r--r--ext/standard/tests/file/parse_ini_file_error.phpt9
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation3.phpt5
-rw-r--r--ext/standard/tests/file/pathinfo_variaton.phpt53
-rw-r--r--ext/standard/tests/file/popen_pclose_error.phpt20
-rw-r--r--ext/standard/tests/file/readfile_error.phpt18
-rw-r--r--ext/standard/tests/file/readfile_variation10-win32.phpt14
-rw-r--r--ext/standard/tests/file/readfile_variation10.phptbin1862 -> 1736 bytes
-rw-r--r--ext/standard/tests/file/readlink_realpath_error.phpt23
-rw-r--r--ext/standard/tests/file/readlink_variation1.phpt6
-rw-r--r--ext/standard/tests/file/realpath_error-win32.phpt29
-rw-r--r--ext/standard/tests/file/rename_variation13-win32.phptbin5233 -> 4384 bytes
-rw-r--r--ext/standard/tests/file/rename_variation13.phpt20
-rw-r--r--ext/standard/tests/file/stat_error-win32.phpt16
-rw-r--r--ext/standard/tests/file/stream_002.phpt7
-rw-r--r--ext/standard/tests/file/stream_rfc2397_002.phpt22
-rw-r--r--ext/standard/tests/file/stream_rfc2397_006.phpt13
-rw-r--r--ext/standard/tests/file/stream_supports_lock.phpt10
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt22
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt22
-rw-r--r--ext/standard/tests/file/tempnam_variation3-win32.phpt16
-rw-r--r--ext/standard/tests/file/tempnam_variation3.phpt19
-rw-r--r--ext/standard/tests/file/tempnam_variation7-win32.phpt19
-rw-r--r--ext/standard/tests/file/tempnam_variation7.phpt19
-rw-r--r--ext/standard/tests/file/touch.phpt3
-rw-r--r--ext/standard/tests/file/touch_error.phpt8
-rw-r--r--ext/standard/tests/file/unlink_error-win32-mb.phpt24
-rw-r--r--ext/standard/tests/file/unlink_error-win32.phpt24
-rw-r--r--ext/standard/tests/file/unlink_error.phpt25
-rw-r--r--ext/standard/tests/file/userstreams_002.phpt10
-rw-r--r--ext/standard/tests/filters/001.phpt8
-rw-r--r--ext/standard/tests/filters/php_user_filter_01.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_02.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_03.phpt2
-rw-r--r--ext/standard/tests/filters/stream_filter_remove_error.phpt25
-rw-r--r--ext/standard/tests/filters/strip_tags_filter.phpt29
-rw-r--r--ext/standard/tests/general_functions/010.phpt23
-rw-r--r--ext/standard/tests/general_functions/bug32647.phpt11
-rw-r--r--ext/standard/tests/general_functions/bug41970.phpt24
-rw-r--r--ext/standard/tests/general_functions/bug47857.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug60723.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug70018.phpt6
-rw-r--r--ext/standard/tests/general_functions/callbacks_001.phpt9
-rw-r--r--ext/standard/tests/general_functions/callbacks_002.phpt26
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_v.phpt6
-rw-r--r--ext/standard/tests/general_functions/error_clear_last.phpt2
-rw-r--r--ext/standard/tests/general_functions/error_get_last.phpt27
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt6
-rw-r--r--ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt6
-rw-r--r--ext/standard/tests/general_functions/floatval.phpt26
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_basic.phpt4
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_error.phpt40
-rw-r--r--ext/standard/tests/general_functions/get_include_path_basic.phpt9
-rw-r--r--ext/standard/tests/general_functions/get_included_files.phpt8
-rw-r--r--ext/standard/tests/general_functions/getrusage.phpt6
-rw-r--r--ext/standard/tests/general_functions/getservbyport_variation1.phpt16
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt4
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_error.phpt26
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation1.phpt21
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation2.phpt31
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation3.phpt31
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation4.phpt47
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation5.phpt25
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation6.phpt25
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation7.phpt25
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation8.phpt33
-rw-r--r--ext/standard/tests/general_functions/head.phpt6
-rw-r--r--ext/standard/tests/general_functions/include_path.phpt24
-rw-r--r--ext/standard/tests/general_functions/intval.phpt15
-rw-r--r--ext/standard/tests/general_functions/intval_variation1.phpt4
-rw-r--r--ext/standard/tests/general_functions/is_array.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_bool.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic2.phpt48
-rw-r--r--ext/standard/tests/general_functions/is_countable_with_variables.phpt4
-rw-r--r--ext/standard/tests/general_functions/is_float.phpt35
-rw-r--r--ext/standard/tests/general_functions/is_float_64bit.phpt35
-rw-r--r--ext/standard/tests/general_functions/is_int.phpt31
-rw-r--r--ext/standard/tests/general_functions/is_int_64bit.phpt31
-rw-r--r--ext/standard/tests/general_functions/is_null.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_numeric.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_object.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_scalar.phpt19
-rw-r--r--ext/standard/tests/general_functions/is_string.phpt15
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_error.phpt7
-rw-r--r--ext/standard/tests/general_functions/ob_get_length_basic.phpt6
-rw-r--r--ext/standard/tests/general_functions/parse_ini_file.phpt16
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_002.phpt8
-rw-r--r--ext/standard/tests/general_functions/php_uname_error.phpt34
-rw-r--r--ext/standard/tests/general_functions/phpcredits.phpt4
-rw-r--r--ext/standard/tests/general_functions/phpcredits2.phpt4
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt7
-rw-r--r--ext/standard/tests/general_functions/phpinfo2.phpt7
-rw-r--r--ext/standard/tests/general_functions/print_r.phpt37
-rw-r--r--ext/standard/tests/general_functions/print_r_64bit.phpt37
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic-win.phpt4
-rw-r--r--ext/standard/tests/general_functions/proc_open-mb0.phpt1
-rw-r--r--ext/standard/tests/general_functions/proc_open-mb1.phpt1
-rw-r--r--ext/standard/tests/general_functions/rand.phpt24
-rw-r--r--ext/standard/tests/general_functions/sleep_error.phpt18
-rw-r--r--ext/standard/tests/general_functions/strval.phpt23
-rw-r--r--ext/standard/tests/general_functions/sys_getloadavg.phpt3
-rw-r--r--ext/standard/tests/general_functions/usleep_error.phpt18
-rw-r--r--ext/standard/tests/general_functions/var_dump.phpt25
-rw-r--r--ext/standard/tests/general_functions/var_dump_64bit.phpt25
-rw-r--r--ext/standard/tests/general_functions/var_export-locale.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export-locale_32.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export_error2.phpt5
-rw-r--r--ext/standard/tests/image/getimagesize_variation2.phpt10
-rw-r--r--ext/standard/tests/image/getimagesize_variation3.phpt4
-rw-r--r--ext/standard/tests/image/image_type_to_extension.phpt16
-rw-r--r--ext/standard/tests/math/abs_variation.phpt26
-rw-r--r--ext/standard/tests/math/acos_variation.phpt4
-rw-r--r--ext/standard/tests/math/acosh_variation.phpt4
-rw-r--r--ext/standard/tests/math/asin_variation.phpt4
-rw-r--r--ext/standard/tests/math/asinh_variation.phpt4
-rw-r--r--ext/standard/tests/math/atan_variation.phpt4
-rw-r--r--ext/standard/tests/math/atanh_variation.phpt4
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt15
-rw-r--r--ext/standard/tests/math/base_convert_variation1.phpt2
-rw-r--r--ext/standard/tests/math/bindec_variation1.phpt16
-rw-r--r--ext/standard/tests/math/bindec_variation1_64bit.phpt16
-rw-r--r--ext/standard/tests/math/ceil_variation1.phpt26
-rw-r--r--ext/standard/tests/math/cos_variation.phpt4
-rw-r--r--ext/standard/tests/math/cosh_variation.phpt4
-rw-r--r--ext/standard/tests/math/deg2rad_variation.phpt4
-rw-r--r--ext/standard/tests/math/fdiv.phpt78
-rw-r--r--ext/standard/tests/math/floor_variation1.phpt26
-rw-r--r--ext/standard/tests/math/hexdec_variation1.phpt16
-rw-r--r--ext/standard/tests/math/hexdec_variation1_64bit.phpt16
-rw-r--r--ext/standard/tests/math/lcg_value_basic.phpt24
-rw-r--r--ext/standard/tests/math/log10_variation.phpt4
-rw-r--r--ext/standard/tests/math/log_error.phpt6
-rw-r--r--ext/standard/tests/math/octdec_variation1.phpt16
-rw-r--r--ext/standard/tests/math/rad2deg_variation.phpt4
-rw-r--r--ext/standard/tests/math/sin_variation.phpt4
-rw-r--r--ext/standard/tests/math/sinh_variation.phpt4
-rw-r--r--ext/standard/tests/math/sqrt_variation.phpt4
-rw-r--r--ext/standard/tests/math/tan_variation.phpt4
-rw-r--r--ext/standard/tests/math/tanh_variation.phpt4
-rw-r--r--ext/standard/tests/misc/get_browser_error.phpt6
-rw-r--r--ext/standard/tests/network/fsockopen_error.phpt27
-rw-r--r--ext/standard/tests/network/gethostbyaddr_error.phpt20
-rw-r--r--ext/standard/tests/network/gethostname.phpt6
-rw-r--r--ext/standard/tests/network/getprotobyname_error.phpt11
-rw-r--r--ext/standard/tests/network/getprotobynumber_error.phpt11
-rw-r--r--ext/standard/tests/network/inet.phpt8
-rw-r--r--ext/standard/tests/network/ip.phpt20
-rw-r--r--ext/standard/tests/network/ip_x86_64.phpt20
-rw-r--r--ext/standard/tests/password/password_bcrypt_errors.phpt26
-rw-r--r--ext/standard/tests/password/password_deprecated_salts.phpt20
-rw-r--r--ext/standard/tests/password/password_hash_error.phpt51
-rw-r--r--ext/standard/tests/password/password_needs_rehash_error.phpt33
-rw-r--r--ext/standard/tests/password/password_removed_salt_option.phpt20
-rw-r--r--ext/standard/tests/password/password_verify_error.phpt16
-rw-r--r--ext/standard/tests/serialize/bug69152.phpt8
-rw-r--r--ext/standard/tests/serialize/bug69793.phpt6
-rw-r--r--ext/standard/tests/serialize/serialization_objects_002.phptbin7231 -> 7233 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_005.phpt2
-rw-r--r--ext/standard/tests/serialize/typed_property_refs.phpt8
-rw-r--r--ext/standard/tests/streams/bug46426.phpt2
-rw-r--r--ext/standard/tests/streams/bug53903.phpt2
-rw-r--r--ext/standard/tests/streams/bug54623.phpt9
-rw-r--r--ext/standard/tests/streams/bug60602.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_contents_001.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_error.phpt42
-rw-r--r--ext/standard/tests/streams/stream_resolve_include_path.phpt13
-rw-r--r--ext/standard/tests/streams/stream_set_chunk_size.phpt4
-rw-r--r--ext/standard/tests/streams/stream_set_timeout_error.phpt40
-rw-r--r--ext/standard/tests/strings/addcslashes_001.phptbin1585 -> 1627 bytes
-rw-r--r--ext/standard/tests/strings/bug24208.phpt13
-rw-r--r--ext/standard/tests/strings/bug33605.phpt10
-rw-r--r--ext/standard/tests/strings/bug37262.phpt8
-rw-r--r--ext/standard/tests/strings/bug40754.phpt4
-rw-r--r--ext/standard/tests/strings/bug54238.phpt7
-rw-r--r--ext/standard/tests/strings/bug54322.phpt14
-rw-r--r--ext/standard/tests/strings/bug61116.phpt16
-rw-r--r--ext/standard/tests/strings/bug63943.phpt8
-rw-r--r--ext/standard/tests/strings/bug77439.phpt9
-rw-r--r--ext/standard/tests/strings/chr_error.phptbin823 -> 881 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt13
-rw-r--r--ext/standard/tests/strings/chunk_split_variation1_32bit.phpt26
-rw-r--r--ext/standard/tests/strings/chunk_split_variation2_32bit.phpt25
-rw-r--r--ext/standard/tests/strings/chunk_split_variation3.phpt30
-rw-r--r--ext/standard/tests/strings/chunk_split_variation5.phptbin2279 -> 2219 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split_variation8.phpt24
-rw-r--r--ext/standard/tests/strings/convert_cyr_string.phpt6
-rw-r--r--ext/standard/tests/strings/count_chars_basic.phpt6
-rw-r--r--ext/standard/tests/strings/crc32_variation3.phpt4
-rw-r--r--ext/standard/tests/strings/crypt.phpt8
-rw-r--r--ext/standard/tests/strings/dirname_error.phpt21
-rw-r--r--ext/standard/tests/strings/dirname_multi.phpt9
-rw-r--r--ext/standard/tests/strings/dirname_multi_win.phpt13
-rw-r--r--ext/standard/tests/strings/explode.phpt56
-rw-r--r--ext/standard/tests/strings/explode1.phpt90
-rw-r--r--ext/standard/tests/strings/fprintf_error.phpt30
-rw-r--r--ext/standard/tests/strings/highlight_file.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities24.phpt12
-rw-r--r--ext/standard/tests/strings/htmlspecialchars.phpt13
-rw-r--r--ext/standard/tests/strings/implode.phpt2
-rw-r--r--ext/standard/tests/strings/implode1.phptbin6079 -> 6042 bytes
-rw-r--r--ext/standard/tests/strings/join_error.phpt34
-rw-r--r--ext/standard/tests/strings/join_variation1.phpt10
-rw-r--r--ext/standard/tests/strings/join_variation2.phpt106
-rw-r--r--ext/standard/tests/strings/join_variation3.phpt4
-rw-r--r--ext/standard/tests/strings/join_variation4.phptbin2318 -> 2319 bytes
-rw-r--r--ext/standard/tests/strings/join_variation5.phpt10
-rw-r--r--ext/standard/tests/strings/lcfirst.phptbin6304 -> 5424 bytes
-rw-r--r--ext/standard/tests/strings/levenshtein.phpt8
-rw-r--r--ext/standard/tests/strings/ltrim.phpt16
-rw-r--r--ext/standard/tests/strings/ltrim_error.phpt18
-rw-r--r--ext/standard/tests/strings/md5_file.phptbin2876 -> 2553 bytes
-rw-r--r--ext/standard/tests/strings/metaphone.phpt3
-rw-r--r--ext/standard/tests/strings/money_format_error.phpt30
-rw-r--r--ext/standard/tests/strings/parse_str_basic1.phpt14
-rw-r--r--ext/standard/tests/strings/parse_str_basic3.phptbin5634 -> 4347 bytes
-rw-r--r--ext/standard/tests/strings/pathinfo.phpt3
-rw-r--r--ext/standard/tests/strings/php_strip_whitespace.phpt4
-rw-r--r--ext/standard/tests/strings/print_variation1.phpt6
-rw-r--r--ext/standard/tests/strings/printf.phpt9
-rw-r--r--ext/standard/tests/strings/printf_64bit.phpt9
-rw-r--r--ext/standard/tests/strings/printf_error.phpt10
-rw-r--r--ext/standard/tests/strings/printf_variation1.phpt30
-rw-r--r--ext/standard/tests/strings/printf_variation2.phpt22
-rw-r--r--ext/standard/tests/strings/quoted_printable_encode_001.phpt14
-rw-r--r--ext/standard/tests/strings/quotemeta_basic_1.phpt4
-rw-r--r--ext/standard/tests/strings/rtrim.phptbin2446 -> 2107 bytes
-rw-r--r--ext/standard/tests/strings/rtrim_error.phpt18
-rw-r--r--ext/standard/tests/strings/setlocale_error.phpt16
-rw-r--r--ext/standard/tests/strings/sha1_file.phpt16
-rw-r--r--ext/standard/tests/strings/soundex.phpt4
-rw-r--r--ext/standard/tests/strings/sprintf_error.phpt10
-rw-r--r--ext/standard/tests/strings/sprintf_variation1.phpt30
-rw-r--r--ext/standard/tests/strings/sprintf_variation18.phpt196
-rw-r--r--ext/standard/tests/strings/sprintf_variation2.phpt22
-rw-r--r--ext/standard/tests/strings/sscanf_error.phpt16
-rw-r--r--ext/standard/tests/strings/str_ireplace.phpt11
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin9812 -> 8557 bytes
-rw-r--r--ext/standard/tests/strings/str_pad_variation1.phpt42
-rw-r--r--ext/standard/tests/strings/str_pad_variation2.phpt70
-rw-r--r--ext/standard/tests/strings/str_pad_variation5.phpt2
-rw-r--r--ext/standard/tests/strings/str_repeat.phptbin16698 -> 3060 bytes
-rw-r--r--ext/standard/tests/strings/str_repeat_variation1.phpt22
-rw-r--r--ext/standard/tests/strings/str_replace.phpt29
-rw-r--r--ext/standard/tests/strings/str_replace_variation3.phpt4
-rw-r--r--ext/standard/tests/strings/str_split_variation6.phpt32
-rw-r--r--ext/standard/tests/strings/str_split_variation6_64bit.phpt22
-rw-r--r--ext/standard/tests/strings/str_split_variation7.phpt32
-rw-r--r--ext/standard/tests/strings/str_split_variation7_64bit.phpt26
-rw-r--r--ext/standard/tests/strings/str_word_count.phpt86
-rw-r--r--ext/standard/tests/strings/str_word_count1.phpt34
-rw-r--r--ext/standard/tests/strings/strcasecmp.phptbin21284 -> 20646 bytes
-rw-r--r--ext/standard/tests/strings/strcmp.phptbin19060 -> 18461 bytes
-rw-r--r--ext/standard/tests/strings/stripos.phpt35
-rw-r--r--ext/standard/tests/strings/stripos_error.phpt20
-rw-r--r--ext/standard/tests/strings/stripos_variation1.phpt38
-rw-r--r--ext/standard/tests/strings/stripos_variation10.phpt102
-rw-r--r--ext/standard/tests/strings/stripos_variation11.phpt152
-rw-r--r--ext/standard/tests/strings/stripos_variation2.phpt44
-rw-r--r--ext/standard/tests/strings/stripos_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/stripos_variation7.phpt6
-rw-r--r--ext/standard/tests/strings/stristr.phpt27
-rw-r--r--ext/standard/tests/strings/stristr2.phpt10
-rw-r--r--ext/standard/tests/strings/stristr_error.phpt60
-rw-r--r--ext/standard/tests/strings/stristr_variation2.phpt70
-rw-r--r--ext/standard/tests/strings/strlen.phptbin6420 -> 5901 bytes
-rw-r--r--ext/standard/tests/strings/strncasecmp_error.phpt27
-rw-r--r--ext/standard/tests/strings/strncmp_error.phpt19
-rw-r--r--ext/standard/tests/strings/strpbrk_error.phpt30
-rw-r--r--ext/standard/tests/strings/strpos.phptbin12013 -> 7940 bytes
-rw-r--r--ext/standard/tests/strings/strpos_number.phpt7
-rw-r--r--ext/standard/tests/strings/strpos_variation1.phpt23
-rw-r--r--ext/standard/tests/strings/strrchr_variation1.phptbin4854 -> 4371 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation10.phpt86
-rw-r--r--ext/standard/tests/strings/strrchr_variation11.phpt94
-rw-r--r--ext/standard/tests/strings/strrchr_variation12.phptbin1765 -> 1127 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation2.phpt12
-rw-r--r--ext/standard/tests/strings/strrchr_variation8.phpt6
-rw-r--r--ext/standard/tests/strings/strripos.phpt18
-rw-r--r--ext/standard/tests/strings/strripos_offset.phpt38
-rw-r--r--ext/standard/tests/strings/strripos_variation1.phpt74
-rw-r--r--ext/standard/tests/strings/strripos_variation2.phpt90
-rw-r--r--ext/standard/tests/strings/strripos_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/strripos_variation6.phpt23
-rw-r--r--ext/standard/tests/strings/strrpos.phpt14
-rw-r--r--ext/standard/tests/strings/strrpos_offset.phpt34
-rw-r--r--ext/standard/tests/strings/strrpos_variation1.phpt38
-rw-r--r--ext/standard/tests/strings/strrpos_variation10.phpt102
-rw-r--r--ext/standard/tests/strings/strrpos_variation11.phpt180
-rw-r--r--ext/standard/tests/strings/strrpos_variation14.phpt23
-rw-r--r--ext/standard/tests/strings/strrpos_variation15.phpt205
-rw-r--r--ext/standard/tests/strings/strrpos_variation2.phpt44
-rw-r--r--ext/standard/tests/strings/strrpos_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/strrpos_variation7.phpt10
-rw-r--r--ext/standard/tests/strings/strstr.phptbin11493 -> 9540 bytes
-rw-r--r--ext/standard/tests/strings/strstr_variation1.phpt23
-rw-r--r--ext/standard/tests/strings/strtolower-win32.phptbin4875 -> 4406 bytes
-rw-r--r--ext/standard/tests/strings/strtolower.phptbin3886 -> 3417 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1-win32.phptbin4884 -> 4415 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1.phptbin3895 -> 3426 bytes
-rw-r--r--ext/standard/tests/strings/strtr_variation6.phpt6
-rw-r--r--ext/standard/tests/strings/strtr_variation8.phpt77
-rw-r--r--ext/standard/tests/strings/strval.phpt2
-rw-r--r--ext/standard/tests/strings/strval_error.phpt21
-rw-r--r--ext/standard/tests/strings/strval_variation1.phpt6
-rw-r--r--ext/standard/tests/strings/substr.phptbin4781 -> 4223 bytes
-rw-r--r--ext/standard/tests/strings/substr_compare.phpt21
-rw-r--r--ext/standard/tests/strings/substr_count_basic.phpt30
-rw-r--r--ext/standard/tests/strings/substr_count_error.phpt18
-rw-r--r--ext/standard/tests/strings/substr_count_variation_001.phpt12
-rw-r--r--ext/standard/tests/strings/substr_replace_error.phpt20
-rw-r--r--ext/standard/tests/strings/trim1.phptbin2045 -> 1538 bytes
-rw-r--r--ext/standard/tests/strings/trim_error.phpt18
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin5536 -> 4656 bytes
-rw-r--r--ext/standard/tests/strings/unpack_error.phpt17
-rw-r--r--ext/standard/tests/strings/uuencode.phpt8
-rw-r--r--ext/standard/tests/strings/vfprintf_error1.phpt20
-rw-r--r--ext/standard/tests/strings/vfprintf_error3.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_error4.phpt10
-rw-r--r--ext/standard/tests/strings/vfprintf_variation1.phpt6
-rw-r--r--ext/standard/tests/strings/vfprintf_variation20.phpt10
-rw-r--r--ext/standard/tests/strings/vfprintf_variation8.phpt40
-rw-r--r--ext/standard/tests/strings/vprintf_variation1.phpt10
-rw-r--r--ext/standard/tests/strings/vprintf_variation8.phpt40
-rw-r--r--ext/standard/tests/strings/vsprintf_variation1.phpt10
-rw-r--r--ext/standard/tests/strings/vsprintf_variation8.phpt40
-rw-r--r--ext/standard/tests/strings/wordwrap.phpt11
-rw-r--r--ext/standard/tests/strings/wordwrap_error.phpt30
-rw-r--r--ext/standard/tests/time/strptime_error.phpt29
-rw-r--r--ext/standard/type.c6
-rw-r--r--ext/standard/uniqid.c2
-rw-r--r--ext/standard/uniqid.h2
-rw-r--r--ext/standard/url.c4
-rw-r--r--ext/standard/url.h2
-rw-r--r--ext/standard/url_scanner_ex.h2
-rw-r--r--ext/standard/url_scanner_ex.re2
-rw-r--r--ext/standard/user_filters.c26
-rw-r--r--ext/standard/uuencode.c10
-rw-r--r--ext/standard/var.c31
-rw-r--r--ext/standard/var_unserializer.re2
-rw-r--r--ext/standard/versioning.c4
-rw-r--r--ext/sysvmsg/php_sysvmsg.h2
-rw-r--r--ext/sysvmsg/sysvmsg.c47
-rw-r--r--ext/sysvmsg/sysvmsg.stub.php32
-rw-r--r--ext/sysvmsg/sysvmsg_arginfo.h43
-rw-r--r--ext/sysvmsg/tests/005.phpt23
-rw-r--r--ext/sysvsem/php_sysvsem.h2
-rw-r--r--ext/sysvsem/sysvsem.c25
-rw-r--r--ext/sysvsem/sysvsem.stub.php22
-rw-r--r--ext/sysvsem/sysvsem_arginfo.h19
-rw-r--r--ext/sysvshm/php_sysvshm.h2
-rw-r--r--ext/sysvshm/sysvshm.c40
-rw-r--r--ext/sysvshm/sysvshm.stub.php35
-rw-r--r--ext/sysvshm/sysvshm_arginfo.h31
-rw-r--r--ext/sysvshm/tests/001.phpt13
-rw-r--r--ext/sysvshm/tests/002.phpt23
-rw-r--r--ext/sysvshm/tests/003.phpt42
-rw-r--r--ext/sysvshm/tests/004.phpt13
-rw-r--r--ext/sysvshm/tests/005.phpt14
-rw-r--r--ext/sysvshm/tests/006.phpt8
-rw-r--r--ext/sysvshm/tests/007.phpt28
-rw-r--r--ext/tidy/php_tidy.h2
-rw-r--r--ext/tidy/tests/019.phpt13
-rw-r--r--ext/tidy/tidy.c257
-rw-r--r--ext/tidy/tidy.stub.php143
-rw-r--r--ext/tidy/tidy_arginfo.h182
-rw-r--r--ext/tokenizer/php_tokenizer.h2
-rw-r--r--ext/tokenizer/tests/001.phpt8
-rw-r--r--ext/tokenizer/tests/003.phpt7
-rw-r--r--ext/tokenizer/tests/bad_character.phpt10
-rw-r--r--ext/tokenizer/tokenizer.c14
-rw-r--r--ext/tokenizer/tokenizer.stub.php6
-rw-r--r--ext/tokenizer/tokenizer_arginfo.h10
-rw-r--r--ext/tokenizer/tokenizer_data.c2
-rwxr-xr-xext/tokenizer/tokenizer_data_gen.sh2
-rw-r--r--ext/xml/compat.c2
-rw-r--r--ext/xml/expat_compat.h2
-rw-r--r--ext/xml/php_xml.h2
-rw-r--r--ext/xml/tests/bug72793.phpt35
-rw-r--r--ext/xml/tests/bug76874.phpt31
-rw-r--r--ext/xml/tests/bug78563.phpt17
-rw-r--r--ext/xml/tests/bug78563_final.phpt15
-rw-r--r--ext/xml/tests/bug78563_serialize.phpt18
-rw-r--r--ext/xml/tests/xml_parser_set_option_variation3.phpt15
-rw-r--r--ext/xml/xml.c349
-rw-r--r--ext/xml/xml.stub.php59
-rw-r--r--ext/xml/xml_arginfo.h82
-rw-r--r--ext/xmlreader/php_xmlreader.c234
-rw-r--r--ext/xmlreader/php_xmlreader.h2
-rw-r--r--ext/xmlreader/xmlreader.stub.php79
-rw-r--r--ext/xmlreader/xmlreader_arginfo.h82
-rw-r--r--ext/xmlrpc/php_xmlrpc.h2
-rw-r--r--ext/xmlrpc/tests/001.phpt4
-rw-r--r--ext/xmlrpc/tests/002.phpt8
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c71
-rw-r--r--ext/xmlrpc/xmlrpc.stub.php33
-rw-r--r--ext/xmlrpc/xmlrpc_arginfo.h65
-rw-r--r--ext/xmlwriter/php_xmlwriter.c1051
-rw-r--r--ext/xmlwriter/php_xmlwriter.h12
-rw-r--r--ext/xmlwriter/tests/bug41326.phpt2
-rw-r--r--ext/xmlwriter/xmlwriter.stub.php176
-rw-r--r--ext/xmlwriter/xmlwriter_arginfo.h336
-rw-r--r--ext/xsl/php_xsl.c2
-rw-r--r--ext/xsl/php_xsl.h2
-rw-r--r--ext/xsl/xsl_fe.h2
-rw-r--r--ext/xsl/xsltprocessor.c20
-rw-r--r--ext/zend_test/php_test.h2
-rw-r--r--ext/zend_test/test.c57
-rw-r--r--ext/zip/php_zip.c409
-rw-r--r--ext/zip/php_zip.h2
-rw-r--r--ext/zip/php_zip.stub.php183
-rw-r--r--ext/zip/php_zip_arginfo.h229
-rw-r--r--ext/zip/tests/bug72374.phpt32
-rw-r--r--ext/zip/tests/doubleclose.phpt22
-rw-r--r--ext/zip/tests/oo_addpattern.phpt6
-rw-r--r--ext/zip/tests/oo_getcomment.phpt4
-rw-r--r--ext/zip/tests/oo_getnameindex.phpt4
-rw-r--r--ext/zip/tests/oo_namelocate.phpt4
-rw-r--r--ext/zip/tests/oo_properties.phpt2
-rw-r--r--ext/zip/tests/zip_entry_close.phpt12
-rw-r--r--ext/zip/tests/zip_open_error.phpt7
-rw-r--r--ext/zip/zip_stream.c2
-rw-r--r--ext/zlib/php_zlib.h2
-rw-r--r--ext/zlib/tests/004-mb.phpt8
-rw-r--r--ext/zlib/tests/004.phpt8
-rw-r--r--ext/zlib/tests/005.phpt8
-rw-r--r--ext/zlib/tests/006.phpt8
-rw-r--r--ext/zlib/tests/007.phpt8
-rw-r--r--ext/zlib/tests/gzclose_basic.phpt20
-rw-r--r--ext/zlib/tests/gzcompress_error1.phpt40
-rw-r--r--ext/zlib/tests/gzdeflate_error1.phpt40
-rw-r--r--ext/zlib/tests/gzencode_error1.phpt49
-rw-r--r--ext/zlib/tests/gzeof_variation1.phpt12
-rw-r--r--ext/zlib/tests/gzgetss.phpt32
-rw-r--r--ext/zlib/tests/gzinflate_error1.phpt40
-rw-r--r--ext/zlib/tests/gzopen_variation4.phpt156
-rw-r--r--ext/zlib/tests/gzuncompress_error1.phpt39
-rw-r--r--ext/zlib/tests/inflate_init_error.phpt4
-rw-r--r--ext/zlib/tests/readgzfile_variation10.phpt67
-rw-r--r--ext/zlib/zlib.c149
-rw-r--r--ext/zlib/zlib.stub.php131
-rw-r--r--ext/zlib/zlib_arginfo.h116
-rw-r--r--ext/zlib/zlib_filter.c2
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c2
-rw-r--r--main/SAPI.c2
-rw-r--r--main/SAPI.h2
-rw-r--r--main/build-defs.h.in2
-rw-r--r--main/explicit_bzero.c2
-rw-r--r--main/fastcgi.c2
-rw-r--r--main/fastcgi.h2
-rw-r--r--main/fopen_wrappers.c2
-rw-r--r--main/fopen_wrappers.h2
-rw-r--r--main/getopt.c2
-rw-r--r--main/http_status_codes.h2
-rw-r--r--main/internal_functions.c.in2
-rw-r--r--main/internal_functions_win32.c2
-rw-r--r--main/main.c45
-rw-r--r--main/network.c2
-rw-r--r--main/output.c12
-rw-r--r--main/php.h4
-rw-r--r--main/php_compat.h2
-rw-r--r--main/php_content_types.c2
-rw-r--r--main/php_content_types.h2
-rw-r--r--main/php_getopt.h2
-rw-r--r--main/php_globals.h3
-rw-r--r--main/php_ini.c2
-rw-r--r--main/php_ini.h2
-rw-r--r--main/php_main.h2
-rw-r--r--main/php_memory_streams.h2
-rw-r--r--main/php_network.h2
-rw-r--r--main/php_open_temporary_file.c2
-rw-r--r--main/php_open_temporary_file.h2
-rw-r--r--main/php_output.h2
-rw-r--r--main/php_reentrancy.h2
-rw-r--r--main/php_scandir.c2
-rw-r--r--main/php_scandir.h2
-rw-r--r--main/php_stdint.h2
-rw-r--r--main/php_streams.h6
-rw-r--r--main/php_syslog.c2
-rw-r--r--main/php_syslog.h2
-rw-r--r--main/php_ticks.c2
-rw-r--r--main/php_ticks.h2
-rw-r--r--main/php_variables.c2
-rw-r--r--main/php_variables.h2
-rw-r--r--main/php_version.h8
-rw-r--r--main/reentrancy.c2
-rw-r--r--main/rfc1867.c2
-rw-r--r--main/rfc1867.h2
-rw-r--r--main/snprintf.c2
-rw-r--r--main/snprintf.h2
-rw-r--r--main/spprintf.c2
-rw-r--r--main/spprintf.h2
-rw-r--r--main/streams/cast.c2
-rw-r--r--main/streams/filter.c2
-rw-r--r--main/streams/glob_wrapper.c2
-rw-r--r--main/streams/memory.c2
-rw-r--r--main/streams/mmap.c2
-rw-r--r--main/streams/php_stream_context.h2
-rw-r--r--main/streams/php_stream_filter_api.h2
-rw-r--r--main/streams/php_stream_glob_wrapper.h2
-rw-r--r--main/streams/php_stream_mmap.h2
-rw-r--r--main/streams/php_stream_plain_wrapper.h2
-rw-r--r--main/streams/php_stream_transport.h2
-rw-r--r--main/streams/php_stream_userspace.h2
-rw-r--r--main/streams/php_streams_int.h2
-rw-r--r--main/streams/plain_wrapper.c2
-rw-r--r--main/streams/streams.c4
-rw-r--r--main/streams/transports.c2
-rw-r--r--main/streams/userspace.c2
-rw-r--r--main/streams/xp_socket.c2
-rw-r--r--main/strlcat.c2
-rw-r--r--main/strlcpy.c2
-rw-r--r--php.ini-development46
-rw-r--r--php.ini-production46
-rwxr-xr-xrun-tests.php47
-rw-r--r--sapi/apache2handler/apache_config.c2
-rw-r--r--sapi/apache2handler/config.m412
-rw-r--r--sapi/apache2handler/config.w326
-rw-r--r--sapi/apache2handler/mod_php.c (renamed from sapi/apache2handler/mod_php7.c)4
-rw-r--r--sapi/apache2handler/php.sym2
-rw-r--r--sapi/apache2handler/php_apache.h6
-rw-r--r--sapi/apache2handler/php_functions.c2
-rw-r--r--sapi/apache2handler/sapi_apache2.c8
-rw-r--r--sapi/cgi/cgi_main.c2
-rw-r--r--sapi/cgi/config9.m42
-rw-r--r--sapi/cli/cli.h2
-rw-r--r--sapi/cli/config.m42
-rwxr-xr-xsapi/cli/generate_mime_type_map.php2
-rw-r--r--sapi/cli/mime_type_map.h2
-rw-r--r--sapi/cli/php_cli.c4
-rw-r--r--sapi/cli/php_cli_process_title.c2
-rw-r--r--sapi/cli/php_cli_process_title.h2
-rw-r--r--sapi/cli/php_cli_server.c4
-rw-r--r--sapi/cli/php_cli_server.h2
-rw-r--r--sapi/cli/ps_title.h2
-rw-r--r--sapi/cli/tests/005.phpt38
-rw-r--r--sapi/cli/tests/006.phpt50
-rw-r--r--sapi/embed/php_embed.c2
-rw-r--r--sapi/embed/php_embed.h2
-rw-r--r--sapi/fpm/config.m42
-rw-r--r--sapi/fpm/fpm/events/devpoll.c2
-rw-r--r--sapi/fpm/fpm/events/devpoll.h2
-rw-r--r--sapi/fpm/fpm/events/epoll.c2
-rw-r--r--sapi/fpm/fpm/events/epoll.h2
-rw-r--r--sapi/fpm/fpm/events/kqueue.c2
-rw-r--r--sapi/fpm/fpm/events/kqueue.h2
-rw-r--r--sapi/fpm/fpm/events/poll.c2
-rw-r--r--sapi/fpm/fpm/events/poll.h2
-rw-r--r--sapi/fpm/fpm/events/port.c2
-rw-r--r--sapi/fpm/fpm/events/port.h2
-rw-r--r--sapi/fpm/fpm/events/select.c2
-rw-r--r--sapi/fpm/fpm/events/select.h2
-rw-r--r--sapi/fpm/fpm/fpm_main.c4
-rw-r--r--sapi/fpm/tests/response.inc2
-rw-r--r--sapi/fpm/www.conf.in2
-rw-r--r--sapi/fuzzer/Makefile.frag18
-rw-r--r--sapi/fuzzer/README.md66
-rw-r--r--sapi/fuzzer/config.m494
-rw-r--r--sapi/fuzzer/corpus/exif/bug34704.jpgbin0 -> 9976 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug34704_2.jpgbin0 -> 9976 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug48378.jpegbin0 -> 2566 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug54002_1.jpegbin0 -> 87599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug54002_2.jpegbin0 -> 87599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug62523_1.jpg9
-rw-r--r--sapi/fuzzer/corpus/exif/bug62523_3.jpg12
-rw-r--r--sapi/fuzzer/corpus/exif/bug68113.jpgbin0 -> 368 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug68113_2.jpgbin0 -> 368 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug68799.jpgbin0 -> 735 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_1.jpgbin0 -> 140 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_2.jpgbin0 -> 140 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_3.jpgbin0 -> 112 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_4.jpgbin0 -> 32 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72603.jpegbin0 -> 3711 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72618.jpgbin0 -> 3711 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72627.tiffbin0 -> 1250 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug73737.tiffbin0 -> 48 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76130_1.jpgbin0 -> 3396 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76130_2.jpgbin0 -> 1632 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76423.jpgbin0 -> 1537 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76557.jpgbin0 -> 2372 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77540.jpgbin0 -> 91 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77563.jpgbin0 -> 63 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77753.tiffbin0 -> 873 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77831.tiffbin0 -> 49 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77950.tiffbin0 -> 1267 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77988.jpgbin0 -> 1202 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiffbin0 -> 9397 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/exif_encoding_crash.jpgbin0 -> 7599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image007.jpgbin0 -> 283 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image008.jpgbin0 -> 527 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image009.jpgbin0 -> 527 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image010.jpgbin0 -> 741 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image011.jpgbin0 -> 741 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image012.jpgbin0 -> 721 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image013.jpgbin0 -> 721 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image014.jpgbin0 -> 935 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image015.jpgbin0 -> 935 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image016.tiffbin0 -> 1874 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image017.tiffbin0 -> 1874 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image018.tiffbin0 -> 2088 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image020.tiffbin0 -> 2068 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image021.tiffbin0 -> 2068 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image022.tiffbin0 -> 2282 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image023.tiffbin0 -> 2282 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image024.jpgbin0 -> 417 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image025.jpgbin0 -> 417 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image026.tiffbin0 -> 1984 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image027.tiffbin0 -> 1984 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpegbin0 -> 43 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpgbin0 -> 46 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test1.jpgbin0 -> 523 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test2.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test22.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test3.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test4.jpgbin0 -> 713 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test5.jpgbin0 -> 603 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test6.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiffbin0 -> 164 bytes
-rw-r--r--sapi/fuzzer/corpus/json/1.json1
-rw-r--r--sapi/fuzzer/corpus/json/10.json1
-rw-r--r--sapi/fuzzer/corpus/json/11.json1
-rw-r--r--sapi/fuzzer/corpus/json/12.json2
-rw-r--r--sapi/fuzzer/corpus/json/13.json1
-rw-r--r--sapi/fuzzer/corpus/json/14.json2
-rw-r--r--sapi/fuzzer/corpus/json/15.json1
-rw-r--r--sapi/fuzzer/corpus/json/16.json1
-rw-r--r--sapi/fuzzer/corpus/json/17.json1
-rw-r--r--sapi/fuzzer/corpus/json/18.json1
-rw-r--r--sapi/fuzzer/corpus/json/19.json1
-rw-r--r--sapi/fuzzer/corpus/json/2.json1
-rw-r--r--sapi/fuzzer/corpus/json/3.json1
-rw-r--r--sapi/fuzzer/corpus/json/4.json1
-rw-r--r--sapi/fuzzer/corpus/json/5.json5
-rw-r--r--sapi/fuzzer/corpus/json/6.json1
-rw-r--r--sapi/fuzzer/corpus/json/7.json2
-rw-r--r--sapi/fuzzer/corpus/json/8.json1
-rw-r--r--sapi/fuzzer/corpus/json/9.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail1.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail10.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail11.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail12.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail13.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail14.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail15.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail16.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail17.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail18.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail19.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail2.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail20.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail21.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail22.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail23.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail24.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail25.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail26.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail27.json2
-rw-r--r--sapi/fuzzer/corpus/json/fail28.json2
-rw-r--r--sapi/fuzzer/corpus/json/fail29.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail3.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail30.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail31.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail32.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail33.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail4.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail5.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail6.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail7.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail8.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail9.json1
-rw-r--r--sapi/fuzzer/corpus/json/pass1.json58
-rw-r--r--sapi/fuzzer/corpus/json/pass2.json1
-rw-r--r--sapi/fuzzer/corpus/json/pass3.json6
-rw-r--r--sapi/fuzzer/corpus/unserialize/__serialize_0071
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug71311
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug713131
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug73144_11
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug73144_21
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug738251
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741011
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741031
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741111
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug746141
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug750541
-rw-r--r--sapi/fuzzer/corpus/unserialize/int_min_iv1
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176281
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176391
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176461
-rw-r--r--sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count1
-rw-r--r--sapi/fuzzer/dict/parser85
-rw-r--r--sapi/fuzzer/fuzzer-exif.c72
-rw-r--r--sapi/fuzzer/fuzzer-json.c70
-rw-r--r--sapi/fuzzer/fuzzer-mbstring.c72
-rw-r--r--sapi/fuzzer/fuzzer-parser.c55
-rw-r--r--sapi/fuzzer/fuzzer-sapi.c273
-rw-r--r--sapi/fuzzer/fuzzer-sapi.h22
-rw-r--r--sapi/fuzzer/fuzzer-unserialize.c90
-rw-r--r--sapi/fuzzer/fuzzer.h18
-rw-r--r--sapi/fuzzer/generate_parser_corpus.php22
-rw-r--r--sapi/fuzzer/generate_unserialize_dict.php9
-rw-r--r--sapi/fuzzer/json.dict52
-rw-r--r--sapi/litespeed/config.m42
-rw-r--r--sapi/litespeed/lsapi_main.c2
-rw-r--r--sapi/litespeed/lsapidef.h2
-rw-r--r--sapi/litespeed/lsapilib.c2
-rw-r--r--sapi/litespeed/lsapilib.h2
-rw-r--r--sapi/litespeed/lscriu.c2
-rw-r--r--sapi/litespeed/lscriu.h2
-rw-r--r--sapi/phpdbg/config.m46
-rwxr-xr-xsapi/phpdbg/create-test.php2
-rw-r--r--sapi/phpdbg/phpdbg.c2
-rw-r--r--sapi/phpdbg/phpdbg.h4
-rw-r--r--sapi/phpdbg/phpdbg_bp.c2
-rw-r--r--sapi/phpdbg/phpdbg_bp.h2
-rw-r--r--sapi/phpdbg/phpdbg_break.c2
-rw-r--r--sapi/phpdbg/phpdbg_break.h2
-rw-r--r--sapi/phpdbg/phpdbg_btree.c2
-rw-r--r--sapi/phpdbg/phpdbg_btree.h2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.h2
-rw-r--r--sapi/phpdbg/phpdbg_eol.c2
-rw-r--r--sapi/phpdbg/phpdbg_eol.h2
-rw-r--r--sapi/phpdbg/phpdbg_frame.c2
-rw-r--r--sapi/phpdbg/phpdbg_frame.h2
-rw-r--r--sapi/phpdbg/phpdbg_help.c2
-rw-r--r--sapi/phpdbg/phpdbg_help.h2
-rw-r--r--sapi/phpdbg/phpdbg_info.c2
-rw-r--r--sapi/phpdbg/phpdbg_info.h2
-rw-r--r--sapi/phpdbg/phpdbg_io.c2
-rw-r--r--sapi/phpdbg/phpdbg_io.h2
-rw-r--r--sapi/phpdbg/phpdbg_lexer.h2
-rw-r--r--sapi/phpdbg/phpdbg_list.c4
-rw-r--r--sapi/phpdbg/phpdbg_list.h2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.h2
-rw-r--r--sapi/phpdbg/phpdbg_out.c2
-rw-r--r--sapi/phpdbg/phpdbg_out.h2
-rw-r--r--sapi/phpdbg/phpdbg_print.c2
-rw-r--r--sapi/phpdbg/phpdbg_print.h2
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c4
-rw-r--r--sapi/phpdbg/phpdbg_prompt.h2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.c2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.h2
-rw-r--r--sapi/phpdbg/phpdbg_set.c2
-rw-r--r--sapi/phpdbg/phpdbg_set.h2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.c2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.h2
-rw-r--r--sapi/phpdbg/phpdbg_utils.c2
-rw-r--r--sapi/phpdbg/phpdbg_utils.h2
-rw-r--r--sapi/phpdbg/phpdbg_wait.c2
-rw-r--r--sapi/phpdbg/phpdbg_wait.h2
-rw-r--r--sapi/phpdbg/phpdbg_watch.c2
-rw-r--r--sapi/phpdbg/phpdbg_watch.h2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.c2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.h2
-rw-r--r--sapi/phpdbg/phpdbg_win.c2
-rw-r--r--sapi/phpdbg/phpdbg_win.h2
-rwxr-xr-xscripts/dev/bless_tests.php168
-rwxr-xr-xscripts/dev/check_parameters.php2
-rwxr-xr-xscripts/dev/gen_stub.php478
-rwxr-xr-xscripts/dev/genfiles2
-rwxr-xr-xscripts/dev/search_underscores.php2
-rw-r--r--tests/basic/012.phpt2
-rw-r--r--tests/basic/025.phpt2
-rw-r--r--tests/basic/027.phpt33
-rw-r--r--tests/basic/bug71273.phpt6
-rw-r--r--tests/basic/enable_post_data_reading_01.phpt2
-rw-r--r--tests/basic/enable_post_data_reading_03.phpt2
-rw-r--r--tests/basic/enable_post_data_reading_04.phpt2
-rw-r--r--tests/classes/abstract_user_call.phpt11
-rw-r--r--tests/classes/autoload_012.phpt15
-rw-r--r--tests/classes/bug27468.phpt2
-rw-r--r--tests/classes/bug27504.phpt41
-rw-r--r--tests/classes/constants_basic_001.phpt14
-rw-r--r--tests/classes/constants_basic_002.phpt2
-rw-r--r--tests/classes/constants_scope_001.phpt5
-rw-r--r--tests/classes/ctor_name_clash.phpt23
-rw-r--r--tests/classes/final_ctor1.phpt8
-rw-r--r--tests/classes/final_ctor2.phpt30
-rw-r--r--tests/classes/final_ctor3.phpt15
-rw-r--r--tests/classes/implicit_instantiation_001.phpt156
-rw-r--r--tests/classes/inheritance_002.phpt74
-rw-r--r--tests/classes/inheritance_003.phpt4
-rw-r--r--tests/classes/inheritance_004.phpt6
-rw-r--r--tests/classes/inheritance_005.phpt58
-rw-r--r--tests/classes/inheritance_007.phpt40
-rw-r--r--tests/classes/method_override_optional_arg_001.phpt4
-rw-r--r--tests/classes/method_override_optional_arg_002.phpt3
-rw-r--r--tests/classes/static_properties_003.phpt2
-rw-r--r--tests/classes/tostring_001.phpt13
-rw-r--r--tests/classes/tostring_004.phpt2
-rw-r--r--tests/classes/type_hinting_005a.phpt10
-rw-r--r--tests/classes/type_hinting_005c.phpt7
-rw-r--r--tests/classes/type_hinting_005d.phpt7
-rw-r--r--tests/lang/031.phpt72
-rw-r--r--tests/lang/bison1.phpt4
-rw-r--r--tests/lang/bug17115.phpt17
-rw-r--r--tests/lang/bug22510.phpt2
-rw-r--r--tests/lang/bug22690.phpt13
-rw-r--r--tests/lang/bug23384.phpt5
-rw-r--r--tests/lang/bug23584.phpt4
-rw-r--r--tests/lang/bug23922.phpt21
-rw-r--r--tests/lang/bug24499.phpt3
-rw-r--r--tests/lang/bug24926.phpt29
-rw-r--r--tests/lang/bug25547.phpt2
-rw-r--r--tests/lang/bug27439.phpt2
-rw-r--r--tests/lang/bug29893.phpt12
-rw-r--r--tests/lang/bug71897.phpt4
-rw-r--r--tests/lang/bug7515.phpt8
-rw-r--r--tests/lang/each_binary_safety.phpt14
-rw-r--r--tests/lang/engine_assignExecutionOrder_002.phpt9
-rw-r--r--tests/lang/engine_assignExecutionOrder_008.phpt28
-rw-r--r--tests/lang/foreachLoop.016.phpt26
-rw-r--r--tests/lang/foreachLoopObjects.004.phpt6
-rw-r--r--tests/lang/func_get_arg_variation.phpt9
-rw-r--r--tests/lang/passByReference_003.phpt6
-rw-r--r--tests/lang/passByReference_005.phpt203
-rw-r--r--tests/lang/passByReference_006.phpt182
-rw-r--r--tests/lang/short_tags.004.phpt4
-rw-r--r--tests/lang/type_hints_003.phpt2
-rw-r--r--tests/output/bug74815.phpt19
-rw-r--r--tests/output/ob_014.phpt23
-rw-r--r--tests/output/ob_015.phpt23
-rw-r--r--tests/output/ob_start_basic_005.phpt7
-rw-r--r--tests/output/ob_start_error_001.phpt32
-rw-r--r--tests/output/stream_isatty.inc1
-rw-r--r--tests/output/stream_isatty_err.phpt3
-rw-r--r--tests/output/stream_isatty_in-err.phpt3
-rw-r--r--tests/output/stream_isatty_in-out-err.phpt3
-rw-r--r--tests/output/stream_isatty_in-out.phpt3
-rw-r--r--tests/output/stream_isatty_out-err.phpt3
-rw-r--r--tests/output/stream_isatty_out.phpt3
-rw-r--r--tests/run-test/test005.phpt36
-rw-r--r--tests/run-test/test008.phpt33
-rw-r--r--tests/run-test/test008a.phpt36
-rw-r--r--tests/strings/001.phpt6
-rw-r--r--tests/strings/offsets_chaining_1.phpt2
-rw-r--r--tests/strings/offsets_chaining_2.phpt2
-rw-r--r--tests/strings/offsets_chaining_3.phpt2
-rw-r--r--tests/strings/offsets_chaining_4.phpt2
-rw-r--r--tests/strings/offsets_chaining_5.phpt2
-rwxr-xr-xtravis/compile.sh4
-rw-r--r--win32/build/Makefile2
-rw-r--r--win32/build/buildconf.js2
-rw-r--r--win32/build/config.w32.h.in1
-rw-r--r--win32/build/confutils.js8
-rw-r--r--win32/build/deplister.c2
-rw-r--r--win32/build/phpize.js.in2
-rw-r--r--win32/codepage.c14
-rw-r--r--win32/codepage.h2
-rw-r--r--win32/console.c2
-rw-r--r--win32/console.h2
-rw-r--r--win32/dllmain.c2
-rw-r--r--win32/ftok.c2
-rw-r--r--win32/getrusage.c2
-rw-r--r--win32/getrusage.h2
-rw-r--r--win32/globals.c2
-rw-r--r--win32/grp.h2
-rw-r--r--win32/inet.c2
-rw-r--r--win32/inet.h2
-rw-r--r--win32/ioutil.c2
-rw-r--r--win32/ioutil.h2
-rw-r--r--win32/ipc.h2
-rw-r--r--win32/nice.c2
-rw-r--r--win32/nice.h2
-rw-r--r--win32/php_registry.h2
-rw-r--r--win32/php_win32_globals.h2
-rw-r--r--win32/registry.c2
-rw-r--r--win32/select.c2
-rw-r--r--win32/select.h2
-rw-r--r--win32/signal.c2
-rw-r--r--win32/sockets.c2
-rw-r--r--win32/sockets.h2
-rw-r--r--win32/syslog.h2
-rw-r--r--win32/winutil.c2
-rw-r--r--win32/winutil.h2
3432 files changed, 90940 insertions, 70554 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 61a2fc175c..97034c7c43 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,6 +1,6 @@
version: "{branch}.build.{build}"
-image: Visual Studio 2017
+image: Visual Studio 2019
branches:
except:
@@ -24,7 +24,7 @@ environment:
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
- PHP_BUILD_CRT: vc15
+ PHP_BUILD_CRT: vs16
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
#MYSQL_TEST_USER: root
diff --git a/.gdbinit b/.gdbinit
index 8e54830ef2..a903c086e5 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -252,37 +252,34 @@ define ____printzv_contents
____printzv &$zvalue->value.ref->val $arg1
end
if $type == 11
- printf "const: %s", $zvalue->value.str->val
+ printf "CONSTANT_AST"
end
if $type == 12
- printf "CONSTANT_AST"
+ printf "CALLABLE"
end
if $type == 13
- printf "indirect: "
- ____printzv $zvalue->value.zv $arg1
+ printf "ITERABLE"
end
if $type == 14
- printf "pointer: %p", $zvalue->value.ptr
+ printf "VOID"
end
if $type == 15
- printf "_ERROR"
+ printf "indirect: "
+ ____printzv $zvalue->value.zv $arg1
end
if $type == 16
- printf "_BOOL"
+ printf "pointer: %p", $zvalue->value.ptr
end
if $type == 17
- printf "CALLABLE"
+ printf "_ERROR"
end
if $type == 18
- printf "ITERABLE"
+ printf "_BOOL"
end
if $type == 19
- printf "VOID"
- end
- if $type == 20
printf "_NUMBER"
end
- if $type > 20
+ if $type > 19
printf "unknown type %d", $type
end
printf "\n"
diff --git a/.gitignore b/.gitignore
index cd6e779831..c8106a0637 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,6 +80,9 @@ include/
libs/
modules/
+# Used by scripts/dev/gen_stub.php
+scripts/dev/PHP-Parser-*
+
# ------------------------------------------------------------------------------
# Configuration headers generated by the PHP build system
# ------------------------------------------------------------------------------
@@ -168,8 +171,14 @@ php
/Zend/zend_language_parser.output
# ------------------------------------------------------------------------------
-# Extensions files additionally generated by `cd ext/name && phpize && ./configure`
+# Extensions files
# ------------------------------------------------------------------------------
+
+# Miscellaneous extensions files
+/ext/opcache/jit/zend_jit_x86.c
+/ext/opcache/minilua
+
+# Generated by `cd ext/name && phpize && ./configure`
/ext/*/build/
/ext/*/configure.ac
/ext/*/run-tests.php
diff --git a/.travis.yml b/.travis.yml
index d78b14e93d..af2b7afb17 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -53,8 +53,8 @@ env:
- PDO_MYSQL_TEST_HOST=127.0.0.1
- REPORT_EXIT_STATUS=1
matrix:
- - ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
- - ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
+ - ENABLE_ZTS=0 ENABLE_DEBUG=0
+ - ENABLE_ZTS=1 ENABLE_DEBUG=1
before_script:
- ccache --version
@@ -73,7 +73,7 @@ before_script:
# Run PHPs run-tests.php
script:
- - ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d opcache.protect_memory=1 -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120 -j$(nproc)
+ - ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120 -j$(nproc)
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'
after_success:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a084bdea98..ba7ac7c8ac 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -262,8 +262,8 @@ included.
- Run `make test` to check your change doesn't break other features.
- Rebuild PHP with `--enable-debug` which will show some kinds of memory errors
and check the PHP and web server error logs after running your PHP tests.
-- Rebuild PHP with `--enable-maintainer-zts` to check your change compiles on
- multi-threaded web servers.
+- Rebuild PHP with `--enable-zts` to check your change compiles and operates
+ correctly in a thread safe PHP.
- Review the change once more just before submitting it.
## What happens after submitting contribution?
@@ -323,8 +323,8 @@ Having said that, here are the organizational rules:
`make test`.
7. For development use the `--enable-debug` switch to avoid memory leaks and the
- `--enable-maintainer-zts` switch to ensure your code handles TSRM correctly
- and doesn't break for those who need that.
+ `--enable-zts` switch to ensure your code handles TSRM correctly and doesn't
+ break for those who need that.
Currently we have the following branches in use:
@@ -410,8 +410,6 @@ New source code files should include the following header block:
```c
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/EXTENSIONS b/EXTENSIONS
index 754239fbaa..3edbff504c 100644
--- a/EXTENSIONS
+++ b/EXTENSIONS
@@ -166,7 +166,7 @@ COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less hav
-------------------------------------------------------------------------------
EXTENSION: sqlite3
PRIMARY MAINTAINER: Scott MacVicar <scottmac@php.net> (2008 - 2011)
- Christoph M. Becker <cmb@php.net> (2016 - 2018)
+ Christoph M. Becker <cmb@php.net> (2016 - 2019)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
@@ -255,6 +255,7 @@ STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: com_dotnet
PRIMARY MAINTAINER: Wez Furlong <wez@php.net> (2003 - 2005)
+ Christoph M. Becker <cmb@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Windows
SINCE: 5.0
@@ -317,7 +318,7 @@ STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: gd
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net> (2002 - 2016)
- Christoph M. Becker <cmb@php.net> (2015 - 2018)
+ Christoph M. Becker <cmb@php.net> (2015 - 2019)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -327,7 +328,7 @@ MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: gmp
-PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2000 - 2018)
+PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2000 - 2019)
Antony Dovgal <tony2001@php.net> (2005 - 2010)
Nikita Popov <nikic@php.net> (2013 - 2019)
MAINTENANCE: Maintained
@@ -348,7 +349,7 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: intl
-PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2008 - 2018)
+PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2008 - 2019)
Anatol Belski <ab@php.net> (2017 - 2018)
MAINTENANCE: Maintained
STATUS: Working
@@ -358,6 +359,7 @@ EXTENSION: imap
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org> (1999 - 2004)
Ilia Alshanetsky <iliaa@php.net> (2002 - 2010)
Pierre-Alain Joye <pajoye@php.net> (2008 - 2010)
+ Bishop Bettini <bishop@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -412,6 +414,7 @@ EXTENSION: phar
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net> (2008 - 2009)
Marcus Börger <helly@php.net> (2008 - 2008)
Steph Fox <sfox@php.net> (2008 - 2008)
+ Bishop Bettini <bishop@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
diff --git a/NEWS b/NEWS
index 5003143e92..f914d9d264 100644
--- a/NEWS
+++ b/NEWS
@@ -1,492 +1,56 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-?? ??? ????, PHP 7.4.0RC5
-
-- COM:
- . Fixed bug #78694 (Appending to a variant array causes segfault). (cmb)
-
-- Date:
- . Fixed bug #70153 (\DateInterval incorrectly unserialized). (Maksim Iakunin)
-
-- FFI:
- . Fixed bug #78716 (Function name mangling is wrong for some parameter
- types). (cmb)
-
-- FPM:
- . Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE).
- (CVE-2019-11043) (Jakub Zelenka)
- . Fixed bug #74083 (master PHP-fpm is stopped on multiple reloads).
- (Maksim Nikulin)
-
--Opcache:
- . Fixed bug #78512 (Cannot make preload work). (Dmitry)
-
-- Reflection:
- . Fixed bug #78697 (ReflectionClass::implementsInterface - inaccurate error
- message with traits). (villfa)
-
-- Testing:
- . Fixed bug #78684 (PCRE bug72463_2 test is sending emails on Linux). (cmb)
-
-17 Oct 2019, PHP 7.4.0RC4
-
-- Core:
- . Fixed bug #78614 (Does not compile with DTRACE anymore).
- (tz at FreeBSD dot org)
- . Fixed bug #78620 (Out of memory error). (cmb, Nikita)
- . Fixed bug #78632 (method_exists() in php74 works differently from php73 in
- checking priv. methods). (Nikita)
- . Fixed bug #78644 (SEGFAULT in ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER).
- (Nikita)
- . Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita)
- . Fixed bug #78656 (Parse errors classified as highest log-level). (Erik
- Lundin)
- . Fixed bug #78662 (stream_write bad error detection). (Remi)
-
-- COM:
- . Fixed bug #78650 (new COM Crash). (cmb)
-
-- Iconv:
- . Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
- cmb).
-
-- Pcntl:
- . Fixed bug #77335 (PHP is preventing SIGALRM from specifying SA_RESTART).
- (Nikita)
-
-- MySQLi:
- . Fixed bug #76809 (SSL settings aren't respected when persistent connections
- are used). (fabiomsouto)
-
-- OpCache:
- . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
- non-ascii characters). (mhagstrand)
-
-- PDO_MySQL:
- . Fixed bug #78623 (Regression caused by "SP call yields additional empty
- result set"). (cmb)
-
-- SimpleXML:
- . Fixed bug #75245 (Don't set content of elements with only whitespaces).
- (eriklundin)
-
-- Sockets:
- . Fixed bug #78665 (Multicasting may leak memory). (cmb)
-
-- Standard:
- . Fixed bug #76859 (stream_get_line skips data if used with data-generating
- filter). (kkopachev)
-
-- Zip:
- . Fixed bug #78641 (addGlob can modify given remove_path value). (cmb)
-
-03 Oct 2019, PHP 7.4.0RC3
-
-- Core:
- . Fixed bug #78604 (token_get_all() does not properly tokenize FOO<?php with
- short_open_tag=0). (Nikita)
-
-- FFI:
- . Fixed bug #78543 (is_callable() on FFI\CData throws Exception). (cmb)
-
-- GMP:
- . Fixed bug #78574 (broken shared build). (Remi)
-
-- MBString:
- . Fixed bug #78579 (mb_decode_numericentity: args number inconsistency).
- (cmb)
- . Fixed bug #78609 (mb_check_encoding() no longer supports stringable
- objects). (cmb)
-
-- OpenSSL:
- . Changed the default config path (Windows only). (cmb)
-
-- Session:
- . Fixed bug #78624 (session_gc return value for user defined session
- handlers). (bshaffer)
-
-- Standard:
- . Fixed bug #78549 (Stack overflow due to nested serialized input). (Nikita)
-
-19 Sep 2019, PHP 7.4.0RC2
-
-- Core:
- . Fixed incorrect usage of QM_ASSIGN instruction. It must not return IS_VAR.
- As a side effect, this allowed passing left hand list() "by reference",
- instead of compile-time error. (Dmitry)
- . Fixed bug #78531 (Crash when using undefined variable as object). (Dmitry)
- . Fixed bug #78535 (auto_detect_line_endings value not parsed as bool).
- (bugreportuser)
-
-- FFI:
- . Added missing FFI::isNull(). (Philip Hofstetter)
- . Fixed bug #78488 (OOB in ZEND_FUNCTION(ffi_trampoline)). (Dmitry)
-
-- Opcache:
- . Add opcache.preload_user INI directive. (Dmitry)
- . Fixed bug #78514 (Preloading segfaults with inherited typed property).
- (Nikita)
- . Fixed bug #78429 (opcache_compile_file(__FILE__); segfaults). (cmb)
-
-- PCRE:
- . Fixed bug #78349 (Bundled pcre2 library missing LICENCE file). (Peter Kokot)
-
-- PDO_Firebird:
- . Implemented FR #77863 (PDO firebird support type Boolean in input
- parameters). (Simonov Denis)
-
-- PDO_MySQL:
- . Fixed bug #41997 (SP call yields additional empty result set). (cmb)
-
-- sodium:
- . Fixed bug #78510 (Partially uninitialized buffer returned by
- sodium_crypto_generichash_init()). (Frank Denis, cmb)
- . Fixed bug #78516 (password_hash(): Memory cost is not in allowed range).
- (cmb, Nikita)
-
-- Standard:
- . Fixed bug #78506 (Error in a php_user_filter::filter() is not reported).
- (Nikita)
-
-05 Sep 2019, PHP 7.4.0RC1
+?? ??? ????, PHP 8.0.0alpha1
- Core:
- . Fixed bug #77812 (Interactive mode does not support PHP 7.3-style heredoc).
- (cmb, Nikita)
- . Fixed bug #78438 (Corruption when __unserializing deeply nested structures).
- (cmb, Nikita)
- . Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
- (cmb)
- . Fixed bug #78454 (Consecutive numeric separators cause OOM error).
- (Theodore Brown)
- . Fixed bug #78335 (Static properties/variables containing cycles report as
- leak). (Nikita)
- . Fixed bug #78460 (PEAR installation failure). (Peter Kokot, L. Declercq)
-
-- FPM:
- . Fixed bug #78334 (fpm log prefix message includes wrong stdout/stderr
- notation). (Tsuyoshi Sadakata)
-
-- ODBC:
- . Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
-
-- SPL:
- . Fixed bug #78436 (Missing addref in SplPriorityQueue EXTR_BOTH mode).
- (Nikita)
- . Fixed bug #78456 (Segfault when serializing SplDoublyLinkedList). (Nikita)
-
-22 Aug 2019, PHP 7.4.0beta4
-
-- Core:
- . Fixed bug #78220 (Can't access OneDrive folder). (cmb, ab)
- . Fixed bug #78396 (Second file_put_contents in Shutdown hangs script).
- (Nikita)
- . Fixed bug #78406 (Broken file includes with user-defined stream filters).
- (Nikita)
- . Fixed bug #72530 (Use After Free in GC with Certain Destructors). (Nikita)
- . Fixed bug #78386 (fstat mode has unexpected value on PHP 7.4). (cmb)
+ . Removed the pdo_odbc.db2_instance_name php.ini directive. (Kalle)
+ . Fixed bug #77619 (Wrong reflection on MultipleIterator::__construct).
+ (Fabien Villepinte)
- Date:
- . Fixed bug #78383 (Casting a DateTime to array no longer returns its
- properties). (Nikita)
-
-- MySQLnd:
- . Fixed connect_attr issues and added the _server_host connection attribute.
- (Qianqian Bu)
-
-- OpenSSL:
- . Fixed bug #78391 (Assertion failure in openssl_random_pseudo_bytes).
- (Nikita)
-
-- Reflection:
- . Fixed bug #78410 (Cannot "manually" unserialize class that is final and
- extends an internal one). (Nikita)
-
-- SPL:
- . Fixed bug #78409 (Segfault when creating instance of ArrayIterator without
- constructor). (Nikita)
-
-08 Aug 2019, PHP 7.4.0beta2
-
-- Core:
- . Fixed bug #78340 (Include of stream wrapper not reading whole file).
- (Nikita)
- . Fixed bug #78344 (Segmentation fault on zend_check_protected). (Nikita)
- . Fixed bug #78356 (Array returned from ArrayAccess is incorrectly unpacked
- as argument). (Nikita)
- . Fixed bug #78379 (Cast to object confuses GC, causes crash). (Dmitry)
-
-- Exif:
- . Fixed bug #78333 (Exif crash (bus error) due to wrong alignment and
- invalid cast). (Nikita)
- . Fixed bug #78256 (heap-buffer-overflow on exif_process_user_comment).
- (CVE-2019-11042) (Stas)
- . Fixed bug #78222 (heap-buffer-overflow on exif_scan_thumbnail).
- (CVE-2019-11041) (Stas)
-
-- Iconv:
- . Fixed bug #78342 (Bus error in configure test for iconv //IGNORE). (Rainer
- Jung)
-
-- MySQLnd:
- . Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
- . Fixed bug #78213 (Empty row pocket). (cmb)
-
-- Opcache:
- . Fixed bug #78341 (Failure to detect smart branch in DFA pass). (Nikita)
- . Fixed bug #78376 (Incorrect preloading of constant static properties).
- (Dmitry)
-
-- PCRE:
- . Fixed bug #78338 (Array cross-border reading in PCRE). (cmb)
-
-- PDO_Sqlite:
- . Fixed bug #78348 (Remove -lrt from pdo_sqlite.so). (Peter Kokot)
-
-- Phar:
- . Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
-
-- Standard:
- . Fixed bug #78326 (improper memory deallocation on stream_get_contents()
- with fixed length buffer). (Albert Casademont)
- . Fixed bug #78346 (strip_tags no longer handling nested php tags). (cmb)
-
-25 Jul 2019, PHP 7.4.0beta1
+ . Fixed bug #65547 (Default value for sunrise/sunset zenith still wrong).
+ (cmb)
+ . Fixed bug #69044 (discrepency between time and microtime). (krakjoe)
-- Core:
- . Fixed bug #78212 (Segfault in built-in webserver). (cmb)
- . Fixed bug #60677 (CGI doesn't properly validate shebang line contains #!).
- (Nikita)
- . Fixed bug #78066 (PHP eats the first byte of a program that comes from
- process substitution). (Nikita)
- . Fixed bug #52752 (Crash when lexing). (Nikita)
- . Implemented RFC: Deprecate curly brace syntax for accessing array elements
- and string offsets.
- https://wiki.php.net/rfc/deprecate_curly_braces_array_access (Andrey Gromov)
- . Implemented RFC: Deprecations for PHP 7.4.
- https://wiki.php.net/rfc/deprecations_php_7_4 (Kalle, Nikita)
+- DOM:
+ . Add property DOMXPath::$registerNodeNamespaces and constructor argument
+ that allow global flag to configure query() or evaluate() calls.
- GD:
- . Fixed bug #78314 (missing freetype support/functions with external gd).
- (Remi)
-
-- Libxml:
- . Fixed bug #78279 (libxml_disable_entity_loader settings is shared between
- requests (cgi-fcgi)). (Nikita)
-
-- LiteSpeed:
- . Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
-
-- Opcache:
- . Fixed bug #78271 (Invalid result of if-else). (Nikita)
- . Added new INI directive opcache.cache_id (Windows only). (cmb)
-
-- PDO:
- . Implemented FR #71885 (Allow escaping question mark placeholders).
- https://wiki.php.net/rfc/pdo_escape_placeholders (Matteo)
-
-- Recode:
- . Unbundled the recode extension. (cmb)
-
-- Standard:
- . Fixed bug #78282 (atime and mtime mismatch). (cmb)
- . Fixed bug #73535 (php_sockop_write() returns 0 on error, can be used to
- trigger Denial of Service). (Nikita)
-
-11 Jul 2019, PHP 7.4.0alpha3
-
-- Core:
- . Fixed bug #78239 (Deprecation notice during string conversion converted to
- exception hangs). (Nikita)
- . Implemented FR #77230 (Support custom CFLAGS and LDFLAGS from environment).
- (cmb)
+ . Replaced gd resources with objects. (Mark Randall)
+ . Removed deprecated image2wbmp(). (cmb)
+ . Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb)
-- Date:
- . Updated timelib to 2018.02. (Derick)
+- Intl:
+ . Removed deprecated INTL_IDNA_VARIANT_2003. (cmb)
-- Fileinfo:
- . Fixed bug #78183 (finfo_file shows wrong mime-type for .tga file).
- (Anatol)
+- JIT:
+ . Fixed bug #77857 (Wrong result if executed with JIT). (Laruence)
-- LiteSpeed:
- . Updated to LiteSpeed SAPI V7.4.3 (increased response header count limit from
- 100 to 1000, added crash handler to cleanly shutdown PHP request, added
- CloudLinux mod_lsapi mode). (George Wang)
- . Fixed bug #76058 (After "POST data can't be buffered", using php://input
- makes huge tmp files). (George Wang)
+- LDAP:
+ . Removed deprecated ldap_sort. (mcmic)
-- Openssl:
- . Fixed bug #78231 (Segmentation fault upon stream_socket_accept of exported
- socket-to-stream). (Nikita)
+- MBString:
+ . Removed the unused $is_hex parameter from mb_decode_numericentity(). (cmb)
-- Opcache:
- . Fixed #78202 (Opcache stats for cache hits are capped at 32bit NUM). (cmb)
+- MySQLi:
+ . Fixed bug #76809 (SSL settings aren't respected when persistent connections
+ are used). (fabiomsouto)
- mysqlnd:
. Fixed #60594 (mysqlnd exposes 160 lines of stats in phpinfo). (PeeHaa)
-- PDO:
- . Implemented FR #78033 (PDO - support username & password specified in
- DSN). (sjon)
-
-- PDO_Sqlite:
- . Fixed #78192 (SegFault when reuse statement after schema has changed).
- (Vincent Quatrevieux)
-
-- Reflection:
- . Fixed bug #78263 (\ReflectionReference::fromArrayElement() returns null
- while item is a reference). (Nikita)
-
-- Standard:
- . Implemented FR #78177 (Make proc_open accept command array). (Nikita)
- . Fixed #78208 (password_needs_rehash() with an unknown algo should always
- return true). (Sara)
- . Fixed #78241 (touch() does not handle dates after 2038 in PHP 64-bit). (cmb)
- . Implemented RFC where password_hash() has argon2i(d) implementations from
- ext/sodium when PHP is built without libargon:
- https://wiki.php.net/rfc/sodium.argon.hash (Sara)
-
-27 Jun 2019, PHP 7.4.0alpha2
-
-- Core:
- . Fixed bug #78151 (Segfault caused by indirect expressions in PHP 7.4a1).
- (Nikita)
- . Fixed bug #78154 (SEND_VAR_NO_REF does not always send reference). (Nikita)
- . Fixed bug #78182 (Segmentation fault during by-reference property
- assignment). (Nikita)
-
-- Date:
- . Fixed #69044 (discrepency between time and microtime). (krakjoe)
-
-- GD:
- . Added TGA read support. (cmb)
-
-- MySQLi:
- . Fixed bug #67348 (Reading $dbc->stat modifies $dbc->affected_rows).
- (Derick)
-
-- Opcache:
- . Fixed bug #78106 (Path resolution fails if opcache disabled during request).
- (Nikita)
- . Fixed bug #78175 (Preloading segfaults at preload time and at runtime).
- (Dmitry)
-
-- SQLite3:
- . Implement FR ##70950 (Make SQLite3 Online Backup API available). (BohwaZ)
-
-13 Jun 2019, PHP 7.4.0alpha1
-
-- Core:
- . Fixed bug #77345 (Stack Overflow caused by circular reference in garbage
- collection). (Alexandru Patranescu, Nikita, Dmitry)
- . Fixed bug #77877 (call_user_func() passes $this to static methods).
- (Dmitry)
- . Implemented FR #76148 (Add array_key_exists() to the list of specially
- compiled functions). (Majkl578)
- . Fixed bug #76430 (__METHOD__ inconsistent outside of method).
- (Ryan McCullagh, Nikita)
- . Fixed bug #75921 (Inconsistent: No warning in some cases when stdObj is
- created on the fly). (David Walker)
- . Fixed bug #71030 (Self-assignment in list() may have inconsistent behavior).
- (Nikita)
- . Fixed bug #76451 (Aliases during inheritance type checks affected by
- opcache). (Nikita)
-
-- CLI:
- . The built-in CLI server now reports the request method in log files.
- (Simon Welsh)
-
-- COM:
- . Deprecated registering of case-insensitive constants from typelibs. (cmb)
-
-- CURL:
- . Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
- (Pierrick)
- . Implemented FR #77711 (CURLFile should support UNICODE filenames). (cmb)
- . Deprecated CURLPIPE_HTTP1. (cmb)
- . Deprecated $version parameter of curl_version(). (cmb)
-
-- Date:
- . Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita)
-
-- FFI:
- . Added FFI extension. (Dmitry)
-
--Fileinfo:
- . Fixed bug #78075 (finfo_file treats JSON file as text/plain). (Anatol)
-
-- Filter:
- . The filter extension no longer have the --with-pcre-dir on Unix builds,
- allowing the extension to be once more compiled as shared using
- ./configure. (Kalle)
-
-- FPM:
- . Implemented FR #72510 (systemd service should be hardened). (Craig Andrews)
-
-- GD:
- . Implemented the scatter filter (IMG_FILTER_SCATTER). (Kalle)
- . Fixed bug #73291 (imagecropauto() $threshold differs from external libgd).
- (cmb)
- . Fixed bug #76324 (cannot detect recent versions of freetype with
- pkg-config). (Eli Schwartz)
- . The bundled libgd behaves now like system libgd wrt. IMG_CROP_DEFAULT never
- falling back to IMG_CROP_SIDES.
- . The default $mode parameter of imagecropauto() has been changed to
- IMG_CROP_DEFAULT; passing -1 is now deprecated.
- . Added support for aspect ratio preserving scaling to a fixed height for
- imagescale(). (Andreas Treichel)
-
-- Hash:
- . The hash extension is now an integral part of PHP and cannot be disabled
- as per RFC: https://wiki.php.net/rfc/permanent_hash_ext. (Kalle)
- . Implemented FR #71890 (crc32c checksum algorithm). (Andrew Brampton)
-
-- InterBase:
- . Unbundled the InterBase extension and moved it to PECL. (Kalle)
-
-- Intl:
- . Raised requirements to ICU ≥ 50.1. (cmb)
- . Changed ResourceBundle to implement Countable. (LeSuisse)
- . Changed default of $variant parameter of idn_to_ascii() and idn_to_utf8().
- (cmb)
-
-- LDAP:
- . Deprecated ldap_control_paged_result_response and ldap_control_paged_result
-
-- Mbstring:
- . Fixed bug #77907 (mb-functions do not respect default_encoding). (Nikita)
-
-- Opcache:
- . Implemented preloading RFC: https://wiki.php.net/rfc/preload. (Dmitry)
-
-- OpenSSL:
- . Added TLS 1.3 support to streams including new tlsv1.3 stream.
- (Codarren Velvindron, Jakub Zelenka)
- . Added openssl_x509_verify function. (Ben Scholzen)
- . openssl_random_pseudo_bytes() now throws in error conditions.
- (Sammy Kaye Powers)
+- OpCache:
+ . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
+ non-ascii characters). (mhagstrand)
- PCRE:
- . Implemented FR #77094 (Support flags in preg_replace_callback). (Nikita)
- . Fixed bug #72685 (Repeated UTF-8 validation of same string in UTF-8 mode).
- (Nikita)
- . Fixed bug #73948 (Preg_match_all should return NULLs on trailing optional
- capture groups).
+ . Don't ignore invalid escape sequences. (sjon)
- PDO:
. Fixed bug #77849 (Disable cloning of PDO handle/connection objects).
(camporter)
-- PDO_OCI:
- . Support Oracle Database tracing attributes ACTION, MODULE,
- CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter)
- . Implemented FR #76908 (PDO_OCI getColumnMeta() not implemented).
- (Valentin Collet, Chris Jones, Remi)
-
-- PDO_SQLite:
- . Implemented sqlite_stmt_readonly in PDO_SQLite. (BohwaZ)
- . Raised requirements to SQLite 3.5.0. (cmb)
-
- phpdbg:
. Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
. Fixed bug #76801 (too many open files). (alekitto)
@@ -494,46 +58,39 @@ PHP NEWS
(krakjoe)
. Fixed bug #77805 (phpdbg build fails when readline is shared). (krakjoe)
-- SimpleXML:
- . Implemented FR #65215 (SimpleXMLElement could register as implementing
- Countable). (LeSuisse)
+- Reflection:
+ . Fixed bug #78697 (ReflectionClass::implementsInterface - inaccurate error
+ message with traits). (villfa)
-- Sockets:
- . Fixed bug #67619 (Validate length on socket_write). (thiagooak)
+- Session:
+ . Fixed bug #78624 (session_gc return value for user defined session
+ handlers). (bshaffer)
+
+- SimpleXML:
+ . Fixed bug #75245 (Don't set content of elements with only whitespaces).
+ (eriklundin)
- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
-- SQLite3:
- . Unbundled libsqlite. (cmb)
- . Raised requirements to SQLite 3.7.4. (cmb)
- . Forbid (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result. (cmb)
- . Added support for the SQLite @name notation. (cmb, BohwaZ)
- . Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. (Bohwaz)
-
-- SPL:
- . Fixed bug #77518 (SeekableIterator::seek() should accept 'int' typehint as
- documented). (Nikita)
-
- Standard:
- . Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with
- stream_socket_client). (Ville Hukkamäki)
- . Implemented FR #38301 (field enclosure behavior in fputcsv). (cmb)
- . Implemented FR #51496 (fgetcsv should take empty string as an escape). (cmb)
- . Implemented FR #77377 (No way to handle CTRL+C in Windows). (Anatol)
- . Implemented password hashing registry RFC:
- https://wiki.php.net/rfc/password_registry. (Sara)
+ . Fixed bug #77204 (getimagesize(): Read error! should mention file path).
+ (peter279k)
+ . Fixed bug #76859 (stream_get_line skips data if used with data-generating
+ filter). (kkopachev)
-- Reflection:
- . Fixed bug #76737 (Unserialized reflection objects are broken, they
- shouldn't be serializable). (Nikita)
+- tidy:
+ . Removed the unused $use_include_path parameter from tidy_repair_string().
+ (cmb)
-- Tidy:
- . Added TIDY_TAG_* constants for HTML5 elements. (cmb)
- . Fixed bug #76736 (wrong reflection for tidy_get_head, tidy_get_html,
- tidy_get_root, and tidy_getopt) (tandre)
+- XML:
+ . Fixed bug #76874 (xml_parser_free() should never leak memory). (Nikita)
-- WDDX:
- . Deprecated and unbundled the WDDX extension. (cmb)
+- XMLWriter:
+ . Changed functions to accept/return XMKWriter objects instead of resources.
+ (cmb)
+
+- Zip:
+ . Fixed bug #72374 (remove_path strips first char of filename). (tyage)
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
diff --git a/README.md b/README.md
index 6b9fe6e65e..120c36ea85 100644
--- a/README.md
+++ b/README.md
@@ -11,12 +11,12 @@
PHP is a popular general-purpose scripting language that is especially suited to
web development. Fast, flexible and pragmatic, PHP powers everything from your
-blog to the most popular websites in the world. PHP is distributed under the PHP
-License v3.01.
+blog to the most popular websites in the world. PHP is distributed under the
+[PHP License v3.01](LICENSE).
[![Build status](https://travis-ci.org/php/php-src.svg?branch=master)](https://travis-ci.org/php/php-src)
-[![Build status](https://ci.appveyor.com/api/projects/status/meyur6fviaxgdwdy?svg=true)](https://ci.appveyor.com/project/php/php-src)
-[![Build Status](https://dev.azure.com/phpazuredevops/php/_apis/build/status/php.php-src?branchName=PHP-7.4)](https://dev.azure.com/phpazuredevops/php/_build/latest?definitionId=1&branchName=PHP-7.4)
+[![Build status](https://ci.appveyor.com/api/projects/status/meyur6fviaxgdwdy/branch/master?svg=true)](https://ci.appveyor.com/project/php/php-src)
+[![Build Status](https://dev.azure.com/phpazuredevops/php/_apis/build/status/php.php-src?branchName=master)](https://dev.azure.com/phpazuredevops/php/_build/latest?definitionId=1&branchName=master)
## Documentation
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 1a8d5192ff..bcd5c806b1 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -102,31 +102,14 @@ static FILE *tsrm_error_file;
}
#endif
-#if defined(GNUPTH)
-static pth_key_t tls_key;
-# define tsrm_tls_set(what) pth_key_setdata(tls_key, (void*)(what))
-# define tsrm_tls_get() pth_key_getdata(tls_key)
-
-#elif defined(PTHREADS)
-/* Thread local storage */
-static pthread_key_t tls_key;
-# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what))
-# define tsrm_tls_get() pthread_getspecific(tls_key)
-
-#elif defined(TSRM_ST)
-static int tls_key;
-# define tsrm_tls_set(what) st_thread_setspecific(tls_key, (void*)(what))
-# define tsrm_tls_get() st_thread_getspecific(tls_key)
-
-#elif defined(TSRM_WIN32)
+#if defined(TSRM_WIN32)
static DWORD tls_key;
# define tsrm_tls_set(what) TlsSetValue(tls_key, (void*)(what))
# define tsrm_tls_get() TlsGetValue(tls_key)
-
#else
-# define tsrm_tls_set(what)
-# define tsrm_tls_get() NULL
-# warning tsrm_set_interpreter_context is probably broken on this platform
+static pthread_key_t tls_key;
+# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what))
+# define tsrm_tls_get() pthread_getspecific(tls_key)
#endif
TSRM_TLS uint8_t in_main_thread = 0;
@@ -135,16 +118,10 @@ TSRM_TLS uint8_t is_thread_shutdown = 0;
/* Startup TSRM (call once for the entire process) */
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
{/*{{{*/
-#if defined(GNUPTH)
- pth_init();
- pth_key_create(&tls_key, 0);
-#elif defined(PTHREADS)
- pthread_key_create( &tls_key, 0 );
-#elif defined(TSRM_ST)
- st_init();
- st_key_create(&tls_key, 0);
-#elif defined(TSRM_WIN32)
+#if defined(TSRM_WIN32)
tls_key = TlsAlloc();
+#else
+ pthread_key_create(&tls_key, 0);
#endif
/* ensure singleton */
@@ -232,13 +209,11 @@ TSRM_API void tsrm_shutdown(void)
if (tsrm_error_file!=stderr) {
fclose(tsrm_error_file);
}
-#if defined(GNUPTH)
- pth_kill();
-#elif defined(PTHREADS)
+#if defined(TSRM_WIN32)
+ TlsFree(tls_key);
+#else
pthread_setspecific(tls_key, 0);
pthread_key_delete(tls_key);
-#elif defined(TSRM_WIN32)
- TlsFree(tls_key);
#endif
if (tsrm_shutdown_handler) {
tsrm_shutdown_handler();
@@ -494,67 +469,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
}/*}}}*/
-/* frees an interpreter context. You are responsible for making sure that
- * it is not linked into the TSRM hash, and not marked as the current interpreter */
-void tsrm_free_interpreter_context(void *context)
-{/*{{{*/
- tsrm_tls_entry *next, *thread_resources = (tsrm_tls_entry*)context;
- int i;
-
- while (thread_resources) {
- next = thread_resources->next;
-
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i]);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- if (!resource_types_table[i].fast_offset) {
- free(thread_resources->storage[i]);
- }
- }
- free(thread_resources->storage);
- free(thread_resources);
- thread_resources = next;
- }
-}/*}}}*/
-
-void *tsrm_set_interpreter_context(void *new_ctx)
-{/*{{{*/
- tsrm_tls_entry *current;
-
- current = tsrm_tls_get();
-
- /* TODO: unlink current from the global linked list, and replace it
- * it with the new context, protected by mutex where/if appropriate */
-
- /* Set thread local storage to this new thread resources structure */
- tsrm_tls_set(new_ctx);
-
- /* return old context, so caller can restore it when they're done */
- return current;
-}/*}}}*/
-
-
-/* allocates a new interpreter context */
-void *tsrm_new_interpreter_context(void)
-{/*{{{*/
- tsrm_tls_entry *new_ctx, *current;
- THREAD_T thread_id;
-
- thread_id = tsrm_thread_id();
- tsrm_mutex_lock(tsmm_mutex);
-
- current = tsrm_tls_get();
-
- allocate_new_resource(&new_ctx, thread_id);
-
- /* switch back to the context that was in use prior to our creation
- * of the new one */
- return tsrm_set_interpreter_context(current);
-}/*}}}*/
-
/* frees all resources allocated for the current thread */
void ts_free_thread(void)
@@ -637,8 +551,6 @@ void ts_free_id(ts_rsrc_id id)
}/*}}}*/
-
-
/*
* Utility Functions
*/
@@ -648,12 +560,8 @@ TSRM_API THREAD_T tsrm_thread_id(void)
{/*{{{*/
#ifdef TSRM_WIN32
return GetCurrentThreadId();
-#elif defined(GNUPTH)
- return pth_self();
-#elif defined(PTHREADS)
+#else
return pthread_self();
-#elif defined(TSRM_ST)
- return st_thread_self();
#endif
}/*}}}*/
@@ -665,14 +573,9 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void)
#ifdef TSRM_WIN32
mutexp = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(mutexp);
-#elif defined(GNUPTH)
- mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
- pth_mutex_init(mutexp);
-#elif defined(PTHREADS)
+#else
mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(mutexp,NULL);
-#elif defined(TSRM_ST)
- mutexp = st_mutex_new();
#endif
#ifdef THR_DEBUG
printf("Mutex created thread: %d\n",mythreadid());
@@ -688,13 +591,9 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
#ifdef TSRM_WIN32
DeleteCriticalSection(mutexp);
free(mutexp);
-#elif defined(GNUPTH)
- free(mutexp);
-#elif defined(PTHREADS)
+#else
pthread_mutex_destroy(mutexp);
free(mutexp);
-#elif defined(TSRM_ST)
- st_mutex_destroy(mutexp);
#endif
}
#ifdef THR_DEBUG
@@ -713,15 +612,8 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
EnterCriticalSection(mutexp);
return 0;
-#elif defined(GNUPTH)
- if (pth_mutex_acquire(mutexp, 0, NULL)) {
- return 0;
- }
- return -1;
-#elif defined(PTHREADS)
+#else
return pthread_mutex_lock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_lock(mutexp);
#endif
}/*}}}*/
@@ -736,15 +628,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
LeaveCriticalSection(mutexp);
return 0;
-#elif defined(GNUPTH)
- if (pth_mutex_release(mutexp)) {
- return 0;
- }
- return -1;
-#elif defined(PTHREADS)
+#else
return pthread_mutex_unlock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_unlock(mutexp);
#endif
}/*}}}*/
@@ -755,12 +640,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset)
{/*{{{*/
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Changed sigmask in thread: %ld", tsrm_thread_id()));
- /* TODO: add support for other APIs */
-#ifdef PTHREADS
- return pthread_sigmask(how, set, oldset);
-#else
- return sigprocmask(how, set, oldset);
-#endif
+
+ return pthread_sigmask(how, set, oldset);
}/*}}}*/
#endif
@@ -842,6 +723,29 @@ TSRM_API void *tsrm_get_ls_cache(void)
return tsrm_tls_get();
}/*}}}*/
+/* Returns offset of tsrm_ls_cache slot from Thread Control Block address */
+TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
+{/*{{{*/
+#if defined(__APPLE__) && defined(__x86_64__)
+ // TODO: Implement support for fast JIT ZTS code ???
+ return 0;
+#elif defined(__x86_64__) && defined(__GNUC__)
+ size_t ret;
+
+ asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
+ : "=r" (ret));
+ return ret;
+#elif defined(__i386__) && defined(__GNUC__)
+ size_t ret;
+
+ asm ("leal _tsrm_ls_cache@ntpoff,%0"
+ : "=r" (ret));
+ return ret;
+#else
+ return 0;
+#endif
+}/*}}}*/
+
TSRM_API uint8_t tsrm_is_main_thread(void)
{/*{{{*/
return in_main_thread;
@@ -854,16 +758,10 @@ TSRM_API uint8_t tsrm_is_shutdown(void)
TSRM_API const char *tsrm_api_name(void)
{/*{{{*/
-#if defined(GNUPTH)
- return "GNU Pth";
-#elif defined(PTHREADS)
- return "POSIX Threads";
-#elif defined(TSRM_ST)
- return "State Threads";
-#elif defined(TSRM_WIN32)
+#if defined(TSRM_WIN32)
return "Windows Threads";
#else
- return "Unknown";
+ return "POSIX Threads";
#endif
}/*}}}*/
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index d710eb6f75..75553edabc 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -44,14 +44,8 @@ typedef uintptr_t tsrm_uintptr_t;
# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS
# define WIN32_LEAN_AND_MEAN
# endif
-# include <windows.h>
-# include <shellapi.h>
-#elif defined(GNUPTH)
-# include <pth.h>
-#elif defined(PTHREADS)
+#else
# include <pthread.h>
-#elif defined(TSRM_ST)
-# include <st.h>
#endif
#if SIZEOF_SIZE_T == 4
@@ -68,15 +62,9 @@ typedef int ts_rsrc_id;
#ifdef TSRM_WIN32
# define THREAD_T DWORD
# define MUTEX_T CRITICAL_SECTION *
-#elif defined(GNUPTH)
-# define THREAD_T pth_t
-# define MUTEX_T pth_mutex_t *
-#elif defined(PTHREADS)
+#else
# define THREAD_T pthread_t
# define MUTEX_T pthread_mutex_t *
-#elif defined(TSRM_ST)
-# define THREAD_T st_thread_t
-# define MUTEX_T st_mutex_t
#endif
#include <signal.h>
@@ -143,13 +131,8 @@ TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_th
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler);
-/* these 3 APIs should only be used by people that fully understand the threading model
- * used by PHP/Zend and the selected SAPI. */
-TSRM_API void *tsrm_new_interpreter_context(void);
-TSRM_API void *tsrm_set_interpreter_context(void *new_ctx);
-TSRM_API void tsrm_free_interpreter_context(void *context);
-
TSRM_API void *tsrm_get_ls_cache(void);
+TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void);
TSRM_API uint8_t tsrm_is_main_thread(void);
TSRM_API uint8_t tsrm_is_shutdown(void);
TSRM_API const char *tsrm_api_name(void);
@@ -160,11 +143,21 @@ TSRM_API const char *tsrm_api_name(void);
# define TSRM_TLS __thread
#endif
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+
+#if !__has_attribute(tls_model)
+# define TSRM_TLS_MODEL_ATTR
+#elif __PIC__
+# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec")))
+#else
+# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("local-exec")))
+#endif
+
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
-#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
-#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache()
#define TSRMG(id, type, element) (TSRMG_BULK(id, type)->element)
#define TSRMG_BULK(id, type) ((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMG_FAST(offset, type, element) (TSRMG_FAST_BULK(offset, type)->element)
@@ -174,18 +167,11 @@ TSRM_API const char *tsrm_api_name(void);
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element)
#define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset)))
-#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
-#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
+#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
+#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE _tsrm_ls_cache
-/* BC only */
-#define TSRMLS_D void
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-#define TSRMLS_FETCH()
-
#ifdef __cplusplus
}
#endif
@@ -195,10 +181,6 @@ TSRM_API const char *tsrm_api_name(void);
#define tsrm_env_lock()
#define tsrm_env_unlock()
-#define TSRMLS_FETCH()
-#define TSRMLS_FETCH_FROM_CTX(ctx)
-#define TSRMLS_SET_CTX(ctx)
-
#define TSRMG_STATIC(id, type, element)
#define TSRMLS_CACHE_EXTERN()
#define TSRMLS_CACHE_DEFINE()
@@ -207,12 +189,6 @@ TSRM_API const char *tsrm_api_name(void);
#define TSRM_TLS
-/* BC only */
-#define TSRMLS_D void
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-
#endif /* ZTS */
#endif /* TSRM_H */
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
index 0330d7a7da..9f5c8001d8 100644
--- a/TSRM/tsrm.m4
+++ b/TSRM/tsrm.m4
@@ -1,44 +1,6 @@
dnl This file contains TSRM specific autoconf macros.
dnl
-dnl TSRM_CHECK_PTH
-dnl
-AC_DEFUN([TSRM_CHECK_PTH],[
-AC_MSG_CHECKING(for GNU Pth)
-PTH_PREFIX="`$1 --prefix`"
-if test -z "$PTH_PREFIX"; then
- AC_MSG_RESULT(Please check your Pth installation)
-fi
-
-CPPFLAGS="$CPPFLAGS `$1 --cflags`"
-LDFLAGS="$LDFLAGS `$1 --ldflags`"
-LIBS="$LIBS `$1 --libs`"
-
-AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
-AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
-])
-
-dnl
-dnl TSRM_CHECK_ST
-dnl
-AC_DEFUN([TSRM_CHECK_ST],[
- if test -r "$1/include/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1/include"
- LDFLAGS="$LDFLAGS -L$1/lib"
- elif test -r "$1/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1"
- LDFLAGS="$LDFLAGS -L$1"
- fi
- AC_CHECK_HEADERS(st.h,[],[
- AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
- ])
- LIBS="$LIBS -lst"
- AC_MSG_CHECKING(for SGI's State Threads)
- AC_MSG_RESULT(yes)
- AC_DEFINE(TSRM_ST, 1, [ ])
-])
-
-dnl
dnl TSRM_CHECK_PTHREADS
dnl
AC_DEFUN([TSRM_CHECK_PTHREADS],[
@@ -53,39 +15,3 @@ AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
AC_MSG_CHECKING(for POSIX threads)
AC_MSG_RESULT(yes)
])
-
-dnl
-dnl TSRM_THREADS_CHECKS
-dnl
-dnl For the thread implementations, we always use --with-* to maintain
-dnl consistency.
-dnl
-AC_DEFUN([TSRM_THREADS_CHECKS],[
-AC_ARG_WITH([tsrm-pth],
- [AS_HELP_STRING([[--with-tsrm-pth[=pth-config]]],
- [Use GNU Pth])],
- [TSRM_PTH=$withval],
- [TSRM_PTH=no])
-
-AC_ARG_WITH([tsrm-st],
- [AS_HELP_STRING([--with-tsrm-st],
- [Use SGI's State Threads])],
- [TSRM_ST=$withval],
- [TSRM_ST=no])
-
-AC_ARG_WITH([tsrm-pthreads],
- [AS_HELP_STRING([--with-tsrm-pthreads],
- [Use POSIX threads (default)])],
- [TSRM_PTHREADS=$withval],
- [TSRM_PTHREADS=yes])
-
-test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
-
-if test "$TSRM_PTH" != "no"; then
- TSRM_CHECK_PTH($TSRM_PTH)
-elif test "$TSRM_ST" != "no"; then
- TSRM_CHECK_ST($TSRM_ST)
-elif test "$TSRM_PTHREADS" != "no"; then
- TSRM_CHECK_PTHREADS
-fi
-])
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index e16c946131..714542a853 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.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/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h
index 1ae9beaf2c..4af6225c93 100644
--- a/TSRM/tsrm_win32.h
+++ b/TSRM/tsrm_win32.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/UPGRADING b/UPGRADING
index c91d90fbf7..41cab54f1e 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -1,4 +1,4 @@
-PHP 7.4 UPGRADE NOTES
+PHP 8.0 UPGRADE NOTES
1. Backward Incompatible Changes
2. New Features
@@ -12,9 +12,8 @@ PHP 7.4 UPGRADE NOTES
10. New Global Constants
11. Changes to INI File Handling
12. Windows Support
-13. Migration to pkg-config
-14. Other Changes
-15. Performance Improvements
+13. Other Changes
+14. Performance Improvements
========================================
@@ -22,337 +21,300 @@ PHP 7.4 UPGRADE NOTES
========================================
- Core:
- . Trying to use values of type null, bool, int, float or resource as an
- array (such as $null["key"]) will now generate a notice. This does not
- affect array accesses performed by list().
- RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
- . get_declared_classes() no longer returns anonymous classes that haven't
- been instantiated yet.
- . "fn" is now a reserved keyword. In particular, it can no longer be used as a
- function or class name. It can still be used as a method or class constant
- name.
- . Passing the result of a (non-reference) list() assignment by reference is
- consistently disallowed now. Previously this worked if the right-hand side
- was a simple (CV) variable and did not occur as part of the list().
- . `<?php` at the end of the file (without trailing newline) will now be
- interpreted as an opening PHP tag. Previously it was interpreted either as
- `<? php` and resulted in a syntax error (with short_open_tag=1) or was
- interpreted as a literal `<?php` string (with short_open_tag=0).
- . When using include/require on a stream, stream_set_option() will be invoked
- with the STREAM_OPTION_READ_BUFFER option. Custom stream wrapper
- implementations may need to implement the stream_set_option() method to
- avoid a warning (always returning false is a sufficient implementation).
-
-- BCMath:
- . BCMath functions will now warn if a non well-formed number is passed, such
- as "32foo". The argument will be interpreted as zero (as before).
-
-- Curl:
- . Attempting to serialize a CURLFile class will now generate an exception.
- Previously the exception was only thrown on unserialization.
- . Using CURLPIPE_HTTP1 is deprecated, and is no longer supported as of cURL
- 7.62.0.
- . The $version parameter of curl_version() is deprecated. If any value not
- equal to the default CURLVERSION_NOW is passed, a warning is raised and the
- parameter is ignored.
-
-- Date:
- . Calling var_dump() or similar on a DateTime(Immutable) instance will no
- longer leave behind accessible properties on the object.
- . Comparison of DateInterval objects (using ==, < and so on) will now generate
- a warning and always return false. Previously all DateInterval objects were
- considered equal, unless they had properties.
-
-- Intl:
- . The default parameter value of idn_to_ascii() and idn_to_utf8() is now
- INTL_IDNA_VARIANT_UTS46 instead of the deprecated INTL_IDNA_VARIANT_2003.
-
-- MySQLi:
- . The embedded server functionality has been removed. It was broken since
- at least PHP 7.0.
- . The undocumented mysqli::$stat property has been removed in favor of
- mysqli::stat().
-
-- Openssl:
- . The openssl_random_pseudo_bytes() function will now throw an exception in
- error situations, similar to random_bytes(). In particular, an Error is
- thrown if the number of requested bytes is less than *or equal to* zero,
- and an Exception is thrown if sufficient randomness cannot be gathered.
- The $crypto_strong output argument is guaranteed to always be true if the
- function does not throw, so explicitly checking it is not necessary.
- RFC: http://php.net/manual/de/function.openssl-random-pseudo-bytes.php
-
-- Pcntl:
- . The $restart_syscalls flag for pcntl_signal() will now be respected for
- SIGALARM. Previously it was hardcoded to false. To reduce the backwards
- compatibility impact, the default for SIGALARM will remain false however.
-
-- PCRE:
- . When PREG_UNMATCHED_AS_NULL mode is used, trailing unmatched capturing
- groups will now also be set to null (or [null, -1] if offset capture is
- enabled). This means that the size of the $matches will always be the same.
-
-- PEAR:
- . Installation of PEAR (including PECL) is no longer enabled by default. It
- can be explicitly enabled using --with-pear. This option is deprecated and
- may be removed in the future.
-
-- PDO:
- . Attempting to serialize a PDO or PDOStatement instance will now generate
- an Exception rather than a PDOException, consistent with other internal
- classes which do not support serialization.
-
-- Reflection:
- . Reflection objects will now generate an exception if an attempt is made
- to serialize them. Serialization for reflection objects was never
- supported and resulted in corrupted reflection objects. It has been
- explicitly prohibited now.
-
-- SPL:
- . Calling get_object_vars() on an ArrayObject instance will now always return
- the properties of the ArrayObject itself (or a subclass). Previously it
- returned the values of the wrapped array/object unless the STD_PROP_LIST
- flag was specified. Other affected operations are:
-
- * ReflectionObject::getProperties()
- * reset(), current(), etc. Use Iterator methods instead.
- * Potentially others working on object properties as a list.
-
- (array) casts are *not* affected. They will continue to return either the
- wrapped array, or the ArrayObject properties, depending on whether the
- STD_PROP_LIST flag is used.
- . SplPriorityQueue::setExtractFlags() will throw an exception if zero is
- passed. Previously this would generate a recoverable fatal error on the
- next extraction operation.
- . ArrayObject, ArrayIterator, SplDoublyLinkedList and SplObjectStorage now
- support the __serialize() + __unserialize() mechanism in addition to the
- Serializable interface. This means that serialization payloads created on
- older PHP versions can still be unserialized, but new payloads created by
- PHP 7.4 will not be understood by older versions.
-
-- Standard:
- . The "o" serialization format has been removed. As it is never produced by
- PHP, this may only break unserialization of manually crafted strings.
- . Password hashing algorithm identifiers are now nullable strings rather
- than integers.
-
- * PASSWORD_DEFAULT was int 1; now is null
- * PASSWORD_BCRYPT was int 1; now is string '2y'
- * PASSWORD_ARGON2I was int 2; now is string 'argon2i'
- * PASSWORD_ARGON2ID was int 3; now is string 'argon2id'
-
- Applications correctly using the constants PASSWORD_DEFAULT,
- PASSWORD_BCRYPT, PASSWORD_ARGON2I, and PASSWORD_ARGON2ID will continue to
- function correctly.
- . htmlentities() will now throw a notice (instead of a strict standards
- warning) if it is used with an encoding for which only basic entity
- substitution is supported, in which case it is equivalent to
- htmlspecialchars().
- . fread() and fwrite() will now return false if the operation failed.
- Previously an empty string or 0 was returned. EAGAIN/EWOULDBLOCK are not
- considered failures.
- . fread() and fwrite() on plain files will now throw a notice on failure,
- such as when trying to write to a read-only file resource.
- . round(-0.0) will now return -0.0 rather than +0.0.
-
-- Tokenizer:
- . token_get_all() will now emit a T_BAD_CHARACTER token for unexpected
- characters instead of leaving behind holes in the token stream.
-
-========================================
-2. New Features
-========================================
-
-- Core:
- . Added support for typed properties. For example:
-
- class User {
- public int $id;
- public string $name;
+ . Methods with the same name as the class are no longer interpreted as
+ constructors. The __construct() method should be used instead.
+ . Removed ability to call non-static methods statically.
+ . Removed (unset) cast.
+ . Removed track_errors ini directive. This means that $php_errormsg is no
+ longer available. The error_get_last() function may be used instead.
+ . Removed the ability to define case-insensitive constants. The third
+ argument to define() may no longer be true.
+ . Access to undefined constants now always results in an Error exception.
+ Previously, unqualified constant accesses resulted in a warning and were
+ interpreted as strings.
+ . Removed ability to specify an autoloader using an __autoload() function.
+ spl_autoload_register() should be used instead.
+ . Removed the $errcontext argument for custom error handlers.
+ . Removed create_function(). Anonymous functions may be used instead.
+ . Removed each(). foreach or ArrayIterator should be used instead.
+ . Removed ability to unbind $this from closures that were created from a
+ method, using Closure::fromCallable() or ReflectionMethod::getClosure().
+ . Any array that has a number n as its first numeric key will use n+1 for
+ its next implicit key. Even if n is negative.
+ RFC: https://wiki.php.net/rfc/negative_array_index
+ . The default error_reporting level is now E_ALL. Previously it excluded
+ E_NOTICE and E_DEPRECATED.
+ . display_startup_errors is now enabled by default.
+ . Using "parent" inside a class that has no parent will now result in a
+ fatal compile-time error.
+ . The @ operator will no longer silence fatal errors (E_ERROR, E_CORE_ERROR,
+ E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_PARSE). Error handlers
+ that expect error_reporting to be 0 when @ is used, should be adjusted to
+ use a mask check instead:
+
+ // Replace
+ function my_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() == 0) {
+ return; // Silenced
+ }
+ // ...
}
- This will enforce that $user->id can only be assigned integers and
- $user->name can only be assigned strings. For more information see the
- RFC: https://wiki.php.net/rfc/typed_properties_v2
-
- . Added support for arrow functions with implicit by-value scope binding.
- For example:
-
- $factor = 10;
- $nums = array_map(fn($num) => $num * $factor, $nums);
-
- RFC: https://wiki.php.net/rfc/arrow_functions_v2
-
- . Added support for limited return type covariance and argument type
- contravariance. The following code will now work:
-
- class A {}
- class B extends A {}
-
- class Producer {
- public function method(): A {}
- }
- class ChildProducer extends Producer {
- public function method(): B {}
+ // With
+ function my_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (!(error_reporting() & $err_no)) {
+ return; // Silenced
+ }
+ // ...
}
- Full variance support is only available if autoloading is used. Inside a
- single file only non-cyclic type references are possible, because all
- classes need to be available before they are referenced.
- RFC: https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters
-
- . Added support for coalesce assign (??=) operator. For example:
-
- $array['key'] ??= computeDefault();
- // is roughly equivalent to
- if (!isset($array['key'])) {
- $array['key'] = computeDefault();
- }
-
- RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator
-
- . Added support for unpacking inside arrays. For example:
-
- $arr1 = [3, 4];
- $arr2 = [1, 2, ...$arr1, 5];
- // $arr2 == [1, 2, 3, 4, 5]
-
- RFC: https://wiki.php.net/rfc/spread_operator_for_array
-
- . Added support for underscore separators in numeric literals. Some examples:
-
- 6.674_083e-11; // float
- 299_792_458; // decimal
- 0xCAFE_F00D; // hexadecimal
- 0b0101_1111; // binary
+ Additionally, care should be taken that error messages are not displayed in
+ production environments, which can result in information leaks. Please
+ ensure that display_errors=Off is used in conjunction with error logging.
+ . Inheritance errors due to incompatible method signatures (LSP violations)
+ will now always generate a fatal error. Previously a warning was generated
+ in some cases.
+ RFC: https://wiki.php.net/rfc/lsp_errors
+ . The precedence of the concatenation operator has changed relative to
+ bitshifts and addition as well as subtraction.
+ RFC: https://wiki.php.net/rfc/concatenation_precedence
+ . Arguments with a default-value that resolves to null at run-time will no
+ longer implicitly mark the argument type as nullable. Either use an explicit
+ nullable type, or an explicit null default value instead.
+
+ // Replace
+ function test(int $arg = CONST_RESOLVING_TO_NULL) {}
+ // With
+ function test(?int $arg = CONST_RESOLVING_TO_NULL) {}
+ // Or
+ function test(int $arg = null) {}
+ . A number of warnings have been converted into Error exceptions:
+
+ * Attempting to write to a property of a non-object. Previously this
+ implicitly created an stdClass object for null, false and empty strings.
+ * Attempting to append an element to an array for which the PHP_INT_MAX key
+ is already used.
+ * Attempting to use an invalid type (array or object) as an array key or
+ string offset.
+ * Attempting to write to an array index of a scalar value.
+ * Attempting to unpack a non-array/Traversable.
+
+ A number of notices have been converted into warnings:
+
+ * Attempting to read an undefined variable.
+ * Attempting to read an undefined property.
+ * Attempting to read a property of a non-object.
+ * Attempting to access an array index of a non-array.
+ * Attempting to convert an array to string.
+ * Attempting to use a resource as an array key.
+ * Attempting to use null, a boolean or a float as a string offset.
+ * Attempting to read an out-of-bounds string offset.
+
+ RFC: https://wiki.php.net/rfc/engine_warnings
+ . Unexpected characters in source files (such as null bytes outside of
+ strings) will now result in a ParseError exception instead of a compile
+ warning.
+ . Uncaught exceptions now go through "clean shutdown", which means that
+ destructors will be called after an uncaught exception.
- RFC: https://wiki.php.net/rfc/numeric_literal_separator
-
- . Support for WeakReferences has been added.
- RFC: https://wiki.php.net/rfc/weakrefs
-
- . Throwing exceptions from __toString() is now permitted. Previously this
- resulted in a fatal error. Existing recoverable fatals in string conversions
- have been converted to Error exceptions.
- RFC: https://wiki.php.net/rfc/tostring_exceptions
+- COM:
+ . Removed the ability to import case-insensitive constants from type
+ libraries. The second argument to com_load_typelib() may no longer be false;
+ com.autoregister_casesensitive may no longer be disabled; case-insensitive
+ markers in com.typelib_file are ignored.
-- CURL:
- . CURLFile now supports stream wrappers in addition to plain file names, if
- the extension has been built against libcurl >= 7.56.0. The streams may
- need to be seekable.
+- Date:
+ . mktime() and gmmktime() now require at least one argument. time() can be
+ used to get the current timestamp.
+
+- dom:
+ . Remove unimplemented classes from ext/dom that had no behavior and contained
+ test data. These classes have also been removed in the latest version of DOM
+ standard:
+
+ * DOMNameList
+ * DomImplementationList
+ * DOMConfiguration
+ * DomError
+ * DomErrorHandler
+ * DOMImplementationSource
+ * DOMLocator
+ * DOMUserDataHandler
+ * DOMTypeInfo
+
+- Exif:
+ . Removed read_exif_data(). exif_read_data() should be used instead.
- Filter:
- . The FILTER_VALIDATE_FLOAT filter now supports the min_range and max_range
- options, with the same semantics as FILTER_VALIDATE_INT.
-
-- FFI:
- . A new extension which provides a simple way to call native functions, access
- native variables and create/access data structures defined in C libraries.
- RFC: https://wiki.php.net/rfc/ffi
+ . The FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED flags for the
+ FILTER_VALIDATE_URL filter have been removed. The scheme and host are (and
+ have been) always required.
+ . The INPUT_REQUEST and INPUT_SESSION source for filter_input() etc have been
+ removed. These were never implemented and their use always generated a
+ warning.
- GD:
- . Added the "scatter" image filter (IMG_FILTER_SCATTER) to apply a scatter
- filter to images. This filter has the following prototype:
+ . The GD extension now uses objects as the underlying data structure for
+ images, rather than resources. These objects are completely opaque, i.e.
+ they don't have any methods.
+ . The deprecated function image2wbmp() has been removed.
+ RFC: https://wiki.php.net/rfc/image2wbmp
+ . The deprecated functions png2wbmp() and jpeg2wbmp() have been removed.
+ RFC: https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp
+ . The default $mode parameter of imagecropauto() no longer accepts -1.
+ IMG_CROP_DEFAULT should be used instead.
+
+- GMP:
+ . gmp_random() has been removed. One of gmp_random_range() or
+ gmp_random_bits() should be used instead.
- imagefilter($im, IMG_FILTER_SCATTER, int $sub, int $plus, array $colors = []);
-
- The $colors array can be populated with a set of indexed colors to
- apply the scatter pixel shifting on.
-
- Note, the result of this filter is always random.
+- Intl:
+ . The deprecated constant INTL_IDNA_VARIANT_2003 has been removed.
+ RFC: https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003
+ . The deprecated Normalizer::NONE constant has been removed.
-- Hash:
- . Added "crc32c" hash using Castagnoli's polynomial. This crc32 variant is
- used by storage systems, such as iSCSI, SCTP, Btrfs and ext4.
+- LDAP:
+ . The deprecated function ldap_sort has been removed.
- Mbstring:
- . Added mb_str_split() function, which provides the same functionality as
- str_split(), but operating on code points rather than bytes.
- RFC: https://wiki.php.net/rfc/mb_str_split
- . Added mbstring.regex_retry_limit ini setting defaulting to 1000000. It
- limits the amount of backtracking that may be performed during one mbregex
- match and thus protects against exponential backtracking attacks (ReDOS).
- This setting only takes effect when linking against oniguruma >= 6.8.0.
-
-- OPcache:
- . Support for preloading code has been added.
- RFC: https://wiki.php.net/rfc/preload
+ . The mbstring.func_overload directive has been removed. The related
+ MB_OVERLOAD_MAIL, MB_OVERLOAD_STRING, and MB_OVERLOAD_REGEX constants have
+ also been removed. Finally, the "func_overload" and "func_overload_list"
+ entries in mb_get_info() have been removed.
+ . mb_parse_str() can no longer be used without specifying a result array.
+ . A number of deprecated mbregex aliases have been removed. See the following
+ list for which functions should be used instead:
+
+ * mbregex_encoding() -> mb_regex_encoding()
+ * mbereg() -> mb_ereg()
+ * mberegi() -> mb_eregi()
+ * mbereg_replace() -> mb_ereg_replace()
+ * mberegi_replace() -> mb_eregi_replace()
+ * mbsplit() -> mb_split()
+ * mbereg_match() -> mb_ereg_match()
+ * mbereg_search() -> mb_ereg_search()
+ * mbereg_search_pos() -> mb_ereg_search_pos()
+ * mbereg_search_regs() -> mb_ereg_search_regs()
+ * mbereg_search_init() -> mb_ereg_search_init()
+ * mbereg_search_getregs() -> mb_ereg_search_getregs()
+ * mbereg_search_getpos() -> mb_ereg_search_getpos()
+ * mbereg_search_setpos() -> mb_ereg_search_setpos()
+
+ . The 'e' modifier for mb_ereg_replace() has been removed.
+ mb_ereg_replace_callback() should be used instead.
+ . A non-string pattern argument to mb_ereg_replace() will now be interpreted
+ as a string instead of an ASCII codepoint. The previous behavior may be
+ restored with an explicit call to chr().
+ . The $is_hex parameter, which was not used internally, has been removed from
+ mb_decode_numericentity().
- PCRE:
- . The preg_replace_callback() and preg_replace_callback_array() functions now
- accept an additional $flags argument, with support for the
- PREG_OFFSET_CAPTURE and PREG_UNMATCHED_AS_NULL flags. This influences the
- format of the matches array passed to the callback function.
+ . When passing invalid escape sequences they are no longer intepreted as
+ literals. This behaviour previously required the X modifier - which is
+ now ignored.
- PDO:
- . The username and password can now be specified as part of the PDO DSN for
- the mysql, mssql, sybase, dblib, firebird and oci drivers. Previously this
- was only supported by the pgsql driver. If a username/password is specified
- both in the constructor and the DSN, the constructor takes precedence.
-
- new PDO("mysql:host=xxx;port=xxx;dbname=xxx;user=xxx;password=xxx");
+ . The method PDOStatement::setFetchMode() now accepts the following signature:
-- PDO_OCI:
- . PDOStatement::getColumnMeta() is now available
+ PDOStatement::setFetchMode($mode, $classname, $params)
-- PDO_SQLite:
- . PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows
- checking whether the statement is read-only, i.e. if it doesn't modify
- the database.
- . PDO::setAttribute(PDO::SQLITE_ATTR_EXTENDED_RESULT_CODES, true) enables the
- use of SQLite3 extended result codes in errorInfo().
+- PDO_ODBC:
+ . The php.ini directive pdo_odbc.db2_instance_name has been removed
-- SQLite3:
- . Added SQLite3::lastExtendedErrorCode() to fetch the last extended result
- code.
- . Added SQLite3::enableExtendedResultCodes($enable = true), which will make
- SQLite3::lastErrorCode() return extended result codes.
-
-- Standard:
- . strip_tags() now also accepts an array of allowed tags: Instead of
- strip_tags($str, '<a><p>') you can now write strip_tags($str, ['a', 'p']).
+- Reflection:
+ . The method signatures
- . A new mechanism for custom object serialization has been added, which
- uses two new magic methods:
+ ReflectionClass::newInstance($args)
+ ReflectionFunction::invoke($args)
+ ReflectionMethod::invoke($object, $args)
- // Returns array containing all the necessary state of the object.
- public function __serialize(): array;
+ have been changed to:
- // Restores the object state from the given data array.
- public function __unserialize(array $data): void;
+ ReflectionClass::newInstance(...$args)
+ ReflectionFunction::invoke(...$args)
+ ReflectionMethod::invoke($object, ...$args)
- The new serialization mechanism supersedes the Serializable interface,
- which will be deprecated in the future.
+ Code that must be compatible with both PHP 7 and PHP 8 can use the following
+ signatures to be compatible with both versions:
- RFC: https://wiki.php.net/rfc/custom_object_serialization
+ ReflectionClass::newInstance($arg = null, ...$args)
+ ReflectionFunction::invoke($arg = null, ...$args)
+ ReflectionMethod::invoke($object, $arg = null, ...$args)
- . A new 'max_depth' option for unserialize(), as well as an
- unserialize_max_depth ini setting have been added. These control the
- maximum depth of structures permitted during unserialization, and are
- intended to prevent stack overflows. The default depth limit is 4096 and
- can be disabled by setting unserialize_max_depth=0.
+ . The ReflectionType::__toString() method will now return a complete debug
+ representation of the type, and is no longer deprecated. In particular the
+ result will include a nullability indicator for nullable types. The format
+ of the return value is not stable and may change between PHP versions.
- . array_merge() and array_merge_recursive() may now be called without any
- arguments, in which case they will return an empty array. This is useful
- in conjunction with the spread operator, e.g. array_merge(...$arrays).
+- Socket:
+ . The deprecated AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES
+ flags for socket_addrinfo_lookup() have been removed.
- . proc_open() now accepts an array instead of a string for the command. In
- this case the process will be opened directly (without going through a
- shell) and PHP will take care of any necessary argument escaping.
+- SPL:
+ . SplFileObject::fgetss() has been removed.
+ . SplHeap::compare($a, $b) now specifies a method signature. Inheriting
+ classes implementing this method will now have to use a compatible
+ method signature.
- proc_open(['php', '-r', 'echo "Hello World\n";'], $descriptors, $pipes);
+- Standard:
+ . assert() will no longer evaluate string arguments, instead they will be
+ treated like any other argument. assert($a == $b) should be used instead of
+ assert('$a == $b'). The assert.quiet_eval ini directive and
+ ASSERT_QUIET_EVAL constants have also been removed, as they would no longer
+ have any effect.
+ . parse_str() can no longer be used without specifying a result array.
+ . fgetss() has been removed.
+ . The string.strip_tags filter has been removed.
+ . The needle argument of strpos(), strrpos(), stripos(), strripos(), strstr(),
+ strchr(), strrchr(), and stristr() will now always be interpreted as a
+ string. Previously non-string needles were interpreted as an ASCII code
+ point. An explicit call to chr() can be used to restore the previous
+ behavior.
+ . The needle argument for strpos(), strrpos(), stripos(), strripos(), strstr() and stristr() can now be empty.
+ . The length argument for substr(), substr_count(), substr_compare(), and
+ iconv_substr() can now be null. Null values will behave as if no length
+ argument was provided and will therefore return the remainder of the string
+ instead of an empty string.
+ . The length argument for array_splice() can now be null. Null values will
+ behave identically to omitting the argument, thus removing everything from
+ the 'offset' to the end of the array.
+ . The 'salt' option of password_hash() is no longer supported. If the 'salt'
+ option is used a warning is generated, the provided salt is ignored, and a
+ generated salt is used instead.
+ . The quotemeta() function will now return an empty string if an empty string
+ was passed. Previously false was returned.
+
+- tidy:
+ . The $use_include_path parameter, which was not used internally, has been
+ removed from tidy_repair_string().
+
+- XML:
+ . xml_parser_create(_ns) will now return an XmlParser object rather than a
+ resource. Return value checks using is_resource() should be replaced with
+ checks for `false`. The xml_parser_free() function no longer has an effect,
+ instead the XmlParser instance is automatically destroyed if it is no longer
+ referenced.
+
+- XMLWriter:
+ . The XMLWriter functions now accept and return, respectively, XMLWriter
+ objects instead of resources.
- . proc_open() now supports "redirect" and "null" descriptors. For example:
+- Zip:
+ . The remove_path option of ZipArchive::addGlob() and ::addPattern() is now
+ treated as arbitrary string prefix (for consistency with the add_path
+ option), whereas formerly it was treated as directory name. This means that
+ if no trailing directory separator is given, the following character is
+ no longer stripped from the filename.
- // Like 2>&1 on the shell
- proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect', 1]], $pipes);
- // Like 2>/dev/null or 2>nul on the shell
- proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['null']], $pipes);
+- Zlib:
+ . gzgetss() has been removed.
- . password_hash() has argon2i(d) implementations from ext/sodium when PHP is
- built without libargon.
+========================================
+2. New Features
+========================================
- RFC: https://wiki.php.net/rfc/sodium.argon.hash
+- Core:
+ . Added ValueError class.
========================================
3. Changes in SAPI modules
@@ -362,451 +324,48 @@ PHP 7.4 UPGRADE NOTES
4. Deprecated Functionality
========================================
-- Core:
- . Nesting ternary operators without explicit parentheses is deprecated:
-
- // Code like
- $a ? $b : $c ? $d : $e
- // should be replaced by (current interpretation)
- ($a ? $b : $c) ? $d : $e
- // or (likely intended interpretation)
- $a ? $b : ($c ? $d : $e)
-
- RFC: https://wiki.php.net/rfc/ternary_associativity
- . The array and string offset access syntax using curly braces is deprecated.
- Use $str[$idx] instead of $str{$idx}.
- RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
- . The (real) cast is deprecated, use (float) instead.
- . Unbinding $this of a non-static method through a combination of
- ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing
- so is equivalent to calling a non-static method statically, which has been
- deprecated since PHP 7.0.
- . Unbinding $this of a non-static closure that uses $this is deprecated.
- . Using "parent" inside a class without a parent is deprecated, and will throw
- a compile-time error in the future. Currently an error will only be
- generated if/when the parent is accessed at run-time.
- . The allow_url_include ini directive is deprecated. Enabling it will generate
- a deprecation notice at startup.
-
-- COM:
- . Importing type libraries with case-insensitive constant registering has been
- deprecated.
-
-- Filter:
- . FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES
- instead.
-
-- Mbstring:
- . Passing a non-string pattern to mb_ereg_replace() is deprecated. Currently
- non-string patterns are interpreted as ASCII codepoints. In PHP 8 the
- pattern will be interpreted as a string instead.
- . Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead
- pass a 0 offset and encoding as 4th parameter.
-
-- LDAP:
- . ldap_control_paged_result_response and ldap_control_paged_result are
- deprecated. Pagination controls can be sent along with ldap_search instead.
-
-- Reflection:
- . Calls to ReflectionType::__toString() now generate a deprecation notice.
- This method has been deprecated in favor of ReflectionNamedType::getName()
- in the documentation since PHP 7.1, but did not throw a deprecation notice
- for technical reasons.
- . The export() methods on all Reflection classes are deprecated. Construct a
- Reflection object and convert it to string instead:
-
- // ReflectionClass::export(Foo::class, false) is:
- echo new ReflectionClass(Foo::class), "\n";
- // $str = ReflectionClass::export(Foo::class, true) is:
- $str = (string) new ReflectionClass(Foo::class);
-
-- Socket:
- . The AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES flags for
- socket_addrinfo_lookup() are deprecated, due to an upstream deprecation in
- glibc.
-
-- Standard:
- . Passing invalid characters to ''base_convert()'', ''bindec()'', ''octdec()''
- and ''hexdec()'' will now generate a deprecation notice. The result will
- still be computed as if the invalid characters did not exist. Leading and
- trailing whitespace, as well as prefixes of type 0x (depending on base)
- continue to be allowed.
- . Using array_key_exists() on objects is deprecated. Instead either isset()
- or property_exists() should be used.
- . The is_real() function is deprecated, use is_float() instead.
- . The get_magic_quotes_gpc() and get_magic_quotes_runtime() functions are
- deprecated. They always return false.
- . The hebrevc() function is deprecated. It can be replaced with
- nl2br(hebrev($str)), or preferably the use of Unicode RTL support.
- . The convert_cyr_string() function is deprecated. It can be replaced by one
- of mb_convert_string(), iconv() or UConverter.
- . The money_format() function is deprecated. It can be replaced by the
- intl NumberFormatter functionality.
- . The ezmlm_hash() function is deprecated.
- . The restore_include_path() function is deprecated. It can be replaced by
- ini_restore('include_path').
- . Passing parameters to implode() in reverse order is deprecated, use
- implode($glue, $parts) instead of implode($parts, $glue).
-
========================================
5. Changed Functions
========================================
-- SPL:
- . SplFileObject::fputcsv(), ::fgetcsv() and ::setCsvControl() now accept an
- empty string as $escape argument, which disables the proprietary PHP
- escaping mechanism. SplFileObject::getCsvControl() now may also return an
- empty string for the third array element, accordingly.
-
-- Standard:
- . fputcsv() and fgetcsv() now accept an empty string as $escape argument,
- which disables the proprietary PHP escaping mechanism. The behavior of
- str_getcsv() has been adjusted accordingly (formerly, an empty string was
- identical to using the default).
- . proc_open() on Windows can be passed a "create_process_group" option. It
- is required, if the child process is supposed to handle CTRL events.
- . password_hash() now accepts nullable string and int as $algo argument.
- . password_needs_rehash() now accepts nullable string and int as $algo
- argument.
-
========================================
6. New Functions
========================================
-- Core:
- . Added get_mangled_object_vars($object) function, which returns the mangled
- object properties. It returns the same result as (array) $object, with the
- exception that it ignores overloaded array casts, such as used by
- ArrayObject.
-
-- GD:
- . Added imagecreatefromtga() function, which allows reading images in TGA
- format. TGA support is now also indicated by gd_info() and imagetypes().
- Note that TGA images are not recognized by imagecreatefromstring() and
- getimagesize().
-
-- OpenSSL:
- . Added openssl_x509_verify(mixed cert, mixed key) function that verifies the
- signature of the certificate using a public key. A wrapper around the
- OpenSSL's X509_verify() function.
- See <https://github.com/php/php-src/pull/3624>.
-
-- Pcntl:
- . Added bool pcntl_unshare(int flags) function which allows dissociating
- parts of the process execution context which are currently being shared with
- other processes. Explicitly, it allows you to unshare the mount, IPC, UTS,
- network, PID, user and cgroup namespaces.
-
-- SQLite3:
- . Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If true is
- passed as $expanded argument, query parameters will be replaced in the
- return value by their currently bound value, if libsqlite ≥ 3.14 is used.
- . Added SQLite3::backup() to create database backups via the SQLite3 online
- backup API.
-
-- Standard
- . bool sapi_windows_set_ctrl_handler(callable handler, [, bool add = true]) -
- set or remove a handler function upon receiving a CTRL event. The handler
- function is expected to have this signature: "function handler(int $event)".
- . bool sapi_windows_generate_ctrl_event(int type, int pid) - send a CTRL event
- to another process.
- . array password_algos() - return a complete list of all registered password
- hashing algorithms. For more details see the RFC:
- https://wiki.php.net/rfc/password_registry
+- Standard:
+ . Added fdiv() method, which performs a floating-point devision under
+ IEEE 754 semantics. Division by zero is considered well-defined and
+ will return one of Inf, -Inf or NaN.
========================================
7. New Classes and Interfaces
========================================
-- Reflection:
- . A new ReflectionReference class has been added, which allows detecting
- references and comparing them for identity. For more details see the RFC:
- https://wiki.php.net/rfc/reference_reflection
-
========================================
8. Removed Extensions and SAPIs
========================================
-- Interbase:
- . The interbase extension has been moved to PECL. Access to an InterBase
- and/or FireBird based database is still available with the PDO_Firebird
- extension. For more details see the RFC:
- https://wiki.php.net/rfc/deprecate-and-remove-ext-interbase
-
-- Recode:
- . The recode extension has been moved to PECL. For character set/encoding
- conversion the iconv or mbstring extensions could be used instead.
- RFC: https://wiki.php.net/rfc/unbundle_recode
-
-- WDDX:
- . The WDDX extension has been deprecated and moved to PECL.
- RFC: https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx
-
========================================
9. Other Changes to Extensions
========================================
-- GD:
- . The behavior of imagecropauto() in the bundled libgd has been synced with
- that of system libgd:
- * IMG_CROP_DEFAULT is no longer falling back to IMG_CROP_SIDES
- * Threshold-cropping now uses the algorithm of system libgd
- . The default $mode parameter of imagecropauto() has been changed to
- IMG_CROP_DEFAULT; passing -1 is now deprecated.
- . imagescale() now supports aspect ratio preserving scaling to a fixed height
- by passing -1 as $new_width.
-
-- Filter:
- . The filter extension no longer exposes --with-pcre-dir for Unix builds and
- can now reliably be built as shared when using ./configure once more.
-
-- Hash:
- . The hash extension cannot be disabled anymore and is always an integral part
- of any PHP build, similar to the date extension.
-
-- Intl:
- . The Intl extension now requires at least ICU 50.1.
- . ResourceBundle now implements Countable.
-
-- Ldap:
- . Support for nsldap has been removed.
- . Support for umich_ldap has been removed.
-
-- Libxml:
- . All libxml based extensions now require libxml 2.7.6 or newer.
-
-- Mbstring:
- . The oniguruma library is no longer bundled with PHP, instead libonig needs
- to be available on the system. Alternatively --disable-mbregex can be used
- to disable the mbregex component.
-
-- OPcache:
- . The --disable-opcache-file|--enable-opcache-file configure options have been
- removed in favor of the opcache.file_cache INI directive.
-
-- PDO:
- . It is now possible to escape question marks in SQL queries to avoid them
- being interpreted as parameter placeholders. Writing "??" allows sending
- a single question mark to the database and e.g. use the PostgreSQL JSON key
- exists "?" operator. For more details see the RFC:
- https://wiki.php.net/rfc/pdo_escape_placeholders
-
-- Reflection:
- . Numeric value of class, property, function and constant modifiers was
- changed. Don't filter methods and properties through
- ReflectionClass::getMethods() and ReflectionClass::getProperties(), or test
- results of Reflection...::getModifiers(), using hard-coded numeric values.
- Use corresponding constants instead (e.g. ReflectionMethod::IS_PUBLIC).
-
-- SimpleXML:
- . SimpleXMLElement now implements Countable.
-
-- SQLite3:
- . The bundled libsqlite has been removed. To build the SQLite3 extension a
- system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite extension
- a system libsqlite3 ≥ 3.5.0 is now required.
- . (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now
- explicitly forbidden. Formerly, serialization of instances of these classes
- was possible, but unserialization yielded unusable objects.
- . The @param notation can now also be used to denote SQL query parameters.
-
-- Zip:
- . The bundled libzip library has been removed. A system libzip >= 0.11 is now
- necessary to build the extension.
-
========================================
10. New Global Constants
========================================
-- Mbstring:
- . MB_ONIGURUMA_VERSION specifies the version of the oniguruma library against
- which mbregex has been built.
-
-- Socket:
- . Added FreeBSD-specific socket options:
- . SO_LABEL
- . SO_PEERLABEL
- . SO_LISTENQLIMIT
- . SO_LISTENQLEN
- . SO_USER_COOKIE
-
-- Standard:
- . PHP_WINDOWS_EVENT_CTRL_C
- . PHP_WINDOWS_EVENT_CTRL_BREAK
-
-- Tidy:
- . TIDY_TAG_ARTICLE
- . TIDY_TAG_ASIDE
- . TIDY_TAG_AUDIO
- . TIDY_TAG_BDI
- . TIDY_TAG_CANVAS
- . TIDY_TAG_COMMAND
- . TIDY_TAG_DATALIST
- . TIDY_TAG_DETAILS
- . TIDY_TAG_DIALOG
- . TIDY_TAG_FIGCAPTION
- . TIDY_TAG_FIGURE
- . TIDY_TAG_FOOTER
- . TIDY_TAG_HEADER
- . TIDY_TAG_HGROUP
- . TIDY_TAG_MAIN
- . TIDY_TAG_MARK
- . TIDY_TAG_MENUITEM
- . TIDY_TAG_METER
- . TIDY_TAG_NAV
- . TIDY_TAG_OUTPUT
- . TIDY_TAG_PROGRESS
- . TIDY_TAG_SECTION
- . TIDY_TAG_SOURCE
- . TIDY_TAG_SUMMARY
- . TIDY_TAG_TEMPLATE
- . TIDY_TAG_TIME
- . TIDY_TAG_TRACK
- . TIDY_TAG_VIDEO
-
========================================
11. Changes to INI File Handling
========================================
-- zend.exception_ignore_args
- . New INI directive to include or exclude arguments from stack traces
- generated for exceptions.
-
-- opcache.preload_user
- . New INI directive to specify the user account under which preloading code
- is executed, if it was to be run as root otherwise (which is not allowed
- for security reasons).
-
========================================
12. Windows Support
========================================
-- stat:
- . The stat implementation has been refactored.
- - An inode number is delivered and is based on the NTFS file index.
- - The device number is now based on the volume serial number.
-
- Note that both values are derived from the system and provided as is on 64-bit
- systems. On 32-bit systems, these values might overflow the 32-bit integer in
- PHP, so they're fake.
-
-- CTRL+C and CTRL+BREAK on console can be caught by setting a handler function
- with sapi_windows_set_ctrl_handler().
-
-- configure now regards additional CFLAGS and LDFLAGS set as environment
- variables.
-
-- OPcache now supports an arbitrary amount of separate caches per user via
- the INI directive opcache.cache_id. All processes with the same cache ID and
- user share an OPcache instance.
-
-- The OpenSSL default config path has been changed to
- "C:\Program Files\Common Files\SSL\openssl.cnf" and
- "C:\Program Files (x86)\Common Files\SSL\openssl.cnf", respectively.
-
========================================
-13. Migration to pkg-config
+13. Other Changes
========================================
-A number of extensions have been migrated to exclusively use pkg-config for the
-detection of library dependencies. Generally, this means that instead of using
---with-foo-dir=DIR or similar only --with-foo is used. Custom library paths can
-be specified either by adding additional directories to PKG_CONFIG_PATH or by
-explicitly specifying compilation options through FOO_CFLAGS and FOO_LIBS.
-
-The following extensions and SAPIs are affected:
-
-- Curl:
- . --with-curl no longer accepts a directory.
-
-- Enchant:
- . --with-enchant no longer accepts a directory.
-
-- FPM:
- . --with-fpm-systemd now uses only pkg-config for libsystem checks. The
- libsystemd minimum required version is 209.
-
-- GD:
- . --with-gd becomes --enable-gd (whether to enable the extension at all) and
- --with-external-gd (to opt into using an external libgd, rather than the
- bundled one).
- . --with-png-dir has been removed. libpng is required.
- . --with-zlib-dir has been removed. zlib is required.
- . --with-freetype-dir becomes --with-freetype.
- . --with-jpeg-dir becomes --with-jpeg.
- . --with-webp-dir becomes --with-webp.
- . --with-xpm-dir becomes --with-xpm.
-
-- IMAP:
- . --with-kerberos no longer accepts a directory.
-
-- Intl:
- . --with-icu-dir has been removed. If --enable-intl is passed, then libicu is
- always required.
-
-- Ldap:
- . --with-ldap-sasl no longer accepts a directory.
-
-- Libxml:
- . --with-libxml-dir has been removed.
- . --enable-libxml becomes --with-libxml.
- . --with-libexpat-dir has been renamed to --with-expat and no longer accepts a
- directory.
-
-- LiteSpeed:
- . --with-litespeed becomes --enable-litespeed.
-
-- Mbstring:
- . --with-onig has been removed. Unless --disable-mbregex has been passed,
- libonig is required.
-
-- ODBC:
- . --with-iodbc no longer accepts a directory.
- . --with-unixODBC without a directory now uses pkg-config (preferred).
- Directory is still accepted for old versions without libodbc.pc.
-
-- OpenSSL:
- . --with-openssl no longer accepts a directory.
- . --with-kerberos no longer accepts a directory.
-
-- PCRE:
- . --with-pcre-regex has been removed. Instead --with-external-pcre is provided
- to opt into using an external PCRE library, rather than the bundled one.
-
-- PDO_SQLite:
- . --with-pdo-sqlite no longer accepts a directory.
-
-- Readline:
- . --with-libedit no longer accepts a directory.
-
-- Sodium:
- . --with-sodium no longer accepts a directory.
-
-- SQLite3:
- . --with-sqlite3 no longer accepts a directory.
-
-- XSL:
- . --with-xsl no longer accepts a directory.
-
-- Zip:
- . --with-libzip has been removed.
- . --enable-zip becomes --with-zip.
-
========================================
-14. Other Changes
+14. Performance Improvements
========================================
-========================================
-15. Performance Improvements
-========================================
-
-- Core:
- . A specialized VM opcode for the array_key_exists() function has been added,
- which improves performance of this function if it can be statically
- resolved. In namespaced code, this may require writing \array_key_exists()
- or explicitly importing the function.
-
-- PCRE:
- . When preg_match() in UTF-8 mode ("u" modifier) is repeatedly called on the
- same string (but possibly different offsets), it will only be checked for
- UTF-8 validity once.
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 8c85e6ddd0..7c4ed27a62 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -1,31 +1,16 @@
-PHP 7.4 INTERNALS UPGRADE NOTES
+PHP 8.0 INTERNALS UPGRADE NOTES
1. Internal API changes
- a. php_sys_symlink() and php_sys_link()
- b. zend_lookup_class_ex() and zend_fetch_class_by_name()
- c. Function/property/class flags
- d. Removed zend_check_private()
- e. php_win32_error_to_msg() memory management
- f. get_properties_for() handler / Z_OBJDEBUG_P
- g. Required object handlers
- h. Immutable classes and op_arrays
- i. php_fgetcsv() and php_fputcsv()
- j. Removed add_get_assoc_*() and add_get_index_*()
- k. Class declaration opcodes
- l. HASH_FLAG_INITIALIZED
- m. write_property return value
- n. Assignments to references
- o. ZEND_COMPILE_EXTENDED_INFO split
- p. ZEND_EXT_FCALL_BEGIN can access arguments
- q. ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
- r. TSRM environment locking
- s. Typed references support
- t. Exceptions thrown by string conversions.
- u. Removed uint and ulong typedefs
- v. Compound assignment opcodes
- w. APACHE symbol removed
- x. php_error_docref0() renamed to php_error_docref()
- y. Stream wrapper read/write ops
+ a. Object Handlers API
+ b. ZEND_OVERLOADED_FUNCTION and corresponding call_method() object handler
+ c. TSRM changes
+ d. get() and set() object handlers
+ e. zend_parse_parameters 'L' specifier
+ f. Arginfo argument types
+ g. zend_free_op type and should_free argument of zend_get_zval_ptr()
+ h. zend_value_error()
+ i. get_closure() object handler
+ j. compare_objects() and compare() object handlers
2. Build system changes
a. Abstract
@@ -33,295 +18,88 @@ PHP 7.4 INTERNALS UPGRADE NOTES
c. Windows build system changes
3. Module changes
- a. ext/xml
- b. ext/hash
========================
1. Internal API changes
========================
- a. php_sys_symlink() and php_sys_link() portability macros have been
- added, which behave like POSIX's symlink() and link(), respectively, on
- POSIX compliant systems and on Windows.
-
- b. zend_lookup_class_ex() and zend_fetch_class_by_name() prototypes were
- changed to accept optional lower-case class name as zend_string*,
- instead of zval*.
-
- c. Function/property/class flags changes
- - ZEND_ACC_IMPLEMENTED_ABSTRACT is removed (it was used only internally
- during inheritance).
- - ZEND_ACC_IMPLICIT_PUBLIC is removed (it was used only for reflection)
- - ZEND_ACC_SHADOW property flag is removed. Instead of creating shadow
- clone, now we use the same private property_info, and should also
- check property_info->ce (in the same way as with methods).
- - ZEND_ACC_ANON_BOUND is replaced with ZEND_ACC_LINKED. This flag is set
- not only during anonymous classes declaration, but also during any
- run-time or compile-time class declaration.
- - ZEND_ACC_NO_RT_ARENA renamed into ZEND_ACC_HEAP_RT_CACHE. Now it's used
- not only for closures, but also for pseudo-main op_arrays.
- - ZEND_ACC_... flags are re-numbered.
-
- d. zend_check_private() is removed. Use (func->common.scope == scope) instead.
-
- e. Pointers returned by php_win32_error_to_msg() have to be freed using
- php_win32_error_msg_free(). Same regarding php_win_err() vs.
- php_win_err_free().
-
- f. A new, optional object handler with the signature
-
- HashTable *get_properties_for(zval *obj, zend_prop_purpose purpose)
-
- has been introduced, where zend_prop_purpose (currently) takes one of:
-
- ZEND_PROP_PURPOSE_DEBUG // var_dump etc.
- ZEND_PROP_PURPOSE_ARRAY_CAST // (array) $obj
- ZEND_PROP_PURPOSE_SERIALIZE // "O"-format serialization (__wakeup)
- ZEND_PROP_PURPOSE_VAR_EXPORT // var_export (__set_state)
- ZEND_PROP_PURPOSE_JSON // json_encode
-
- The handler returns a non-null HashTable with increased refcounted, and
- the return value must be released using zend_release_properties().
-
- This handler serves the same general function as get_properties(), but
- provides more control over different property uses, while also making
- it possible to return a temporary property table.
-
- get_properties() is still used in cases where none of the above purposes
- apply, but overloading get_properties() is generally discouraged. If you
- want to provide purposes for general usage rather than just debugging or
- serialization, please prefer using properly declared properties.
-
- get_debug_info() is superseded by get_properties_for() with the
- ZEND_PROP_PURPOSE_DEBUG purpose, but remains available for backwards-
- compatibility reasons. However, while it is fine to define this handler,
- it should never be directly called by consuming code.
-
- The Z_OBJDEBUG_P macro has been removed. It should be replaced by calls to
- zend_get_properties_for() with the ZEND_PROP_PURPOSE_DEBUG purpose:
-
- // OLD
- int is_temp;
- HashTable *ht = Z_OBJDEBUG_P(obj, is_temp);
- // ...
- if (is_temp) {
- zend_hash_destroy(ht);
- FREE_HASHTABLE(ht);
- }
-
- // NEW
- HashTable *ht = zend_get_properties_for(obj, ZEND_PROP_PURPOSE_DEBUG);
- // ...
- zend_release_properties(ht);
-
- g. The following object handlers are now required (must be non-NULL):
-
- * free_obj
- * dtor_obj
- * read_property
- * write_property
- * read_dimension
- * write_dimension
- * get_property_ptr_ptr
- * has_property
- * unset_property
- * has_dimension
- * unset_dimension
- * get_properties
- * get_method
- * get_constructor
- * get_class_name
- * get_gc
-
- It is recommended to initialize object handler structures by copying the
- std object handlers and only overwriting those you want to change.
-
- h. Opcache may make classes and op_arrays immutable. Such classes are marked
- by ZEND_ACC_IMMUTABLE flag, they are not going to be copied from opcache
- shared memory to process memory and must not be modified at all.
- Few related data structures were changed to allow addressing mutable data
- structures from immutable ones. This access is implemented through
- ZEND_MAP_PTR... abstraction macros and, basically, uses additional level of
- indirection. op_array->run_time_cache, op_array->static_variables_ptr and
- class_entry->static_members_table now have to be accessed through
- ZEND_MAP_PTR... macros.
- It's also not allowed to change op_array->reserved[] handles of immutable
- op_arrays. Instead, now you have to reserve op_array handle using
- zend_get_op_array_extension_handle() during MINIT and access its value
- using ZEND_OP_ARRAY_EXTENSION(op_array, handle).
-
- i. The type of the escape parameter of php_fgetcsv() and php_fputcsv() has
- been changed from char to int. This allows to pass the new constant macro
- PHP_CSV_NO_ESCAPE to this parameter, to disable PHP's proprietary escape
- mechanism.
-
- j. add_get_assoc_*() and add_get_index_*() are removed. Use add_assoc*(),
- add_index*() or zend_hash_*() API functions instead.
-
- k. Complex class declaration opcodes ZEND_ADD_INTERFACE, ZEND_ADD_TRAIT,
- ZEND_BIND_TRAITS and ZEND_VERIFY_ABSTRACT_CLASS were removed. Information
- about interfaces and traits is kept in zend_class_entry structure and
- actual linked performed by ZEND_DECLARE_...CLASS... opcode(s).
- Linked classes have ZEND_ACC_LINKED flag set.
-
- l. HASH_FLAG_INITIALIZED was reverted into HASH_FLAG_UNINITIALIZED. Special
- HT_IS_INITIALIZED() and HT_INVALIDATE() macro were introduced to hide
- implementation details.
-
- m. The write_property() object handler now returns the assigned value (after
- possible type coercions) rather than void. For extensions, it should
- usually be sufficient to return whatever was passed as the argument.
-
- n. Assignments to references now need to ensure that they respect property
- types that affect the reference. This means that references should no
- longer be directly assigned to, and instead a set of specialized macros of
- the form ZEND_TRY_ASSIGN* needs to be used. You can find detailed porting
- instructions as well as a compatibility shim in the wiki:
- https://wiki.php.net/rfc/typed_properties_v2#assignments_to_references
-
- o. ZEND_COMPILE_EXTENDED_INFO has been split into:
- ZEND_COMPILE_EXTENDED_FCALL and ZEND_COMPILE_EXTENDED_STMT
- This allows tooling to choose between profiling and debugging behaviour
- ZEND_COMPILE_EXTENDED_INFO remains and preserves behaviour.
-
- p. ZEND_EXT_BEGIN_FCALL is emitted after arguments are sent, this means
- that handlers may access arguments.
-
- q. ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
- are respected by zend_get_call_op such that when set, the only possible
- call opcodes are ZEND_DO_FCALL and ZEND_DO_FCALL_BY_NAME, previously they
- were ignored by zend_get_call_op.
-
- r. TSRM adds tsrm_env_lock() and tsrm_env_unlock() for ZTS:
- code that may change environ and may run concurrently with user code in ZTS
- is expected to use this exclusion API to maintain as much safety as
- reasonable. This results in "thread safe" getenv/putenv in Windows and
- Unix, however functions that may read the environment without exclusion
- still exist, for example:
- - setlocale
- - mktime
- - tzset
- The above is not an exhaustive list of such functions, while getenv/putenv
- will behave as if they are safe, care should still be taken in
- multi-threaded environments.
-
- s. Correct support for typed properties requires the use of new macros to
- assign values to references. For more information see
- https://wiki.php.net/rfc/typed_properties_v2#impact_on_extensions.
-
- t. convert_to_string() and zval_get_string() are now more likely to result in
- an exception. For instructions on how to gracefully handle this see
- https://wiki.php.net/rfc/tostring_exceptions#extension_guidelines.
-
- u. The Windows typedefs uint and ulong are no longer available, and have to be
- replaced with standard types.
-
- v. Compound assignment opcodes were changed. Instead of ZEND_ASSIGN_ADD (and
- others) with 0, ZEND_ASSIGN_DIM, ZEND_ASSIGN_OBJ or
- ZEND_ASSIGN_STATIC_PROP in extended value, now we use ZEND_ASSIGN_OP,
- ZEND_ASSIGN_DIM_OP, ZEND_ASSIGN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP with
- ZEND_ADD (or other) in extended_value.
-
- w. APACHE symbol has been removed and is no longer defined.
-
- x. php_error_docref0() has been removed and renamed to php_error_docref().
-
- y. The read and write operations of php_stream_ops now return ssize_t, with
- negative values indicating an error.
+ a. Object Handlers API and some related functions, e.g. zend_call_method() and
+ zend_objects_clone_obj() were changed to receive zend_object* instead of
+ zval* and zend_string* instead of zval* for property names.
+
+ b. ZEND_OVERLOADED_FUNCTION and corresponding call_method() object handler
+ were removed. ZEND_INTERNAL_FUNCTION with ZEND_ACC_CALL_VIA_HANDLER and
+ defined "handler" callback should be used instead. This "handler" callback
+ should also take care about function cleanup. See ext/zend_test/test.c
+ for example.
+
+ c. The following things have been removed from TSRM:
+ - TSRMLS_DC
+ - TSRMLS_D
+ - TSRMLS_CC
+ - TSRMLS_C
+ - TSRMLS_FETCH
+ - TSRMLS_FETCH_FROM_CTX
+ - TSRMLS_SET_CTX
+ - tsrm_new_interpreter_context
+ - tsrm_set_interpreter_context
+ - tsrm_free_interpreter_context
+ - support for GNUPTH, SGI ST, and BETHREADS
+
+ d. The get() and set() object handlers have been removed. The get() handler
+ can generally be replaced with cast_object(). Some uses of set() may be
+ replaced by do_operation(). If set() was used to overload direct
+ assignments using "=", then this is no longer supported and the
+ functionality should be provided in some other way (for example, as
+ modification of an object property).
+
+ e. The zend_parse_parameters 'L' specifier and the Z_PARAM_STRICT_LONG()
+ family of macros have been removed. Use 'l' and Z_PARAM_LONG() instead,
+ which, despite the confusing name, actually have stricter input validation.
+
+ f. Arginfo argument types for internal functions are no longer checked.
+ Instead type checks should be performed using the zend_parse_parameters()
+ or ZEND_PARSE_PARAMETERS_*() APIs.
+
+ g. zend_free_op type and "should_free" argument of zend_get_zval_ptr() were
+ removed. It's possible to get the old "should_free" value using the
+ following code.
+
+ zval *ret = zend_get_zval_ptr(opline, opline->op1_type, &opline->op1,
+ execute_data, BP_VAR_R);
+ zval *should_free = (op_type & (IS_TMP_VAR|IS_VAR)) ? ret : NULL;
+
+ h. Added the zend_value_error() function, which is intended to be used
+ to raise ValueError when inappropriate argument values are passed
+ to functions.
+
+ i. get_closure() object handlers now accept an additional zend_bool parameter
+ `check_only`. If it is true, the handler is called to check whether the
+ object is callable; in this case the handler should not throw an exception.
+
+ j. compare_objects() handler was removed. Extensions should use compare() object
+ handler instead and check if both arguments are objects and have the same
+ compare handler, using ZEND_COMPARE_OBJECTS_FALLBACK() macro.
========================
2. Build system changes
========================
a. Abstract
- - The hash extension is now always available, meaning the --enable-hash
- configure argument has been removed.
- - The filter extension no longer exposes the --with-pcre-dir configure
- argument and therefore allows shared builds with ./configure for Unix
- builds.
- - Symbols HAVE_DATE, HAVE_REFLECTION, and HAVE_SPL have been removed. It
- should be considered to have these extensions always available.
- - Removed unused build time symbols: PHP_ADA_INCLUDE, PHP_ADA_LFLAGS,
- PHP_ADA_LIBS, PHP_APACHE_INCLUDE, PHP_APACHE_TARGET, PHP_FHTTPD_INCLUDE,
- PHP_FHTTPD_LIB, PHP_FHTTPD_TARGET, PHP_CFLAGS, PHP_DBASE_LIB,
- PHP_BUILD_DEBUG, PHP_GDBM_INCLUDE, PHP_IBASE_INCLUDE, PHP_IBASE_LFLAGS,
- PHP_IBASE_LIBS, PHP_IFX_INCLUDE, PHP_IFX_LFLAGS, PHP_IFX_LIBS,
- PHP_INSTALL_IT, PHP_IODBC_INCLUDE, PHP_IODBC_LFLAGS, PHP_IODBC_LIBS,
- PHP_MSQL_LFLAGS, PHP_MSQL_INCLUDE, PHP_MSQL_LFLAGS, PHP_MSQL_LIBS,
- PHP_MYSQL_INCLUDE, PHP_MYSQL_LIBS, PHP_MYSQL_TYPE, PHP_OCI8_SHARED_LIBADD,
- PHP_ORACLE_SHARED_LIBADD, PHP_ORACLE_DIR, PHP_ORACLE_VERSION,
- PHP_PGSQL_INCLUDE, PHP_PGSQL_LFLAGS, PHP_PGSQL_LIBS, PHP_SOLID_INCLUDE,
- PHP_SOLID_LIBS, PHP_EMPRESS_INCLUDE, PHP_EMPRESS_LIBS, PHP_SYBASE_INCLUDE,
- PHP_SYBASE_LFLAGS, PHP_SYBASE_LIBS, PHP_DBM_TYPE, PHP_DBM_LIB,
- PHP_LDAP_LFLAGS, PHP_LDAP_INCLUDE, PHP_LDAP_LIBS.
- - Removed unused symbols: HAVE_CURL_EASY_STRERROR, HAVE_CURL_MULTI_STRERROR,
- HAVE_MPIR, HAVE_MBSTR_CN, HAVE_MBSTR_JA, HAVE_MBSTR_KR, HAVE_MBSTR_RU,
- HAVE_MBSTR_TW.
+ - Symbol HAVE_HASH_EXT is removed and is no longer defined. It should be
+ considered to have hash extension always available since PHP 7.4.
+ - Symbol HAVE_PCRE is removed and is no longer defined. It should be
+ considered to have pcre extension always available since PHP 7.4.
+ - Symbol HAVE_LOCALE_H has been removed and is no longer defined.
b. Unix build system changes
- - Added --ini-path and --ini-dir options to php-config.
- - configure --help now also outputs --program-suffix and --program-prefix
- information by using the Autoconf AC_ARG_PROGRAM macro.
- - Obsolescent macros AC_FUNC_VPRINTF and AC_FUNC_UTIME_NULL have been
- removed. Symbols HAVE_VPRINTF and HAVE_UTIME_NULL are no longer defined
- since they are not needed on the current systems.
- - Local PHP m4 unused or obsolete macros have been removed:
- PHP_TARGET_RDYNAMIC, PHP_SOLARIS_PIC_WEIRDNESS, PHP_SYS_LFS,
- PHP_AC_BROKEN_SPRINTF, PHP_EXTENSION, PHP_DECLARED_TIMEZONE,
- PHP_CHECK_TYPES, PHP_CHECK_64BIT, PHP_READDIR_R_TYPE,
- PHP_SETUP_KERBEROS.
- - Local PHP_TM_GMTOFF m4 macro replaced with Autoconf's AC_CHECK_MEMBERS.
- The HAVE_TM_GMTOFF symbol is replaced with HAVE_STRUCT_TM_TM_GMTOFF and
- HAVE_TM_ZONE symbol is replaced with HAVE_STRUCT_TM_TM_ZONE.
- - new --enable-rtld-now build option allow to switch dlopen behavior
- from RTLD_LAZY to RTLD_NOW
- - Minimum Bison version is 3.0+ for generating parser files.
- - PHP_PROG_BISON macro now takes two optional arguments - minimum required
- version and excluded versions that aren't supported.
- - PHP_PROG_RE2C is not called in the generated configure.ac for extensions
- anymore and now takes one optional argument - minimum required version.
- - with-pcre-valgrind and with-valgrind are merged, and valgrind detected by
- pkgconfig
- - Removed unused AC_PROG_CC_C_O check and the NO_MINUS_C_MINUS_O symbol.
- - Obsolescant checks for headers and functions that are part of C89 have
- been removed. The following symbols are therefore no longer defined by the
- PHP build system at the configure step and shouldn't be used anymore:
- HAVE_SETLOCALE, HAVE_LOCALECONV, HAVE_STRSTR, HAVE_STRTOL, HAVE_STRBRK,
- HAVE_PERROR, HAVE_STRFTIME, HAVE_TZNAME, HAVE_STDARG_H, HAVE_STRING_H,
- HAVE_STDLIB_H, HAVE_SYS_VARARGS_H, HAVE_ASSERT_H, HAVE_SYS_DIR_H,
- TM_IN_SYS_TIME, HAVE_STRTOD, HAVE_STRCOLL, HAVE_ERRNO_H, HAVE_MEMCPY,
- HAVE_SNPRINTF, HAVE_STDIO_H, HAVE_STRPBRK, HAVE_TIME_H, HAVE_LIMITS_H,
- HAVE_STRTOUL, HAVE_SYS_NDIR_H, HAVE_SYS_TIMES_H, PHP_HAVE_STDINT_TYPES,
- HAVE_SIGNAL_H, HAVE_STRERROR.
- - Removed unused check for dev/arandom and the HAVE_DEV_ARANDOM symbol.
- - Remove unused functions checks: HAVE_MBSINIT, HAVE_MEMPCPY, HAVE_SETPGID,
- HAVE_STRPNCPY, HAVE_STRTOULL, HAVE_VSNPRINTF, HAVE_CUSERID, HAVE_LRAND48,
- HAVE_RANDOM, HAVE_SRAND48, HAVE_SRANDOM, HAVE_STRDUP, HAVE_GCVT,
- HAVE_ISASCII, HAVE_LINK, HAVE_LOCKF, HAVE_SOCKOPT, HAVE_SETVBUF, HAVE_SIN,
- HAVE_TEMPNAM.
- - Unused check for struct cmsghdr and symbol HAVE_CMSGHDR have been removed.
- - Unused ApplicationServices/ApplicationServices.h headers check and
- HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H symbol have been removed.
- - PHP_DEBUG_MACRO macro has been removed.
- - PHP_CHECK_CONFIGURE_OPTIONS macro has been removed. Default Autoconf's
- --enable-option-checking=fatal option can be used in the configure step
- to enable error when invalid options are used.
- - Removed unused check and symbols HAVE_SHM_MMAP_ZERO, HAVE_SHM_MMAP_FILE.
- - Removed unused check and symbol MISSING_MSGHDR_MSGFLAGS.
- c. Windows build system changes
+ 1. --enable-maintainer-zts is renamed --enable-zts for parity with Windows
+ and as recognition that ZTS is not a "maintainer" or experimental feature.
- . Visual Studio 2019 is utilized for the Windows builds
- . Removed unused defined symbol HAVE_LIBBIND.
+ c. Windows build system changes
========================
3. Module changes
========================
- a. ext/xml
- - The public (internal) API of the ext/xml extension has been removed. All
- functions and structures are private to the extension now.
-
- b. ext/hash
- - The hash extension is now always available, allowing extensions to rely
- on its functionality to be available without compile time checks.
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/bug78239.phpt b/Zend/tests/bug78239.phpt
index 94908a785b..aa81af4452 100644
--- a/Zend/tests/bug78239.phpt
+++ b/Zend/tests/bug78239.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #78239: Deprecation notice during string conversion converted to exception hangs
+--SKIPIF--
+<?php if (!extension_loaded("zend-test")) die("skip requires zend-test extension"); ?>
--FILE--
<?php
function handleError($level, $message, $file = '', $line = 0, $context = [])
@@ -9,21 +11,12 @@ function handleError($level, $message, $file = '', $line = 0, $context = [])
set_error_handler('handleError');
-class A
-{
-
- public function abc(): bool
- {
- return false;
- }
-}
-
-$r = new ReflectionMethod("A", "abc");
-(string)$r->getReturnType() ?: "";
+$r = new _ZendTestClass;
+(string)$r ?: "";
?>
--EXPECTF--
-Fatal error: Uncaught ErrorException: Function ReflectionType::__toString() is deprecated in %s:%d
+Fatal error: Uncaught ErrorException: Function _ZendTestClass::__toString() is deprecated in %s:%d
Stack trace:
#0 %s(%d): handleError(%s)
#1 {main}
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/typed_properties_class_loading.phpt b/Zend/tests/type_declarations/typed_properties_class_loading.phpt
index 0612624454..a81bc5b4fe 100644
--- a/Zend/tests/type_declarations/typed_properties_class_loading.phpt
+++ b/Zend/tests/type_declarations/typed_properties_class_loading.phpt
@@ -43,9 +43,9 @@ var_dump($test->propY);
?>
--EXPECT--
-Typed property Test::$propX must be an instance of X, stdClass used
+Cannot assign stdClass to property Test::$propX of type X
object(X)#3 (0) {
}
-Typed property Test::$propY must be an instance of Y or null, stdClass used
+Cannot assign stdClass to property Test::$propY of type ?Y
object(Y)#4 (0) {
}
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..0b9fcd76af 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,23 @@ 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_LONG_OR_NULL(dest, is_null) \
+ Z_PARAM_LONG_EX(dest, is_null, 1, 0)
+
+/* 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_STRICT_LONG_EX(dest, is_null, check_null, separate) \
- Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, separate, separate)
+#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 +1489,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 +1515,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 +1539,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 +1549,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 +1571,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 +1656,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 c21554e464..8eac0dcae7 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 5407d89680..cf8d2973bf 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,39 @@ 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 +660,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 +676,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 +719,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 +735,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 +754,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 +924,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))) {
- 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)) {
+ 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 (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 +965,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 +981,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 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 (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 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 +1131,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 +1147,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 +1182,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 +1192,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 +1204,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 +1214,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 +1239,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 +1275,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) {
+ 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_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_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 +1298,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 +1348,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 +1478,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 +1490,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 +1564,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 +1595,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 +1743,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 +1764,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 +1795,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 +1889,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 +1906,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 +1926,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 +1933,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 +2098,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 +2119,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 +2137,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 +2145,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 +2169,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 +2188,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 +2259,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 +2277,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 +2299,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 +2319,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 +2379,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 +2391,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 +2430,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 +2512,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,38 +2522,15 @@ 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
- * assignment is not possible, NULL otherwise. */
-static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_reference *ref) {
+/* Checks whether an array can be assigned to the reference. Throws error if not assignable. */
+ZEND_API zend_bool zend_verify_ref_array_assignable(zend_reference *ref) {
zend_property_info *prop;
ZEND_ASSERT(ZEND_REF_HAS_TYPE_SOURCES(ref));
ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
@@ -2662,20 +2542,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 +2577,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 +2606,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 +2628,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 +2665,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 +2725,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 +2780,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 +2821,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 +2838,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 +2865,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 +2879,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 +2891,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 +2953,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 +2993,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 +3010,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 +3080,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 +3171,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 +3776,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 +3853,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 +3884,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 +3892,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 +3975,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 +4105,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 +4152,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 +4243,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 +4314,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 +4337,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 +4376,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..8636399d3b 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,12 @@ 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);
+ZEND_API zend_bool zend_verify_ref_array_assignable(zend_reference *ref);
+
#define ZEND_REF_TYPE_SOURCES(ref) \
(ref)->sources
@@ -120,11 +126,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 +328,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, |
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 688d36c148..b59550766d 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -15,75 +15,75 @@ jobs:
- template: azure/job.yml
parameters:
configurationName: DEBUG_NTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
- template: azure/job.yml
parameters:
configurationName: RELEASE_ZTS
- configurationParameters: '--disable-debug --enable-maintainer-zts'
+ configurationParameters: '--disable-debug --enable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_DEBUG_ZTS
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_DEBUG_NTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
- template: azure/job.yml
parameters:
configurationName: DEBUG_ZTS
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
- template: azure/job.yml
parameters:
configurationName: RELEASE_NTS
- configurationParameters: '--disable-debug --disable-maintainer-zts'
+ configurationParameters: '--disable-debug --disable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_DEBUG_NTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_RELEASE_NTS
- configurationParameters: '--disable-debug --disable-maintainer-zts'
+ configurationParameters: '--disable-debug --disable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_RELEASE_ZTS
- configurationParameters: '--disable-debug --enable-maintainer-zts'
+ configurationParameters: '--disable-debug --enable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_DEBUG_ZTS
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_RELEASE_NTS
- configurationParameters: '--disable-debug --disable-maintainer-zts'
+ configurationParameters: '--disable-debug --disable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_RELEASE_ZTS
- configurationParameters: '--disable-debug --enable-maintainer-zts'
+ configurationParameters: '--disable-debug --enable-zts'
- template: azure/job.yml
parameters:
configurationName: DEBUG_ZTS_ASAN_UBSAN
configurationParameters: >-
- --enable-debug --enable-maintainer-zts
+ --enable-debug --enable-zts
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
LDFLAGS='-fsanitize=undefined,address'
runTestsParameters: --asan
- timeoutInMinutes: 120
+ timeoutInMinutes: 150
- template: azure/msan_job.yml
parameters:
configurationName: DEBUG_ZTS_MSAN
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
runTestsParameters: --asan
- template: azure/community_job.yml
parameters:
configurationName: COMMUNITY
configurationParameters: >-
- --enable-debug --enable-maintainer-zts
+ --enable-debug --enable-zts
CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
LDFLAGS='-fsanitize=undefined,address'
- template: azure/coverage_job.yml
parameters:
configurationName: COVERAGE_DEBUG_ZTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
timeoutInMinutes: 90
diff --git a/azure/community_job.yml b/azure/community_job.yml
index 46cbdaded4..be6c9837de 100644
--- a/azure/community_job.yml
+++ b/azure/community_job.yml
@@ -46,6 +46,7 @@ jobs:
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
+ echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
displayName: 'Install Build'
- script: |
git clone https://github.com/laravel/framework.git --branch=master --depth=1
diff --git a/azure/i386/job.yml b/azure/i386/job.yml
index 623f7e1e29..3e78593534 100644
--- a/azure/i386/job.yml
+++ b/azure/i386/job.yml
@@ -90,3 +90,8 @@ jobs:
configurationName: ${{ parameters.configurationName }}
runTestsName: 'OpCache'
runTestsParameters: -d zend_extension=opcache.so
+ - template: test.yml
+ parameters:
+ configurationName: ${{ parameters.configurationName }}
+ runTestsName: 'JIT'
+ runTestsParameters: -d zend_extension=opcache.so -d opcache.jit_buffer_size=16M
diff --git a/azure/job.yml b/azure/job.yml
index afe1d99e80..72a36da8ce 100644
--- a/azure/job.yml
+++ b/azure/job.yml
@@ -33,3 +33,11 @@ jobs:
runTestsParameters: >-
${{ parameters.runTestsParameters }}
-d zend_extension=opcache.so
+ - template: test.yml
+ parameters:
+ configurationName: ${{ parameters.configurationName }}
+ runTestsName: 'JIT'
+ runTestsParameters: >-
+ ${{ parameters.runTestsParameters }}
+ -d zend_extension=opcache.so
+ -d opcache.jit_buffer_size=16M
diff --git a/azure/macos/job.yml b/azure/macos/job.yml
index 2b179aff5f..90045f13c7 100644
--- a/azure/macos/job.yml
+++ b/azure/macos/job.yml
@@ -84,3 +84,8 @@ jobs:
configurationName: ${{ parameters.configurationName }}
runTestsName: 'OpCache'
runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1
+ - template: test.yml
+ parameters:
+ configurationName: ${{ parameters.configurationName }}
+ runTestsName: 'JIT'
+ runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M
diff --git a/azure/msan_job.yml b/azure/msan_job.yml
index 28dcae3f88..fb2655b240 100644
--- a/azure/msan_job.yml
+++ b/azure/msan_job.yml
@@ -31,6 +31,7 @@ jobs:
--disable-xmlreader \
--disable-xmlwriter \
--without-pcre-jit \
+ --disable-opcache-jit \
--enable-phpdbg \
--enable-fpm \
--with-pdo-mysql=mysqlnd \
diff --git a/build/Makefile.global b/build/Makefile.global
index 82e0d69f35..79aad5f369 100644
--- a/build/Makefile.global
+++ b/build/Makefile.global
@@ -16,7 +16,7 @@ build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
build-binaries: $(PHP_BINARIES)
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
+ $(LIBTOOL) --mode=link --tag=disable-static $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
@@ -142,6 +142,12 @@ prof-clean:
prof-use:
CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-use all
+%_arginfo.h: %.stub.php
+ if type php >/dev/null 2>/dev/null; then php $(top_srcdir)/scripts/dev/gen_stub.php $<; fi
+
+# As we don't track includes, this is just a heuristic
+%.c: %_arginfo.h
+ touch $@
.PHONY: all clean install distclean test prof-gen prof-clean prof-use
.NOEXPORT:
diff --git a/build/libtool.m4 b/build/libtool.m4
index f7f5164292..577dad4cbe 100644
--- a/build/libtool.m4
+++ b/build/libtool.m4
@@ -945,6 +945,7 @@ else
#endif
#include <stdio.h>
+#include <stdlib.h>
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
@@ -978,10 +979,6 @@ else
# endif
#endif
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
void fnord() { int i=42;}
int main ()
{
diff --git a/build/php.m4 b/build/php.m4
index e91ef9887c..bcf89e3bdd 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -745,7 +745,7 @@ dnl
dnl PHP_BUILD_THREAD_SAFE
dnl
AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
- enable_maintainer_zts=yes
+ enable_zts=yes
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.])
fi
@@ -851,7 +851,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[
\$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
$3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
- \$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
+ \$(LIBTOOL) --mode=link --tag=disable-static ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
EOF
])
@@ -1120,7 +1120,7 @@ AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
-main() {
+int main() {
char buf[27];
struct tm t;
time_t old = 0;
@@ -1136,7 +1136,7 @@ return (1);
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
-main() {
+int main() {
struct tm t, *s;
time_t old = 0;
char buf[27], *p;
@@ -1175,8 +1175,9 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
$1
- main() {
+ int main() {
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
if (fd < 0) exit(1);
@@ -1208,8 +1209,9 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
$1
- main() {
+ int main() {
char buf[3];
int fd = open("conftest_in", O_RDONLY);
if (fd < 0) exit(1);
@@ -1462,6 +1464,7 @@ dnl Even newer glibcs have a different seeker definition.
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _GNU_SOURCE
#include <stdio.h>
+#include <stdlib.h>
struct cookiedata {
__off64_t pos;
@@ -1478,7 +1481,7 @@ int seeker(void *cookie, __off64_t *position, int whence)
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
-main() {
+int main() {
struct cookiedata g = { 0 };
FILE *fp = fopencookie(&g, "r", funcs);
@@ -1597,7 +1600,7 @@ AC_DEFUN([PHP_CHECK_FUNC_LIB],[
if test "$found" = "yes"; then
ac_libs=$LIBS
LIBS="$LIBS -l$2"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[main() { return (0); }]])],[found=yes],[found=no],[found=no])
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return (0); }]])],[found=yes],[found=no],[found=no])
LIBS=$ac_libs
fi
@@ -2283,7 +2286,7 @@ AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
#define TEXT "This is the test message -- "
-main()
+int main()
{
int n;
diff --git a/configure.ac b/configure.ac
index 038a3fbb9f..2314da79de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
-AC_INIT([PHP],[7.4.0-dev],[https://bugs.php.net],[php],[https://www.php.net])
+AC_INIT([PHP],[8.0.0-dev],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
@@ -178,6 +178,7 @@ PKG_PROG_PKG_CONFIG
AC_PROG_CC([cc gcc])
PHP_DETECT_ICC
PHP_DETECT_SUNCC
+AC_PROG_CC_C99
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_LN_S
@@ -349,7 +350,7 @@ if test -z "$PHP_INSTALLED_SAPIS"; then
fi
dnl Force ZTS.
-if test "$enable_maintainer_zts" = "yes"; then
+if test "$enable_zts" = "yes"; then
dnl Add pthreads linker and compiler flags.
if test -n "$ac_cv_pthreads_lib"; then
LIBS="$LIBS -l$ac_cv_pthreads_lib"
@@ -412,7 +413,6 @@ dnl Then headers.
dnl ----------------------------------------------------------------------------
dnl QNX requires unix.h to allow functions in libunix to work properly.
-dnl locale.h is checked for supporting old code in extensions such as imagick.
AC_CHECK_HEADERS([ \
inttypes.h \
stdint.h \
@@ -430,7 +430,6 @@ fcntl.h \
grp.h \
ieeefp.h \
langinfo.h \
-locale.h \
malloc.h \
monetary.h \
netdb.h \
@@ -663,6 +662,8 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <netdb.h>
#include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
#ifndef AF_INET
# include <sys/socket.h>
#endif
@@ -848,6 +849,18 @@ else
ZEND_DEBUG=no
fi
+PHP_ARG_ENABLE([debug-assertions],
+ [whether to enable debug assertions in release mode],
+ [AS_HELP_STRING([--enable-debug-assertions],
+ [Compile with debug assertions even in release mode])],
+ [no],
+ [no])
+
+if test "$PHP_DEBUG_ASSERTIONS" = "yes"; then
+ PHP_DEBUG=1
+ ZEND_DEBUG=yes
+fi
+
PHP_ARG_ENABLE([rtld-now],
[whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
[AS_HELP_STRING([--enable-rtld-now],
@@ -1055,7 +1068,9 @@ enable_static=yes
case $php_sapi_module in
shared[)]
- enable_static=no
+ if test "$PHP_CGI" = "no" && test "$PHP_CLI" = "no" && test "$PHP_FPM" = "no" && test "$PHP_LITESPEED" = "no" && test "$PHP_PHPDBG" = "no"; then
+ enable_static=no
+ fi
case $with_pic in
yes)
standard_libtool_flag='-prefer-pic'
@@ -1144,7 +1159,7 @@ LIBZEND_BASIC_CHECKS
LIBZEND_DLSYM_CHECK
LIBZEND_OTHER_CHECKS
-if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
+if test "$ZEND_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
PHP_THREAD_SAFETY=yes
else
@@ -1165,7 +1180,7 @@ unset LIBS LDFLAGS
PHP_HELP_SEPARATOR([TSRM:])
PHP_CONFIGURE_PART(Configuring TSRM)
if test "$PHP_THREAD_SAFETY" = "yes"; then
- TSRM_THREADS_CHECKS
+ TSRM_CHECK_PTHREADS
fi
dnl Align segments on huge page boundary
@@ -1220,7 +1235,7 @@ if test -z "$EXTENSION_DIR"; then
else
part1=no-debug
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
part2=zts
else
part2=non-zts
@@ -1228,7 +1243,7 @@ if test -z "$EXTENSION_DIR"; then
extbasedir=$part1-$part2-$extbasedir
EXTENSION_DIR=$libdir/extensions/$extbasedir
else
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
extbasedir=$extbasedir-zts
fi
@@ -1477,7 +1492,7 @@ PHP_ADD_SOURCES(Zend, \
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
zend_closures.c zend_weakrefs.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
- zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c, \
+ zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c, \
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
dnl Selectively disable optimization due to high RAM usage during compiling the
@@ -1563,7 +1578,7 @@ cat <<X
| |
| You have built PHP for Apache's current non-threaded MPM. |
| If you change Apache to use a threaded MPM you must reconfigure |
-| PHP with --enable-maintainer-zts |
+| PHP with --enable-zts |
X
fi
fi
diff --git a/docs/parameter-parsing-api.md b/docs/parameter-parsing-api.md
index d4d24b1dbf..e038a20dee 100644
--- a/docs/parameter-parsing-api.md
+++ b/docs/parameter-parsing-api.md
@@ -75,7 +75,6 @@ f - function or array containing php method call info (returned as
h - array (returned as HashTable*)
H - array or HASH_OF(object) (returned as HashTable*)
l - long (zend_long)
-L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (zend_long, ZEND_LONG_MAX/ZEND_LONG_MIN)
o - object of any type (zval*)
O - object of specific type given by class entry (zval*, zend_class_entry)
p - valid path (string without null bytes in the middle) and its length (char*, size_t)
diff --git a/docs/release-process.md b/docs/release-process.md
index cb04009060..5579270581 100644
--- a/docs/release-process.md
+++ b/docs/release-process.md
@@ -439,6 +439,8 @@
`gpg --fingerprint "$USER@php.net"`. Let one or more of the previous RMs
sign your key. Publish your public key to pgp.mit.edu with:
`gpg --keyserver pgp.mit.edu --send-keys $KEYID`
+ Add new keys in the php-keyring.gpg in distribution repository using:
+ `gpg2 --export --export-options export-minimal --armor <all RM keys>`
3. Request karma to edit `main/php_version.h` and `Zend/zend.h`. Possibly karma
for other restricted parts of php-src might come in question. To edit
diff --git a/docs/unix-build-system.md b/docs/unix-build-system.md
index c576b5e075..4df945a62b 100644
--- a/docs/unix-build-system.md
+++ b/docs/unix-build-system.md
@@ -108,7 +108,7 @@ regarding how PHP is supposed to be built (shared module, program, etc).
For example for APXS:
```m4
-PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php7.c php_apache.c)
+PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php.c php_apache.c)
```
## General info
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index ecfce4f54d..f528922752 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.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, |
@@ -25,6 +23,7 @@
#if HAVE_BCMATH
#include "php_ini.h"
+#include "bcmath_arginfo.h"
#include "ext/standard/info.h"
#include "php_bcmath.h"
#include "libbcmath/src/bcmath.h"
@@ -33,67 +32,6 @@ ZEND_DECLARE_MODULE_GLOBALS(bcmath)
static PHP_GINIT_FUNCTION(bcmath);
static PHP_GSHUTDOWN_FUNCTION(bcmath);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcadd, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcsub, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcmul, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcdiv, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcmod, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpowmod, 0, 0, 3)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, mod)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpow, 0, 0, 2)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcsqrt, 0, 0, 1)
- ZEND_ARG_INFO(0, operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bccomp, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcscale, 0, 0, 0)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
static const zend_function_entry bcmath_functions[] = {
PHP_FE(bcadd, arginfo_bcadd)
PHP_FE(bcsub, arginfo_bcsub)
@@ -400,10 +338,10 @@ PHP_FUNCTION(bcmod)
/* }}} */
/* {{{ proto string bcpowmod(string x, string y, string mod [, int scale])
- Returns the value of an arbitrary precision number raised to the power of another reduced by a modulous */
+ Returns the value of an arbitrary precision number raised to the power of another reduced by a modulus */
PHP_FUNCTION(bcpowmod)
{
- zend_string *left, *right, *modulous;
+ zend_string *left, *right, *modulus;
bc_num first, second, mod, result;
zend_long scale = BCG(bc_precision);
int scale_int;
@@ -411,7 +349,7 @@ PHP_FUNCTION(bcpowmod)
ZEND_PARSE_PARAMETERS_START(3, 4)
Z_PARAM_STR(left)
Z_PARAM_STR(right)
- Z_PARAM_STR(modulous)
+ Z_PARAM_STR(modulus)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(scale)
ZEND_PARSE_PARAMETERS_END();
@@ -422,7 +360,7 @@ PHP_FUNCTION(bcpowmod)
bc_init_num(&result);
php_str2num(&first, ZSTR_VAL(left));
php_str2num(&second, ZSTR_VAL(right));
- php_str2num(&mod, ZSTR_VAL(modulous));
+ php_str2num(&mod, ZSTR_VAL(modulus));
scale_int = (int) ((int)scale < 0 ? 0 : scale);
diff --git a/ext/bcmath/bcmath.stub.php b/ext/bcmath/bcmath.stub.php
new file mode 100644
index 0000000000..b5d1816acc
--- /dev/null
+++ b/ext/bcmath/bcmath.stub.php
@@ -0,0 +1,22 @@
+<?php
+
+function bcadd(string $left_operand, string $right_operand, int $scale = UNKNOWN) : string {}
+
+function bcsub(string $left_operand, string $right_operand, int $scale = UNKNOWN) : string {}
+
+function bcmul(string $left_operand, string $right_operand, int $scale = UNKNOWN) : string {}
+
+function bcdiv(string $dividend, string $divisor, int $scale = UNKNOWN) : ?string {}
+
+function bcmod(string $dividend, string $divisor, int $scale = UNKNOWN) : ?string {}
+
+/** @return string|false */
+function bcpowmod(string $base, string $exponent, string $modulus, int $scale = UNKNOWN) {}
+
+function bcpow(string $base, string $exponent, int $scale = UNKNOWN) : string {}
+
+function bcsqrt(string $operand, int $scale = UNKNOWN) : ?string {}
+
+function bccomp(string $left_operand, string $right_operand, int $scale = UNKNOWN) : int {}
+
+function bcscale(int $scale = UNKNOWN) : int {}
diff --git a/ext/bcmath/bcmath_arginfo.h b/ext/bcmath/bcmath_arginfo.h
new file mode 100644
index 0000000000..6c0b1061f2
--- /dev/null
+++ b/ext/bcmath/bcmath_arginfo.h
@@ -0,0 +1,47 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcadd, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, left_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, right_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_bcsub arginfo_bcadd
+
+#define arginfo_bcmul arginfo_bcadd
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcdiv, 0, 2, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, dividend, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, divisor, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_bcmod arginfo_bcdiv
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpowmod, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, modulus, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcpow, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcsqrt, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bccomp, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, left_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, right_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcscale, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index 375513bc92..5c97780ead 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.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/ext/bz2/bz2.c b/ext/bz2/bz2.c
index 7b54766575..98e8bf9770 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.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, |
@@ -22,6 +20,7 @@
#include "php.h"
#include "php_bz2.h"
+#include "bz2_arginfo.h"
#if HAVE_BZ2
@@ -50,57 +49,12 @@ static PHP_FUNCTION(bzerror);
static PHP_FUNCTION(bzcompress);
static PHP_FUNCTION(bzdecompress);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzread, 0, 0, 1)
- ZEND_ARG_INFO(0, bz)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzopen, 0)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzerrno, 0)
- ZEND_ARG_INFO(0, bz)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzerrstr, 0)
- ZEND_ARG_INFO(0, bz)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzerror, 0)
- ZEND_ARG_INFO(0, bz)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, blocksize)
- ZEND_ARG_INFO(0, workfactor)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzdecompress, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, small)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzwrite, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzflush, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry bz2_functions[] = {
PHP_FE(bzopen, arginfo_bzopen)
PHP_FE(bzread, arginfo_bzread)
PHP_FALIAS(bzwrite, fwrite, arginfo_bzwrite)
PHP_FALIAS(bzflush, fflush, arginfo_bzflush)
- PHP_FALIAS(bzclose, fclose, arginfo_bzflush)
+ PHP_FALIAS(bzclose, fclose, arginfo_bzclose)
PHP_FE(bzerrno, arginfo_bzerrno)
PHP_FE(bzerrstr, arginfo_bzerrstr)
PHP_FE(bzerror, arginfo_bzerror)
@@ -379,7 +333,7 @@ static PHP_FUNCTION(bzread)
zend_string *data;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &bz, &len)) {
- RETURN_FALSE;
+ return;
}
php_stream_from_zval(stream, bz);
@@ -579,7 +533,7 @@ static PHP_FUNCTION(bzdecompress)
bz_stream bzs;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &small)) {
- RETURN_FALSE;
+ return;
}
bzs.bzalloc = NULL;
diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php
new file mode 100644
index 0000000000..f90d66c168
--- /dev/null
+++ b/ext/bz2/bz2.stub.php
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @param string|resource $file
+ * @return resource|false
+ */
+ function bzopen($file, string $mode) {}
+
+/**
+ * @param resource $bz
+ * @return string|false
+ */
+function bzread ($bz, int $length = 1024) {}
+
+/**
+ * @param resource $bz
+ * @return int|false
+ */
+function bzwrite ($bz, string $str, int $length = UNKNOWN) {}
+
+/**
+ * @param resource $bz
+ */
+function bzflush ($bz): bool {}
+
+/**
+ * @param resource $bz
+ */
+function bzclose ($bz): bool {}
+
+/**
+ * @param resource $bz
+ */
+function bzerrno ($bz): int {}
+
+/**
+ * @param resource $bz
+ */
+function bzerrstr ($bz): string {}
+
+/**
+ * @param resource $bz
+ */
+function bzerror ($bz): array {}
+
+/**
+ * @return string|int
+ */
+function bzcompress (string $source, int $blocksize = 4, int $workfactor = 0) {}
+
+/**
+ * @return string|int
+ */
+function bzdecompress (string $source, int $small = 0) {}
diff --git a/ext/bz2/bz2_arginfo.h b/ext/bz2/bz2_arginfo.h
new file mode 100644
index 0000000000..be89a095e8
--- /dev/null
+++ b/ext/bz2/bz2_arginfo.h
@@ -0,0 +1,46 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
+ ZEND_ARG_INFO(0, file)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bzread, 0, 0, 1)
+ ZEND_ARG_INFO(0, bz)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bzwrite, 0, 0, 2)
+ ZEND_ARG_INFO(0, bz)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzflush, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+#define arginfo_bzclose arginfo_bzflush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerrno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerrstr, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerror, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, blocksize, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, workfactor, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bzdecompress, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, small, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index e7d7c3334f..40e01edca0 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.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/ext/bz2/php_bz2.h b/ext/bz2/php_bz2.h
index 9523f32e14..bfa3ce690d 100644
--- a/ext/bz2/php_bz2.h
+++ b/ext/bz2/php_bz2.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/ext/bz2/tests/001.phpt b/ext/bz2/tests/001.phpt
index 5a6b2878b8..ee1872f0ef 100644
--- a/ext/bz2/tests/001.phpt
+++ b/ext/bz2/tests/001.phpt
@@ -5,7 +5,6 @@ bzopen() and invalid parameters
--FILE--
<?php
-var_dump(bzopen());
var_dump(bzopen("", ""));
var_dump(bzopen("", "r"));
var_dump(bzopen("", "w"));
@@ -19,9 +18,6 @@ var_dump(bzopen($fp, "r"));
echo "Done\n";
?>
--EXPECTF--
-Warning: bzopen() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d
bool(false)
diff --git a/ext/bz2/tests/003-mb.phpt b/ext/bz2/tests/003-mb.phpt
index ad43b0d11e..b5f8fe814e 100644
--- a/ext/bz2/tests/003-mb.phpt
+++ b/ext/bz2/tests/003-mb.phpt
@@ -6,8 +6,6 @@ bzread() tests
<?php
$fd = bzopen(__DIR__."/003ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.bz2","r");
-var_dump(bzread());
-var_dump(bzread($fd, 1 ,0));
var_dump(bzread($fd, 0));
var_dump(bzread($fd, -10));
var_dump(bzread($fd, 1));
@@ -17,11 +15,6 @@ var_dump(bzread($fd, 100000));
echo "Done\n";
?>
--EXPECTF--
-Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
string(0) ""
Warning: bzread(): length may not be negative in %s on line %d
diff --git a/ext/bz2/tests/003.phpt b/ext/bz2/tests/003.phpt
index feb806e424..cc5b2a3787 100644
--- a/ext/bz2/tests/003.phpt
+++ b/ext/bz2/tests/003.phpt
@@ -6,8 +6,6 @@ bzread() tests
<?php
$fd = bzopen(__DIR__."/003.txt.bz2","r");
-var_dump(bzread());
-var_dump(bzread($fd, 1 ,0));
var_dump(bzread($fd, 0));
var_dump(bzread($fd, -10));
var_dump(bzread($fd, 1));
@@ -17,11 +15,6 @@ var_dump(bzread($fd, 100000));
echo "Done\n";
?>
--EXPECTF--
-Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
string(0) ""
Warning: bzread(): length may not be negative in %s on line %d
diff --git a/ext/bz2/tests/004.phpt b/ext/bz2/tests/004.phpt
index 2225433e0e..15eb90f89a 100644
--- a/ext/bz2/tests/004.phpt
+++ b/ext/bz2/tests/004.phpt
@@ -36,14 +36,30 @@ var_dump(bzerrstr($fd2));
var_dump(bzerrno($fd2));
bzclose($fd2);
-var_dump(bzread($fd2));
-var_dump(bzerror($fd2));
-var_dump(bzerrstr($fd2));
-var_dump(bzerrno($fd2));
+try {
+ var_dump(bzread($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(bzerror($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(bzerrstr($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(bzerrno($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
array(2) {
["errno"]=>
int(0)
@@ -96,16 +112,8 @@ array(2) {
}
string(10) "DATA_ERROR"
int(-4)
-
-Warning: bzread(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: bzerror(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: bzerrstr(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: bzerrno(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+bzread(): supplied resource is not a valid stream resource
+bzerror(): supplied resource is not a valid stream resource
+bzerrstr(): supplied resource is not a valid stream resource
+bzerrno(): supplied resource is not a valid stream resource
Done
diff --git a/ext/bz2/tests/005.phpt b/ext/bz2/tests/005.phpt
index 27dffb9c1b..ff14e65659 100644
--- a/ext/bz2/tests/005.phpt
+++ b/ext/bz2/tests/005.phpt
@@ -10,7 +10,6 @@ Drifting further everyday
Getting lost within myself
Nothing matters no one else";
-var_dump(bzcompress());
var_dump(bzcompress(1,1,1));
var_dump(bzcompress($string, 100));
var_dump(bzcompress($string, 100, -1));
@@ -23,8 +22,6 @@ $data2 = bzcompress($string, 1, 10);
$data3 = $data2;
$data3[3] = 0;
-var_dump(bzdecompress());
-var_dump(bzdecompress(1,1,1));
var_dump(bzdecompress(1,1));
var_dump(bzdecompress($data3));
var_dump(bzdecompress($data3,1));
@@ -38,19 +35,11 @@ var_dump(bzdecompress($data2));
echo "Done\n";
?>
--EXPECTF--
-Warning: bzcompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
string(%d) "BZ%a"
int(-2)
int(-2)
int(-2)
int(-2)
-
-Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
int(-5)
int(-5)
int(-5)
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index e24ac56a25..e2c7cf064a 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.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/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 3c7236de9a..e450722dd0 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.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, |
@@ -25,6 +23,7 @@
#include "php.h"
#include "ext/standard/info.h"
+#include "calendar_arginfo.h"
#include "php_calendar.h"
#include "sdncal.h"
@@ -36,100 +35,6 @@
#undef CAL_GREGORIAN
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_unixtojd, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtounix, 0)
- ZEND_ARG_INFO(0, jday)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_cal_info, 0, 0, 0)
- ZEND_ARG_INFO(0, calendar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cal_days_in_month, 0)
- ZEND_ARG_INFO(0, calendar)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cal_to_jd, 0)
- ZEND_ARG_INFO(0, calendar)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cal_from_jd, 0)
- ZEND_ARG_INFO(0, jd)
- ZEND_ARG_INFO(0, calendar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtogregorian, 0)
- ZEND_ARG_INFO(0, juliandaycount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gregoriantojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtojulian, 0)
- ZEND_ARG_INFO(0, juliandaycount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_juliantojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_jdtojewish, 0, 0, 1)
- ZEND_ARG_INFO(0, juliandaycount)
- ZEND_ARG_INFO(0, hebrew)
- ZEND_ARG_INFO(0, fl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jewishtojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtofrench, 0)
- ZEND_ARG_INFO(0, juliandaycount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_frenchtojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_jddayofweek, 0, 0, 1)
- ZEND_ARG_INFO(0, juliandaycount)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdmonthname, 0)
- ZEND_ARG_INFO(0, juliandaycount)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_easter_date, 0, 0, 0)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_easter_days, 0, 0, 0)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
static const zend_function_entry calendar_functions[] = {
PHP_FE(jdtogregorian, arginfo_jdtogregorian)
PHP_FE(gregoriantojd, arginfo_gregoriantojd)
@@ -295,7 +200,7 @@ PHP_FUNCTION(cal_info)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &cal) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (cal == -1) {
@@ -331,7 +236,7 @@ PHP_FUNCTION(cal_days_in_month)
zend_long sdn_start, sdn_next;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &cal, &month, &year) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
@@ -377,7 +282,7 @@ PHP_FUNCTION(cal_to_jd)
zend_long cal, month, day, year;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &cal, &month, &day, &year) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
@@ -398,7 +303,7 @@ PHP_FUNCTION(cal_from_jd)
const struct cal_entry_t *calendar;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &jd, &cal) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
@@ -449,7 +354,7 @@ PHP_FUNCTION(jdtogregorian)
int year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
- RETURN_FALSE;
+ return;
}
SdnToGregorian(julday, &year, &month, &day);
@@ -465,7 +370,7 @@ PHP_FUNCTION(gregoriantojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(GregorianToSdn(year, month, day));
@@ -480,7 +385,7 @@ PHP_FUNCTION(jdtojulian)
int year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
- RETURN_FALSE;
+ return;
}
SdnToJulian(julday, &year, &month, &day);
@@ -496,7 +401,7 @@ PHP_FUNCTION(juliantojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(JulianToSdn(year, month, day));
@@ -609,7 +514,7 @@ PHP_FUNCTION(jdtojewish)
char *dayp, *yearp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|bl", &julday, &heb, &fl) == FAILURE) {
- RETURN_FALSE;
+ return;
}
SdnToJewish(julday, &year, &month, &day);
@@ -640,7 +545,7 @@ PHP_FUNCTION(jewishtojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(JewishToSdn(year, month, day));
@@ -655,7 +560,7 @@ PHP_FUNCTION(jdtofrench)
int year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
- RETURN_FALSE;
+ return;
}
SdnToFrench(julday, &year, &month, &day);
@@ -671,7 +576,7 @@ PHP_FUNCTION(frenchtojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(FrenchToSdn(year, month, day));
@@ -687,7 +592,7 @@ PHP_FUNCTION(jddayofweek)
const char *daynamel, *daynames;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &julday, &mode) == FAILURE) {
- RETURN_FALSE;
+ return;
}
day = DayOfWeek(julday);
@@ -718,7 +623,7 @@ PHP_FUNCTION(jdmonthname)
int month, day, year;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &julday, &mode) == FAILURE) {
- RETURN_FALSE;
+ return;
}
switch (mode) {
diff --git a/ext/calendar/calendar.stub.php b/ext/calendar/calendar.stub.php
new file mode 100644
index 0000000000..da08cd7037
--- /dev/null
+++ b/ext/calendar/calendar.stub.php
@@ -0,0 +1,46 @@
+<?php
+
+/** @return int|false */
+function cal_days_in_month(int $calendar, int $month, int $year) {}
+
+/** @return array<string, array<int, string>&int&string>|false */
+function cal_from_jd(int $jd, int $calendar) {}
+
+/** @return array|false */
+function cal_info(?int $calendar = UNKNOWN) {}
+
+/** @return int|false */
+function cal_to_jd(int $calendar, int $month, int $day, int $year) {}
+
+/** @return int|false */
+function easter_date(int $year = UNKNOWN, int $method = CAL_EASTER_DEFAULT) {}
+
+function easter_days(int $year = UNKNOWN, int $method = CAL_EASTER_DEFAULT): int {}
+
+function frenchtojd(int $month, int $day, int $year): int {}
+
+function gregoriantojd(int $month, int $day, int $year): int {}
+
+/** @return int|string */
+function jddayofweek(int $juliandaycount, int $mode = CAL_DOW_DAYNO) {}
+
+function jdmonthname(int $juliandaycount, int $mode): string {}
+
+function jdtofrench(int $juliandaycount): string {}
+
+function jdtogregorian(int $juliandaycount): string {}
+
+/** @return string|false */
+function jdtojewish(int $juliandaycount, bool $hebrew = false, int $fl = 0) {}
+
+function jdtojulian(int $juliandaycount): string {}
+
+/** @return int|false */
+function jdtounix(int $jday) {}
+
+function jewishtojd(int $month, int $day, int $year): int {}
+
+function juliantojd(int $month, int $day, int $year): int {}
+
+/** @return int|false */
+function unixtojd(int $timestamp = UNKNOWN) {}
diff --git a/ext/calendar/calendar_arginfo.h b/ext/calendar/calendar_arginfo.h
new file mode 100644
index 0000000000..6e526062b0
--- /dev/null
+++ b/ext/calendar/calendar_arginfo.h
@@ -0,0 +1,77 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cal_days_in_month, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cal_from_jd, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, jd, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cal_info, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_cal_to_jd, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_easter_date, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_easter_days, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frenchtojd, 0, 3, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gregoriantojd arginfo_frenchtojd
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_jddayofweek, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_jdmonthname, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_jdtofrench, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_jdtogregorian arginfo_jdtofrench
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_jdtojewish, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, hebrew, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, fl, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_jdtojulian arginfo_jdtofrench
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_jdtounix, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, jday, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_jewishtojd arginfo_frenchtojd
+
+#define arginfo_juliantojd arginfo_frenchtojd
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_unixtojd, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
index 2b9a2562e1..36c851d94f 100644
--- a/ext/calendar/easter.c
+++ b/ext/calendar/easter.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/ext/calendar/tests/jdtomonthname.phpt b/ext/calendar/tests/jdtomonthname.phpt
index 2ad50a450e..c7fa6cc774 100644
--- a/ext/calendar/tests/jdtomonthname.phpt
+++ b/ext/calendar/tests/jdtomonthname.phpt
@@ -9,7 +9,6 @@ $jd_days = Array(
2453396,
2440588,
-1,
- array(),
10000000
);
@@ -52,28 +51,6 @@ string(0) ""
string(0) ""
string(0) ""
-===
-Notice: Array to string conversion in %sjdtomonthname.php on line %d
-Array
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
=== 10000000
string(3) "Dec"
string(8) "December"
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 58a22a9c62..90972b93df 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.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, |
@@ -60,12 +58,10 @@ PHP_FUNCTION(com_create_instance)
ZEND_NUM_ARGS(), "s|s!ls",
&module_name, &module_name_len, &server_name, &server_name_len,
&cp, &typelib_name, &typelib_name_len) &&
- FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
+ FAILURE == zend_parse_parameters(
ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
-
- php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!");
return;
}
@@ -302,7 +298,6 @@ PHP_FUNCTION(com_get_active_object)
php_com_initialize();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&module_name, &module_name_len, &code_page)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments!");
return;
}
@@ -704,7 +699,7 @@ PHP_FUNCTION(com_event_sink)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oo|z/",
&object, php_com_variant_class_entry, &sinkobject, &sink)) {
- RETURN_FALSE;
+ return;
}
php_com_initialize();
@@ -765,7 +760,7 @@ PHP_FUNCTION(com_print_typeinfo)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z/|s!b", &arg1, &ifacename,
&ifacelen, &wantsink)) {
- RETURN_FALSE;
+ return;
}
php_com_initialize();
@@ -832,7 +827,8 @@ PHP_FUNCTION(com_load_typelib)
}
if (!cs) {
- php_error_docref(NULL, E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
+ php_error_docref(NULL, E_WARNING, "Declaration of case-insensitive constants is no longer supported");
+ RETURN_FALSE;
}
RETVAL_FALSE;
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index 7222615986..40fb6479b1 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.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, |
@@ -243,7 +241,6 @@ PHP_FUNCTION(com_dotnet_create_instance)
&assembly_name, &assembly_name_len,
&datatype_name, &datatype_name_len,
&cp)) {
- php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!");
return;
}
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index 7ff0fd0ebd..8dc7133534 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.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, |
@@ -29,6 +27,7 @@
#include "php_com_dotnet_internal.h"
#include "Zend/zend_exceptions.h"
#include "Zend/zend_interfaces.h"
+#include "com_extension_arginfo.h"
ZEND_DECLARE_MODULE_GLOBALS(com_dotnet)
static PHP_GINIT_FUNCTION(com_dotnet);
@@ -38,116 +37,21 @@ zend_class_entry
*php_com_exception_class_entry,
*php_com_saproxy_class_entry;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_set, 0, 0, 2)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_left_right, 0, 0, 2)
- ZEND_ARG_INFO(0, left)
- ZEND_ARG_INFO(0, right)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_abs, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_fix, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_int, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_neg, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_not, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_round, 0, 0, 2)
- ZEND_ARG_INFO(0, left)
- ZEND_ARG_INFO(0, decimals)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cmp, 0, 0, 2)
- ZEND_ARG_INFO(0, left)
- ZEND_ARG_INFO(0, right)
- ZEND_ARG_INFO(0, lcid)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_to_timestamp, 0, 0, 1)
- ZEND_ARG_INFO(0, variant)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_from_timestamp, 0, 0, 1)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_get_type, 0, 0, 1)
- ZEND_ARG_INFO(0, variant)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_set_type, 0, 0, 2)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cast, 0, 0, 2)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_get_active_object, 0, 0, 1)
- ZEND_ARG_INFO(0, progid)
- ZEND_ARG_INFO(0, code_page)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_com_create_guid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_event_sink, 0, 0, 2)
- ZEND_ARG_INFO(0, comobject)
- ZEND_ARG_INFO(0, sinkobject)
- ZEND_ARG_INFO(0, sinkinterface)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_print_typeinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, comobject)
- ZEND_ARG_INFO(0, dispinterface)
- ZEND_ARG_INFO(0, wantsink)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_message_pump, 0, 0, 0)
- ZEND_ARG_INFO(0, timeoutms)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_load_typelib, 0, 0, 1)
- ZEND_ARG_INFO(0, typelib_name)
- ZEND_ARG_INFO(0, case_insensitive)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry com_dotnet_functions[] = {
PHP_FE(variant_set, arginfo_variant_set)
- PHP_FE(variant_add, arginfo_left_right)
- PHP_FE(variant_cat, arginfo_left_right)
- PHP_FE(variant_sub, arginfo_left_right)
- PHP_FE(variant_mul, arginfo_left_right)
- PHP_FE(variant_and, arginfo_left_right)
- PHP_FE(variant_div, arginfo_left_right)
- PHP_FE(variant_eqv, arginfo_left_right)
- PHP_FE(variant_idiv, arginfo_left_right)
- PHP_FE(variant_imp, arginfo_left_right)
- PHP_FE(variant_mod, arginfo_left_right)
- PHP_FE(variant_or, arginfo_left_right)
- PHP_FE(variant_pow, arginfo_left_right)
- PHP_FE(variant_xor, arginfo_left_right)
+ PHP_FE(variant_add, arginfo_variant_add)
+ PHP_FE(variant_cat, arginfo_variant_add)
+ PHP_FE(variant_sub, arginfo_variant_add)
+ PHP_FE(variant_mul, arginfo_variant_add)
+ PHP_FE(variant_and, arginfo_variant_add)
+ PHP_FE(variant_div, arginfo_variant_add)
+ PHP_FE(variant_eqv, arginfo_variant_add)
+ PHP_FE(variant_idiv, arginfo_variant_add)
+ PHP_FE(variant_imp, arginfo_variant_add)
+ PHP_FE(variant_mod, arginfo_variant_add)
+ PHP_FE(variant_or, arginfo_variant_add)
+ PHP_FE(variant_pow, arginfo_variant_add)
+ PHP_FE(variant_xor, arginfo_variant_add)
PHP_FE(variant_abs, arginfo_variant_abs)
PHP_FE(variant_fix, arginfo_variant_fix)
PHP_FE(variant_int, arginfo_variant_int)
@@ -235,8 +139,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
modifier = php_strtok_r(NULL, "#", &strtok_buf);
if (modifier != NULL) {
if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
- php_error_docref("com.configuration", E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
- mode &= ~CONST_CS;
+ php_error_docref("com.configuration", E_WARNING, "Declaration of case-insensitive constants is no longer supported; #cis modifier ignored");
}
}
@@ -267,7 +170,8 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
static ZEND_INI_MH(OnAutoregisterCasesensitive)
{
if (!zend_ini_parse_bool(new_value)) {
- php_error_docref("com.configuration", E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
+ php_error_docref("com.configuration", E_WARNING, "Declaration of case-insensitive constants is no longer supported");
+ return FAILURE;
}
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
diff --git a/ext/com_dotnet/com_extension.stub.php b/ext/com_dotnet/com_extension.stub.php
new file mode 100644
index 0000000000..34ff543297
--- /dev/null
+++ b/ext/com_dotnet/com_extension.stub.php
@@ -0,0 +1,67 @@
+<?php
+
+function variant_set(variant $variant, $value): void {}
+
+function variant_add($left, $right): variant {}
+
+function variant_cat($left, $right): variant {}
+
+function variant_sub($left, $right): variant {}
+
+function variant_mul($left, $right): variant {}
+
+function variant_and($left, $right): variant {}
+
+function variant_div($left, $right): variant {}
+
+function variant_eqv($left, $right): variant {}
+
+function variant_idiv($left, $right): variant {}
+
+function variant_imp($left, $right): variant {}
+
+function variant_mod($left, $right): variant {}
+
+function variant_or($left, $right): variant {}
+
+function variant_pow($left, $right): variant {}
+
+function variant_xor($left, $right): variant {}
+
+function variant_abs($left): variant {}
+
+function variant_fix($left): variant {}
+
+function variant_int($left): variant {}
+
+function variant_neg($left): variant {}
+
+function variant_not($left): variant {}
+
+function variant_round($left, int $decimals): ?variant {}
+
+function variant_cmp($left, $right, int $lcid = UNKNOWN, int $flags = 0) {}
+
+function variant_date_to_timestamp(variant $variant): ?int {}
+
+/** @return variant|false */
+function variant_date_from_timestamp(int $timestamp) {}
+
+function variant_get_type(variant $variant): int {}
+
+function variant_set_type(variant $variant, int $type): void {}
+
+function variant_cast(variant $variant, int $type): variant {}
+
+function com_get_active_object(string $progid, int $code_page = UNKNOWN): variant {}
+
+/** @return string|false */
+function com_create_guid() {}
+
+function com_event_sink(variant $comobject, object $sinkobject, $sinkinterface = UNKNOWN): bool {}
+
+function com_print_typeinfo($comobject, ?string $dispinterface = null, bool $wantsink = false): bool {}
+
+function com_message_pump(int $timeoutms = 0): bool {}
+
+function com_load_typelib(string $typelib_name, bool $case_insensitive = true) {}
diff --git a/ext/com_dotnet/com_extension_arginfo.h b/ext/com_dotnet/com_extension_arginfo.h
new file mode 100644
index 0000000000..b2f7d0a09c
--- /dev/null
+++ b/ext/com_dotnet/com_extension_arginfo.h
@@ -0,0 +1,110 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_add, 0, 2, variant, 0)
+ ZEND_ARG_INFO(0, left)
+ ZEND_ARG_INFO(0, right)
+ZEND_END_ARG_INFO()
+
+#define arginfo_variant_cat arginfo_variant_add
+
+#define arginfo_variant_sub arginfo_variant_add
+
+#define arginfo_variant_mul arginfo_variant_add
+
+#define arginfo_variant_and arginfo_variant_add
+
+#define arginfo_variant_div arginfo_variant_add
+
+#define arginfo_variant_eqv arginfo_variant_add
+
+#define arginfo_variant_idiv arginfo_variant_add
+
+#define arginfo_variant_imp arginfo_variant_add
+
+#define arginfo_variant_mod arginfo_variant_add
+
+#define arginfo_variant_or arginfo_variant_add
+
+#define arginfo_variant_pow arginfo_variant_add
+
+#define arginfo_variant_xor arginfo_variant_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_abs, 0, 1, variant, 0)
+ ZEND_ARG_INFO(0, left)
+ZEND_END_ARG_INFO()
+
+#define arginfo_variant_fix arginfo_variant_abs
+
+#define arginfo_variant_int arginfo_variant_abs
+
+#define arginfo_variant_neg arginfo_variant_abs
+
+#define arginfo_variant_not arginfo_variant_abs
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_round, 0, 2, variant, 1)
+ ZEND_ARG_INFO(0, left)
+ ZEND_ARG_TYPE_INFO(0, decimals, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cmp, 0, 0, 2)
+ ZEND_ARG_INFO(0, left)
+ ZEND_ARG_INFO(0, right)
+ ZEND_ARG_TYPE_INFO(0, lcid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_date_to_timestamp, 0, 1, IS_LONG, 1)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_from_timestamp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_get_type, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set_type, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_cast, 0, 2, variant, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_com_get_active_object, 0, 1, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, progid, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_com_create_guid, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_event_sink, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, comobject, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, sinkobject, IS_OBJECT, 0)
+ ZEND_ARG_INFO(0, sinkinterface)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_print_typeinfo, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, comobject)
+ ZEND_ARG_TYPE_INFO(0, dispinterface, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, wantsink, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_message_pump, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, timeoutms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_com_load_typelib, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, typelib_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, case_insensitive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index fe39e2f9e0..1a5d9c3046 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.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, |
@@ -27,7 +25,7 @@
#include "php_com_dotnet_internal.h"
#include "Zend/zend_exceptions.h"
-static zval *com_property_read(zval *object, zval *member, int type, void **cahce_slot, zval *rv)
+static zval *com_property_read(zend_object *object, zend_string *member, int type, void **cahce_slot, zval *rv)
{
php_com_dotnet_object *obj;
VARIANT v;
@@ -35,21 +33,22 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
ZVAL_NULL(rv);
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
VariantInit(&v);
- convert_to_string_ex(member);
-
- res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
+ res = php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member),
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1);
if (res == SUCCESS) {
php_com_zval_from_variant(rv, &v, obj->code_page);
VariantClear(&v);
} else if (res == DISP_E_BADPARAMCOUNT) {
- php_com_saproxy_create(object, rv, member);
+ zval zv;
+
+ ZVAL_STR(&zv, member);
+ php_com_saproxy_create(object, rv, &zv);
}
} else {
php_com_throw_exception(E_INVALIDARG, "this variant has no properties");
@@ -58,18 +57,17 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
return rv;
}
-static zval *com_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *com_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot)
{
php_com_dotnet_object *obj;
VARIANT v;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
VariantInit(&v);
- convert_to_string_ex(member);
- if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
+ if (SUCCESS == php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member),
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0)) {
VariantClear(&v);
}
@@ -79,14 +77,14 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void **
return value;
}
-static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv)
+static zval *com_read_dimension(zend_object *object, zval *offset, int type, zval *rv)
{
php_com_dotnet_object *obj;
VARIANT v;
ZVAL_NULL(rv);
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
VariantInit(&v);
@@ -115,14 +113,14 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv)
return rv;
}
-static void com_write_dimension(zval *object, zval *offset, zval *value)
+static void com_write_dimension(zend_object *object, zval *offset, zval *value)
{
php_com_dotnet_object *obj;
zval args[2];
VARIANT v;
HRESULT res;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (offset == NULL) {
php_com_throw_exception(DISP_E_BADINDEX, "appending to variants is not supported");
@@ -184,29 +182,15 @@ static zval *com_get_property_ptr_ptr(zval *object, zval *member, int type, void
return NULL;
}
-#if 0
-static void com_object_set(zval **property, zval *value)
-{
- /* Not yet implemented in the engine */
-}
-
-static zval *com_object_get(zval *property)
-{
- /* Not yet implemented in the engine */
- return NULL;
-}
-#endif
-
-static int com_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int com_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot)
{
DISPID dispid;
php_com_dotnet_object *obj;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
- convert_to_string_ex(member);
- if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid))) {
+ if (SUCCEEDED(php_com_get_id_of_name(obj, ZSTR_VAL(member), ZSTR_LEN(member), &dispid))) {
/* TODO: distinguish between property and method! */
return 1;
}
@@ -217,23 +201,23 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
return 0;
}
-static int com_dimension_exists(zval *object, zval *member, int check_empty)
+static int com_dimension_exists(zend_object *object, zval *member, int check_empty)
{
php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object");
return 0;
}
-static void com_property_delete(zval *object, zval *member, void **cache_slot)
+static void com_property_delete(zend_object *object, zend_string *member, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static void com_dimension_delete(zval *object, zval *offset)
+static void com_dimension_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static HashTable *com_properties_get(zval *object)
+static HashTable *com_properties_get(zend_object *object)
{
/* TODO: use type-info to get all the names and values ?
* DANGER: if we do that, there is a strong possibility for
@@ -257,11 +241,42 @@ static void function_dtor(zval *zv)
static PHP_FUNCTION(com_method_handler)
{
zval *object = getThis();
+ zend_string *method = EX(func)->common.function_name;
+ zval *args = NULL;
+ php_com_dotnet_object *obj = CDNO_FETCH(object);
+ int nargs;
+ VARIANT v;
+ int ret = FAILURE;
+
+ if (V_VT(&obj->v) != VT_DISPATCH) {
+ goto exit;
+ }
- Z_OBJ_HANDLER_P(object, call_method)(
- ((zend_internal_function*)EX(func))->function_name,
- Z_OBJ_P(object),
- INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ nargs = ZEND_NUM_ARGS();
+
+ if (nargs) {
+ args = (zval *)safe_emalloc(sizeof(zval), nargs, 0);
+ zend_get_parameters_array_ex(nargs, args);
+ }
+
+ VariantInit(&v);
+
+ if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) {
+ php_com_zval_from_variant(return_value, &v, obj->code_page);
+ ret = SUCCESS;
+ VariantClear(&v);
+ }
+
+ if (args) {
+ efree(args);
+ }
+
+exit:
+ /* Cleanup trampoline */
+ ZEND_ASSERT(EX(func)->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE);
+ zend_string_release(EX(func)->common.function_name);
+ zend_free_trampoline(EX(func));
+ EX(func) = NULL;
}
static zend_function *com_method_get(zend_object **object_ptr, zend_string *name, const zval *key)
@@ -281,7 +296,8 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
/* check cache */
if (obj->method_cache == NULL || NULL == (fptr = zend_hash_find_ptr(obj->method_cache, name))) {
- f.type = ZEND_OVERLOADED_FUNCTION;
+ memset(&f, 0, sizeof(zend_internal_function));
+ f.type = ZEND_INTERNAL_FUNCTION;
f.num_args = 0;
f.arg_info = NULL;
f.scope = obj->ce;
@@ -311,7 +327,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
f.arg_info = ecalloc(bindptr.lpfuncdesc->cParams, sizeof(zend_arg_info));
for (i = 0; i < bindptr.lpfuncdesc->cParams; i++) {
- f.arg_info[i].type = ZEND_TYPE_ENCODE(0,1);
+ f.arg_info[i].type = ZEND_TYPE_ENCODE_NONE();
if (bindptr.lpfuncdesc->lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FOUT) {
f.arg_info[i].pass_by_reference = ZEND_SEND_BY_REF;
}
@@ -356,6 +372,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
if (fptr) {
/* duplicate this into a new chunk of emalloc'd memory,
* since the engine will efree it */
+ zend_string_addref(fptr->function_name);
func = emalloc(sizeof(*fptr));
memcpy(func, fptr, sizeof(*fptr));
@@ -365,40 +382,6 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
return NULL;
}
-static int com_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *args = NULL;
- php_com_dotnet_object *obj = (php_com_dotnet_object*)object;
- int nargs;
- VARIANT v;
- int ret = FAILURE;
-
- if (V_VT(&obj->v) != VT_DISPATCH) {
- return FAILURE;
- }
-
- nargs = ZEND_NUM_ARGS();
-
- if (nargs) {
- args = (zval *)safe_emalloc(sizeof(zval), nargs, 0);
- zend_get_parameters_array_ex(nargs, args);
- }
-
- VariantInit(&v);
-
- if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) {
- php_com_zval_from_variant(return_value, &v, obj->code_page);
- ret = SUCCESS;
- VariantClear(&v);
- }
-
- if (args) {
- efree(args);
- }
-
- return ret;
-}
-
static zend_function *com_constructor_get(zend_object *object)
{
php_com_dotnet_object *obj = (php_com_dotnet_object *) object;
@@ -449,6 +432,8 @@ static int com_objects_compare(zval *object1, zval *object2)
* So, we have this declaration here to fix it */
STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags);
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+
obja = CDNO_FETCH(object1);
objb = CDNO_FETCH(object2);
@@ -471,14 +456,14 @@ static int com_objects_compare(zval *object1, zval *object2)
return ret;
}
-static int com_object_cast(zval *readobj, zval *writeobj, int type)
+static int com_object_cast(zend_object *readobj, zval *writeobj, int type)
{
php_com_dotnet_object *obj;
VARIANT v;
VARTYPE vt = VT_EMPTY;
HRESULT res = S_OK;
- obj = CDNO_FETCH(readobj);
+ obj = (php_com_dotnet_object*) readobj;
ZVAL_NULL(writeobj);
VariantInit(&v);
@@ -528,12 +513,12 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type)
return zend_std_cast_object_tostring(readobj, writeobj, type);
}
-static int com_object_count(zval *object, zend_long *count)
+static int com_object_count(zend_object *object, zend_long *count)
{
php_com_dotnet_object *obj;
LONG ubound = 0, lbound = 0;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (!V_ISARRAY(&obj->v)) {
return FAILURE;
@@ -557,23 +542,22 @@ zend_object_handlers php_com_object_handlers = {
com_read_dimension,
com_write_dimension,
com_get_property_ptr_ptr,
- NULL, /* com_object_get, */
- NULL, /* com_object_set, */
com_property_exists,
com_property_delete,
com_dimension_exists,
com_dimension_delete,
com_properties_get,
com_method_get,
- com_call_method,
com_constructor_get,
com_class_name_get,
- com_objects_compare,
com_object_cast,
com_object_count,
NULL, /* get_debug_info */
NULL, /* get_closure */
zend_std_get_gc, /* get_gc */
+ NULL, /* do_operation */
+ com_objects_compare, /* compare */
+ NULL, /* get_properties_for */
};
void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable)
@@ -629,11 +613,11 @@ void php_com_object_free_storage(zend_object *object)
zend_object_std_dtor(object);
}
-zend_object* php_com_object_clone(zval *object)
+zend_object* php_com_object_clone(zend_object *object)
{
php_com_dotnet_object *cloneobj, *origobject;
- origobject = (php_com_dotnet_object*)Z_OBJ_P(object);
+ origobject = (php_com_dotnet_object*) object;
cloneobj = (php_com_dotnet_object*)emalloc(sizeof(php_com_dotnet_object));
memcpy(cloneobj, origobject, sizeof(*cloneobj));
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index e6f5b84cbd..4300fd2cdc 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.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/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c
index 13a94033e6..24230761c1 100644
--- a/ext/com_dotnet/com_misc.c
+++ b/ext/com_dotnet/com_misc.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/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c
index 6c5b6430bd..665773b120 100644
--- a/ext/com_dotnet/com_olechar.c
+++ b/ext/com_dotnet/com_olechar.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/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index 9be79995a3..dc320c966c 100644
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.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, |
@@ -287,7 +285,6 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
}
#define CPH_ME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_PUBLIC)
-#define CPH_SME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC)
#define CPH_METHOD(fname) static PHP_METHOD(com_persist, fname)
#define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis());
@@ -383,7 +380,6 @@ CPH_METHOD(SaveToFile)
if (helper->ipf) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b",
&filename, &filename_len, &remember)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
return;
}
@@ -447,7 +443,6 @@ CPH_METHOD(LoadFromFile)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l",
&filename, &filename_len, &flags)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
return;
}
@@ -543,7 +538,6 @@ CPH_METHOD(LoadFromStream)
CPH_FETCH();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
- php_com_throw_exception(E_INVALIDARG, "invalid arguments");
return;
}
@@ -605,7 +599,6 @@ CPH_METHOD(SaveToStream)
CPH_NO_OBJ();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
- php_com_throw_exception(E_INVALIDARG, "invalid arguments");
return;
}
@@ -653,7 +646,6 @@ CPH_METHOD(__construct)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!",
&zobj, php_com_variant_class_entry)) {
- php_com_throw_exception(E_INVALIDARG, "invalid arguments");
return;
}
@@ -710,9 +702,9 @@ static void helper_free_storage(zend_object *obj)
}
-static zend_object* helper_clone(zval *obj)
+static zend_object* helper_clone(zend_object *obj)
{
- php_com_persist_helper *clone, *object = (php_com_persist_helper*)Z_OBJ_P(obj);
+ php_com_persist_helper *clone, *object = (php_com_persist_helper*) obj;
clone = emalloc(sizeof(*object));
memcpy(clone, object, sizeof(*object));
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c
index 5f43c9fe25..2b42315151 100644
--- a/ext/com_dotnet/com_saproxy.c
+++ b/ext/com_dotnet/com_saproxy.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, |
@@ -37,7 +35,6 @@
typedef struct {
zend_object std;
/* the object we a proxying for; we hold a refcount to it */
- zval *zobj;
php_com_dotnet_object *obj;
/* how many dimensions we are indirecting to get into this element */
@@ -69,7 +66,7 @@ static inline void clone_indices(php_com_saproxy *dest, php_com_saproxy *src, in
}
}
-static zval *saproxy_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *saproxy_property_read(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv)
{
ZVAL_NULL(rv);
@@ -78,15 +75,15 @@ static zval *saproxy_property_read(zval *object, zval *member, int type, void **
return rv;
}
-static zval *saproxy_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *saproxy_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot)
{
php_com_throw_exception(E_INVALIDARG, "safearray has no properties");
return value;
}
-static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *rv)
+static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type, zval *rv)
{
- php_com_saproxy *proxy = SA_FETCH(object);
+ php_com_saproxy *proxy = (php_com_saproxy*) object;
UINT dims, i;
SAFEARRAY *sa;
LONG ubound, lbound;
@@ -202,9 +199,9 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
return rv;
}
-static void saproxy_write_dimension(zval *object, zval *offset, zval *value)
+static void saproxy_write_dimension(zend_object *object, zval *offset, zval *value)
{
- php_com_saproxy *proxy = SA_FETCH(object);
+ php_com_saproxy *proxy = (php_com_saproxy*) object;
UINT dims, i;
HRESULT res;
VARIANT v;
@@ -275,41 +272,29 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value)
}
}
-#if 0
-static void saproxy_object_set(zval **property, zval *value)
-{
-}
-
-static zval *saproxy_object_get(zval *property)
-{
- /* Not yet implemented in the engine */
- return NULL;
-}
-#endif
-
-static int saproxy_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int saproxy_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot)
{
/* no properties */
return 0;
}
-static int saproxy_dimension_exists(zval *object, zval *member, int check_empty)
+static int saproxy_dimension_exists(zend_object *object, zval *member, int check_empty)
{
php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object");
return 0;
}
-static void saproxy_property_delete(zval *object, zval *member, void **cache_slot)
+static void saproxy_property_delete(zend_object *object, zend_string *member, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static void saproxy_dimension_delete(zval *object, zval *offset)
+static void saproxy_dimension_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static HashTable *saproxy_properties_get(zval *object)
+static HashTable *saproxy_properties_get(zend_object *object)
{
/* no properties */
return NULL;
@@ -321,11 +306,6 @@ static zend_function *saproxy_method_get(zend_object **object, zend_string *name
return NULL;
}
-static int saproxy_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
static zend_function *saproxy_constructor_get(zend_object *object)
{
/* user cannot instantiate */
@@ -339,17 +319,18 @@ static zend_string* saproxy_class_name_get(const zend_object *object)
static int saproxy_objects_compare(zval *object1, zval *object2)
{
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
return -1;
}
-static int saproxy_object_cast(zval *readobj, zval *writeobj, int type)
+static int saproxy_object_cast(zend_object *readobj, zval *writeobj, int type)
{
return FAILURE;
}
-static int saproxy_count_elements(zval *object, zend_long *count)
+static int saproxy_count_elements(zend_object *object, zend_long *count)
{
- php_com_saproxy *proxy = SA_FETCH(object);
+ php_com_saproxy *proxy = (php_com_saproxy*) object;
LONG ubound, lbound;
if (!V_ISARRAY(&proxy->obj->v)) {
@@ -375,21 +356,22 @@ static void saproxy_free_storage(zend_object *object)
//??? }
//??? }
+ OBJ_RELEASE(&proxy->obj->zo);
+
zend_object_std_dtor(object);
- zval_ptr_dtor(proxy->zobj);
efree(proxy->indices);
}
-static zend_object* saproxy_clone(zval *object)
+static zend_object* saproxy_clone(zend_object *object)
{
- php_com_saproxy *proxy = (php_com_saproxy *)Z_OBJ_P(object);
+ php_com_saproxy *proxy = (php_com_saproxy *) object;
php_com_saproxy *cloneproxy;
cloneproxy = emalloc(sizeof(*cloneproxy));
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
- Z_ADDREF_P(cloneproxy->zobj);
+ GC_ADDREF(&cloneproxy->obj->zo);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
clone_indices(cloneproxy, proxy, proxy->dimensions);
@@ -406,40 +388,40 @@ zend_object_handlers php_com_saproxy_handlers = {
saproxy_read_dimension,
saproxy_write_dimension,
NULL,
- NULL, /* saproxy_object_get, */
- NULL, /* saproxy_object_set, */
saproxy_property_exists,
saproxy_property_delete,
saproxy_dimension_exists,
saproxy_dimension_delete,
saproxy_properties_get,
saproxy_method_get,
- saproxy_call_method,
saproxy_constructor_get,
saproxy_class_name_get,
- saproxy_objects_compare,
saproxy_object_cast,
- saproxy_count_elements
+ saproxy_count_elements,
+ NULL, /* get_debug_info */
+ NULL, /* get_closure */
+ NULL, /* get_gc */
+ NULL, /* do_operation */
+ saproxy_objects_compare, /* compare */
+ NULL, /* get_properties_for */
};
-int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
+int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index)
{
php_com_saproxy *proxy, *rel = NULL;
proxy = ecalloc(1, sizeof(*proxy));
proxy->dimensions = 1;
- if (Z_OBJCE_P(com_object) == php_com_saproxy_class_entry) {
- rel = SA_FETCH(com_object);
+ if (com_object->ce == php_com_saproxy_class_entry) {
+ rel = (php_com_saproxy*) com_object;
proxy->obj = rel->obj;
- proxy->zobj = rel->zobj;
proxy->dimensions += rel->dimensions;
} else {
- proxy->obj = CDNO_FETCH(com_object);
- proxy->zobj = com_object;
+ proxy->obj = (php_com_dotnet_object*) com_object;
}
- Z_ADDREF_P(proxy->zobj);
+ GC_ADDREF(&proxy->obj->zo);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
if (rel) {
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 44d0340af5..fe1d18f5d6 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.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/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c
index aef7fabe7f..e74739135a 100644
--- a/ext/com_dotnet/com_variant.c
+++ b/ext/com_dotnet/com_variant.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, |
@@ -452,7 +450,6 @@ PHP_FUNCTION(com_variant_create_instance)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"z!|ll", &zvalue, &vt, &codepage)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
return;
}
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index 78d8912a90..5318011e44 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.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/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h
index 50894158f5..e770fd3a94 100644
--- a/ext/com_dotnet/php_com_dotnet.h
+++ b/ext/com_dotnet/php_com_dotnet.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/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index 676d2f9330..3ee7ec4eba 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.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, |
@@ -72,14 +70,14 @@ zend_class_entry *php_com_variant_class_entry, *php_com_exception_class_entry, *
/* com_handlers.c */
zend_object* php_com_object_new(zend_class_entry *ce);
-zend_object* php_com_object_clone(zval *object);
+zend_object* php_com_object_clone(zend_object *object);
void php_com_object_free_storage(zend_object *object);
zend_object_handlers php_com_object_handlers;
void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable);
/* com_saproxy.c */
zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref);
-int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index);
+int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index);
/* com_olechar.c */
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index d12976df18..0e80cad16a 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.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, |
@@ -23,6 +21,7 @@
#include "php.h"
#include "php_ini.h"
#include "php_ctype.h"
+#include "ctype_arginfo.h"
#include "SAPI.h"
#include "ext/standard/info.h"
@@ -43,52 +42,6 @@ static PHP_FUNCTION(ctype_punct);
static PHP_FUNCTION(ctype_space);
static PHP_FUNCTION(ctype_upper);
static PHP_FUNCTION(ctype_xdigit);
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_alnum, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_alpha, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_cntrl, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_digit, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_lower, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_graph, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_print, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_punct, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_space, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_upper, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_xdigit, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
/* }}} */
/* {{{ ctype_functions[]
diff --git a/ext/ctype/ctype.stub.php b/ext/ctype/ctype.stub.php
new file mode 100644
index 0000000000..7bcc44e6ae
--- /dev/null
+++ b/ext/ctype/ctype.stub.php
@@ -0,0 +1,23 @@
+<?php
+
+function ctype_alnum($text): bool {}
+
+function ctype_alpha($text): bool {}
+
+function ctype_cntrl($text): bool {}
+
+function ctype_digit($text): bool {}
+
+function ctype_lower($text): bool {}
+
+function ctype_graph($text): bool {}
+
+function ctype_print($text): bool {}
+
+function ctype_punct($text): bool {}
+
+function ctype_space($text): bool {}
+
+function ctype_upper($text): bool {}
+
+function ctype_xdigit($text): bool {}
diff --git a/ext/ctype/ctype_arginfo.h b/ext/ctype/ctype_arginfo.h
new file mode 100644
index 0000000000..d22d9d3d69
--- /dev/null
+++ b/ext/ctype/ctype_arginfo.h
@@ -0,0 +1,25 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ctype_alnum, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, text)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ctype_alpha arginfo_ctype_alnum
+
+#define arginfo_ctype_cntrl arginfo_ctype_alnum
+
+#define arginfo_ctype_digit arginfo_ctype_alnum
+
+#define arginfo_ctype_lower arginfo_ctype_alnum
+
+#define arginfo_ctype_graph arginfo_ctype_alnum
+
+#define arginfo_ctype_print arginfo_ctype_alnum
+
+#define arginfo_ctype_punct arginfo_ctype_alnum
+
+#define arginfo_ctype_space arginfo_ctype_alnum
+
+#define arginfo_ctype_upper arginfo_ctype_alnum
+
+#define arginfo_ctype_xdigit arginfo_ctype_alnum
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
index 3265f50e06..4fb5d93a09 100644
--- a/ext/ctype/php_ctype.h
+++ b/ext/ctype/php_ctype.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/ext/curl/curl.stub.php b/ext/curl/curl.stub.php
new file mode 100644
index 0000000000..f5bd6daacf
--- /dev/null
+++ b/ext/curl/curl.stub.php
@@ -0,0 +1,147 @@
+<?php
+
+/** @param resource $handle */
+function curl_close($handle): void {}
+
+/**
+ * @param resource $handle
+ *
+ * @return resource|false
+ */
+function curl_copy_handle($handle) {}
+
+/** @param resource $handle */
+function curl_errno($handle): int {}
+
+/** @param resource $handle */
+function curl_error($handle): string {}
+
+/**
+ * @param resource $handle
+ *
+ * @return string|false
+ */
+function curl_escape($handle, string $string) {}
+
+/**
+ * @param resource $handle
+ *
+ * @return string|bool
+ */
+function curl_exec($handle) {}
+
+function curl_file_create(
+ string $filename,
+ string $mimetype = UNKNOWN,
+ string $postname = UNKNOWN
+): CURLFile {}
+
+/**
+ * @param resource $handle
+ *
+ * @return mixed
+ */
+function curl_getinfo($handle, int $option = UNKNOWN) {}
+
+/**
+ * @param resource $handle
+ *
+ * @return resource|false
+ */
+function curl_init(string $url = UNKNOWN) {}
+
+/**
+ * @param resource $multi_handle
+ * @param resource $handle
+ */
+function curl_multi_add_handle($multi_handle, $handle): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_close($multi_handle): void {}
+
+/**
+ * @param resource $multi_handle
+ *
+ * @return int|false
+ */
+function curl_multi_errno($multi_handle): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_exec($multi_handle, &$still_running): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_getcontent($multi_handle): ?string {}
+
+/**
+ * @param resource $multi_handle
+ *
+ * @return array|false
+ */
+function curl_multi_info_read($multi_handle, &$msgs_in_queue = null) {}
+
+/** @return resource */
+function curl_multi_init() {}
+
+/**
+ * @param resource $multi_handle
+ * @param resource $handle
+ */
+function curl_multi_remove_handle($multi_handle, $handle): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_select($multi_handle, float $timeout = 1.0): int {}
+
+/**
+ * @param resource $multi_handle
+ * @param mixed $value
+ */
+function curl_multi_setopt($multi_handle, int $option, $value): bool {}
+
+function curl_multi_strerror(int $error_number): ?string {}
+
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+/** @param resource $handle */
+function curl_pause($handle, int $bitmask): int {}
+#endif
+
+/** @param resource $handle */
+function curl_reset($handle): void {}
+
+/**
+ * @param resource $handle
+ * @param array<int, mixed> $options
+ */
+function curl_setopt_array($handle, array $options): bool {}
+
+
+/**
+ * @param resource $handle
+ * @param mixed $value
+ */
+function curl_setopt($handle, int $option, $value): bool {}
+
+/** @param resource $share_handle */
+function curl_share_close($share_handle): void {}
+
+/** @param resource $share_handle */
+function curl_share_errno($share_handle): int {}
+
+/** @return resource */
+function curl_share_init() {}
+
+/** @param resource $share_handle */
+function curl_share_setopt($share_handle, int $option, $value): bool {}
+
+function curl_share_strerror(int $error_number): ?string {}
+
+function curl_strerror(int $error_number): ?string {}
+
+/**
+ * @param resource $handle
+ *
+ * @return string|false
+ */
+function curl_unescape($handle, string $string) {}
+
+/** @return array|false */
+function curl_version(int $age = UNKNOWN) {}
diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h
new file mode 100644
index 0000000000..561c0a7684
--- /dev/null
+++ b/ext/curl/curl_arginfo.h
@@ -0,0 +1,132 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_copy_handle, 0, 0, 1)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_error, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_escape, 0, 0, 2)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_exec arginfo_curl_copy_handle
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_curl_file_create, 0, 1, CURLFile, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_getinfo, 0, 0, 1)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_init, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_add_handle, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_exec, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_INFO(1, still_running)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_getcontent, 0, 1, IS_STRING, 1)
+ ZEND_ARG_INFO(0, multi_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_info_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_INFO(1, msgs_in_queue)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_init, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_multi_remove_handle arginfo_curl_multi_add_handle
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_select, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_setopt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_strerror, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, error_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_pause, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, bitmask, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_curl_reset arginfo_curl_close
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_setopt_array, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_setopt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_share_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, share_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_share_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, share_handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_share_init arginfo_curl_multi_init
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_share_setopt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, share_handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_share_strerror arginfo_curl_multi_strerror
+
+#define arginfo_curl_strerror arginfo_curl_multi_strerror
+
+#define arginfo_curl_unescape arginfo_curl_escape
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_version, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, age, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c
index a35e29147c..3241a8e31b 100644
--- a/ext/curl/curl_file.c
+++ b/ext/curl/curl_file.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, |
@@ -24,6 +22,8 @@
#include "Zend/zend_exceptions.h"
#include "Zend/zend_interfaces.h"
#include "php_curl.h"
+#include "curl_arginfo.h"
+#include "curl_file_arginfo.h"
#if HAVE_CURL
PHP_CURL_API zend_class_entry *curl_CURLFile_class;
@@ -131,24 +131,13 @@ ZEND_METHOD(CURLFile, setPostFilename)
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curlfile_create, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mimetype)
- ZEND_ARG_INFO(0, postname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curlfile_name, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-
static const zend_function_entry curlfile_funcs[] = {
- PHP_ME(CURLFile, __construct, arginfo_curlfile_create, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, getFilename, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, getMimeType, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, setMimeType, arginfo_curlfile_name, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, getPostFilename, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, setPostFilename, arginfo_curlfile_name, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, __construct, arginfo_class_CURLFile___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, getFilename, arginfo_class_CURLFile_getFilename, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, getMimeType, arginfo_class_CURLFile_getMimeType, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, setMimeType, arginfo_class_CURLFile_setMimeType, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, getPostFilename, arginfo_class_CURLFile_getPostFilename, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, setPostFilename, arginfo_class_CURLFile_setPostFilename, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/curl/curl_file.stub.php b/ext/curl/curl_file.stub.php
new file mode 100644
index 0000000000..e6e21f9a02
--- /dev/null
+++ b/ext/curl/curl_file.stub.php
@@ -0,0 +1,24 @@
+<?php
+
+class CURLFile {
+ public function __construct(
+ string $filename,
+ string $mimetype = UNKNOWN,
+ string $postname = UNKNOWN
+ ) {}
+
+ /** @return string */
+ public function getFilename() {}
+
+ /** @return string */
+ public function getMimeType() {}
+
+ /** @return string */
+ public function getPostFilename() {}
+
+ /** @return void */
+ public function setMimeType(string $mime) {}
+
+ /** @return void */
+ public function setPostFilename(string $postname) {}
+}
diff --git a/ext/curl/curl_file_arginfo.h b/ext/curl/curl_file_arginfo.h
new file mode 100644
index 0000000000..df50ab29dd
--- /dev/null
+++ b/ext/curl/curl_file_arginfo.h
@@ -0,0 +1,22 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_getFilename, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_CURLFile_getMimeType arginfo_class_CURLFile_getFilename
+
+#define arginfo_class_CURLFile_getPostFilename arginfo_class_CURLFile_getFilename
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_setMimeType, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, mime, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_setPostFilename, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 6a25359597..abb4a8a688 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.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, |
@@ -68,6 +66,7 @@
#include "ext/standard/file.h"
#include "ext/standard/url.h"
#include "php_curl.h"
+#include "curl_arginfo.h"
int le_curl;
int le_curl_multi_handle;
@@ -241,154 +240,6 @@ void _php_curl_verify_handlers(php_curl *ch, int reporterror) /* {{{ */
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_version, 0, 0, 0)
- ZEND_ARG_INFO(0, version)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_init, 0, 0, 0)
- ZEND_ARG_INFO(0, url)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_copy_handle, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_setopt, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_setopt_array, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_ARRAY_INFO(0, options, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_exec, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_getinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_error, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_errno, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_close, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_reset, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_escape, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_unescape, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_setopt, 0)
- ZEND_ARG_INFO(0, sh)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_init, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_add_handle, 0)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_remove_handle, 0)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_select, 0, 0, 1)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_exec, 0, 0, 1)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(1, still_running)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_getcontent, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_info_read, 0, 0, 1)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(1, msgs_in_queue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_close, 0)
- ZEND_ARG_INFO(0, mh)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_errno, 0)
- ZEND_ARG_INFO(0, mh)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_strerror, 0)
- ZEND_ARG_INFO(0, errornum)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_strerror, 0)
- ZEND_ARG_INFO(0, errornum)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_strerror, 0)
- ZEND_ARG_INFO(0, errornum)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_init, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_close, 0)
- ZEND_ARG_INFO(0, sh)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_setopt, 0)
- ZEND_ARG_INFO(0, sh)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_errno, 0)
- ZEND_ARG_INFO(0, sh)
-ZEND_END_ARG_INFO()
-
-#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
-ZEND_BEGIN_ARG_INFO(arginfo_curl_pause, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, bitmask)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curlfile_create, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mimetype)
- ZEND_ARG_INFO(0, postname)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ curl_functions[]
*/
static const zend_function_entry curl_functions[] = {
@@ -411,6 +262,7 @@ static const zend_function_entry curl_functions[] = {
#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
PHP_FE(curl_pause, arginfo_curl_pause)
#endif
+ PHP_FE(curl_file_create, arginfo_curl_file_create)
PHP_FE(curl_multi_init, arginfo_curl_multi_init)
PHP_FE(curl_multi_add_handle, arginfo_curl_multi_add_handle)
PHP_FE(curl_multi_remove_handle, arginfo_curl_multi_remove_handle)
@@ -425,7 +277,6 @@ static const zend_function_entry curl_functions[] = {
PHP_FE(curl_share_close, arginfo_curl_share_close)
PHP_FE(curl_share_setopt, arginfo_curl_share_setopt)
PHP_FE(curl_share_errno, arginfo_curl_share_errno)
- PHP_FE(curl_file_create, arginfo_curlfile_create)
PHP_FE_END
};
/* }}} */
@@ -2108,7 +1959,7 @@ PHP_FUNCTION(curl_copy_handle)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
cp = curl_easy_duphandle(ch->cp);
@@ -3074,7 +2925,7 @@ PHP_FUNCTION(curl_setopt)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (options <= 0 && options != CURLOPT_SAFE_UPLOAD) {
@@ -3105,7 +2956,7 @@ PHP_FUNCTION(curl_setopt_array)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(arr), option, string_key, entry) {
@@ -3152,7 +3003,7 @@ PHP_FUNCTION(curl_exec)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
_php_curl_verify_handlers(ch, 1);
@@ -3211,7 +3062,7 @@ PHP_FUNCTION(curl_getinfo)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ZEND_NUM_ARGS() < 2) {
@@ -3475,7 +3326,7 @@ PHP_FUNCTION(curl_error)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ch->err.no) {
@@ -3499,7 +3350,7 @@ PHP_FUNCTION(curl_errno)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(ch->err.no);
@@ -3518,7 +3369,7 @@ PHP_FUNCTION(curl_close)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ch->in_callback) {
@@ -3692,7 +3543,7 @@ PHP_FUNCTION(curl_reset)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ch->in_callback) {
@@ -3721,7 +3572,7 @@ PHP_FUNCTION(curl_escape)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(str))) {
@@ -3753,7 +3604,7 @@ PHP_FUNCTION(curl_unescape)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(str))) {
@@ -3784,7 +3635,7 @@ PHP_FUNCTION(curl_pause)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(curl_easy_pause(ch->cp, bitmask));
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 4ba165a09d..bbed3fe1f2 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.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, |
@@ -85,11 +83,11 @@ PHP_FUNCTION(curl_multi_add_handle)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
_php_curl_cleanup_handle(ch);
@@ -171,11 +169,11 @@ PHP_FUNCTION(curl_multi_remove_handle)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
error = curl_multi_remove_handle(mh->multi, ch->cp);
@@ -224,7 +222,7 @@ PHP_FUNCTION(curl_multi_select)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
@@ -269,7 +267,7 @@ PHP_FUNCTION(curl_multi_exec)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
{
@@ -281,7 +279,7 @@ PHP_FUNCTION(curl_multi_exec)
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(pz_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
_php_curl_verify_handlers(ch, 1);
@@ -309,7 +307,7 @@ PHP_FUNCTION(curl_multi_getcontent)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ch->handlers->write->method == PHP_CURL_RETURN) {
@@ -342,7 +340,7 @@ PHP_FUNCTION(curl_multi_info_read)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
tmp_msg = curl_multi_info_read(mh->multi, &queued_msgs);
@@ -396,7 +394,7 @@ PHP_FUNCTION(curl_multi_close)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
zend_list_close(Z_RES_P(z_mh));
@@ -448,7 +446,7 @@ PHP_FUNCTION(curl_multi_errno)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(mh->err.no);
@@ -627,7 +625,7 @@ PHP_FUNCTION(curl_multi_setopt)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!_php_curl_multi_setopt(mh, options, zvalue, return_value)) {
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 5d93f16c03..44a86bff8b 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.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/ext/curl/share.c b/ext/curl/share.c
index 242cad09cd..2814d0b822 100644
--- a/ext/curl/share.c
+++ b/ext/curl/share.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, |
@@ -62,7 +60,7 @@ PHP_FUNCTION(curl_share_close)
ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
zend_list_close(Z_RES_P(z_sh));
@@ -106,7 +104,7 @@ PHP_FUNCTION(curl_share_setopt)
ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(zid), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!_php_curl_share_setopt(sh, options, zvalue, return_value)) {
@@ -140,7 +138,7 @@ PHP_FUNCTION(curl_share_errno)
ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(sh->err.no);
diff --git a/ext/curl/tests/curl_multi_close_basic001.phpt b/ext/curl/tests/curl_multi_close_basic001.phpt
index 0cabf2cbad..cf47668b30 100644
--- a/ext/curl/tests/curl_multi_close_basic001.phpt
+++ b/ext/curl/tests/curl_multi_close_basic001.phpt
@@ -11,15 +11,17 @@ var_dump($cmh);
$multi_close_result = curl_multi_close($cmh);
var_dump($multi_close_result);
var_dump($cmh);
-$bad_mh_close_result = curl_multi_close($cmh);
-var_dump($bad_mh_close_result);
+try {
+ $bad_mh_close_result = curl_multi_close($cmh);
+ var_dump($bad_mh_close_result);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
--EXPECTF--
resource(%d) of type (curl_multi)
NULL
resource(%d) of type (Unknown)
-
-Warning: curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource in %s on line %d
-bool(false)
+curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource
===DONE===
diff --git a/ext/curl/tests/curl_setopt_error.phpt b/ext/curl/tests/curl_setopt_error.phpt
index ab864d4b2d..0a7db7265f 100644
--- a/ext/curl/tests/curl_setopt_error.phpt
+++ b/ext/curl/tests/curl_setopt_error.phpt
@@ -9,37 +9,17 @@ Paul Sohier
<?php
echo "*** curl_setopt() call with incorrect parameters\n";
$ch = curl_init();
-curl_setopt();
-curl_setopt(false);
-curl_setopt($ch);
-curl_setopt($ch, false);
-curl_setopt($ch, -10);
-curl_setopt($ch, '');
-curl_setopt($ch, 1, false);
+try {
+ curl_setopt($ch, '', false);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-curl_setopt(false, false, false);
-curl_setopt($ch, '', false);
-curl_setopt($ch, 1, '');
curl_setopt($ch, -10, 0);
?>
--EXPECTF--
*** curl_setopt() call with incorrect parameters
-
-Warning: curl_setopt() expects exactly 3 parameters, 0 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: curl_setopt() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: curl_setopt() expects parameter 2 to be int, string given in %s on line %d
+curl_setopt() expects parameter 2 to be int, string given
Warning: curl_setopt(): Invalid curl configuration option in %scurl_setopt_error.php on line %d
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index b76c4c9a7e..7a82a255dc 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.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, |
@@ -76,345 +74,7 @@ PHPAPI time_t php_time()
#endif
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmdate, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_idate, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strtotime, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, now)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 0)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, sec)
- ZEND_ARG_INFO(0, mon)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmmktime, 0, 0, 0)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, sec)
- ZEND_ARG_INFO(0, mon)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_checkdate, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strftime, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmstrftime, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_time, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_localtime, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp)
- ZEND_ARG_INFO(0, associative_array)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_getdate, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_default_timezone_set, 0)
- ZEND_ARG_INFO(0, timezone_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_default_timezone_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunrise, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, latitude)
- ZEND_ARG_INFO(0, longitude)
- ZEND_ARG_INFO(0, zenith)
- ZEND_ARG_INFO(0, gmt_offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunset, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, latitude)
- ZEND_ARG_INFO(0, longitude)
- ZEND_ARG_INFO(0, zenith)
- ZEND_ARG_INFO(0, gmt_offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_sun_info, 0)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, latitude)
- ZEND_ARG_INFO(0, longitude)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 0)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create_from_format, 0, 0, 2)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse_from_format, 0, 0, 2)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_get_last_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_format, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_format, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_modify, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, modify)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_modify, 0, 0, 1)
- ZEND_ARG_INFO(0, modify)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_add, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_add, 0, 0, 1)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sub, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_sub, 0, 0, 1)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_timezone_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_set, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timezone_set, 0, 0, 1)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_offset_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_offset_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_diff, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, object2)
- ZEND_ARG_INFO(0, absolute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_diff, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, absolute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_time_set, 0, 0, 3)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
- ZEND_ARG_INFO(0, microseconds)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_time_set, 0, 0, 2)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
- ZEND_ARG_INFO(0, microseconds)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_date_set, 0, 0, 4)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_date_set, 0, 0, 3)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_isodate_set, 0, 0, 3)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, week)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_isodate_set, 0, 0, 2)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, week)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_set, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, unixtimestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timestamp_set, 0, 0, 1)
- ZEND_ARG_INFO(0, unixtimestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_timestamp_get, 0)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_immutable, 0, 0, 1)
- ZEND_ARG_INFO(0, DateTimeImmutable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_mutable, 0, 0, 1)
- ZEND_ARG_INFO(0, DateTime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_open, 0, 0, 1)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_name_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1)
- ZEND_ARG_INFO(0, abbr)
- ZEND_ARG_INFO(0, gmtoffset)
- ZEND_ARG_INFO(0, isdst)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_offset_get, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
- ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_offset_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, timestamp_begin)
- ZEND_ARG_INFO(0, timestamp_end)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_transitions_get, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp_begin)
- ZEND_ARG_INFO(0, timestamp_end)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_location_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_location_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0)
- ZEND_ARG_INFO(0, what)
- ZEND_ARG_INFO(0, country)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_abbreviations_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_version_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_create_from_date_string, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_format, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_interval_format, 0)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, interval)
- ZEND_ARG_INFO(0, end)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, array, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, interval_spec)
-ZEND_END_ARG_INFO()
-/* }}} */
+#include "php_date_arginfo.h"
/* {{{ Function table */
static const zend_function_entry date_functions[] = {
@@ -479,91 +139,91 @@ static const zend_function_entry date_functions[] = {
};
static const zend_function_entry date_funcs_interface[] = {
- PHP_ABSTRACT_ME(DateTimeInterface, format, arginfo_date_method_format)
- PHP_ABSTRACT_ME(DateTimeInterface, getTimezone, arginfo_date_method_timezone_get)
- PHP_ABSTRACT_ME(DateTimeInterface, getOffset, arginfo_date_method_offset_get)
- PHP_ABSTRACT_ME(DateTimeInterface, getTimestamp, arginfo_date_method_timestamp_get)
- PHP_ABSTRACT_ME(DateTimeInterface, diff, arginfo_date_method_diff)
- PHP_ABSTRACT_ME(DateTimeInterface, __wakeup, NULL)
+ PHP_ABSTRACT_ME(DateTimeInterface, format, arginfo_class_DateTimeInterface_format)
+ PHP_ABSTRACT_ME(DateTimeInterface, getTimezone, arginfo_class_DateTimeInterface_getTimezone)
+ PHP_ABSTRACT_ME(DateTimeInterface, getOffset, arginfo_class_DateTimeInterface_getOffset)
+ PHP_ABSTRACT_ME(DateTimeInterface, getTimestamp, arginfo_class_DateTimeInterface_getTimestamp)
+ PHP_ABSTRACT_ME(DateTimeInterface, diff, arginfo_class_DateTimeInterface_diff)
+ PHP_ABSTRACT_ME(DateTimeInterface, __wakeup, arginfo_class_DateTimeInterface___wakeup)
PHP_FE_END
};
static const zend_function_entry date_funcs_date[] = {
- PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_PUBLIC)
- PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateTime, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
- PHP_ME_MAPPING(modify, date_modify, arginfo_date_method_modify, 0)
- PHP_ME_MAPPING(add, date_add, arginfo_date_method_add, 0)
- PHP_ME_MAPPING(sub, date_sub, arginfo_date_method_sub, 0)
- PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
- PHP_ME_MAPPING(setTimezone, date_timezone_set, arginfo_date_method_timezone_set, 0)
- PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0)
- PHP_ME_MAPPING(setTime, date_time_set, arginfo_date_method_time_set, 0)
- PHP_ME_MAPPING(setDate, date_date_set, arginfo_date_method_date_set, 0)
- PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_date_method_isodate_set, 0)
- PHP_ME_MAPPING(setTimestamp, date_timestamp_set, arginfo_date_method_timestamp_set, 0)
- PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_date_method_timestamp_get, 0)
- PHP_ME_MAPPING(diff, date_diff, arginfo_date_method_diff, 0)
+ PHP_ME(DateTime, __construct, arginfo_class_DateTime___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __wakeup, arginfo_class_DateTimeInterface___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __set_state, arginfo_class_DateTime___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTime, createFromImmutable, arginfo_class_DateTime_createFromImmutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_class_DateTime_createFromFormat, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_class_DateTime_getLastErrors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(format, date_format, arginfo_class_DateTimeInterface_format, 0)
+ PHP_ME_MAPPING(modify, date_modify, arginfo_class_DateTime_modify, 0)
+ PHP_ME_MAPPING(add, date_add, arginfo_class_DateTime_add, 0)
+ PHP_ME_MAPPING(sub, date_sub, arginfo_class_DateTime_sub, 0)
+ PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_class_DateTimeInterface_getTimezone, 0)
+ PHP_ME_MAPPING(setTimezone, date_timezone_set, arginfo_class_DateTime_setTimezone, 0)
+ PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_class_DateTimeInterface_getOffset, 0)
+ PHP_ME_MAPPING(setTime, date_time_set, arginfo_class_DateTime_setTime, 0)
+ PHP_ME_MAPPING(setDate, date_date_set, arginfo_class_DateTime_setDate, 0)
+ PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_class_DateTime_setISODate, 0)
+ PHP_ME_MAPPING(setTimestamp, date_timestamp_set, arginfo_class_DateTime_setTimestamp, 0)
+ PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_class_DateTimeInterface_getTimestamp, 0)
+ PHP_ME_MAPPING(diff, date_diff, arginfo_class_DateTimeInterface_diff, 0)
PHP_FE_END
};
static const zend_function_entry date_funcs_immutable[] = {
- PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_PUBLIC)
- PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateTimeImmutable, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTimeImmutable, __construct, arginfo_class_DateTimeImmutable___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __wakeup, arginfo_class_DateTimeInterface___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTimeImmutable, __set_state, arginfo_class_DateTimeImmutable___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
- PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
- PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0)
- PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_date_method_timestamp_get, 0)
- PHP_ME_MAPPING(diff, date_diff, arginfo_date_method_diff, 0)
- PHP_ME(DateTimeImmutable, modify, arginfo_date_method_modify, 0)
- PHP_ME(DateTimeImmutable, add, arginfo_date_method_add, 0)
- PHP_ME(DateTimeImmutable, sub, arginfo_date_method_sub, 0)
- PHP_ME(DateTimeImmutable, setTimezone, arginfo_date_method_timezone_set, 0)
- PHP_ME(DateTimeImmutable, setTime, arginfo_date_method_time_set, 0)
- PHP_ME(DateTimeImmutable, setDate, arginfo_date_method_date_set, 0)
- PHP_ME(DateTimeImmutable, setISODate, arginfo_date_method_isodate_set, 0)
- PHP_ME(DateTimeImmutable, setTimestamp, arginfo_date_method_timestamp_set, 0)
- PHP_ME(DateTimeImmutable, createFromMutable, arginfo_date_method_create_from_mutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(format, date_format, arginfo_class_DateTimeInterface_format, 0)
+ PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_class_DateTimeInterface_getTimezone, 0)
+ PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_class_DateTimeInterface_getOffset, 0)
+ PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_class_DateTimeInterface_getTimestamp, 0)
+ PHP_ME_MAPPING(diff, date_diff, arginfo_class_DateTimeInterface_diff, 0)
+ PHP_ME(DateTimeImmutable, modify, arginfo_class_DateTimeImmutable_modify, 0)
+ PHP_ME(DateTimeImmutable, add, arginfo_class_DateTimeImmutable_add, 0)
+ PHP_ME(DateTimeImmutable, sub, arginfo_class_DateTimeImmutable_sub, 0)
+ PHP_ME(DateTimeImmutable, setTimezone, arginfo_class_DateTimeImmutable_setTimezone, 0)
+ PHP_ME(DateTimeImmutable, setTime, arginfo_class_DateTimeImmutable_setTime, 0)
+ PHP_ME(DateTimeImmutable, setDate, arginfo_class_DateTimeImmutable_setDate, 0)
+ PHP_ME(DateTimeImmutable, setISODate, arginfo_class_DateTimeImmutable_setISODate, 0)
+ PHP_ME(DateTimeImmutable, setTimestamp, arginfo_class_DateTimeImmutable_setTimestamp, 0)
+ PHP_ME(DateTimeImmutable, createFromMutable, arginfo_class_DateTimeImmutable_createFromMutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry date_funcs_timezone[] = {
- PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_PUBLIC)
- PHP_ME(DateTimeZone, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateTimeZone, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0)
- PHP_ME_MAPPING(getOffset, timezone_offset_get, arginfo_timezone_method_offset_get, 0)
- PHP_ME_MAPPING(getTransitions, timezone_transitions_get, arginfo_timezone_method_transitions_get, 0)
- PHP_ME_MAPPING(getLocation, timezone_location_get, arginfo_timezone_method_location_get, 0)
- PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_timezone_abbreviations_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_timezone_identifiers_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTimeZone, __construct, arginfo_class_DateTimeZone___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTimeZone, __wakeup, arginfo_class_DateTimeZone___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTimeZone, __set_state, arginfo_class_DateTimeZone___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getName, timezone_name_get, arginfo_class_DateTimeZone_getName, 0)
+ PHP_ME_MAPPING(getOffset, timezone_offset_get, arginfo_class_DateTimeZone_getOffset, 0)
+ PHP_ME_MAPPING(getTransitions, timezone_transitions_get, arginfo_class_DateTimeZone_getTransitions, 0)
+ PHP_ME_MAPPING(getLocation, timezone_location_get, arginfo_class_DateTimeZone_getLocation, 0)
+ PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_class_DateTimeZone_listAbbreviations, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_class_DateTimeZone_listIdentifiers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry date_funcs_interval[] = {
- PHP_ME(DateInterval, __construct, arginfo_date_interval_construct, ZEND_ACC_PUBLIC)
- PHP_ME(DateInterval, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateInterval, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(format, date_interval_format, arginfo_date_method_interval_format, 0)
- PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateInterval, __construct, arginfo_class_DateInterval___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateInterval, __wakeup, arginfo_class_DateInterval___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateInterval, __set_state, arginfo_class_DateInterval___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(format, date_interval_format, arginfo_class_DateInterval_format, 0)
+ PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_class_DateInterval_createFromDateString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry date_funcs_period[] = {
- PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, getRecurrences, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, __construct, arginfo_class_DatePeriod___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, __wakeup, arginfo_class_DatePeriod___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, __set_state, arginfo_class_DatePeriod___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DatePeriod, getStartDate, arginfo_class_DatePeriod_getStartDate, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getEndDate, arginfo_class_DatePeriod_getEndDate, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getDateInterval, arginfo_class_DatePeriod_getDateInterval, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getRecurrences, arginfo_class_DatePeriod_getRecurrences, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -581,11 +241,11 @@ int php_date_global_timezone_db_enabled;
#define DATE_DEFAULT_LATITUDE "31.7667"
#define DATE_DEFAULT_LONGITUDE "35.2333"
-/* on 90'35; common sunset declaration (start of sun body appear) */
-#define DATE_SUNSET_ZENITH "90.583333"
+/* on 90'50; common sunset declaration (start of sun body appear) */
+#define DATE_SUNSET_ZENITH "90.833333"
-/* on 90'35; common sunrise declaration (sun body disappeared) */
-#define DATE_SUNRISE_ZENITH "90.583333"
+/* on 90'50; common sunrise declaration (sun body disappeared) */
+#define DATE_SUNRISE_ZENITH "90.833333"
static PHP_INI_MH(OnUpdate_date_timezone);
@@ -641,8 +301,8 @@ static zend_object_handlers date_object_handlers_period;
#define DATE_CHECK_INITIALIZED(member, class_name) \
if (!(member)) { \
- php_error_docref(NULL, E_WARNING, "The " #class_name " object has not been correctly initialized by its constructor"); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "The " #class_name " object has not been correctly initialized by its constructor"); \
+ return; \
}
static void date_object_free_storage_date(zend_object *object);
@@ -655,30 +315,30 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type);
static zend_object *date_object_new_interval(zend_class_entry *class_type);
static zend_object *date_object_new_period(zend_class_entry *class_type);
-static zend_object *date_object_clone_date(zval *this_ptr);
-static zend_object *date_object_clone_timezone(zval *this_ptr);
-static zend_object *date_object_clone_interval(zval *this_ptr);
-static zend_object *date_object_clone_period(zval *this_ptr);
+static zend_object *date_object_clone_date(zend_object *this_ptr);
+static zend_object *date_object_clone_timezone(zend_object *this_ptr);
+static zend_object *date_object_clone_interval(zend_object *this_ptr);
+static zend_object *date_object_clone_period(zend_object *this_ptr);
static int date_object_compare_date(zval *d1, zval *d2);
-static HashTable *date_object_get_gc(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose);
-static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_interval(zval *object);
-static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_period(zval *object);
-static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose);
-static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n);
-static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp);
+static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose);
+static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_interval(zend_object *object);
+static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_period(zend_object *object);
+static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose);
+static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp);
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv);
static int date_interval_compare_objects(zval *o1, zval *o2);
-static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
-static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
+static zval *date_interval_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
+static zval *date_interval_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
+static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
+static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv);
+static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot);
+static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot);
/* {{{ Module struct */
zend_module_entry date_module_entry = {
@@ -1276,7 +936,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
Z_PARAM_STR(format)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(ts)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 1) {
ts = php_time();
@@ -1436,7 +1096,7 @@ PHP_FUNCTION(idate)
Z_PARAM_STR(format)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(ts)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(format) != 1) {
php_error_docref(NULL, E_WARNING, "idate format is one char");
@@ -1508,7 +1168,7 @@ PHP_FUNCTION(strtotime)
Z_PARAM_STR(times)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(preset_ts)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
tzi = get_timezone_info();
@@ -1546,15 +1206,15 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
zend_long ts, adjust_seconds = 0;
int error;
- ZEND_PARSE_PARAMETERS_START(0, 6)
- Z_PARAM_OPTIONAL
+ ZEND_PARSE_PARAMETERS_START(1, 6)
Z_PARAM_LONG(hou)
+ Z_PARAM_OPTIONAL
Z_PARAM_LONG(min)
Z_PARAM_LONG(sec)
Z_PARAM_LONG(mon)
Z_PARAM_LONG(day)
Z_PARAM_LONG(yea)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize structure with current time */
now = timelib_time_ctor();
@@ -1568,8 +1228,6 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
}
/* Fill in the new data */
switch (ZEND_NUM_ARGS()) {
- case 7:
- /* break intentionally missing */
case 6:
if (yea >= 0 && yea < 70) {
yea += 2000;
@@ -1593,8 +1251,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
case 1:
now->h = hou;
break;
- default:
- php_error_docref(NULL, E_DEPRECATED, "You should be using the time() function instead");
+ EMPTY_SWITCH_DEFAULT_CASE()
}
/* Update the timestamp */
if (gmt) {
@@ -1616,7 +1273,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
}
/* }}} */
-/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+/* {{{ proto int mktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]])
Get UNIX timestamp for a date */
PHP_FUNCTION(mktime)
{
@@ -1624,7 +1281,7 @@ PHP_FUNCTION(mktime)
}
/* }}} */
-/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+/* {{{ proto int gmmktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]])
Get UNIX timestamp for a GMT date */
PHP_FUNCTION(gmmktime)
{
@@ -1642,7 +1299,7 @@ PHP_FUNCTION(checkdate)
Z_PARAM_LONG(m)
Z_PARAM_LONG(d)
Z_PARAM_LONG(y)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (y < 1 || y > 32767 || !timelib_valid_date(y, m, d)) {
RETURN_FALSE;
@@ -1670,7 +1327,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
Z_PARAM_STR(format)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(timestamp)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(format) == 0) {
RETURN_FALSE;
@@ -1788,7 +1445,7 @@ PHP_FUNCTION(localtime)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(timestamp)
Z_PARAM_BOOL(associative)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0) {
timestamp = (zend_long) php_time();
@@ -1839,7 +1496,7 @@ PHP_FUNCTION(getdate)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(timestamp)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0) {
timestamp = (zend_long) php_time();
@@ -2047,35 +1704,21 @@ static int implement_date_interface_handler(zend_class_entry *interface, zend_cl
return SUCCESS;
} /* }}} */
-static int date_interval_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static int date_interval_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
php_interval_obj *obj;
- zval tmp_member;
zval rv;
zval *prop;
int retval = 0;
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return 0;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- retval = zend_std_has_property(object, member, type, cache_slot);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_has_property(object, name, type, cache_slot);
return retval;
}
- prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ prop = date_interval_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (prop != &EG(uninitialized_zval)) {
if (type == 2) {
@@ -2086,11 +1729,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void
retval = (Z_TYPE_P(prop) != IS_NULL);
}
} else {
- retval = zend_std_has_property(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_has_property(object, name, type, cache_slot);
}
return retval;
@@ -2130,7 +1769,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_date.offset = XtOffsetOf(php_date_obj, std);
date_object_handlers_date.free_obj = date_object_free_storage_date;
date_object_handlers_date.clone_obj = date_object_clone_date;
- date_object_handlers_date.compare_objects = date_object_compare_date;
+ date_object_handlers_date.compare = date_object_compare_date;
date_object_handlers_date.get_properties_for = date_object_get_properties_for;
date_object_handlers_date.get_gc = date_object_get_gc;
zend_class_implements(date_ce_date, 1, date_ce_interface);
@@ -2140,7 +1779,7 @@ static void date_register_classes(void) /* {{{ */
date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, NULL);
memcpy(&date_object_handlers_immutable, &std_object_handlers, sizeof(zend_object_handlers));
date_object_handlers_immutable.clone_obj = date_object_clone_date;
- date_object_handlers_immutable.compare_objects = date_object_compare_date;
+ date_object_handlers_immutable.compare = date_object_compare_date;
date_object_handlers_immutable.get_properties_for = date_object_get_properties_for;
date_object_handlers_immutable.get_gc = date_object_get_gc;
zend_class_implements(date_ce_immutable, 1, date_ce_interface);
@@ -2187,7 +1826,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_interval.get_properties = date_object_get_properties_interval;
date_object_handlers_interval.get_property_ptr_ptr = date_interval_get_property_ptr_ptr;
date_object_handlers_interval.get_gc = date_object_get_gc_interval;
- date_object_handlers_interval.compare_objects = date_interval_compare_objects;
+ date_object_handlers_interval.compare = date_interval_compare_objects;
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
ce_period.create_object = date_object_new_period;
@@ -2221,9 +1860,9 @@ static zend_object *date_object_new_date(zend_class_entry *class_type) /* {{{ */
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_date(zend_object *this_ptr) /* {{{ */
{
- php_date_obj *old_obj = Z_PHPDATE_P(this_ptr);
+ php_date_obj *old_obj = php_date_obj_from_obj(this_ptr);
php_date_obj *new_obj = php_date_obj_from_obj(date_object_new_date(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2246,13 +1885,18 @@ static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */
static void date_clone_immutable(zval *object, zval *new_object) /* {{{ */
{
- ZVAL_OBJ(new_object, date_object_clone_date(object));
+ ZVAL_OBJ(new_object, date_object_clone_date(Z_OBJ_P(object)));
} /* }}} */
static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */
{
- php_date_obj *o1 = Z_PHPDATE_P(d1);
- php_date_obj *o2 = Z_PHPDATE_P(d2);
+ php_date_obj *o1;
+ php_date_obj *o2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(d1, d2);
+
+ o1 = Z_PHPDATE_P(d1);
+ o2 = Z_PHPDATE_P(d2);
if (!o1->time || !o2->time) {
php_error_docref(NULL, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
@@ -2268,21 +1912,21 @@ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */
return timelib_time_compare(o1->time, o2->time);
} /* }}} */
-static HashTable *date_object_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
HashTable *props;
zval zv;
@@ -2299,7 +1943,7 @@ static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose
return zend_std_get_properties_for(object, purpose);
}
- dateobj = Z_PHPDATE_P(object);
+ dateobj = php_date_obj_from_obj(object);
props = zend_array_dup(zend_std_get_properties(object));
if (!dateobj->time) {
return props;
@@ -2351,9 +1995,9 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type) /* {{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_timezone(zend_object *this_ptr) /* {{{ */
{
- php_timezone_obj *old_obj = Z_PHPTIMEZONE_P(this_ptr);
+ php_timezone_obj *old_obj = php_timezone_obj_from_obj(this_ptr);
php_timezone_obj *new_obj = php_timezone_obj_from_obj(date_object_new_timezone(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2404,7 +2048,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
}
}
-static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
HashTable *props;
zval zv;
@@ -2421,7 +2065,7 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro
return zend_std_get_properties_for(object, purpose);
}
- tzobj = Z_PHPTIMEZONE_P(object);
+ tzobj = php_timezone_obj_from_obj(object);
props = zend_array_dup(zend_std_get_properties(object));
if (!tzobj->initialized) {
return props;
@@ -2436,13 +2080,13 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro
return props;
} /* }}} */
-static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */
+static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp) /* {{{ */
{
HashTable *ht, *props;
zval zv;
php_timezone_obj *tzobj;
- tzobj = Z_PHPTIMEZONE_P(object);
+ tzobj = php_timezone_obj_from_obj(object);
props = zend_std_get_properties(object);
*is_temp = 1;
@@ -2468,9 +2112,9 @@ static zend_object *date_object_new_interval(zend_class_entry *class_type) /* {{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_interval(zend_object *this_ptr) /* {{{ */
{
- php_interval_obj *old_obj = Z_PHPINTERVAL_P(this_ptr);
+ php_interval_obj *old_obj = php_interval_obj_from_obj(this_ptr);
php_interval_obj *new_obj = php_interval_obj_from_obj(date_object_new_interval(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2482,7 +2126,7 @@ static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */
return &new_obj->std;
} /* }}} */
-static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
@@ -2490,13 +2134,13 @@ static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */
+static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */
{
HashTable *props;
zval zv;
php_interval_obj *intervalobj;
- intervalobj = Z_PHPINTERVAL_P(object);
+ intervalobj = php_interval_obj_from_obj(object);
props = zend_std_get_properties(object);
if (!intervalobj->initialized) {
return props;
@@ -2544,9 +2188,9 @@ static zend_object *date_object_new_period(zend_class_entry *class_type) /* {{{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_period(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_period(zend_object *this_ptr) /* {{{ */
{
- php_period_obj *old_obj = Z_PHPPERIOD_P(this_ptr);
+ php_period_obj *old_obj = php_period_obj_from_obj(this_ptr);
php_period_obj *new_obj = php_period_obj_from_obj(date_object_new_period(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2757,7 +2401,7 @@ PHP_FUNCTION(date_create)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_date, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0)) {
@@ -2780,7 +2424,7 @@ PHP_FUNCTION(date_create_immutable)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_immutable, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0)) {
@@ -2804,7 +2448,7 @@ PHP_FUNCTION(date_create_from_format)
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OPTIONAL
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_date, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0)) {
@@ -2828,7 +2472,7 @@ PHP_FUNCTION(date_create_immutable_from_format)
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OPTIONAL
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_immutable, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0)) {
@@ -2848,7 +2492,7 @@ PHP_METHOD(DateTime, __construct)
size_t time_str_len = 0;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2)
+ ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
@@ -2870,7 +2514,7 @@ PHP_METHOD(DateTimeImmutable, __construct)
size_t time_str_len = 0;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2)
+ ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
@@ -2983,7 +2627,7 @@ PHP_METHOD(DateTime, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -3005,7 +2649,7 @@ PHP_METHOD(DateTimeImmutable, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -3155,7 +2799,7 @@ PHP_FUNCTION(date_parse)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(date)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
parsed_time = timelib_strtotime(ZSTR_VAL(date), ZSTR_LEN(date), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error);
@@ -3174,7 +2818,7 @@ PHP_FUNCTION(date_parse_from_format)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(format)
Z_PARAM_STR(date)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
parsed_time = timelib_parse_from_format(ZSTR_VAL(format), ZSTR_VAL(date), ZSTR_LEN(date), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error);
@@ -3856,7 +3500,7 @@ PHP_FUNCTION(timezone_open)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(tz)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, return_value));
if (SUCCESS != timezone_initialize(tzobj, ZSTR_VAL(tz), ZSTR_LEN(tz))) {
@@ -3875,7 +3519,7 @@ PHP_METHOD(DateTimeZone, __construct)
php_timezone_obj *tzobj;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(tz)
ZEND_PARSE_PARAMETERS_END();
@@ -3981,7 +3625,7 @@ PHP_FUNCTION(timezone_name_from_abbr)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(gmtoffset)
Z_PARAM_LONG(isdst)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
tzid = timelib_timezone_id_from_abbr(ZSTR_VAL(abbr), gmtoffset, isdst);
@@ -4169,6 +3813,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
} /* }}} */
static int date_interval_compare_objects(zval *o1, zval *o2) {
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
/* There is no well defined way to compare intervals like P1M and P30D, which may compare
* smaller, equal or greater depending on the point in time at which the interval starts. As
* such, we treat DateInterval objects are non-comparable and emit a warning. */
@@ -4177,38 +3822,24 @@ static int date_interval_compare_objects(zval *o1, zval *o2) {
}
/* {{{ date_interval_read_property */
-static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *date_interval_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
php_interval_obj *obj;
zval *retval;
- zval tmp_member;
timelib_sll value = -1;
double fvalue = -1;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
return retval;
}
#define GET_VALUE_FROM_STRUCT(n,m) \
- if (strcmp(Z_STRVAL_P(member), m) == 0) { \
- value = obj->diff->n; \
- break; \
+ if (strcmp(ZSTR_VAL(name), m) == 0) { \
+ value = obj->diff->n; \
+ break; \
}
do {
GET_VALUE_FROM_STRUCT(y, "y");
@@ -4217,18 +3848,14 @@ static zval *date_interval_read_property(zval *object, zval *member, int type, v
GET_VALUE_FROM_STRUCT(h, "h");
GET_VALUE_FROM_STRUCT(i, "i");
GET_VALUE_FROM_STRUCT(s, "s");
- if (strcmp(Z_STRVAL_P(member), "f") == 0) {
+ if (strcmp(ZSTR_VAL(name), "f") == 0) {
fvalue = obj->diff->us / 1000000.0;
break;
}
GET_VALUE_FROM_STRUCT(invert, "invert");
GET_VALUE_FROM_STRUCT(days, "days");
/* didn't find any */
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
return retval;
} while(0);
@@ -4243,42 +3870,23 @@ static zval *date_interval_read_property(zval *object, zval *member, int type, v
ZVAL_FALSE(retval);
}
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
-
return retval;
}
/* }}} */
/* {{{ date_interval_write_property */
-static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *date_interval_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
php_interval_obj *obj;
- zval tmp_member;
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- value = zend_std_write_property(object, member, value, cache_slot);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
- return value;
+ return zend_std_write_property(object, name, value, cache_slot);
}
-#define SET_VALUE_FROM_STRUCT(n,m) \
- if (strcmp(Z_STRVAL_P(member), m) == 0) { \
+#define SET_VALUE_FROM_STRUCT(n,m) \
+ if (strcmp(ZSTR_VAL(name), m) == 0) { \
obj->diff->n = zval_get_long(value); \
break; \
}
@@ -4290,55 +3898,37 @@ static zval *date_interval_write_property(zval *object, zval *member, zval *valu
SET_VALUE_FROM_STRUCT(h, "h");
SET_VALUE_FROM_STRUCT(i, "i");
SET_VALUE_FROM_STRUCT(s, "s");
- if (strcmp(Z_STRVAL_P(member), "f") == 0) {
+ if (strcmp(ZSTR_VAL(name), "f") == 0) {
obj->diff->us = zval_get_double(value) * 1000000;
break;
}
SET_VALUE_FROM_STRUCT(invert, "invert");
/* didn't find any */
- value = zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, name, value, cache_slot);
} while(0);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
-
return value;
}
/* }}} */
/* {{{ date_interval_get_property_ptr_ptr */
-static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
-{
- zval tmp_member, *ret;
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return NULL;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
+static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
+{
+ zval *ret;
+
+ if(zend_binary_strcmp("y", sizeof("y") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("m", sizeof("m") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("d", sizeof("d") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("h", sizeof("h") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("i", sizeof("i") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("s", sizeof("s") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("f", sizeof("f") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("days", sizeof("days") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("invert", sizeof("invert") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
/* Fallback to read_property. */
ret = NULL;
} else {
- ret = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ ret = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return ret;
@@ -4354,7 +3944,7 @@ PHP_METHOD(DateInterval, __construct)
timelib_rel_time *reltime;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(interval_string)
ZEND_PARSE_PARAMETERS_END();
@@ -4458,7 +4048,7 @@ PHP_METHOD(DateInterval, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -4496,7 +4086,7 @@ PHP_FUNCTION(date_interval_create_from_date_string)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(time_str)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
time = timelib_strtotime(ZSTR_VAL(time_str), ZSTR_LEN(time_str), &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
@@ -4737,7 +4327,7 @@ PHP_METHOD(DatePeriod, getStartDate)
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
- php_date_instantiate(dpobj->start_ce, return_value);
+ php_date_instantiate(dpobj->start_ce, return_value);
dateobj = Z_PHPDATE_P(return_value);
dateobj->time = timelib_time_ctor();
*dateobj->time = *dpobj->start;
@@ -4789,9 +4379,9 @@ PHP_METHOD(DatePeriod, getDateInterval)
php_period_obj *dpobj;
php_interval_obj *diobj;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
@@ -4810,13 +4400,13 @@ PHP_METHOD(DatePeriod, getRecurrences)
php_period_obj *dpobj;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ return;
}
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
if (0 == dpobj->recurrences - dpobj->include_start_date) {
- return;
+ return;
}
RETURN_LONG(dpobj->recurrences - dpobj->include_start_date);
@@ -4855,7 +4445,7 @@ PHP_FUNCTION(timezone_identifiers_list)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(what)
Z_PARAM_STRING_EX(option, option_len, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Extra validation */
if (what == PHP_DATE_TIMEZONE_PER_COUNTRY && option_len != 2) {
@@ -4880,7 +4470,7 @@ PHP_FUNCTION(timezone_identifiers_list)
}
/* }}} */
-/* {{{ proto array timezone_version_get()
+/* {{{ proto string timezone_version_get()
Returns the Olson database version number.
*/
PHP_FUNCTION(timezone_version_get)
@@ -4936,7 +4526,7 @@ PHP_FUNCTION(date_default_timezone_set)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(zone, zone_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!timelib_timezone_id_is_valid(zone, DATE_TIMEZONEDB)) {
php_error_docref(NULL, E_NOTICE, "Timezone ID '%s' is invalid", zone);
@@ -4987,7 +4577,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
Z_PARAM_DOUBLE(longitude)
Z_PARAM_DOUBLE(zenith)
Z_PARAM_DOUBLE(gmt_offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -5091,7 +4681,7 @@ PHP_FUNCTION(date_sun_info)
Z_PARAM_LONG(time)
Z_PARAM_DOUBLE(latitude)
Z_PARAM_DOUBLE(longitude)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize time struct */
t = timelib_time_ctor();
@@ -5105,7 +4695,7 @@ PHP_FUNCTION(date_sun_info)
array_init(return_value);
/* Get sun up/down and transit */
- rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
+ rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
switch (rs) {
case -1: /* always below */
add_assoc_bool(return_value, "sunrise", 0);
@@ -5182,20 +4772,20 @@ PHP_FUNCTION(date_sun_info)
}
/* }}} */
-static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
+static HashTable *date_object_get_properties_period(zend_object *object) /* {{{ */
{
HashTable *props;
zval zv;
php_period_obj *period_obj;
- period_obj = Z_PHPPERIOD_P(object);
+ period_obj = php_period_obj_from_obj(object);
props = zend_std_get_properties(object);
if (!period_obj->start) {
return props;
@@ -5342,7 +4932,7 @@ PHP_METHOD(DatePeriod, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -5391,42 +4981,36 @@ static int date_period_is_magic_property(zend_string *name)
/* }}} */
/* {{{ date_period_read_property */
-static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
if (type != BP_VAR_IS && type != BP_VAR_R) {
- zend_string *name = zval_get_string(member);
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
- zend_string_release(name);
return &EG(uninitialized_zval);
}
- zend_string_release(name);
}
- Z_OBJPROP_P(object); /* build properties hash table */
+ object->handlers->get_properties(object); /* build properties hash table */
- return zend_std_read_property(object, member, type, cache_slot, rv);
+ return zend_std_read_property(object, name, type, cache_slot, rv);
}
/* }}} */
/* {{{ date_period_write_property */
-static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zend_string *name = zval_get_string(member);
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Writing to DatePeriod->%s is unsupported", ZSTR_VAL(name));
- zend_string_release(name);
return value;
}
- zend_string_release(name);
- std_object_handlers.write_property(object, member, value, cache_slot);
+ std_object_handlers.write_property(object, name, value, cache_slot);
return value;
}
/* }}} */
/* {{{ date_period_get_property_ptr_ptr */
-static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
+static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot)
{
/* Fall back to read_property handler. */
return NULL;
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index 009be83a3f..57a9e28d88 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.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/ext/date/php_date.stub.php b/ext/date/php_date.stub.php
new file mode 100644
index 0000000000..840efd19c7
--- /dev/null
+++ b/ext/date/php_date.stub.php
@@ -0,0 +1,298 @@
+<?php
+
+/* TODO: Convert "uninitialized" into an exception. This will remove many
+ * possibilities for false return values in here. */
+
+/** @return int|false */
+function strtotime(string $time, int $now = UNKNOWN) {}
+
+function date(string $format, int $timestamp = UNKNOWN): string {}
+
+/** @return int|false */
+function idate(string $format, int $timestamp = UNKNOWN) {}
+
+function gmdate(string $format, int $timestamp = UNKNOWN): string {}
+
+/** @return int|false */
+function mktime(
+ int $hour, int $min = UNKNOWN, int $sec = UNKNOWN,
+ int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN) {}
+
+/** @return int|false */
+function gmmktime(
+ int $hour, int $min = UNKNOWN, int $sec = UNKNOWN,
+ int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN) {}
+
+function checkdate(int $m, int $d, int $y): bool {}
+
+/** @return string|false */
+function strftime(string $format, int $timestamp = UNKNOWN) {}
+
+/** @return string|false */
+function gmstrftime(string $format, int $timestamp = UNKNOWN) {}
+
+function time(): int {}
+
+function localtime(int $timestamp = UNKNOWN, bool $associative = false): array {}
+
+function getdate(int $timestamp = UNKNOWN): array {}
+
+/** @return DateTime|false */
+function date_create(string $time = "now", ?DateTimeZone $timezone = null) {}
+
+/** @return DateTime|false */
+function date_create_immutable(string $time = "now", ?DateTimeZone $timezone = null) {}
+
+/** @return DateTime|false */
+function date_create_from_format(string $format, string $time, ?DateTimeZone $timezone = null) {}
+
+/** @return DateTimeImmutable|false */
+function date_create_immutable_from_format(
+ string $format, string $time, ?DateTimeZone $timezone = null) {}
+
+function date_parse(string $date): array {}
+
+function date_parse_from_format(string $format, string $date): array {}
+
+/** @return array|false */
+function date_get_last_errors() {}
+
+function date_format(DateTimeInterface $object, string $format): string {}
+
+/** @return DateTime|false */
+function date_modify(DateTime $object, string $modify) {}
+
+function date_add(DateTime $object, DateInterval $interval): DateTime {}
+
+function date_sub(DateTime $object, DateInterval $interval): DateTime {}
+
+/** @return DateTimeZone|false */
+function date_timezone_get(DateTimeInterface $object) {}
+
+function date_timezone_set(DateTimeInterface $object, DateTimeZone $timezone): DateTime {}
+
+function date_offset_get(DateTimeInterface $object): int {}
+
+function date_diff(
+ DateTimeInterface $object, DateTimeInterface $object2, bool $absolute = false): DateInterval {}
+
+function date_time_set(
+ DateTime $object, int $hour, int $minute, int $second = 0, int $microseconds = 0): DateTime {}
+
+function date_date_set(DateTime $object, int $year, int $month, int $day): DateTime {}
+
+function date_isodate_set(DateTime $object, int $year, int $week, int $day = 1): DateTime {}
+
+function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
+
+/** @return int|false */
+function date_timestamp_get(DateTimeInterface $object) {}
+
+/** @return DateTimeZone|false */
+function timezone_open(string $timezone) {}
+
+function timezone_name_get(DateTimeZone $object): string {}
+
+/** @return string|false */
+function timezone_name_from_abbr(string $abbr, int $gmtoffset = -1, int $isdst = -1) {}
+
+function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {}
+
+/** @return array|false */
+function timezone_transitions_get(
+ DateTimeZone $object, int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX) {}
+
+/** @return array|false */
+function timezone_location_get(DateTimeZone $object) {}
+
+/** @return array|false */
+function timezone_identifiers_list(int $what = DateTimeZone::ALL, ?string $country = null) {}
+
+function timezone_abbreviations_list(): array {}
+
+function timezone_version_get(): string {}
+
+/** @return DateInterval|false */
+function date_interval_create_from_date_string(string $time) {}
+
+function date_interval_format(DateInterval $object, string $format): string {}
+
+function date_default_timezone_set(string $timezone_identifier): bool {}
+
+function date_default_timezone_get(): string {}
+
+/** @return string|int|float|false */
+function date_sunrise(
+ int $time, int $retformat = SUNFUNCS_RET_STRING,
+ float $latitude = UNKNOWN, float $longitude = UNKNOWN, float $zenith = UNKNOWN,
+ float $gmt_offset = 0) {}
+
+/** @return string|int|float|false */
+function date_sunset(
+ int $time, int $retformat = SUNFUNCS_RET_STRING,
+ float $latitude = UNKNOWN, float $longitude = UNKNOWN, float $zenith = UNKNOWN,
+ float $gmt_offset = 0) {}
+
+function date_sun_info(int $time, float $latitude, float $longitude): array {}
+
+// NB: Adding return types to methods is a BC break!
+// For now only using @return annotations here.
+
+interface DateTimeInterface {
+ /** @return string */
+ public function format(string $format);
+
+ /** @return DateTimeZone|false */
+ public function getTimezone();
+
+ /** @return int|false */
+ public function getOffset();
+
+ /** @return int|false */
+ public function getTimestamp();
+
+ /** @return DateInterval|false */
+ public function diff(DateTimeInterface $object, bool $absolute = false);
+
+ public function __wakeup();
+}
+
+class DateTime implements DateTimeInterface {
+ public function __construct(string $time = "now", ?DateTimeZone $timezone = null);
+
+ /** @return DateTime */
+ public static function __set_state(array $array);
+
+ /** @return DateTime */
+ public static function createFromImmutable(DateTimeImmutable $object);
+
+ /** @return DateTime|false */
+ public static function createFromFormat(
+ string $format, string $time, ?DateTimeZone $timezone = null);
+
+ /** @return array|false */
+ public static function getLastErrors();
+
+ /** @return DateTime|false */
+ public function modify(string $modify);
+
+ /** @return DateTime */
+ public function add(DateInterval $interval);
+
+ /** @return DateTime */
+ public function sub(DateInterval $interval);
+
+ /** @return DateTime */
+ public function setTimezone(DateTimeZone $timezone);
+
+ /** @return DateTime */
+ public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0);
+
+ /** @return DateTime */
+ public function setDate(int $year, int $month, int $day);
+
+ /** @return DateTime */
+ public function setISODate(int $year, int $week, int $day = 1);
+
+ /** @return DateTime */
+ public function setTimestamp(int $timestamp);
+}
+
+class DateTimeImmutable implements DateTimeInterface {
+ public function __construct(string $time = "now", ?DateTimeZone $timezone = null);
+
+ /** @return DateTimeZone */
+ public static function __set_state(array $array);
+
+ /** @return DateTimeImmutable */
+ public static function createFromMutable(DateTime $object);
+
+ /** @return DateTimeImmutable|false */
+ public function modify(string $modify);
+
+ /** @return DateTimeImmutable */
+ public function add(DateInterval $interval);
+
+ /** @return DateTimeImmutable */
+ public function sub(DateInterval $interval);
+
+ /** @return DateTimeImmutable */
+ public function setTimezone(DateTimeZone $timezone);
+
+ /** @return DateTimeImmutable */
+ public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0);
+
+ /** @return DateTimeImmutable */
+ public function setDate(int $year, int $month, int $day);
+
+ /** @return DateTimeImmutable */
+ public function setISODate(int $year, int $week, int $day = 1);
+
+ /** @return DateTimeImmutable */
+ public function setTimestamp(int $timestamp);
+}
+
+class DateTimeZone {
+ public function __construct(string $timezone);
+
+ /** @return string */
+ public function getName();
+
+ /** @return int */
+ public function getOffset(DateTimeInterface $datetime);
+
+ /** @return array|false */
+ public function getTransitions(
+ int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX);
+
+ /** @return array|false */
+ public function getLocation();
+
+ /** @return array */
+ public static function listAbbreviations();
+
+ /** @return array|false */
+ public static function listIdentifiers(int $what = DateTimeZone::ALL, ?string $country = null);
+
+ public function __wakeup();
+
+ /** @return DateTimeZone */
+ public static function __set_state(array $array);
+}
+
+class DateInterval {
+ public function __construct(string $interval_spec);
+
+ /** @return DateInterval|false */
+ public static function createFromDateString(string $time);
+
+ /** @return string */
+ public function format(string $format);
+
+ public function __wakeup();
+
+ /** @return DateInterval */
+ public static function __set_state(array $array);
+}
+
+class DatePeriod implements Traversable {
+ /* Has an overloaded signature */
+ public function __construct($start, $interval = UNKNOWN, $end = UNKNOWN);
+
+ /** @return DateTimeInterface */
+ public function getStartDate();
+
+ /** @return DateTimeInterface|null */
+ public function getEndDate();
+
+ /** @return DateInterval */
+ public function getDateInterval();
+
+ /** @return int|null */
+ public function getRecurrences();
+
+ public function __wakeup();
+
+ /** @return DatePeriod */
+ public static function __set_state(array $array);
+}
diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h
new file mode 100644
index 0000000000..57832f005e
--- /dev/null
+++ b/ext/date/php_date_arginfo.h
@@ -0,0 +1,360 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strtotime, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, now, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_idate, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmdate arginfo_date
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, sec, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mon, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmmktime arginfo_mktime
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_checkdate, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, m, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, d, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strftime arginfo_idate
+
+#define arginfo_gmstrftime arginfo_idate
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_time, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_localtime, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, associative, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getdate, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_create_immutable arginfo_date_create
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create_from_format, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_create_immutable_from_format arginfo_date_create_from_format
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse_from_format, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_get_last_errors, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_format, 0, 2, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_modify, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_add, 0, 2, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, interval, DateInterval, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_sub arginfo_date_add
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_get, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timezone_set, 0, 2, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_offset_get, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_diff, 0, 2, DateInterval, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_OBJ_INFO(0, object2, DateTimeInterface, 0)
+ ZEND_ARG_TYPE_INFO(0, absolute, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_time_set, 0, 3, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, microseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_date_set, 0, 4, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_isodate_set, 0, 3, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timestamp_set, 0, 2, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_timestamp_get arginfo_date_timezone_get
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_name_get, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, abbr, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, gmtoffset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, isdst, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_offset_get, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_begin, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_end, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_location_get, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, country, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_abbreviations_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_version_get, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_create_from_date_string, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_interval_format, 0, 2, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateInterval, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_default_timezone_set, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, timezone_identifier, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_default_timezone_get arginfo_timezone_version_get
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunrise, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retformat, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, latitude, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, longitude, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, zenith, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, gmt_offset, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_sunset arginfo_date_sunrise
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_sun_info, 0, 3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, latitude, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, longitude, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_format, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeInterface_getTimezone arginfo_date_get_last_errors
+
+#define arginfo_class_DateTimeInterface_getOffset arginfo_date_get_last_errors
+
+#define arginfo_class_DateTimeInterface_getTimestamp arginfo_date_get_last_errors
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_diff, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_TYPE_INFO(0, absolute, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeInterface___wakeup arginfo_date_get_last_errors
+
+#define arginfo_class_DateTime___construct arginfo_date_create
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime___set_state, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_createFromImmutable, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeImmutable, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTime_createFromFormat arginfo_date_create_from_format
+
+#define arginfo_class_DateTime_getLastErrors arginfo_date_get_last_errors
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_modify, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_add, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, interval, DateInterval, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTime_sub arginfo_class_DateTime_add
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimezone, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTime, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, microseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setDate, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setISODate, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimestamp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeImmutable___construct arginfo_date_create
+
+#define arginfo_class_DateTimeImmutable___set_state arginfo_class_DateTime___set_state
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeImmutable_createFromMutable, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeImmutable_modify arginfo_class_DateTime_modify
+
+#define arginfo_class_DateTimeImmutable_add arginfo_class_DateTime_add
+
+#define arginfo_class_DateTimeImmutable_sub arginfo_class_DateTime_add
+
+#define arginfo_class_DateTimeImmutable_setTimezone arginfo_class_DateTime_setTimezone
+
+#define arginfo_class_DateTimeImmutable_setTime arginfo_class_DateTime_setTime
+
+#define arginfo_class_DateTimeImmutable_setDate arginfo_class_DateTime_setDate
+
+#define arginfo_class_DateTimeImmutable_setISODate arginfo_class_DateTime_setISODate
+
+#define arginfo_class_DateTimeImmutable_setTimestamp arginfo_class_DateTime_setTimestamp
+
+#define arginfo_class_DateTimeZone___construct arginfo_timezone_open
+
+#define arginfo_class_DateTimeZone_getName arginfo_date_get_last_errors
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getOffset, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getTransitions, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_begin, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_end, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeZone_getLocation arginfo_date_get_last_errors
+
+#define arginfo_class_DateTimeZone_listAbbreviations arginfo_date_get_last_errors
+
+#define arginfo_class_DateTimeZone_listIdentifiers arginfo_timezone_identifiers_list
+
+#define arginfo_class_DateTimeZone___wakeup arginfo_date_get_last_errors
+
+#define arginfo_class_DateTimeZone___set_state arginfo_class_DateTime___set_state
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, interval_spec, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateInterval_createFromDateString arginfo_date_interval_create_from_date_string
+
+#define arginfo_class_DateInterval_format arginfo_class_DateTimeInterface_format
+
+#define arginfo_class_DateInterval___wakeup arginfo_date_get_last_errors
+
+#define arginfo_class_DateInterval___set_state arginfo_class_DateTime___set_state
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DatePeriod___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, start)
+ ZEND_ARG_INFO(0, interval)
+ ZEND_ARG_INFO(0, end)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DatePeriod_getStartDate arginfo_date_get_last_errors
+
+#define arginfo_class_DatePeriod_getEndDate arginfo_date_get_last_errors
+
+#define arginfo_class_DatePeriod_getDateInterval arginfo_date_get_last_errors
+
+#define arginfo_class_DatePeriod_getRecurrences arginfo_date_get_last_errors
+
+#define arginfo_class_DatePeriod___wakeup arginfo_date_get_last_errors
+
+#define arginfo_class_DatePeriod___set_state arginfo_class_DateTime___set_state
diff --git a/ext/date/tests/005.phpt b/ext/date/tests/005.phpt
index e1075ef248..23fff3b731 100644
--- a/ext/date/tests/005.phpt
+++ b/ext/date/tests/005.phpt
@@ -6,9 +6,6 @@ date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(idate());
-var_dump(idate(1,1,1));
-
var_dump(idate(1,1));
var_dump(idate(""));
var_dump(idate(0));
@@ -20,12 +17,6 @@ var_dump(idate("'"));
echo "Done\n";
?>
--EXPECTF--
-Warning: idate() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: idate() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
Warning: idate(): Unrecognized date format token. in %s on line %d
bool(false)
diff --git a/ext/date/tests/006.phpt b/ext/date/tests/006.phpt
index 425430a470..5171c430e2 100644
--- a/ext/date/tests/006.phpt
+++ b/ext/date/tests/006.phpt
@@ -4,7 +4,6 @@ checkdate() tests
<?php
date_default_timezone_set('UTC');
-var_dump(checkdate());
var_dump(checkdate(1,1,1));
var_dump(checkdate(2,29,2006));
@@ -18,9 +17,7 @@ var_dump(checkdate(1,1,-1));
echo "Done\n";
?>
---EXPECTF--
-Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
-bool(false)
+--EXPECT--
bool(true)
bool(false)
bool(false)
diff --git a/ext/date/tests/007.phpt b/ext/date/tests/007.phpt
index 141e251753..4e0b24ce75 100644
--- a/ext/date/tests/007.phpt
+++ b/ext/date/tests/007.phpt
@@ -5,7 +5,6 @@ localtime() tests
date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(localtime(1,1,1));
var_dump(localtime());
var_dump(localtime($t));
@@ -15,8 +14,6 @@ var_dump(localtime($t, false));
echo "Done\n";
?>
--EXPECTF--
-Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
array(9) {
[0]=>
int(%d)
diff --git a/ext/date/tests/008.phpt b/ext/date/tests/008.phpt
index e67b4bd0a4..701403d1f8 100644
--- a/ext/date/tests/008.phpt
+++ b/ext/date/tests/008.phpt
@@ -5,7 +5,6 @@ getdate() tests
date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(getdate(1,1));
var_dump(getdate($t));
var_dump(getdate());
@@ -13,8 +12,6 @@ var_dump(getdate());
echo "Done\n";
?>
--EXPECTF--
-Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d
-bool(false)
array(11) {
["seconds"]=>
int(0)
diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt
index 4812d63de6..9d77a552cc 100644
--- a/ext/date/tests/009.phpt
+++ b/ext/date/tests/009.phpt
@@ -10,16 +10,12 @@ date_default_timezone_set('Asia/Jerusalem');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(strftime());
-
var_dump(strftime(""));
var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
var_dump(strftime("%%q %%a", $t));
var_dump(strftime("%q", $t));
var_dump(strftime("blah", $t));
-var_dump(gmstrftime());
-
var_dump(gmstrftime(""));
var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
var_dump(gmstrftime("%%q %%a", $t));
@@ -29,17 +25,12 @@ var_dump(gmstrftime("blah", $t));
echo "Done\n";
?>
--EXPECTF--
-Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s
%s %"
string(5) "%q %a"
string(%d) "%s"
string(4) "blah"
-
-Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s
%s %"
diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt
index 91c1b261ce..dcd118c97d 100644
--- a/ext/date/tests/009_win32.phpt
+++ b/ext/date/tests/009_win32.phpt
@@ -14,8 +14,6 @@ setlocale(LC_TIME, "en-us");
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(strftime());
-
var_dump(strftime(""));
var_dump(strftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
@@ -24,8 +22,6 @@ var_dump(strftime("%%q %%a", $t));
var_dump(strftime("blah", $t));
-var_dump(gmstrftime());
-
var_dump(gmstrftime(""));
var_dump(gmstrftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
@@ -39,15 +35,10 @@ echo "Done\n";
setlocale(LC_TIME, $loc);
?>
--EXPECTF--
-Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Tue Tuesday Jun June 6/27/2006 12:00:00 AM 27 00 12 178 06 00 AM 00 26 26 2 6/27/2006 12:00:00 AM 06 2006 %s"
string(5) "%q %a"
string(4) "blah"
-
-Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Mon Monday Jun June 6/26/2006 9:00:00 PM 26 21 09 177 06 00 PM 00 26 26 1 6/26/2006 9:00:00 PM 06 2006 %s"
string(5) "%q %a"
diff --git a/ext/date/tests/011.phpt b/ext/date/tests/011.phpt
index 092a4b7758..ca9820c4ef 100644
--- a/ext/date/tests/011.phpt
+++ b/ext/date/tests/011.phpt
@@ -4,7 +4,6 @@ timezone_name_from_abbr() tests
<?php
date_default_timezone_set('UTC');
-var_dump(timezone_name_from_abbr());
var_dump(timezone_name_from_abbr("CET"));
var_dump(timezone_name_from_abbr("AXST"));
var_dump(timezone_name_from_abbr("", 3600));
@@ -12,9 +11,7 @@ var_dump(timezone_name_from_abbr("", 3600, 0));
echo "Done\n";
?>
---EXPECTF--
-Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
+--EXPECT--
string(13) "Europe/Berlin"
bool(false)
bool(false)
diff --git a/ext/date/tests/012.phpt b/ext/date/tests/012.phpt
index be7e4e32af..ee8faf1c00 100644
--- a/ext/date/tests/012.phpt
+++ b/ext/date/tests/012.phpt
@@ -7,15 +7,10 @@ date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump(date_isodate_set($dto, 2006, 2, 15));
var_dump($dto->format("Y/m/d H:i:s"));
-var_dump(date_isodate_set($dto, 2006));
-var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 5));
var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 100, 15));
var_dump($dto->format("Y/m/d H:i:s"));
-var_dump(date_isodate_set($dto, 2006, 100, 15, 10));
-var_dump($dto->format("Y/m/d H:i:s"));
-
echo "Done\n";
?>
--EXPECTF--
@@ -28,10 +23,6 @@ object(DateTime)#1 (3) {
string(3) "UTC"
}
string(19) "2006/01/23 00:00:00"
-
-Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d
-bool(false)
-string(19) "2006/01/23 00:00:00"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2006-01-30 00:00:00.000000"
@@ -50,8 +41,4 @@ object(DateTime)#1 (3) {
string(3) "UTC"
}
string(19) "2007/12/10 00:00:00"
-
-Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-string(19) "2007/12/10 00:00:00"
Done
diff --git a/ext/date/tests/013.phpt b/ext/date/tests/013.phpt
index 266dafe06a..6010071be6 100644
--- a/ext/date/tests/013.phpt
+++ b/ext/date/tests/013.phpt
@@ -7,10 +7,6 @@ date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump($dto);
var_dump($dto->format("Y.m.d H:i:s"));
-var_dump(date_date_set());
-var_dump($dto->format("Y.m.d H:i:s"));
-var_dump(date_date_set($dto, 2006, 5));
-var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 2, 15));
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 24, 60));
@@ -28,14 +24,6 @@ object(DateTime)#%d (3) {
string(3) "UTC"
}
string(19) "2006.12.12 00:00:00"
-
-Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
-bool(false)
-string(19) "2006.12.12 00:00:00"
-
-Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
-bool(false)
-string(19) "2006.12.12 00:00:00"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2006-02-15 00:00:00.000000"
diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt
index 2e72bdabe0..f57f3e4b1d 100644
--- a/ext/date/tests/014.phpt
+++ b/ext/date/tests/014.phpt
@@ -10,7 +10,6 @@ var_dump($dto);
$dtz = date_timezone_get($dto);
var_dump($dtz);
-var_dump(timezone_offset_get());
var_dump(timezone_offset_get($dtz, $dto));
var_dump(timezone_offset_get($dto, $dtz));
@@ -32,12 +31,9 @@ object(DateTimeZone)#%d (2) {
["timezone"]=>
string(3) "UTC"
}
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
int(0)
-Fatal error: Uncaught TypeError: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s:%d
+Fatal error: Uncaught TypeError: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s:%d
Stack trace:
#0 %s(%d): timezone_offset_get(Object(DateTime), Object(DateTimeZone))
#1 {main}
diff --git a/ext/date/tests/68062.phpt b/ext/date/tests/68062.phpt
index 6b1e16ae67..1270382158 100644
--- a/ext/date/tests/68062.phpt
+++ b/ext/date/tests/68062.phpt
@@ -6,8 +6,12 @@ DateTimeZone::getOffset() accepts a DateTimeInterface object
$tz = new DateTimeZone('Europe/London');
$dt = new DateTimeImmutable('2014-09-20', $tz);
-echo $tz->getOffset($dt);
-echo $tz->getOffset(1);
---EXPECTF--
+echo $tz->getOffset($dt), "\n";
+try {
+ echo $tz->getOffset(1);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+--EXPECT--
3600
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s
+DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given
diff --git a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt
index ac92fb4bb4..671afc1229 100644
--- a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt
+++ b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt
@@ -1,5 +1,5 @@
--TEST--
-Tests for DateTimeImmutable::createFromMutable.
+Tests for DateTimeImmutable::createFromMutable
--INI--
date.timezone=Europe/London
--FILE--
@@ -9,8 +9,11 @@ $current = "2014-03-02 16:24:08";
$i = DateTimeImmutable::createFromMutable( date_create( $current ) );
var_dump( $i );
-$i = DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
-var_dump( $i );
+try {
+ DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
object(DateTimeImmutable)#%d (3) {
@@ -21,6 +24,4 @@ object(DateTimeImmutable)#%d (3) {
["timezone"]=>
string(13) "Europe/London"
}
-
-Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in %stests%eDateTimeImmutable_createFromMutable.php on line %d
-NULL
+DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given
diff --git a/ext/date/tests/DateTime_createFromImmutable.phpt b/ext/date/tests/DateTime_createFromImmutable.phpt
index ee7731855a..841a3d4d33 100644
--- a/ext/date/tests/DateTime_createFromImmutable.phpt
+++ b/ext/date/tests/DateTime_createFromImmutable.phpt
@@ -14,8 +14,11 @@ $m->modify('+ 1 hour');
var_dump( $i->format('Y-m-d H:i:s') === $current );
-$m = DateTime::createFromImmutable( date_create( $current ) );
-var_dump( $m );
+try {
+ DateTime::createFromImmutable( date_create( $current ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
object(DateTime)#%d (3) {
@@ -27,6 +30,4 @@ object(DateTime)#%d (3) {
string(13) "Europe/London"
}
bool(true)
-
-Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
-NULL
+DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given
diff --git a/ext/date/tests/ExtendDateTime.phpt b/ext/date/tests/ExtendDateTime.phpt
index 164221709c..212d44ab82 100644
--- a/ext/date/tests/ExtendDateTime.phpt
+++ b/ext/date/tests/ExtendDateTime.phpt
@@ -9,4 +9,4 @@ class MyDateTime extends DateTime {
}
?>
--EXPECTF--
-Warning: Declaration of MyDateTime::__set_state() should be compatible with DateTime::__set_state(array $array) in %s on line %d
+Fatal error: Declaration of MyDateTime::__set_state() must be compatible with DateTime::__set_state(array $array) in %s on line %d
diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt
index ab0f3a3c8a..691bb4a7e2 100644
--- a/ext/date/tests/bug36988.phpt
+++ b/ext/date/tests/bug36988.phpt
@@ -6,7 +6,11 @@ Bug #36988 (mktime freezes on long numbers)
<?php
date_default_timezone_set('GMT');
$start = microtime(true);
-$a = mktime(1, 1, 1, 1, 1, 11111111111);
+try {
+ $a = mktime(1, 1, 1, 1, 1, 11111111111);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: mktime() expects parameter 6 to be int, float given in %s on line %d
+--EXPECT--
+mktime() expects parameter 6 to be int, float given
diff --git a/ext/date/tests/bug48476.phpt b/ext/date/tests/bug48476.phpt
index 1335025c76..02086e0e56 100644
--- a/ext/date/tests/bug48476.phpt
+++ b/ext/date/tests/bug48476.phpt
@@ -10,22 +10,28 @@ class MyDateTimeZone extends DateTimeZone {
}
$o = new MyDateTime;
-var_dump($o->format("d"));
+try {
+ var_dump($o->format("d"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$x = clone $o;
-var_dump($x->format("d"));
+try {
+ var_dump($x->format("d"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
clone $o;
-
-var_dump(timezone_location_get(clone new MyDateTimezone));
+try {
+ var_dump(timezone_location_get(clone new MyDateTimezone));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10
-bool(false)
-
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13
-bool(false)
-
-Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18
-bool(false)
+--EXPECT--
+The DateTime object has not been correctly initialized by its constructor
+The DateTime object has not been correctly initialized by its constructor
+The DateTimeZone object has not been correctly initialized by its constructor
diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt
index cbcccf84b9..b1f7f25d7b 100644
--- a/ext/date/tests/bug52062.phpt
+++ b/ext/date/tests/bug52062.phpt
@@ -13,7 +13,11 @@ var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
var_dump($d->format('U'));
-$d->setTimestamp(100000000000);
+try {
+ $d->setTimestamp(100000000000);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
@@ -24,8 +28,7 @@ var_dump($i->format('%s'));
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(12) "100000000000"
-
-Warning: DateTime::setTimestamp() expects parameter 1 to be int, float given in %s on line %d
+DateTime::setTimestamp() expects parameter 1 to be int, float given
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(10) "1215752192"
diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt
index 6952332014..3afa7a561b 100644
--- a/ext/date/tests/bug62500.phpt
+++ b/ext/date/tests/bug62500.phpt
@@ -23,6 +23,6 @@ try {
NULL
int(3)
-Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d
+Warning: Undefined property: Crasher::$2 in %s on line %d
NULL
string(%s) "DateInterval::__construct(): Unknown or bad format (blah)"
diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt
index 332142856e..5a7d2d1d07 100644
--- a/ext/date/tests/bug67118.phpt
+++ b/ext/date/tests/bug67118.phpt
@@ -23,5 +23,9 @@ class mydt extends datetime
new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
?>
--EXPECTF--
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
-Bad date
+Fatal error: Uncaught Error: The DateTime object has not been correctly initialized by its constructor in %s:%d
+Stack trace:
+#0 %s(%d): DateTime->format('Y')
+#1 %s(%d): mydt->__construct(%s)
+#2 {main}
+ thrown in %s on line %d
diff --git a/ext/date/tests/bug70245.phpt b/ext/date/tests/bug70245.phpt
index f754bf65a1..b480192326 100644
--- a/ext/date/tests/bug70245.phpt
+++ b/ext/date/tests/bug70245.phpt
@@ -3,8 +3,11 @@ Bug #70245 (strtotime does not emit warning when 2nd parameter is object or stri
--FILE--
<?php
$d = new DateTime('2011-01-15 00:00:00');
-var_dump(strtotime('-1 month', $d));
+try {
+ var_dump(strtotime('-1 month', $d));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: strtotime() expects parameter 2 to be int, object given in %sbug70245.php on line %d
-bool(false)
+strtotime() expects parameter 2 to be int, object given
diff --git a/ext/date/tests/bug74852.phpt b/ext/date/tests/bug74852.phpt
index e293bef8bf..d5fea0ad3f 100644
--- a/ext/date/tests/bug74852.phpt
+++ b/ext/date/tests/bug74852.phpt
@@ -13,5 +13,5 @@ var_dump($interval->abcde);
bool(false)
bool(false)
-Notice: Undefined property: DateInterval::$abcde in %s on line %d
+Warning: Undefined property: DateInterval::$abcde in %s on line %d
NULL
diff --git a/ext/date/tests/bug75232.phpt b/ext/date/tests/bug75232.phpt
index 9200f65e91..cf4f289465 100644
--- a/ext/date/tests/bug75232.phpt
+++ b/ext/date/tests/bug75232.phpt
@@ -14,7 +14,7 @@ echo $d2->date, "\n";
?>
--EXPECTF--
-Notice: Undefined property: DateTime::$date in %s on line %d
+Warning: Undefined property: DateTime::$date in %s on line %d
DateTime Object
(
@@ -23,4 +23,4 @@ DateTime Object
[timezone] => UTC
)
-Notice: Undefined property: DateTime::$date in %s on line %d
+Warning: Undefined property: DateTime::$date in %s on line %d
diff --git a/ext/date/tests/date_default_timezone_set_error.phpt b/ext/date/tests/date_default_timezone_set_error.phpt
index 15c6aa6fed..24a851ff01 100644
--- a/ext/date/tests/date_default_timezone_set_error.phpt
+++ b/ext/date/tests/date_default_timezone_set_error.phpt
@@ -9,13 +9,6 @@ Test date_default_timezone_set() function : error variations
echo "*** Testing date_default_timezone_set() : error variations ***\n";
-echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n";
-var_dump( date_default_timezone_set() );
-
-echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( date_default_timezone_set("GMT", $extra_arg) );
-
echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n";
var_dump( date_default_timezone_set("foo") );
@@ -24,16 +17,6 @@ var_dump( date_default_timezone_set("foo") );
--EXPECTF--
*** Testing date_default_timezone_set() : error variations ***
--- Testing date_default_timezone_set() function with less than expected no. of arguments --
-
-Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing date_default_timezone_set() function with more than expected no. of arguments --
-
-Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing date_default_timezone_set() function with invalid timezone identifier --
Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d
diff --git a/ext/date/tests/date_parse_001.phpt b/ext/date/tests/date_parse_001.phpt
index b5c5ac0f48..0d58c1f8e9 100644
--- a/ext/date/tests/date_parse_001.phpt
+++ b/ext/date/tests/date_parse_001.phpt
@@ -12,7 +12,6 @@ Test basic date_parse()
var_dump(date_parse("03-03"));
var_dump(date_parse("0-0"));
var_dump(date_parse(""));
- var_dump(date_parse(array()));
echo "Done\n";
?>
--EXPECTF--
@@ -298,7 +297,4 @@ array(12) {
["is_localtime"]=>
bool(false)
}
-
-Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d
-bool(false)
Done
diff --git a/ext/date/tests/date_parse_error.phpt b/ext/date/tests/date_parse_error.phpt
index 9f444bb435..dc03944004 100644
--- a/ext/date/tests/date_parse_error.phpt
+++ b/ext/date/tests/date_parse_error.phpt
@@ -12,14 +12,6 @@ date_default_timezone_set("Europe/London");
echo "*** Testing date_parse() : error conditions ***\n";
-echo "\n-- Testing date_parse() function with zero arguments --\n";
-var_dump( date_parse() );
-
-echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n";
-$date = "2009-02-27 10:00:00.5";
-$extra_arg = 10;
-var_dump( date_parse($date, $extra_arg) );
-
echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n";
$invalid_date = "2OO9-02--27 10:00?00.5";
var_dump( date_parse($invalid_date) );
@@ -29,16 +21,6 @@ var_dump( date_parse($invalid_date) );
--EXPECTF--
*** Testing date_parse() : error conditions ***
--- Testing date_parse() function with zero arguments --
-
-Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing date_parse() function with more than expected no. of arguments --
-
-Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing date_parse() function with unexpected characters in $date argument --
array(13) {
["year"]=>
diff --git a/ext/date/tests/date_sun_info_001.phpt b/ext/date/tests/date_sun_info_001.phpt
index c9096af46d..708d2550cc 100644
--- a/ext/date/tests/date_sun_info_001.phpt
+++ b/ext/date/tests/date_sun_info_001.phpt
@@ -10,9 +10,9 @@ echo "Done\n";
--EXPECT--
array(9) {
["sunrise"]=>
- int(1165897761)
+ int(1165897682)
["sunset"]=>
- int(1165934160)
+ int(1165934239)
["transit"]=>
int(1165915961)
["civil_twilight_begin"]=>
diff --git a/ext/date/tests/date_sun_info_002.phpt b/ext/date/tests/date_sun_info_002.phpt
index 73956cc46a..f74f1c88de 100644
--- a/ext/date/tests/date_sun_info_002.phpt
+++ b/ext/date/tests/date_sun_info_002.phpt
@@ -11,8 +11,8 @@ foreach ($sun_info as $key => $elem )
echo "Done\n";
?>
--EXPECT--
-2007-04-13 06:13:31 CEST sunrise
-2007-04-13 20:30:51 CEST sunset
+2007-04-13 06:11:26 CEST sunrise
+2007-04-13 20:32:56 CEST sunset
2007-04-13 13:22:11 CEST transit
2007-04-13 05:29:22 CEST civil_twilight_begin
2007-04-13 21:15:00 CEST civil_twilight_end
diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt
deleted file mode 100644
index 75794cc632..0000000000
--- a/ext/date/tests/date_sunrise_variation9.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
- * Description: Returns time of sunrise for a given day and location
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing date_sunrise() : usage variation ***\n";
-
-// GMT is zero for the timezone
-date_default_timezone_set("Asia/Calcutta");
-//Initialise the variables
-$latitude = 38.4;
-$longitude = -9;
-$zenith = 90;
-$gmt_offset = 1;
-
-echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n";
-$time = 12.3456789000e10;
-var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n";
-$time = -12.3456789000e10;
-var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing date_sunrise() : usage variation ***
-
--- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt
deleted file mode 100644
index 4f897e1df0..0000000000
--- a/ext/date/tests/date_sunset_variation9.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
- * Description: Returns time of sunset for a given day and location
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing date_sunset() : usage variation ***\n";
-
-// GMT is zero for the timezone
-date_default_timezone_set("Asia/Calcutta");
-//Initialise the variables
-$latitude = 38.4;
-$longitude = -9;
-$zenith = 90;
-$gmt_offset = 1;
-
-echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n";
-$time = 12.3456789000e10;
-var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n";
-$time = -12.3456789000e10;
-var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing date_sunset() : usage variation ***
-
--- Testing date_sunset() function by passing float 12.3456789000e10 value to time --
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing date_sunset() function by passing float -12.3456789000e10 value to time --
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt
deleted file mode 100644
index e24f3e6d84..0000000000
--- a/ext/date/tests/getdate_variation7.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test getdate() function : usage variation - Passing high positive and negative float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : array getdate([int timestamp])
- * Description: Get date/time information
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing getdate() : usage variation ***\n";
-date_default_timezone_set("Asia/Calcutta");
-
-echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( getdate($timestamp) );
-
-echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( getdate($timestamp) );
-?>
-===DONE===
---EXPECTF--
-*** Testing getdate() : usage variation ***
-
--- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --
-
-Warning: getdate() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --
-
-Warning: getdate() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt
deleted file mode 100644
index 5b6c48fca5..0000000000
--- a/ext/date/tests/gmdate_variation14.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : string gmdate(string format [, long timestamp])
- * Description: Format a GMT date/time
- * Source code: ext/date/php_date.c
- */
-
-echo "*** Testing gmdate() : usage variation ***\n";
-
-// Initialise all required variables
-date_default_timezone_set('UTC');
-$format = DATE_ISO8601;
-
-echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( gmdate($format, $timestamp) );
-
-echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( gmdate($format, $timestamp) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing gmdate() : usage variation ***
-
--- Testing gmdate() function with float 12.3456789000e10 to timestamp --
-
-Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-
--- Testing gmdate() function with float -12.3456789000e10 to timestamp --
-
-Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/gmmktime_basic.phpt b/ext/date/tests/gmmktime_basic.phpt
index cdb44f0c62..dca6675e6c 100644
--- a/ext/date/tests/gmmktime_basic.phpt
+++ b/ext/date/tests/gmmktime_basic.phpt
@@ -21,15 +21,9 @@ $year = 2008;
// Calling gmmktime() with all possible arguments
var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
-// Calling gmmktime() with mandatory arguments
-var_dump( gmmktime() );
-
?>
===DONE===
--EXPECTF--
*** Testing gmmktime() : basic functionality ***
int(1218182888)
-
-Deprecated: gmmktime(): You should be using the time() function instead in %s on line %d
-int(%d)
===DONE===
diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt
deleted file mode 100644
index 9b6bc567e0..0000000000
--- a/ext/date/tests/idate_variation3.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : int idate(string format [, int timestamp])
- * Description: Format a local time/date as integer
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing idate() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$format = 'Y';
-date_default_timezone_set("Asia/Calcutta");
-
-echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( idate($format, $timestamp) );
-
-echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( idate($format, $timestamp) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing idate() : usage variation ***
-
--- Testing idate() function with float 12.3456789000e10 to timestamp --
-
-Warning: idate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-
--- Testing idate() function with float -12.3456789000e10 to timestamp --
-
-Warning: idate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt
deleted file mode 100644
index 42731dc6ce..0000000000
--- a/ext/date/tests/localtime_variation3.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : array localtime([int timestamp [, bool associative_array]])
- * Description: Returns the results of the C system call localtime as an associative array
- * if the associative_array argument is set to 1 other wise it is a regular array
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing localtime() : usage variation ***\n";
-
-date_default_timezone_set("UTC");
-// Initialise function arguments not being substituted (if any)
-$is_associative = true;
-
-echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( localtime($timestamp) );
-var_dump( localtime($timestamp, $is_associative) );
-
-echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( localtime($timestamp) );
-var_dump( localtime($timestamp, $is_associative) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing localtime() : usage variation ***
-
--- Testing localtime() function with 'float 12.3456789000e10' to timestamp --
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing localtime() function with 'float -12.3456789000e10' to timestamp --
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt
index 699416d382..0e4b5d5a35 100644
--- a/ext/date/tests/microtime_error.phpt
+++ b/ext/date/tests/microtime_error.phpt
@@ -7,13 +7,6 @@ Test wrong number of arguments for microtime()
* Function is implemented in ext/standard/microtime.c
*/
-$opt_arg_0 = true;
-$extra_arg = 1;
-
-echo "\n-- Too many arguments --\n";
-var_dump(microtime($opt_arg_0, $extra_arg));
-
-
echo "\n-- Bad Arg types --\n";
$bad_args = array(null,
@@ -25,17 +18,16 @@ $bad_args = array(null,
foreach ($bad_args as $bad_arg) {
echo "\n--> bad arg: ";
var_dump($bad_arg);
- var_dump(microtime($bad_arg));
+ try {
+ var_dump(microtime($bad_arg));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
===DONE===
--EXPECTF--
--- Too many arguments --
-
-Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11
-NULL
-
-- Bad Arg types --
--> bad arg: NULL
@@ -56,15 +48,11 @@ float(%s)
int(0)
}
}
-
-Warning: microtime() expects parameter 1 to be bool, array given in %s on line 25
-NULL
+microtime() expects parameter 1 to be bool, array given
--> bad arg: object(stdClass)#%d (0) {
}
-
-Warning: microtime() expects parameter 1 to be bool, object given in %s on line 25
-NULL
+microtime() expects parameter 1 to be bool, object given
--> bad arg: int(1)
float(%s)
diff --git a/ext/date/tests/mktime_error.phpt b/ext/date/tests/mktime_error.phpt
index a24d189fb1..c507ecf78b 100644
--- a/ext/date/tests/mktime_error.phpt
+++ b/ext/date/tests/mktime_error.phpt
@@ -14,7 +14,11 @@ date_default_timezone_set("Europe/London");
echo "*** Testing mktime() : error conditions ***\n";
echo "\n-- Testing mktime() function with Zero arguments --\n";
-var_dump( mktime() );
+try {
+ var_dump( mktime() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
$hour = 10;
@@ -24,7 +28,11 @@ $month = 7;
$day = 2;
$year = 1963;
$extra_arg = 10;
-var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
+try {
+ var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
@@ -32,12 +40,8 @@ var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
*** Testing mktime() : error conditions ***
-- Testing mktime() function with Zero arguments --
-
-Deprecated: mktime(): You should be using the time() function instead in %s on line %d
-int(%d)
+mktime() expects at least 1 parameter, 0 given
-- Testing mktime() function with more than expected no. of arguments --
-
-Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d
-bool(false)
+mktime() expects at most 6 parameters, 7 given
===DONE===
diff --git a/ext/date/tests/oo_001.phpt b/ext/date/tests/oo_001.phpt
index 7cbf847c52..111364ec83 100644
--- a/ext/date/tests/oo_001.phpt
+++ b/ext/date/tests/oo_001.phpt
@@ -15,8 +15,12 @@ class _t extends DateTimeZone {
$d = new DateTime;
var_dump($d->format("Y-m-d H:i:s"));
-$d = new _d;
-var_dump($d->format("Y-m-d H:i:s"));
+try {
+ $d = new _d;
+ var_dump($d->format("Y-m-d H:i:s"));
+} catch (Error $e) {
+ echo $e->getMessage(),"\n";
+}
try {
new DateTime("1am todax");
@@ -27,8 +31,12 @@ try {
$t = new DateTimeZone("UTC");
var_dump($t->getName());
-$t = new _t;
-var_dump($t->getName());
+try {
+ $t = new _t;
+ var_dump($t->getName());
+} catch (Error $e) {
+ echo $e->getMessage(),"\n";
+}
try {
new DateTimeZone("GottaFindThisOne");
@@ -40,13 +48,9 @@ echo "DONE\n";
?>
--EXPECTF--
string(19) "%d-%d-%d %d:%d:%d"
-
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %soo_001.php on line %d
-bool(false)
+The DateTime object has not been correctly initialized by its constructor
DateTime::__construct(): Failed to parse time string (1am todax) at position 4 (t): The timezone could not be found in the database
string(3) "UTC"
-
-Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %soo_001.php on line %d
-bool(false)
+The DateTimeZone object has not been correctly initialized by its constructor
DateTimeZone::__construct(): Unknown or bad timezone (GottaFindThisOne)
DONE
diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt
deleted file mode 100644
index 22f079702a..0000000000
--- a/ext/date/tests/strftime_variation23.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Test strftime() function : usage variation - Checking large positive and negative float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : string strftime(string format [, int timestamp])
- * Description: Format a local time/date according to locale settings
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing strftime() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-setlocale(LC_ALL, "en_US");
-date_default_timezone_set("UTC");
-$format = '%b %d %Y %H:%M:%S';
-
-echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( strftime($format, $timestamp) );
-
-echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( strftime($format, $timestamp) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing strftime() : usage variation ***
-
--- Testing strftime() function with float 12.3456789000e10 to timestamp --
-
-Warning: strftime() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-
--- Testing strftime() function with float -12.3456789000e10 to timestamp --
-
-Warning: strftime() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt
index 413755ac72..89687db4f2 100644
--- a/ext/date/tests/timezone_offset_get_error.phpt
+++ b/ext/date/tests/timezone_offset_get_error.phpt
@@ -15,31 +15,6 @@ $date = date_create("GMT");
echo "*** Testing timezone_offset_get() : error conditions ***\n";
-echo "\n-- Testing timezone_offset_get() function with zero arguments --\n";
-try {
- var_dump( timezone_offset_get() );
-} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
-}
-
-echo "\n-- Testing timezone_offset_get() function with less than expected no. of arguments --\n";
-try {
- var_dump( timezone_offset_get($tz) );
-} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
-}
-
-echo "\n-- Testing timezone_offset_get() function with more than expected no. of arguments --\n";
-$extra_arg = 99;
-try {
- var_dump( timezone_offset_get($tz, $date, $extra_arg) );
-} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
-}
-
echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n";
$invalid_obj = new stdClass();
try {
@@ -87,37 +62,22 @@ try {
}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing timezone_offset_get() : error conditions ***
--- Testing timezone_offset_get() function with zero arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-
--- Testing timezone_offset_get() function with less than expected no. of arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
--- Testing timezone_offset_get() function with more than expected no. of arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
-- Testing timezone_offset_get() function with an invalid values for $object argument --
-string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given"
+string(74) "timezone_offset_get() expects parameter 1 to be DateTimeZone, object given"
-string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given"
+string(71) "timezone_offset_get() expects parameter 1 to be DateTimeZone, int given"
-string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given"
+string(72) "timezone_offset_get() expects parameter 1 to be DateTimeZone, null given"
-- Testing timezone_offset_get() function with an invalid values for $datetime argument --
-string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of stdClass given"
+string(79) "timezone_offset_get() expects parameter 2 to be DateTimeInterface, object given"
-string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given"
+string(76) "timezone_offset_get() expects parameter 2 to be DateTimeInterface, int given"
-string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given"
+string(77) "timezone_offset_get() expects parameter 2 to be DateTimeInterface, null given"
===DONE===
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 952993582b..a24b70ecd3 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.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, |
@@ -50,82 +48,7 @@
#include "php_qdbm.h"
#include "php_tcadb.h"
#include "php_lmdb.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, handlername)
- ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_open, 0, 0, 2)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, handlername)
- ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_close, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_exists, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_fetch, 0, 0, 2)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, skip)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_key_split, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_firstkey, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_nextkey, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_delete, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_insert, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_replace, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_optimize, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_sync, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_handlers, 0, 0, 0)
- ZEND_ARG_INFO(0, full_info)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_list, 0)
-ZEND_END_ARG_INFO()
-
-/* }}} */
+#include "dba_arginfo.h"
/* {{{ dba_functions[]
*/
@@ -277,13 +200,13 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
#define DBA_FETCH_RESOURCE(info, id) \
if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NULL) { \
- RETURN_FALSE; \
+ return; \
}
#define DBA_FETCH_RESOURCE_WITH_ID(info, id) \
if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NULL) { \
DBA_ID_DONE; \
- RETURN_FALSE; \
+ return; \
}
#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_FETCH_RESOURCE_WITH_ID(info, id)
diff --git a/ext/dba/dba.stub.php b/ext/dba/dba.stub.php
new file mode 100644
index 0000000000..80b82259fc
--- /dev/null
+++ b/ext/dba/dba.stub.php
@@ -0,0 +1,67 @@
+<?php
+
+/** @return resource|false */
+function dba_popen($path, $mode, $handlername = UNKNOWN, ...$handler_parameters) {}
+
+/** @return resource|false */
+function dba_open($path, $mode, $handlername = UNKNOWN, ...$handler_parameters) {}
+
+/** @param resource $handle */
+function dba_close($handle): void {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_exists($key, $handle): bool {}
+
+/**
+ * @param string|array $key
+ * @param int|resource $skip actually this parameter is optional, not $handle
+ * @param resource $handle
+ * @return string|false
+ */
+function dba_fetch($key, $skip, $handle = UNKOWN) {}
+
+/** @return array|false */
+function dba_key_split(string $key) {}
+
+/**
+ * @param resource $handle
+ * @return string|false
+ */
+function dba_firstkey($handle) {}
+
+/**
+ * @param resource $handle
+ * @return string|false
+ */
+function dba_nextkey($handle) {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_delete($key, $handle): bool {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_insert($key, string $value, $handle): bool {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_replace($key, string $value, $handle): bool {}
+
+/** @param resource $handle */
+function dba_optimize($handle): bool {}
+
+/** @param resource $handle */
+function dba_sync($handle): bool {}
+
+function dba_handlers(bool $full_info = false): array {}
+
+function dba_list(): array {}
diff --git a/ext/dba/dba_arginfo.h b/ext/dba/dba_arginfo.h
new file mode 100644
index 0000000000..d5ac0683f8
--- /dev/null
+++ b/ext/dba/dba_arginfo.h
@@ -0,0 +1,58 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
+ ZEND_ARG_INFO(0, path)
+ ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_INFO(0, handlername)
+ ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_open arginfo_dba_popen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_fetch, 0, 0, 2)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, skip)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_key_split, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_firstkey, 0, 0, 1)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_nextkey arginfo_dba_firstkey
+
+#define arginfo_dba_delete arginfo_dba_exists
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_insert, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_replace arginfo_dba_insert
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_optimize, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_sync arginfo_dba_optimize
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_handlers, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, full_info, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c
index d269990c16..c20136652a 100644
--- a/ext/dba/dba_cdb.c
+++ b/ext/dba/dba_cdb.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/ext/dba/dba_db1.c b/ext/dba/dba_db1.c
index 5d9c28dcec..70fe23e772 100644
--- a/ext/dba/dba_db1.c
+++ b/ext/dba/dba_db1.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/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
index 0fecd36c33..0ff4784fe5 100644
--- a/ext/dba/dba_db2.c
+++ b/ext/dba/dba_db2.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/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
index bc0fdacd02..a22c28f721 100644
--- a/ext/dba/dba_db3.c
+++ b/ext/dba/dba_db3.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/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index ee296b9c4f..d2d8df3c7f 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.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/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
index 58a1493c51..317219be2d 100644
--- a/ext/dba/dba_dbm.c
+++ b/ext/dba/dba_dbm.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/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c
index 9a4a3674f3..b9a3a4cfe9 100644
--- a/ext/dba/dba_flatfile.c
+++ b/ext/dba/dba_flatfile.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/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
index 185241421d..0f0f256ac7 100644
--- a/ext/dba/dba_gdbm.c
+++ b/ext/dba/dba_gdbm.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/ext/dba/dba_inifile.c b/ext/dba/dba_inifile.c
index ed001654af..dd3d42290f 100644
--- a/ext/dba/dba_inifile.c
+++ b/ext/dba/dba_inifile.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/ext/dba/dba_lmdb.c b/ext/dba/dba_lmdb.c
index 4bc085177d..41228df2ea 100644
--- a/ext/dba/dba_lmdb.c
+++ b/ext/dba/dba_lmdb.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/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
index 973a91322f..0819c72d87 100644
--- a/ext/dba/dba_ndbm.c
+++ b/ext/dba/dba_ndbm.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/ext/dba/dba_qdbm.c b/ext/dba/dba_qdbm.c
index ba68bcc4ba..91dada80ab 100644
--- a/ext/dba/dba_qdbm.c
+++ b/ext/dba/dba_qdbm.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/ext/dba/dba_tcadb.c b/ext/dba/dba_tcadb.c
index 2df9433026..4b6d20b57f 100644
--- a/ext/dba/dba_tcadb.c
+++ b/ext/dba/dba_tcadb.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/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c
index 841505a20a..101360d96c 100644
--- a/ext/dba/libcdb/cdb.c
+++ b/ext/dba/libcdb/cdb.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/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h
index f02ec5040e..57b784d7c4 100644
--- a/ext/dba/libcdb/cdb.h
+++ b/ext/dba/libcdb/cdb.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/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c
index 95b1c25181..fd1c022cb6 100644
--- a/ext/dba/libcdb/cdb_make.c
+++ b/ext/dba/libcdb/cdb_make.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/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h
index d6cc715a04..ef7b13023a 100644
--- a/ext/dba/libcdb/cdb_make.h
+++ b/ext/dba/libcdb/cdb_make.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/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c
index 9dd8236886..f7d96207bc 100644
--- a/ext/dba/libcdb/uint32.c
+++ b/ext/dba/libcdb/uint32.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/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h
index 1ccc04eefb..ca8a8513f4 100644
--- a/ext/dba/libcdb/uint32.h
+++ b/ext/dba/libcdb/uint32.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/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c
index 410f340526..bceeaff3c5 100644
--- a/ext/dba/libflatfile/flatfile.c
+++ b/ext/dba/libflatfile/flatfile.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/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h
index 184500cec5..c161659b21 100644
--- a/ext/dba/libflatfile/flatfile.h
+++ b/ext/dba/libflatfile/flatfile.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/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index 42cb3bb761..8330125dea 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.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/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h
index 11ffbd834b..ec33f80ee7 100644
--- a/ext/dba/libinifile/inifile.h
+++ b/ext/dba/libinifile/inifile.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/ext/dba/php_dba.h b/ext/dba/php_dba.h
index 221d60afa5..cd93b47bd1 100644
--- a/ext/dba/php_dba.h
+++ b/ext/dba/php_dba.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/ext/dba/php_tcadb.h b/ext/dba/php_tcadb.h
index a8158ce57c..6cb5a52406 100644
--- a/ext/dba/php_tcadb.h
+++ b/ext/dba/php_tcadb.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/ext/dba/tests/dba011.phpt b/ext/dba/tests/dba011.phpt
index 087233667c..1a4742c618 100644
--- a/ext/dba/tests/dba011.phpt
+++ b/ext/dba/tests/dba011.phpt
@@ -9,7 +9,6 @@ die("info $HND handler used");
<?php
require_once(__DIR__ .'/test.inc');
echo "database handler: $handler\n";
-var_dump(dba_open($db_file));
var_dump(dba_open($db_file, 'n'));
var_dump(dba_open($db_file, 'n', 'bogus'));
var_dump(dba_open($db_file, 'q', $handler));
@@ -22,9 +21,6 @@ require(__DIR__ .'/clean.inc');
?>
--EXPECTF--
database handler: flatfile
-
-Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d
-NULL
resource(%d) of type (dba)
Warning: dba_open(%stest0.dbm,n): No such handler: bogus in %sdba011.php on line %d
diff --git a/ext/dba/tests/dba_handlers.phpt b/ext/dba/tests/dba_handlers.phpt
index a6f104f16a..f3c299ce2a 100644
--- a/ext/dba/tests/dba_handlers.phpt
+++ b/ext/dba/tests/dba_handlers.phpt
@@ -35,13 +35,9 @@ check(dba_handlers(null));
echo "Test 3\n";
-check(dba_handlers(1, 2));
-
-echo "Test 4\n";
-
check(dba_handlers(0));
-echo "Test 5 - full info\n";
+echo "Test 4 - full info\n";
$h = dba_handlers(1);
foreach ($h as $key => $val) {
if ($key === "flatfile") {
@@ -61,9 +57,6 @@ Success: flatfile enabled
Test 2
Success: flatfile enabled
Test 3
-
-Warning: dba_handlers() expects at most 1 parameter, 2 given in %sdba_handlers.php on line %d
-Test 4
Success: flatfile enabled
-Test 5 - full info
+Test 4 - full info
Success: flatfile enabled
diff --git a/ext/dba/tests/dba_optimize.phpt b/ext/dba/tests/dba_optimize.phpt
index db258f5ff7..9aee57e39f 100644
--- a/ext/dba/tests/dba_optimize.phpt
+++ b/ext/dba/tests/dba_optimize.phpt
@@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
echo dba_exists("key$i", $db_file) ? "Y" : "N";
}
echo "\n";
- var_dump(dba_optimize());
- var_dump(dba_optimize(""));
var_dump(dba_optimize($db_file));
dba_close($db_file);
} else {
@@ -41,11 +39,5 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
--EXPECTF--
database handler: flatfile
2YY
-
-Warning: dba_optimize() expects exactly 1 parameter, 0 given in %sdba_optimize.php on line %d
-NULL
-
-Warning: dba_optimize() expects parameter 1 to be resource, string given in %sdba_optimize.php on line %d
-NULL
bool(true)
===DONE===
diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt
index 37a2157666..77a0f3b5a0 100644
--- a/ext/dba/tests/dba_split.phpt
+++ b/ext/dba/tests/dba_split.phpt
@@ -7,7 +7,6 @@ DBA Split Test
?>
--FILE--
<?php
-var_dump(dba_key_split("key1", "name"));
var_dump(dba_key_split(1));
var_dump(dba_key_split(null));
var_dump(dba_key_split(""));
@@ -23,8 +22,6 @@ var_dump(dba_key_split("[key1]name1"));
===DONE===
<?php exit(0); ?>
--EXPECTF--
-Warning: Wrong parameter count for dba_key_split() in %sdba_split.php on line %d
-NULL
array(2) {
[0]=>
string(0) ""
diff --git a/ext/dba/tests/dba_sync.phpt b/ext/dba/tests/dba_sync.phpt
index 7210469cd5..5c123a2647 100644
--- a/ext/dba/tests/dba_sync.phpt
+++ b/ext/dba/tests/dba_sync.phpt
@@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
echo dba_exists("key$i", $db_file) ? "Y" : "N";
}
echo "\n";
- var_dump(dba_sync());
- var_dump(dba_sync(""));
var_dump(dba_sync($db_file));
dba_close($db_file);
} else {
@@ -41,11 +39,5 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
--EXPECTF--
database handler: flatfile
2YY
-
-Warning: dba_sync() expects exactly 1 parameter, 0 given in %sdba_sync.php on line %d
-NULL
-
-Warning: dba_sync() expects parameter 1 to be resource, string given in %sdba_sync.php on line %d
-NULL
bool(true)
===DONE===
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index 9326e145bf..73ce75b366 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.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/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index 4d34e58a61..6af743e4e3 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.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/ext/dom/characterdata.c b/ext/dom/characterdata.c
index b0ac50f44e..2363cc6003 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.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/ext/dom/comment.c b/ext/dom/comment.c
index 9cbec9f173..c4b488888d 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.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/ext/dom/config.m4 b/ext/dom/config.m4
index 1a7f81ef8d..de3b54da4c 100644
--- a/ext/dom/config.m4
+++ b/ext/dom/config.m4
@@ -12,16 +12,16 @@ if test "$PHP_DOM" != "no"; then
PHP_SETUP_LIBXML(DOM_SHARED_LIBADD, [
AC_DEFINE(HAVE_DOM,1,[ ])
- PHP_NEW_EXTENSION(dom, [php_dom.c attr.c document.c domerrorhandler.c \
- domstringlist.c domexception.c namelist.c \
+ PHP_NEW_EXTENSION(dom, [php_dom.c attr.c document.c \
+ domexception.c \
processinginstruction.c cdatasection.c \
documentfragment.c domimplementation.c \
- element.c node.c string_extend.c characterdata.c \
- documenttype.c domimplementationlist.c entity.c \
- nodelist.c text.c comment.c domconfiguration.c \
- domimplementationsource.c entityreference.c \
+ element.c node.c characterdata.c \
+ documenttype.c entity.c \
+ nodelist.c text.c comment.c \
+ entityreference.c \
notation.c xpath.c dom_iterators.c \
- typeinfo.c domerror.c domlocator.c namednodemap.c userdatahandler.c],
+ namednodemap.c],
$ext_shared)
PHP_SUBST(DOM_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/dom/xml_common.h])
diff --git a/ext/dom/config.w32 b/ext/dom/config.w32
index 1ac3c614a5..cd5f5a6cb8 100644
--- a/ext/dom/config.w32
+++ b/ext/dom/config.w32
@@ -7,14 +7,14 @@ if (PHP_DOM == "yes") {
ADD_EXTENSION_DEP('dom', 'libxml') &&
CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS_DOM", PHP_PHP_BUILD + "\\include\\libxml2")
) {
- EXTENSION("dom", "php_dom.c attr.c document.c domerrorhandler.c \
- domstringlist.c domexception.c namelist.c processinginstruction.c \
+ EXTENSION("dom", "php_dom.c attr.c document.c \
+ domexception.c processinginstruction.c \
cdatasection.c documentfragment.c domimplementation.c element.c \
- node.c string_extend.c characterdata.c documenttype.c \
- domimplementationlist.c entity.c nodelist.c text.c comment.c \
- domconfiguration.c domimplementationsource.c entityreference.c \
- notation.c xpath.c dom_iterators.c typeinfo.c domerror.c \
- domlocator.c namednodemap.c userdatahandler.c");
+ node.c characterdata.c documenttype.c \
+ entity.c nodelist.c text.c comment.c \
+ entityreference.c \
+ notation.c xpath.c dom_iterators.c \
+ namednodemap.c");
AC_DEFINE("HAVE_DOM", 1, "DOM support");
diff --git a/ext/dom/document.c b/ext/dom/document.c
index df1e7a8dfb..ede0311b5d 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.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, |
@@ -109,12 +107,6 @@ ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_normalize_document, 0, 0, 0)
ZEND_END_ARG_INFO();
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_rename_node, 0, 0, 3)
- ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO();
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_load, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_ARG_INFO(0, options)
@@ -209,17 +201,16 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
PHP_FALIAS(getElementById, dom_document_get_element_by_id, arginfo_dom_document_get_element_by_id)
PHP_FALIAS(adoptNode, dom_document_adopt_node, arginfo_dom_document_adopt_node)
PHP_FALIAS(normalizeDocument, dom_document_normalize_document, arginfo_dom_document_normalize_document)
- PHP_FALIAS(renameNode, dom_document_rename_node, arginfo_dom_document_rename_node)
- PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC)
PHP_FALIAS(save, dom_document_save, arginfo_dom_document_save)
- PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC)
PHP_FALIAS(saveXML, dom_document_savexml, arginfo_dom_document_savexml)
PHP_ME(domdocument, __construct, arginfo_dom_document_construct, ZEND_ACC_PUBLIC)
PHP_FALIAS(validate, dom_document_validate, arginfo_dom_document_validate)
PHP_FALIAS(xinclude, dom_document_xinclude, arginfo_dom_document_xinclude)
#if defined(LIBXML_HTML_ENABLED)
- PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC)
PHP_FALIAS(saveHTML, dom_document_save_html, arginfo_dom_document_savehtml)
PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, arginfo_dom_document_savehtmlfile)
#endif /* defined(LIBXML_HTML_ENABLED) */
@@ -1262,16 +1253,6 @@ PHP_FUNCTION(dom_document_normalize_document)
}
/* }}} end dom_document_normalize_document */
-/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_document_rename_node)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_document_rename_node */
-
/* {{{ proto DOMDocument::__construct([string version], [string encoding]); */
PHP_METHOD(domdocument, __construct)
{
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index 9b222586ac..e84553db4d 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.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/ext/dom/documenttype.c b/ext/dom/documenttype.c
index dd8a647167..ea9e7eba05 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.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/ext/dom/dom_ce.h b/ext/dom/dom_ce.h
index a8b9c9227c..4fea77b8e2 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.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, |
@@ -22,10 +20,6 @@
extern PHP_DOM_EXPORT zend_class_entry *dom_node_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_domexception_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domstringlist_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_namelist_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domimplementationlist_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domimplementationsource_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_domimplementation_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_documentfragment_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_document_class_entry;
@@ -36,19 +30,12 @@ extern PHP_DOM_EXPORT zend_class_entry *dom_attr_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_element_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_text_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_comment_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_typeinfo_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_userdatahandler_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domerror_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domerrorhandler_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domlocator_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domconfiguration_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_cdatasection_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_documenttype_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_notation_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_entity_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_entityreference_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_processinginstruction_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_string_extend_class_entry;
#if defined(LIBXML_XPATH_ENABLED)
extern PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
#endif
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index b8c1ff2266..c4826edf42 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.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, |
@@ -21,10 +19,6 @@
#define DOM_FE_H
extern const zend_function_entry php_dom_domexception_class_functions[];
-extern const zend_function_entry php_dom_domstringlist_class_functions[];
-extern const zend_function_entry php_dom_namelist_class_functions[];
-extern const zend_function_entry php_dom_domimplementationlist_class_functions[];
-extern const zend_function_entry php_dom_domimplementationsource_class_functions[];
extern const zend_function_entry php_dom_domimplementation_class_functions[];
extern const zend_function_entry php_dom_documentfragment_class_functions[];
extern const zend_function_entry php_dom_document_class_functions[];
@@ -36,19 +30,12 @@ extern const zend_function_entry php_dom_attr_class_functions[];
extern const zend_function_entry php_dom_element_class_functions[];
extern const zend_function_entry php_dom_text_class_functions[];
extern const zend_function_entry php_dom_comment_class_functions[];
-extern const zend_function_entry php_dom_typeinfo_class_functions[];
-extern const zend_function_entry php_dom_userdatahandler_class_functions[];
-extern const zend_function_entry php_dom_domerror_class_functions[];
-extern const zend_function_entry php_dom_domerrorhandler_class_functions[];
-extern const zend_function_entry php_dom_domlocator_class_functions[];
-extern const zend_function_entry php_dom_domconfiguration_class_functions[];
extern const zend_function_entry php_dom_cdatasection_class_functions[];
extern const zend_function_entry php_dom_documenttype_class_functions[];
extern const zend_function_entry php_dom_notation_class_functions[];
extern const zend_function_entry php_dom_entity_class_functions[];
extern const zend_function_entry php_dom_entityreference_class_functions[];
extern const zend_function_entry php_dom_processinginstruction_class_functions[];
-extern const zend_function_entry php_dom_string_extend_class_functions[];
extern const zend_function_entry php_dom_xpath_class_functions[];
/* domexception errors */
@@ -79,20 +66,6 @@ typedef enum {
VALIDATION_ERR = 16
} dom_exception_code;
-/* domstringlist methods */
-PHP_FUNCTION(dom_domstringlist_item);
-
-/* domnamelist methods */
-PHP_FUNCTION(dom_namelist_get_name);
-PHP_FUNCTION(dom_namelist_get_namespace_uri);
-
-/* domimplementationlist methods */
-PHP_FUNCTION(dom_domimplementationlist_item);
-
-/* domimplementationsource methods */
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementation);
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementations);
-
/* domimplementation methods */
PHP_METHOD(domimplementation, hasFeature);
PHP_METHOD(domimplementation, createDocumentType);
@@ -224,23 +197,6 @@ PHP_METHOD(domtext, __construct);
/* domcomment methods */
PHP_METHOD(domcomment, __construct);
-/* domtypeinfo methods */
-
-/* domuserdatahandler methods */
-PHP_FUNCTION(dom_userdatahandler_handle);
-
-/* domdomerror methods */
-
-/* domerrorhandler methods */
-PHP_FUNCTION(dom_domerrorhandler_handle_error);
-
-/* domlocator methods */
-
-/* domconfiguration methods */
-PHP_FUNCTION(dom_domconfiguration_set_parameter);
-PHP_FUNCTION(dom_domconfiguration_get_parameter);
-PHP_FUNCTION(dom_domconfiguration_can_set_parameter);
-
/* domcdatasection methods */
PHP_METHOD(domcdatasection, __construct);
@@ -256,10 +212,6 @@ PHP_METHOD(domentityreference, __construct);
/* domprocessinginstruction methods */
PHP_METHOD(domprocessinginstruction, __construct);
-/* string_extend methods */
-PHP_FUNCTION(dom_string_extend_find_offset16);
-PHP_FUNCTION(dom_string_extend_find_offset32);
-
#if defined(LIBXML_XPATH_ENABLED)
/* xpath methods */
PHP_METHOD(domxpath, __construct);
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 7483235c0f..6a89861107 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.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/ext/dom/dom_properties.h b/ext/dom/dom_properties.h
index 73d404429e..793e18c363 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.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, |
@@ -71,27 +69,6 @@ int dom_documenttype_public_id_read(dom_object *obj, zval *retval);
int dom_documenttype_system_id_read(dom_object *obj, zval *retval);
int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval);
-/* domerror properties */
-int dom_domerror_severity_read(dom_object *obj, zval *retval);
-int dom_domerror_message_read(dom_object *obj, zval *retval);
-int dom_domerror_type_read(dom_object *obj, zval *retval);
-int dom_domerror_related_exception_read(dom_object *obj, zval *retval);
-int dom_domerror_related_data_read(dom_object *obj, zval *retval);
-int dom_domerror_location_read(dom_object *obj, zval *retval);
-
-/* domimplementationlist properties */
-int dom_domimplementationlist_length_read(dom_object *obj, zval *retval);
-
-/* domlocator properties */
-int dom_domlocator_line_number_read(dom_object *obj, zval *retval);
-int dom_domlocator_column_number_read(dom_object *obj, zval *retval);
-int dom_domlocator_offset_read(dom_object *obj, zval *retval);
-int dom_domlocator_related_node_read(dom_object *obj, zval *retval);
-int dom_domlocator_uri_read(dom_object *obj, zval *retval);
-
-/* domstringlist properties */
-int dom_domstringlist_length_read(dom_object *obj, zval *retval);
-
/* element properties */
int dom_element_tag_name_read(dom_object *obj, zval *retval);
int dom_element_schema_type_info_read(dom_object *obj, zval *retval);
@@ -110,9 +87,6 @@ int dom_entity_version_write(dom_object *obj, zval *newval);
/* namednodemap properties */
int dom_namednodemap_length_read(dom_object *obj, zval *retval);
-/* namelist properties */
-int dom_namelist_length_read(dom_object *obj, zval *retval);
-
/* node properties */
int dom_node_node_name_read(dom_object *obj, zval *retval);
int dom_node_node_value_read(dom_object *obj, zval *retval);
@@ -151,13 +125,11 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval);
/* text properties */
int dom_text_whole_text_read(dom_object *obj, zval *retval);
-/* typeinfo properties */
-int dom_typeinfo_type_name_read(dom_object *obj, zval *retval);
-int dom_typeinfo_type_namespace_read(dom_object *obj, zval *retval);
-
#if defined(LIBXML_XPATH_ENABLED)
/* xpath properties */
int dom_xpath_document_read(dom_object *obj, zval *retval);
+int dom_xpath_register_node_ns_read(dom_object *obj, zval *retval);
+int dom_xpath_register_node_ns_write(dom_object *obj, zval *newval);
#endif
#endif /* DOM_PROPERTIERS_H */
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
deleted file mode 100644
index b1d8ef452a..0000000000
--- a/ext/dom/domconfiguration.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_set_parameter, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_get_parameter, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_can_set_parameter, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domdomconfiguration
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domconfiguration_class_functions[] = {
- PHP_FALIAS(setParameter, dom_domconfiguration_set_parameter, arginfo_dom_configuration_set_parameter)
- PHP_FALIAS(getParameter, dom_domconfiguration_get_parameter, arginfo_dom_configuration_get_parameter)
- PHP_FALIAS(canSetParameter, dom_domconfiguration_can_set_parameter, arginfo_dom_configuration_can_set_parameter)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property
-Since:
-*/
-PHP_FUNCTION(dom_domconfiguration_set_parameter)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domconfiguration_set_parameter */
-
-/* {{{ proto domdomuserdata dom_domconfiguration_get_parameter(string name);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter
-Since:
-*/
-PHP_FUNCTION(dom_domconfiguration_get_parameter)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domconfiguration_get_parameter */
-
-/* {{{ proto bool dom_domconfiguration_can_set_parameter(string name, domuserdata value);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter
-Since:
-*/
-PHP_FUNCTION(dom_domconfiguration_can_set_parameter)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domconfiguration_can_set_parameter */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
deleted file mode 100644
index 1932d51408..0000000000
--- a/ext/dom/domerror.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domerror
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-Interfaces-DOMError
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domerror_class_functions[] = {
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ severity unsigned short
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-severity
-Since:
-*/
-int dom_domerror_severity_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ message string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-message
-Since:
-*/
-int dom_domerror_message_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ type string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-type
-Since:
-*/
-int dom_domerror_type_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ relatedException object
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedException
-Since:
-*/
-int dom_domerror_related_exception_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ relatedData domobject
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedData
-Since:
-*/
-int dom_domerror_related_data_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ location domlocator
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-location
-Since:
-*/
-int dom_domerror_location_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
deleted file mode 100644
index 344cb77c4f..0000000000
--- a/ext/dom/domerrorhandler.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_domerrorhandler_handle_error, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, error, DOMDomError, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domerrorhandler
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-Interfaces-DOMErrorHandler
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domerrorhandler_class_functions[] = {
- PHP_FALIAS(handleError, dom_domerrorhandler_handle_error, arginfo_dom_domerrorhandler_handle_error)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto dom_boolean dom_domerrorhandler_handle_error(domerror error);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError
-Since:
-*/
-PHP_FUNCTION(dom_domerrorhandler_handle_error)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domerrorhandler_handle_error */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index 922d01c95e..e398a8003b 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.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/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 05e99af39b..abbda2699e 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.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, |
@@ -55,10 +53,10 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_domimplementation_class_functions[] = {
- PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC)
+ PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC)
+ PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC)
+ PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c
deleted file mode 100644
index 9b248d4a02..0000000000
--- a/ext/dom/domimplementationlist.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationlist_item, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domimplementationlist
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domimplementationlist_class_functions[] = {
- PHP_FALIAS(item, dom_domimplementationlist_item, arginfo_dom_implementationlist_item)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ length unsigned long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-length
-Since:
-*/
-int dom_domimplementationlist_length_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto domdomimplementation dom_domimplementationlist_item(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item
-Since:
-*/
-PHP_FUNCTION(dom_domimplementationlist_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domimplementationlist_item */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
deleted file mode 100644
index 7f3f8b9dfc..0000000000
--- a/ext/dom/domimplementationsource.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementation, 0, 0, 1)
- ZEND_ARG_INFO(0, features)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementations, 0, 0, 1)
- ZEND_ARG_INFO(0, features)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domimplementationsource
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationSource
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domimplementationsource_class_functions[] = {
- PHP_FALIAS(getDomimplementation, dom_domimplementationsource_get_domimplementation, arginfo_dom_implementationsource_getdomimplementation)
- PHP_FALIAS(getDomimplementations, dom_domimplementationsource_get_domimplementations, arginfo_dom_implementationsource_getdomimplementations)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto domdomimplementation dom_domimplementationsource_get_domimplementation(string features);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl
-Since:
-*/
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementation)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domimplementationsource_get_domimplementation */
-
-/* {{{ proto domimplementationlist dom_domimplementationsource_get_domimplementations(string features);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls
-Since:
-*/
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementations)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domimplementationsource_get_domimplementations */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
deleted file mode 100644
index 7ad0ff8866..0000000000
--- a/ext/dom/domlocator.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domlocator
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Interfaces-DOMLocator
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domlocator_class_functions[] = {
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ line_number long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-line-number
-Since:
-*/
-int dom_domlocator_line_number_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ column_number long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-column-number
-Since:
-*/
-int dom_domlocator_column_number_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ offset long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-offset
-Since:
-*/
-int dom_domlocator_offset_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ related_node node
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-node
-Since:
-*/
-int dom_domlocator_related_node_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ uri string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-uri
-Since:
-*/
-int dom_domlocator_uri_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
deleted file mode 100644
index 224b924c1a..0000000000
--- a/ext/dom/domstringlist.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_stringlist_item, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domstringlist
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domstringlist_class_functions[] = {
- PHP_FALIAS(item, dom_domstringlist_item, arginfo_dom_stringlist_item)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ length unsigned long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-length
-Since:
-*/
-int dom_domstringlist_length_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto domstring dom_domstringlist_item(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item
-Since:
-*/
-PHP_FUNCTION(dom_domstringlist_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domstringlist_item */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 51aba0e155..b0b070e18a 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.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/ext/dom/entity.c b/ext/dom/entity.c
index b41255066a..6b01cb3fb2 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.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/ext/dom/entityreference.c b/ext/dom/entityreference.c
index f7c0c2a711..d4b0c14e39 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.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/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 4b8df2734f..613cea3360 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.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, |
@@ -30,14 +28,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_item, 0, 0, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
@@ -47,15 +37,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item_ns, 0, 0, 0)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item_ns, 0, 0, 0)
- ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item_ns, 0, 0, 0)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_count, 0, 0, 0)
ZEND_END_ARG_INFO();
/* }}} */
@@ -69,12 +50,8 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_namednodemap_class_functions[] = { /* {{{ */
PHP_FALIAS(getNamedItem, dom_namednodemap_get_named_item, arginfo_dom_namednodemap_get_named_item)
- PHP_FALIAS(setNamedItem, dom_namednodemap_set_named_item, arginfo_dom_namednodemap_set_named_item)
- PHP_FALIAS(removeNamedItem, dom_namednodemap_remove_named_item, arginfo_dom_namednodemap_remove_named_item)
PHP_FALIAS(item, dom_namednodemap_item, arginfo_dom_namednodemap_item)
PHP_FALIAS(getNamedItemNS, dom_namednodemap_get_named_item_ns, arginfo_dom_namednodemap_get_named_item_ns)
- PHP_FALIAS(setNamedItemNS, dom_namednodemap_set_named_item_ns, arginfo_dom_namednodemap_set_named_item_ns)
- PHP_FALIAS(removeNamedItemNS, dom_namednodemap_remove_named_item_ns, arginfo_dom_namednodemap_remove_named_item_ns)
PHP_FALIAS(count, dom_namednodemap_count, arginfo_dom_namednodemap_count)
PHP_FE_END
};
@@ -177,26 +154,6 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
}
/* }}} end dom_namednodemap_get_named_item */
-/* {{{ proto DOMNode dom_namednodemap_set_named_item(DOMNode arg);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788
-Since:
-*/
-PHP_FUNCTION(dom_namednodemap_set_named_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_set_named_item */
-
-/* {{{ proto DOMNode dom_namednodemap_remove_named_item(string name);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193
-Since:
-*/
-PHP_FUNCTION(dom_namednodemap_remove_named_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_remove_named_item */
-
/* {{{ proto DOMNode dom_namednodemap_item(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9
Since:
@@ -317,26 +274,6 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
}
/* }}} end dom_namednodemap_get_named_item_ns */
-/* {{{ proto DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS
-Since: DOM Level 2
-*/
-PHP_FUNCTION(dom_namednodemap_set_named_item_ns)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_set_named_item_ns */
-
-/* {{{ proto DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS
-Since: DOM Level 2
-*/
-PHP_FUNCTION(dom_namednodemap_remove_named_item_ns)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_remove_named_item_ns */
-
/* {{{ proto int|bool dom_namednodemap_count();
*/
PHP_FUNCTION(dom_namednodemap_count)
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
deleted file mode 100644
index a235536bb5..0000000000
--- a/ext/dom/namelist.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_name, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_namespace_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class DOMNameList
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_namelist_class_functions[] = {
- PHP_FALIAS(getName, dom_namelist_get_name, arginfo_dom_namelist_get_name)
- PHP_FALIAS(getNamespaceURI, dom_namelist_get_namespace_uri, arginfo_dom_namelist_get_namespace_uri)
- PHP_FE_END
-};
-
-/* {{{ length int
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-length
-Since:
-*/
-int dom_namelist_length_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto string dom_namelist_get_name(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName
-Since:
-*/
-PHP_FUNCTION(dom_namelist_get_name)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namelist_get_name */
-
-/* {{{ proto string dom_namelist_get_namespace_uri(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI
-Since:
-*/
-PHP_FUNCTION(dom_namelist_get_namespace_uri)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namelist_get_namespace_uri */
-
-#endif
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 609d1a6116..2e74531467 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.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, |
@@ -82,25 +80,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_namespace_uri, 0, 0, 1)
ZEND_ARG_INFO(0, prefix)
ZEND_END_ARG_INFO();
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_equal_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_feature, 0, 0, 2)
- ZEND_ARG_INFO(0, feature)
- ZEND_ARG_INFO(0, version)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_set_user_data, 0, 0, 3)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, handler)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_user_data, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO();
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getNodePath, 0, 0, 0)
ZEND_END_ARG_INFO();
@@ -145,10 +124,6 @@ const zend_function_entry php_dom_node_class_functions[] = { /* {{{ */
PHP_FALIAS(lookupPrefix, dom_node_lookup_prefix, arginfo_dom_node_lookup_prefix)
PHP_FALIAS(isDefaultNamespace, dom_node_is_default_namespace, arginfo_dom_node_is_default_namespace)
PHP_FALIAS(lookupNamespaceUri, dom_node_lookup_namespace_uri, arginfo_dom_node_lookup_namespace_uri)
- PHP_FALIAS(isEqualNode, dom_node_is_equal_node, arginfo_dom_node_is_equal_node)
- PHP_FALIAS(getFeature, dom_node_get_feature, arginfo_dom_node_get_feature)
- PHP_FALIAS(setUserData, dom_node_set_user_data, arginfo_dom_node_set_user_data)
- PHP_FALIAS(getUserData, dom_node_get_user_data, arginfo_dom_node_get_user_data)
PHP_ME(domnode, getNodePath, arginfo_dom_node_getNodePath, ZEND_ACC_PUBLIC)
PHP_ME(domnode, getLineNo, arginfo_dom_node_getLineNo, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14N, arginfo_dom_node_C14N, ZEND_ACC_PUBLIC)
@@ -1228,7 +1203,7 @@ PHP_FUNCTION(dom_node_remove_child)
}
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
- RETURN_FALSE
+ RETURN_FALSE;
}
/* }}} end dom_node_remove_child */
@@ -1654,46 +1629,6 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
}
/* }}} end dom_node_lookup_namespace_uri */
-/* {{{ proto bool dom_node_is_equal_node(DomNode arg);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_is_equal_node)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_is_equal_node */
-
-/* {{{ proto DomNode dom_node_get_feature(string feature, string version);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_get_feature)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_get_feature */
-
-/* {{{ proto mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_set_user_data)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_set_user_data */
-
-/* {{{ proto mixed dom_node_get_user_data(string key);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_get_user_data)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_get_user_data */
-
static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
zval *id;
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index 84c4a9eb73..4c6967ffce 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.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/ext/dom/notation.c b/ext/dom/notation.c
index 2fc3a84fec..2256b359d8 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.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/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 726b74b934..cdde529e2f 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.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, |
@@ -36,10 +34,6 @@
/* {{{ class entries */
PHP_DOM_EXPORT zend_class_entry *dom_node_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_domexception_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domstringlist_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_namelist_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domimplementationlist_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domimplementationsource_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_domimplementation_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_documentfragment_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_document_class_entry;
@@ -50,19 +44,12 @@ PHP_DOM_EXPORT zend_class_entry *dom_attr_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_element_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_text_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_comment_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_typeinfo_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_userdatahandler_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domerror_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domerrorhandler_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domlocator_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domconfiguration_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_cdatasection_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_documenttype_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_notation_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_entity_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_entityreference_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_processinginstruction_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_string_extend_class_entry;
#if defined(LIBXML_XPATH_ENABLED)
PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
#endif
@@ -77,9 +64,6 @@ zend_object_handlers dom_xpath_object_handlers;
static HashTable classes;
/* {{{ prop handler tables */
-static HashTable dom_domstringlist_prop_handlers;
-static HashTable dom_namelist_prop_handlers;
-static HashTable dom_domimplementationlist_prop_handlers;
static HashTable dom_document_prop_handlers;
static HashTable dom_node_prop_handlers;
static HashTable dom_nodelist_prop_handlers;
@@ -88,9 +72,6 @@ static HashTable dom_characterdata_prop_handlers;
static HashTable dom_attr_prop_handlers;
static HashTable dom_element_prop_handlers;
static HashTable dom_text_prop_handlers;
-static HashTable dom_typeinfo_prop_handlers;
-static HashTable dom_domerror_prop_handlers;
-static HashTable dom_domlocator_prop_handlers;
static HashTable dom_documenttype_prop_handlers;
static HashTable dom_notation_prop_handlers;
static HashTable dom_entity_prop_handlers;
@@ -310,31 +291,27 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, size_
}
/* }}} */
-static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *dom_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
zval *retval = NULL;
- if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, member_str)) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, name)) {
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
-
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
/* {{{ dom_read_property */
-zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *dom_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
zval *retval;
dom_prop_handler *hnd = NULL;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
} else if (instanceof_function(obj->std.ce, dom_node_class_entry)) {
php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", ZSTR_VAL(obj->std.ce->name));
}
@@ -347,46 +324,41 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot,
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
/* {{{ dom_write_property */
-zval *dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *dom_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
dom_prop_handler *hnd = NULL;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
hnd->write_func(obj, value);
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
- zend_string_release_ex(member_str, 0);
-
return value;
}
/* }}} */
/* {{{ dom_property_exists */
-static int dom_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int dom_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
dom_prop_handler *hnd = NULL;
int retval = 0;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
zval tmp;
@@ -402,17 +374,16 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void
zval_ptr_dtor(&tmp);
}
} else {
- retval = zend_std_has_property(object, member, check_empty, cache_slot);
+ retval = zend_std_has_property(object, name, check_empty, cache_slot);
}
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
-static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ */
+static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /* {{{ */
{
- dom_object *obj = Z_DOMOBJ_P(object);
+ dom_object *obj = php_dom_obj_from_obj(object);
HashTable *debug_info,
*prop_handlers = obj->prop_handler,
*std_props;
@@ -453,7 +424,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
}
/* }}} */
-static HashTable* dom_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable* dom_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
return dom_get_debug_info_helper(object, is_temp);
}
@@ -500,9 +471,9 @@ PHP_FUNCTION(dom_import_simplexml)
static dom_object* dom_objects_set_class(zend_class_entry *class_type);
-static zend_object *dom_objects_store_clone_obj(zval *zobject) /* {{{ */
+static zend_object *dom_objects_store_clone_obj(zend_object *zobject) /* {{{ */
{
- dom_object *intern = Z_DOMOBJ_P(zobject);
+ dom_object *intern = php_dom_obj_from_obj(zobject);
dom_object *clone = dom_objects_set_class(intern->std.ce);
clone->std.handlers = dom_get_obj_handlers();
@@ -583,7 +554,9 @@ ZEND_GET_MODULE(dom)
void dom_objects_free_storage(zend_object *object);
void dom_nnodemap_objects_free_storage(zend_object *object);
-static zend_object *dom_objects_store_clone_obj(zval *zobject);
+static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
+static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty);
+static zend_object *dom_objects_store_clone_obj(zend_object *zobject);
static void dom_nnodemap_object_dtor(zend_object *object);
#if defined(LIBXML_XPATH_ENABLED)
void dom_xpath_objects_free_storage(zend_object *object);
@@ -617,25 +590,6 @@ PHP_MINIT_FUNCTION(dom)
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC);
- REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry);
-
- zend_hash_init(&dom_domstringlist_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domstringlist_prop_handlers, "length", sizeof("length")-1, dom_domstringlist_length_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domstringlist_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMNameList", NULL, php_dom_namelist_class_functions, dom_namelist_class_entry);
-
- zend_hash_init(&dom_namelist_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_namelist_prop_handlers, "length", sizeof("length")-1, dom_namelist_length_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_namelist_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMImplementationList", NULL, php_dom_domimplementationlist_class_functions, dom_domimplementationlist_class_entry);
-
- zend_hash_init(&dom_domimplementationlist_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domimplementationlist_prop_handlers, "length", sizeof("length")-1, dom_domimplementationlist_length_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domimplementationlist_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMImplementationSource", NULL, php_dom_domimplementationsource_class_functions, dom_domimplementationsource_class_entry);
REGISTER_DOM_CLASS(ce, "DOMImplementation", NULL, php_dom_domimplementation_class_functions, dom_domimplementation_class_entry);
REGISTER_DOM_CLASS(ce, "DOMNode", NULL, php_dom_node_class_functions, dom_node_class_entry);
@@ -757,37 +711,6 @@ PHP_MINIT_FUNCTION(dom)
REGISTER_DOM_CLASS(ce, "DOMComment", dom_characterdata_class_entry, php_dom_comment_class_functions, dom_comment_class_entry);
zend_hash_add_ptr(&classes, ce.name, &dom_characterdata_prop_handlers);
- REGISTER_DOM_CLASS(ce, "DOMTypeinfo", NULL, php_dom_typeinfo_class_functions, dom_typeinfo_class_entry);
-
- zend_hash_init(&dom_typeinfo_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeName", sizeof("typeName")-1, dom_typeinfo_type_name_read, NULL);
- dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeNamespace", sizeof("typeNamespace")-1, dom_typeinfo_type_namespace_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_typeinfo_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMUserDataHandler", NULL, php_dom_userdatahandler_class_functions, dom_userdatahandler_class_entry);
- REGISTER_DOM_CLASS(ce, "DOMDomError", NULL, php_dom_domerror_class_functions, dom_domerror_class_entry);
-
- zend_hash_init(&dom_domerror_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "severity", sizeof("severity")-1, dom_domerror_severity_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "message", sizeof("message")-1, dom_domerror_message_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "type", sizeof("type")-1, dom_domerror_type_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "relatedException", sizeof("relatedException")-1, dom_domerror_related_exception_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "related_data", sizeof("related_data")-1, dom_domerror_related_data_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "location", sizeof("location")-1, dom_domerror_location_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domerror_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMErrorHandler", NULL, php_dom_domerrorhandler_class_functions, dom_domerrorhandler_class_entry);
- REGISTER_DOM_CLASS(ce, "DOMLocator", NULL, php_dom_domlocator_class_functions, dom_domlocator_class_entry);
-
- zend_hash_init(&dom_domlocator_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "lineNumber", sizeof("lineNumber")-1, dom_domlocator_line_number_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "columnNumber", sizeof("columnNumber")-1, dom_domlocator_column_number_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "offset", sizeof("offset")-1, dom_domlocator_offset_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "relatedNode", sizeof("relatedNode")-1, dom_domlocator_related_node_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "uri", sizeof("uri")-1, dom_domlocator_uri_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domlocator_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMConfiguration", NULL, php_dom_domconfiguration_class_functions, dom_domconfiguration_class_entry);
REGISTER_DOM_CLASS(ce, "DOMCdataSection", dom_text_class_entry, php_dom_cdatasection_class_functions, dom_cdatasection_class_entry);
zend_hash_add_ptr(&classes, ce.name, &dom_text_prop_handlers);
@@ -834,8 +757,6 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_merge(&dom_processinginstruction_prop_handlers, &dom_node_prop_handlers, dom_copy_prop_handler, 0);
zend_hash_add_ptr(&classes, ce.name, &dom_processinginstruction_prop_handlers);
- REGISTER_DOM_CLASS(ce, "DOMStringExtend", NULL, php_dom_string_extend_class_functions, dom_string_extend_class_entry);
-
#if defined(LIBXML_XPATH_ENABLED)
memcpy(&dom_xpath_object_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
dom_xpath_object_handlers.offset = XtOffsetOf(dom_xpath_object, dom) + XtOffsetOf(dom_object, std);
@@ -847,6 +768,7 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_init(&dom_xpath_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
dom_register_prop_handler(&dom_xpath_prop_handlers, "document", sizeof("document")-1, dom_xpath_document_read, NULL);
+ dom_register_prop_handler(&dom_xpath_prop_handlers, "registerNodeNamespaces", sizeof("registerNodeNamespaces")-1, dom_xpath_register_node_ns_read, dom_xpath_register_node_ns_write);
zend_hash_add_ptr(&classes, ce.name, &dom_xpath_prop_handlers);
#endif
@@ -933,9 +855,6 @@ PHP_MINFO_FUNCTION(dom)
PHP_MSHUTDOWN_FUNCTION(dom) /* {{{ */
{
- zend_hash_destroy(&dom_domstringlist_prop_handlers);
- zend_hash_destroy(&dom_namelist_prop_handlers);
- zend_hash_destroy(&dom_domimplementationlist_prop_handlers);
zend_hash_destroy(&dom_document_prop_handlers);
zend_hash_destroy(&dom_node_prop_handlers);
zend_hash_destroy(&dom_namespace_node_prop_handlers);
@@ -945,9 +864,6 @@ PHP_MSHUTDOWN_FUNCTION(dom) /* {{{ */
zend_hash_destroy(&dom_attr_prop_handlers);
zend_hash_destroy(&dom_element_prop_handlers);
zend_hash_destroy(&dom_text_prop_handlers);
- zend_hash_destroy(&dom_typeinfo_prop_handlers);
- zend_hash_destroy(&dom_domerror_prop_handlers);
- zend_hash_destroy(&dom_domlocator_prop_handlers);
zend_hash_destroy(&dom_documenttype_prop_handlers);
zend_hash_destroy(&dom_notation_prop_handlers);
zend_hash_destroy(&dom_entity_prop_handlers);
@@ -1102,6 +1018,7 @@ zend_object *dom_xpath_objects_new(zend_class_entry *class_type)
dom_xpath_object *intern = zend_object_alloc(sizeof(dom_xpath_object), class_type);
intern->registered_phpfunctions = zend_new_array(0);
+ intern->register_node_ns = 1;
intern->dom.prop_handler = &dom_xpath_prop_handlers;
intern->dom.std.handlers = &dom_xpath_object_handlers;
@@ -1530,22 +1447,23 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
}
/* }}} end dom_get_nsdecl */
-zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
zval offset_copy;
if (!offset) {
+ zend_throw_error(NULL, "Cannot access node list without offset");
return NULL;
}
ZVAL_LONG(&offset_copy, zval_get_long(offset));
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy);
+ zend_call_method_with_1_params(object, object->ce, NULL, "item", rv, &offset_copy);
return rv;
} /* }}} end dom_nodelist_read_dimension */
-int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
+static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty)
{
zend_long offset = zval_get_long(member);
zval rv;
@@ -1553,8 +1471,11 @@ int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
if (offset < 0) {
return 0;
} else {
- zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0, &rv);
+ zval obj;
+ zval *length;
+ ZVAL_OBJ(&obj, object);
+ length = zend_read_property(object->ce, &obj, "length", sizeof("length") - 1, 0, &rv);
return length && offset < Z_LVAL_P(length);
}
} /* }}} end dom_nodelist_has_dimension */
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index ce377b5ce7..11ca442df2 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.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, |
@@ -67,6 +65,7 @@ extern zend_module_entry dom_module_entry;
typedef struct _dom_xpath_object {
int registerPhpFunctions;
+ int register_node_ns;
HashTable *registered_phpfunctions;
HashTable *node_list;
dom_object dom;
@@ -125,8 +124,6 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
-zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv);
-int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty);
#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index 8cd2848c51..f672bb5f9c 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.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/ext/dom/string_extend.c b/ext/dom/string_extend.c
deleted file mode 100644
index ecc29b0dd6..0000000000
--- a/ext/dom/string_extend.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset16, 0, 0, 1)
- ZEND_ARG_INFO(0, offset32)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset32, 0, 0, 1)
- ZEND_ARG_INFO(0, offset16)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domstringextend
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend
-* Since:
-*/
-
-const zend_function_entry php_dom_string_extend_class_functions[] = {
- PHP_FALIAS(findOffset16, dom_string_extend_find_offset16, arginfo_dom_string_extend_find_offset16)
- PHP_FALIAS(findOffset32, dom_string_extend_find_offset32, arginfo_dom_string_extend_find_offset32)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto int dom_string_extend_find_offset16(int offset32);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16
-Since:
-*/
-PHP_FUNCTION(dom_string_extend_find_offset16)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_string_extend_find_offset16 */
-
-/* {{{ proto int dom_string_extend_find_offset32(int offset16);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32
-Since:
-*/
-PHP_FUNCTION(dom_string_extend_find_offset32)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_string_extend_find_offset32 */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt b/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
index a7766541d5..e57c3da913 100644
--- a/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
+++ b/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
@@ -19,5 +19,5 @@ var_dump($attr->ownerElement);
--EXPECTF--
Warning: Couldn't fetch DOMAttr. Node no longer exists in %s on line %d
-Notice: Undefined property: DOMAttr::$ownerElement in %s on line %d
+Warning: Undefined property: DOMAttr::$ownerElement in %s on line %d
NULL
diff --git a/ext/dom/tests/bug36756.phpt b/ext/dom/tests/bug36756.phpt
index 4e47b86e4b..ccf9ba5049 100644
--- a/ext/dom/tests/bug36756.phpt
+++ b/ext/dom/tests/bug36756.phpt
@@ -31,5 +31,5 @@ child
Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d
-Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
+Warning: Undefined property: DOMElement::$nodeType in %s on line %d
nodeType:
diff --git a/ext/dom/tests/bug47430.phpt b/ext/dom/tests/bug47430.phpt
index efce132a2e..7be332ecc1 100644
--- a/ext/dom/tests/bug47430.phpt
+++ b/ext/dom/tests/bug47430.phpt
@@ -11,7 +11,11 @@ $dom->loadXML($xml);
$elements = $dom->getElementsByTagName('i');
foreach ($elements as $i) {
- $i->previousSibling->nodeValue = '';
+ try {
+ $i->previousSibling->nodeValue = '';
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$arr = array();
@@ -20,10 +24,9 @@ $arr[0] = 'Value';
print_r($arr);
?>
---EXPECTF--
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
+--EXPECT--
+Attempt to assign property 'nodeValue' of non-object
+Attempt to assign property 'nodeValue' of non-object
Array
(
[0] => Value
diff --git a/ext/dom/tests/bug55700.phpt b/ext/dom/tests/bug55700.phpt
new file mode 100644
index 0000000000..9e00beb53e
--- /dev/null
+++ b/ext/dom/tests/bug55700.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #55700 (XPath namespace prefix conflict, global registerNodeNS flag)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+$doc->loadXML('<prefix:root xmlns:prefix="urn:a" />');
+
+$xp = new DOMXPath($doc, true);
+$xp->registerNamespace('prefix', 'urn:b');
+
+echo($xp->query('//prefix:root')->length . "\n");
+
+$xp = new DOMXPath($doc, false);
+$xp->registerNamespace('prefix', 'urn:b');
+
+echo($xp->query('//prefix:root')->length . "\n");
+
+var_dump($xp->registerNodeNamespaces);
+$xp->registerNodeNamespaces = true;
+
+var_dump($xp->registerNodeNamespaces);
+
+echo($xp->query('//prefix:root')->length . "\n");
+
+var_dump($xp);
+?>
+--EXPECT--
+1
+0
+bool(false)
+bool(true)
+1
+object(DOMXPath)#4 (2) {
+ ["document"]=>
+ string(22) "(object value omitted)"
+ ["registerNodeNamespaces"]=>
+ bool(true)
+}
diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt
index dd27352e6c..c49f0e4e0e 100644
--- a/ext/dom/tests/bug67949.phpt
+++ b/ext/dom/tests/bug67949.phpt
@@ -42,7 +42,11 @@ var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent);
var_dump($offset);
echo "testing read_dimension with null offset\n";
-var_dump($nodes[][] = 1);
+try {
+ var_dump($nodes[][] = 1);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "testing attribute access\n";
$anchor = $doc->getElementsByTagName('a')[0];
@@ -58,7 +62,7 @@ bool(false)
testing property access
string(4) "data"
-Notice: Trying to get property 'textContent' of non-object in %s on line %d
+Warning: Trying to get property 'textContent' of non-object in %s on line %d
NULL
testing offset not a long
array(1) {
@@ -66,7 +70,7 @@ array(1) {
string(4) "test"
}
-Notice: Trying to get property 'textContent' of non-object in %s on line %d
+Warning: Trying to get property 'textContent' of non-object in %s on line %d
bool(false)
NULL
array(1) {
@@ -82,7 +86,7 @@ bool(true)
string(4) "data"
string(4) "test"
testing read_dimension with null offset
-NULL
+Cannot access node list without offset
testing attribute access
string(4) "href"
==DONE==
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 168d06d8f4..bd4e29a208 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.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, |
@@ -34,10 +32,6 @@ ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_is_whitespace_in_element_content, 0, 0, 0)
ZEND_END_ARG_INFO();
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_replace_whole_text, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO();
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_construct, 0, 0, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
@@ -54,7 +48,6 @@ const zend_function_entry php_dom_text_class_functions[] = {
PHP_FALIAS(splitText, dom_text_split_text, arginfo_dom_text_split_text)
PHP_FALIAS(isWhitespaceInElementContent, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
PHP_FALIAS(isElementContentWhitespace, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
- PHP_FALIAS(replaceWholeText, dom_text_replace_whole_text, arginfo_dom_text_replace_whole_text)
PHP_ME(domtext, __construct, arginfo_dom_text_construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -215,14 +208,4 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
}
/* }}} end dom_text_is_whitespace_in_element_content */
-/* {{{ proto DOMText dom_text_replace_whole_text(string content)
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_text_replace_whole_text)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_text_replace_whole_text */
-
#endif
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
deleted file mode 100644
index 2d918c2007..0000000000
--- a/ext/dom/typeinfo.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domtypeinfo
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_typeinfo_class_functions[] = {
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ type_name string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeName
-Since:
-*/
-int dom_typeinfo_type_name_read(dom_object *obj, zval *retval)
-{
- ZVAL_NULL(retval);
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ type_namespace string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeNamespace
-Since:
-*/
-int dom_typeinfo_type_namespace_read(dom_object *obj, zval *retval)
-{
- ZVAL_NULL(retval);
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index 6f51fecace..d239b85b63 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.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/ext/dom/xpath.c b/ext/dom/xpath.c
index 69fdcb947f..5582831698 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.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, |
@@ -37,6 +35,7 @@
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_construct, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
+ ZEND_ARG_INFO(0, registerNodeNS)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_register_ns, 0, 0, 2)
@@ -251,12 +250,13 @@ static void dom_xpath_ext_function_object_php(xmlXPathParserContextPtr ctxt, int
PHP_METHOD(domxpath, __construct)
{
zval *doc;
+ zend_bool register_node_ns = 1;
xmlDocPtr docp = NULL;
dom_object *docobj;
dom_xpath_object *intern;
xmlXPathContextPtr ctx, oldctx;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &doc, dom_document_class_entry) == FAILURE) {
+ if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O|b", &doc, dom_document_class_entry, &register_node_ns) == FAILURE) {
return;
}
@@ -286,6 +286,7 @@ PHP_METHOD(domxpath, __construct)
intern->dom.ptr = ctx;
ctx->userData = (void *)intern;
intern->dom.document = docobj->document;
+ intern->register_node_ns = register_node_ns;
php_libxml_increment_doc_ref((php_libxml_node_object *) &intern->dom, docp);
}
}
@@ -306,6 +307,26 @@ int dom_xpath_document_read(dom_object *obj, zval *retval)
}
/* }}} */
+/* {{{ registerNodeNamespaces bool*/
+static inline dom_xpath_object *php_xpath_obj_from_dom_obj(dom_object *obj) {
+ return (dom_xpath_object*)((char*)(obj) - XtOffsetOf(dom_xpath_object, dom));
+}
+
+int dom_xpath_register_node_ns_read(dom_object *obj, zval *retval)
+{
+ ZVAL_BOOL(retval, php_xpath_obj_from_dom_obj(obj)->register_node_ns);
+
+ return SUCCESS;
+}
+
+int dom_xpath_register_node_ns_write(dom_object *obj, zval *newval)
+{
+ php_xpath_obj_from_dom_obj(obj)->register_node_ns = zend_is_true(newval);
+
+ return SUCCESS;
+}
+/* }}} */
+
/* {{{ proto bool dom_xpath_register_ns(string prefix, string uri) */
PHP_FUNCTION(dom_xpath_register_ns)
{
@@ -329,7 +350,7 @@ PHP_FUNCTION(dom_xpath_register_ns)
}
if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) {
- RETURN_FALSE
+ RETURN_FALSE;
}
RETURN_TRUE;
}
@@ -356,15 +377,16 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
char *expr;
xmlDoc *docp = NULL;
xmlNsPtr *ns = NULL;
- zend_bool register_node_ns = 1;
+ zend_bool register_node_ns;
id = ZEND_THIS;
+ intern = Z_XPATHOBJ_P(id);
+ register_node_ns = intern->register_node_ns;
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|O!b", &expr, &expr_len, &context, dom_node_class_entry, &register_node_ns) == FAILURE) {
return;
}
- intern = Z_XPATHOBJ_P(id);
-
ctxp = (xmlXPathContextPtr) intern->dom.ptr;
if (ctxp == NULL) {
php_error_docref(NULL, E_WARNING, "Invalid XPath Context");
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 1bbbe2e453..06566ce2df 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
@@ -26,6 +24,7 @@
#include "ext/standard/info.h"
#include <enchant.h>
#include "php_enchant.h"
+#include "enchant_arginfo.h"
typedef EnchantBroker * EnchantBrokerPtr;
typedef struct _broker_struct enchant_broker;
@@ -59,63 +58,6 @@ static int le_enchant_dict;
#define PHP_ENCHANT_MYSPELL 1
#define PHP_ENCHANT_ISPELL 2
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_enchant_broker_init, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_free, 0, 0, 1)
- ZEND_ARG_INFO(0, broker)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_set_dict_path, 0, 0, 3)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_get_dict_path, 0, 0, 2)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_dict, 0, 0, 2)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, tag)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_pwl_dict, 0, 0, 2)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_free_dict, 0, 0, 1)
- ZEND_ARG_INFO(0, dict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_set_ordering, 0, 0, 3)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, tag)
- ZEND_ARG_INFO(0, ordering)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_quick_check, 0, 0, 2)
- ZEND_ARG_INFO(0, dict)
- ZEND_ARG_INFO(0, word)
- ZEND_ARG_INFO(1, suggestions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_check, 0, 0, 2)
- ZEND_ARG_INFO(0, dict)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_store_replacement, 0, 0, 3)
- ZEND_ARG_INFO(0, dict)
- ZEND_ARG_INFO(0, mis)
- ZEND_ARG_INFO(0, cor)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ enchant_functions[]
*
* Every user visible function must have an entry in enchant_functions[].
@@ -123,24 +65,24 @@ ZEND_END_ARG_INFO()
static const zend_function_entry enchant_functions[] = {
PHP_FE(enchant_broker_init, arginfo_enchant_broker_init)
PHP_FE(enchant_broker_free, arginfo_enchant_broker_free)
- PHP_FE(enchant_broker_get_error, arginfo_enchant_broker_free)
+ PHP_FE(enchant_broker_get_error, arginfo_enchant_broker_get_error)
PHP_FE(enchant_broker_set_dict_path, arginfo_enchant_broker_set_dict_path)
PHP_FE(enchant_broker_get_dict_path, arginfo_enchant_broker_get_dict_path)
- PHP_FE(enchant_broker_list_dicts, arginfo_enchant_broker_free)
+ PHP_FE(enchant_broker_list_dicts, arginfo_enchant_broker_list_dicts)
PHP_FE(enchant_broker_request_dict, arginfo_enchant_broker_request_dict)
PHP_FE(enchant_broker_request_pwl_dict, arginfo_enchant_broker_request_pwl_dict)
PHP_FE(enchant_broker_free_dict, arginfo_enchant_broker_free_dict)
- PHP_FE(enchant_broker_dict_exists, arginfo_enchant_broker_request_dict)
+ PHP_FE(enchant_broker_dict_exists, arginfo_enchant_broker_dict_exists)
PHP_FE(enchant_broker_set_ordering, arginfo_enchant_broker_set_ordering)
- PHP_FE(enchant_broker_describe, arginfo_enchant_broker_free)
+ PHP_FE(enchant_broker_describe, arginfo_enchant_broker_describe)
PHP_FE(enchant_dict_check, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_suggest, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_add_to_personal, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_add_to_session, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_is_in_session, arginfo_enchant_dict_check)
+ PHP_FE(enchant_dict_suggest, arginfo_enchant_dict_suggest)
+ PHP_FE(enchant_dict_add_to_personal, arginfo_enchant_dict_add_to_personal)
+ PHP_FE(enchant_dict_add_to_session, arginfo_enchant_dict_add_to_session)
+ PHP_FE(enchant_dict_is_in_session, arginfo_enchant_dict_is_in_session)
PHP_FE(enchant_dict_store_replacement, arginfo_enchant_dict_store_replacement)
- PHP_FE(enchant_dict_get_error, arginfo_enchant_broker_free_dict)
- PHP_FE(enchant_dict_describe, arginfo_enchant_broker_free_dict)
+ PHP_FE(enchant_dict_get_error, arginfo_enchant_dict_get_error)
+ PHP_FE(enchant_dict_describe, arginfo_enchant_dict_describe)
PHP_FE(enchant_dict_quick_check, arginfo_enchant_dict_quick_check)
PHP_FE_END
};
@@ -377,7 +319,7 @@ PHP_FUNCTION(enchant_broker_free)
enchant_broker *pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -395,7 +337,7 @@ PHP_FUNCTION(enchant_broker_get_error)
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -420,7 +362,7 @@ PHP_FUNCTION(enchant_broker_set_dict_path)
size_t value_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls", &broker, &dict_type, &value, &value_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (!value_len) {
@@ -459,7 +401,7 @@ PHP_FUNCTION(enchant_broker_get_dict_path)
char *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &broker, &dict_type) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -514,7 +456,7 @@ PHP_FUNCTION(enchant_broker_list_dicts)
enchant_broker *pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -537,7 +479,7 @@ PHP_FUNCTION(enchant_broker_request_dict)
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &broker, &tag, &taglen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -585,7 +527,7 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict)
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp", &broker, &pwl, &pwllen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (php_check_open_basedir(pwl)) {
@@ -627,7 +569,7 @@ PHP_FUNCTION(enchant_broker_free_dict)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &dict) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -647,7 +589,7 @@ PHP_FUNCTION(enchant_broker_dict_exists)
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &broker, &tag, &taglen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -673,7 +615,7 @@ PHP_FUNCTION(enchant_broker_set_ordering)
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -692,7 +634,7 @@ PHP_FUNCTION(enchant_broker_describe)
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_BROKER;
@@ -712,7 +654,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|z", &dict, &word, &wordlen, &sugg) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (sugg) {
@@ -760,7 +702,7 @@ PHP_FUNCTION(enchant_dict_check)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -782,7 +724,7 @@ PHP_FUNCTION(enchant_dict_suggest)
size_t n_sugg_st;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -812,7 +754,7 @@ PHP_FUNCTION(enchant_dict_add_to_personal)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -831,7 +773,7 @@ PHP_FUNCTION(enchant_dict_add_to_session)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -850,7 +792,7 @@ PHP_FUNCTION(enchant_dict_is_in_session)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -873,7 +815,7 @@ PHP_FUNCTION(enchant_dict_store_replacement)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -891,7 +833,7 @@ PHP_FUNCTION(enchant_dict_get_error)
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &dict) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
@@ -913,7 +855,7 @@ PHP_FUNCTION(enchant_dict_describe)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &dict) == FAILURE) {
- RETURN_FALSE;
+ return;
}
PHP_ENCHANT_GET_DICT;
diff --git a/ext/enchant/enchant.stub.php b/ext/enchant/enchant.stub.php
new file mode 100644
index 0000000000..71f0e81715
--- /dev/null
+++ b/ext/enchant/enchant.stub.php
@@ -0,0 +1,79 @@
+<?php
+
+/** @return resource|false */
+function enchant_broker_init() {}
+
+/** @param resource $broker */
+function enchant_broker_free($broker): bool {}
+
+/**
+* @param resource $broker
+* @return string|false
+*/
+function enchant_broker_get_error($broker) {}
+
+/** @param resource $broker */
+function enchant_broker_set_dict_path($broker, int $name, string $value): bool {}
+
+/**
+ * @param resource $broker
+ * @return string|false
+ */
+function enchant_broker_get_dict_path($broker, int $name) {}
+
+/** @param resource $broker */
+function enchant_broker_list_dicts($broker): array {}
+
+/**
+ * @param resource $broker
+ * @return resource|false
+ */
+function enchant_broker_request_dict($broker, string $tag) {}
+
+/**
+ * @param resource $broker
+ * @return resource|false
+ */
+function enchant_broker_request_pwl_dict($broker, string $filename) {}
+
+/** @param resource $dict */
+function enchant_broker_free_dict($dict): bool {}
+
+/** @param resource $broker */
+function enchant_broker_dict_exists($broker, string $tag): bool {}
+
+/** @param resource $broker */
+function enchant_broker_set_ordering($broker, string $tag, string $ordering): bool {}
+
+/** @param resource $broker */
+function enchant_broker_describe($broker): array {}
+
+/** @param resource $dict */
+function enchant_dict_quick_check($dict, string $word, &$suggestions = UNKNOWN): bool {}
+
+/** @param resource $dict */
+function enchant_dict_check($dict, string $word): bool {}
+
+/** @param resource $dict */
+function enchant_dict_suggest($dict, string $word): ?array {}
+
+/** @param resource $dict */
+function enchant_dict_add_to_personal($dict, string $word): void {}
+
+/** @param resource $dict */
+function enchant_dict_add_to_session($dict, string $word): void {}
+
+/** @param resource $dict */
+function enchant_dict_is_in_session($dict, string $word): bool {}
+
+/** @param resource $dict */
+function enchant_dict_store_replacement($dict, string $mis, string $cor): void {}
+
+/**
+* @param resource $dict
+* @return string|false
+*/
+function enchant_dict_get_error($dict) {}
+
+/** @param resource $dict */
+function enchant_dict_describe($dict): array {}
diff --git a/ext/enchant/enchant_arginfo.h b/ext/enchant/enchant_arginfo.h
new file mode 100644
index 0000000000..488567651c
--- /dev/null
+++ b/ext/enchant/enchant_arginfo.h
@@ -0,0 +1,93 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_init, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_free, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_get_error, 0, 0, 1)
+ ZEND_ARG_INFO(0, broker)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_set_dict_path, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_get_dict_path, 0, 0, 2)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_list_dicts, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, broker)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_dict, 0, 0, 2)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_pwl_dict, 0, 0, 2)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_free_dict, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, dict)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_dict_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_set_ordering, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ordering, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_enchant_broker_describe arginfo_enchant_broker_list_dicts
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_quick_check, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ ZEND_ARG_INFO(1, suggestions)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_check, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_suggest, 0, 2, IS_ARRAY, 1)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_add_to_personal, 0, 2, IS_VOID, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_enchant_dict_add_to_session arginfo_enchant_dict_add_to_personal
+
+#define arginfo_enchant_dict_is_in_session arginfo_enchant_dict_check
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_store_replacement, 0, 3, IS_VOID, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, mis, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cor, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_get_error, 0, 0, 1)
+ ZEND_ARG_INFO(0, dict)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_describe, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, dict)
+ZEND_END_ARG_INFO()
diff --git a/ext/enchant/php_enchant.h b/ext/enchant/php_enchant.h
index 9ba21094a8..02578b4596 100644
--- a/ext/enchant/php_enchant.h
+++ b/ext/enchant/php_enchant.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/enchant/tests/broker_dict_exists.phpt b/ext/enchant/tests/broker_dict_exists.phpt
index 4ea4fd610e..3033c10e57 100644
--- a/ext/enchant/tests/broker_dict_exists.phpt
+++ b/ext/enchant/tests/broker_dict_exists.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_free_02.phpt b/ext/enchant/tests/broker_free_02.phpt
index 75ce5cb8ac..1b31c1fc37 100644
--- a/ext/enchant/tests/broker_free_02.phpt
+++ b/ext/enchant/tests/broker_free_02.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if(!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_free_dict.phpt b/ext/enchant/tests/broker_free_dict.phpt
index 0e18ae7cc6..f8523e5cf7 100644
--- a/ext/enchant/tests/broker_free_dict.phpt
+++ b/ext/enchant/tests/broker_free_dict.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if(!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_request_dict.phpt b/ext/enchant/tests/broker_request_dict.phpt
index 3cf952f869..2aa27c52b7 100644
--- a/ext/enchant/tests/broker_request_dict.phpt
+++ b/ext/enchant/tests/broker_request_dict.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_request_dict_01.phpt b/ext/enchant/tests/broker_request_dict_01.phpt
index 49deeaaf30..2c2905c959 100644
--- a/ext/enchant/tests/broker_request_dict_01.phpt
+++ b/ext/enchant/tests/broker_request_dict_01.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_set_ordering.phpt b/ext/enchant/tests/broker_set_ordering.phpt
index c3cb2072c9..56ed30bab8 100644
--- a/ext/enchant/tests/broker_set_ordering.phpt
+++ b/ext/enchant/tests/broker_set_ordering.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_add_to_personal.phpt b/ext/enchant/tests/dict_add_to_personal.phpt
index e711a25f45..9afcab0cfa 100644
--- a/ext/enchant/tests/dict_add_to_personal.phpt
+++ b/ext/enchant/tests/dict_add_to_personal.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_add_to_session.phpt b/ext/enchant/tests/dict_add_to_session.phpt
index 441d2dde74..49c4769fb5 100644
--- a/ext/enchant/tests/dict_add_to_session.phpt
+++ b/ext/enchant/tests/dict_add_to_session.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_check.phpt b/ext/enchant/tests/dict_check.phpt
index eb4198c4cf..283dfa4707 100644
--- a/ext/enchant/tests/dict_check.phpt
+++ b/ext/enchant/tests/dict_check.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_describe.phpt b/ext/enchant/tests/dict_describe.phpt
index 18cdbfe379..d63cfae178 100644
--- a/ext/enchant/tests/dict_describe.phpt
+++ b/ext/enchant/tests/dict_describe.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_get_error.phpt b/ext/enchant/tests/dict_get_error.phpt
index 271214a786..340dcdd89a 100644
--- a/ext/enchant/tests/dict_get_error.phpt
+++ b/ext/enchant/tests/dict_get_error.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_is_in_session.phpt b/ext/enchant/tests/dict_is_in_session.phpt
index 4e670d5512..12771e552e 100644
--- a/ext/enchant/tests/dict_is_in_session.phpt
+++ b/ext/enchant/tests/dict_is_in_session.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_quick_check.phpt b/ext/enchant/tests/dict_quick_check.phpt
index 15eb2aec38..a7196b659d 100644
--- a/ext/enchant/tests/dict_quick_check.phpt
+++ b/ext/enchant/tests/dict_quick_check.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
$tag = 'en_US';
$r = enchant_broker_init();
diff --git a/ext/enchant/tests/dict_quick_check_01.phpt b/ext/enchant/tests/dict_quick_check_01.phpt
index a4dd818111..b4f9b72342 100644
--- a/ext/enchant/tests/dict_quick_check_01.phpt
+++ b/ext/enchant/tests/dict_quick_check_01.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_store_replacement.phpt b/ext/enchant/tests/dict_store_replacement.phpt
index 8ecd7b06a0..eb01dcbc57 100644
--- a/ext/enchant/tests/dict_store_replacement.phpt
+++ b/ext/enchant/tests/dict_store_replacement.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_suggest.phpt b/ext/enchant/tests/dict_suggest.phpt
index 85aa823579..1ba7decbb5 100644
--- a/ext/enchant/tests/dict_suggest.phpt
+++ b/ext/enchant/tests/dict_suggest.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/enchant_broker_set_dict_path.phpt b/ext/enchant/tests/enchant_broker_set_dict_path.phpt
index db35288a42..9c21a86336 100644
--- a/ext/enchant/tests/enchant_broker_set_dict_path.phpt
+++ b/ext/enchant/tests/enchant_broker_set_dict_path.phpt
@@ -7,7 +7,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index f48a24e8ab..418e658bf7 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.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, |
@@ -42,6 +40,7 @@
#endif
#include "php_exif.h"
+#include "exif_arginfo.h"
#include <math.h>
#include "php_ini.h"
#include "ext/standard/php_string.h"
@@ -66,36 +65,10 @@ typedef unsigned char uchar;
#define MAX_IFD_NESTING_LEVEL 150
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_read_data, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, sections_needed)
- ZEND_ARG_INFO(0, sub_arrays)
- ZEND_ARG_INFO(0, read_thumbnail)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_thumbnail, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(1, width)
- ZEND_ARG_INFO(1, height)
- ZEND_ARG_INFO(1, imagetype)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_exif_imagetype, 0)
- ZEND_ARG_INFO(0, imagefile)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ exif_functions[]
*/
static const zend_function_entry exif_functions[] = {
PHP_FE(exif_read_data, arginfo_exif_read_data)
- PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data)
PHP_FE(exif_tagname, arginfo_exif_tagname)
PHP_FE(exif_thumbnail, arginfo_exif_thumbnail)
PHP_FE(exif_imagetype, arginfo_exif_imagetype)
@@ -4455,7 +4428,7 @@ PHP_FUNCTION(exif_read_data)
ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_ZVAL(stream)
Z_PARAM_OPTIONAL
- Z_PARAM_STR(z_sections_needed)
+ Z_PARAM_STR_EX(z_sections_needed, 1, 0)
Z_PARAM_BOOL(sub_arrays)
Z_PARAM_BOOL(read_thumbnail)
ZEND_PARSE_PARAMETERS_END();
@@ -4745,7 +4718,7 @@ PHP_FUNCTION(exif_imagetype)
RETURN_FALSE;
}
- itype = php_getimagetype(stream, NULL);
+ itype = php_getimagetype(stream, imagefile, NULL);
php_stream_close(stream);
diff --git a/ext/exif/exif.stub.php b/ext/exif/exif.stub.php
new file mode 100644
index 0000000000..a878c3c3ff
--- /dev/null
+++ b/ext/exif/exif.stub.php
@@ -0,0 +1,13 @@
+<?php
+
+/** @return string|false */
+function exif_tagname(int $index) {}
+
+/** @return array|false */
+function exif_read_data($filename, ?string $sections_needed = null, bool $sub_arrays = false, bool $read_thumbnail = false) {}
+
+/** @return string|false */
+function exif_thumbnail($filename, &$width = null, &$height = null, &$imagetype = null) {}
+
+/** @return int|false */
+function exif_imagetype(string $filename) {}
diff --git a/ext/exif/exif_arginfo.h b/ext/exif/exif_arginfo.h
new file mode 100644
index 0000000000..2e449deae1
--- /dev/null
+++ b/ext/exif/exif_arginfo.h
@@ -0,0 +1,23 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_tagname, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_read_data, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ ZEND_ARG_TYPE_INFO(0, sections_needed, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, sub_arrays, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, read_thumbnail, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_thumbnail, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ ZEND_ARG_INFO(1, width)
+ ZEND_ARG_INFO(1, height)
+ ZEND_ARG_INFO(1, imagetype)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_imagetype, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h
index 03f4abca84..8cbf70fef3 100644
--- a/ext/exif/php_exif.h
+++ b/ext/exif/php_exif.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/ext/exif/tests/exif_imagetype_error.phpt b/ext/exif/tests/exif_imagetype_error.phpt
index 80538a0f68..765f01d1ea 100644
--- a/ext/exif/tests/exif_imagetype_error.phpt
+++ b/ext/exif/tests/exif_imagetype_error.phpt
@@ -12,13 +12,6 @@ Test exif_imagetype() function : error conditions
echo "*** Testing exif_imagetype() : error conditions ***\n";
-echo "\n-- Testing exif_imagetype() function with no arguments --\n";
-var_dump( exif_imagetype() );
-
-echo "\n-- Testing exif_imagetype() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( exif_imagetype(__DIR__.'/test2.jpg', $extra_arg) );
-
echo "\n-- Testing exif_imagetype() function with an unknown file --\n";
var_dump( exif_imagetype(__DIR__.'/foo.jpg') );
@@ -28,16 +21,6 @@ var_dump( exif_imagetype(__DIR__.'/foo.jpg') );
--EXPECTF--
*** Testing exif_imagetype() : error conditions ***
--- Testing exif_imagetype() function with no arguments --
-
-Warning: exif_imagetype() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing exif_imagetype() function with more than expected no. of arguments --
-
-Warning: exif_imagetype() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-- Testing exif_imagetype() function with an unknown file --
Warning: exif_imagetype(%s/foo.jpg): failed to open stream: No such file or directory in %s on line %d
diff --git a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
deleted file mode 100644
index 70e9ab0401..0000000000
--- a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-Check for read_exif_data default behaviour
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-
-/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] )
- * Description: Alias of exif_read_data()
- * Source code: ext/exif/exif.c
-*/
-echo "*** Testing read_exif_data() : basic functionality ***\n";
-
-print_r(read_exif_data(__DIR__.'/test2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg'));
-?>
-===Done===
---EXPECTF--
-*** Testing read_exif_data() : basic functionality ***
-
-Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic-mb.php on line 9
-Array
-(
- [FileName] => test2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg
- [FileDateTime] => %d
- [FileSize] => 1240
- [FileType] => 2
- [MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT
- [COMPUTED] => Array
- (
- [html] => width="1" height="1"
- [Height] => 1
- [Width] => 1
- [IsColor] => 1
- [ByteOrderMotorola] => 1
- [UserComment] => Exif test image.
- [UserCommentEncoding] => ASCII
- [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger.
- [Copyright.Photographer] => Photo (c) M.Boerger
- [Copyright.Editor] => Edited by M.Boerger.
- [Thumbnail.FileType] => 2
- [Thumbnail.MimeType] => image/jpeg
- )
-
- [Copyright] => Photo (c) M.Boerger
- [UserComment] => ASCII
- [THUMBNAIL] => Array
- (
- [JPEGInterchangeFormat] => 134
- [JPEGInterchangeFormatLength] => 523
- )
-
- [COMMENT] => Array
- (
- [0] => Comment #1.
- [1] => Comment #2.
- [2] => Comment #3end
- )
-
-)
-===Done===
diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt
deleted file mode 100644
index 254cd1a164..0000000000
--- a/ext/exif/tests/exif_read_exif_data_basic.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-Check for read_exif_data default behaviour
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-
-/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] )
- * Description: Alias of exif_read_data()
- * Source code: ext/exif/exif.c
-*/
-echo "*** Testing read_exif_data() : basic functionality ***\n";
-
-print_r(read_exif_data(__DIR__.'/test2.jpg'));
-?>
-===Done===
---EXPECTF--
-*** Testing read_exif_data() : basic functionality ***
-
-Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic.php on line 9
-Array
-(
- [FileName] => test2.jpg
- [FileDateTime] => %d
- [FileSize] => 1240
- [FileType] => 2
- [MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT
- [COMPUTED] => Array
- (
- [html] => width="1" height="1"
- [Height] => 1
- [Width] => 1
- [IsColor] => 1
- [ByteOrderMotorola] => 1
- [UserComment] => Exif test image.
- [UserCommentEncoding] => ASCII
- [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger.
- [Copyright.Photographer] => Photo (c) M.Boerger
- [Copyright.Editor] => Edited by M.Boerger.
- [Thumbnail.FileType] => 2
- [Thumbnail.MimeType] => image/jpeg
- )
-
- [Copyright] => Photo (c) M.Boerger
- [UserComment] => ASCII
- [THUMBNAIL] => Array
- (
- [JPEGInterchangeFormat] => 134
- [JPEGInterchangeFormatLength] => 523
- )
-
- [COMMENT] => Array
- (
- [0] => Comment #1.
- [1] => Comment #2.
- [2] => Comment #3end
- )
-
-)
-===Done===
diff --git a/ext/ext_skel.php b/ext/ext_skel.php
index 5f45ed5146..f5cd415ce8 100755
--- a/ext/ext_skel.php
+++ b/ext/ext_skel.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -264,8 +262,6 @@ function process_source_tags($file, $short_name) {
$header = <<<"HEADER"
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index ca6e7c4ef5..0968764459 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.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, |
@@ -28,6 +26,7 @@
#include "zend_interfaces.h"
#include "zend_closures.h"
#include "main/SAPI.h"
+#include "ffi_arginfo.h"
#include <ffi.h>
@@ -971,9 +970,9 @@ static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value) /* {{{ *
/* }}} */
#endif
-static zval *zend_ffi_cdata_get(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_get(zend_object *obj, zend_string *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
#if 0
@@ -983,8 +982,7 @@ static zval *zend_ffi_cdata_get(zval *object, zval *member, int read_type, void
}
#endif
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)
- || UNEXPECTED(!zend_string_equals_literal(Z_STR_P(member), "cdata"))) {
+ if (UNEXPECTED(!zend_string_equals_literal(member, "cdata"))) {
zend_throw_error(zend_ffi_exception_ce, "only 'cdata' property may be read");
return &EG(uninitialized_zval);;
}
@@ -994,9 +992,9 @@ static zval *zend_ffi_cdata_get(zval *object, zval *member, int read_type, void
}
/* }}} */
-static zval *zend_ffi_cdata_set(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_cdata_set(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
#if 0
@@ -1006,8 +1004,7 @@ static zval *zend_ffi_cdata_set(zval *object, zval *member, zval *value, void **
}
#endif
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)
- || UNEXPECTED(!zend_string_equals_literal(Z_STR_P(member), "cdata"))) {
+ if (UNEXPECTED(!zend_string_equals_literal(member, "cdata"))) {
zend_throw_error(zend_ffi_exception_ce, "only 'cdata' property may be set");
return &EG(uninitialized_zval);;
}
@@ -1018,10 +1015,10 @@ static zval *zend_ffi_cdata_set(zval *object, zval *member, zval *value, void **
}
/* }}} */
-static int zend_ffi_cdata_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
+static int zend_ffi_cdata_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
if (type == IS_STRING) {
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(readobj);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)readobj;
zend_ffi_type *ctype = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_type_kind kind = ctype->kind;
@@ -1092,9 +1089,9 @@ again:
}
/* }}} */
-static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_read_field(zend_object *obj, zend_string *field_name, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_field *field;
@@ -1102,28 +1099,22 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
if (cache_slot && *cache_slot == type) {
field = *(cache_slot + 1);
} else {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
-
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
if (type->kind == ZEND_FFI_TYPE_POINTER) {
/* transparently dereference the pointer */
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
ptr = (void*)(*(char**)ptr);
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
type = ZEND_FFI_TYPE(type->pointer.type);
}
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read field '%s' of non C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
}
@@ -1131,12 +1122,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
field = zend_hash_find_ptr(&type->record.fields, field_name);
if (UNEXPECTED(!field)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined field '%s' of C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
- zend_tmp_string_release(tmp_field_name);
-
if (cache_slot) {
*cache_slot = type;
*(cache_slot + 1) = field;
@@ -1170,9 +1158,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
}
/* }}} */
-static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_cdata_write_field(zend_object *obj, zend_string *field_name, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_field *field;
@@ -1180,28 +1168,22 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
if (cache_slot && *cache_slot == type) {
field = *(cache_slot + 1);
} else {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
-
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
if (type->kind == ZEND_FFI_TYPE_POINTER) {
/* transparently dereference the pointer */
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return value;
}
ptr = (void*)(*(char**)ptr);
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return value;
}
type = ZEND_FFI_TYPE(type->pointer.type);
}
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign field '%s' of non C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
}
@@ -1209,12 +1191,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
field = zend_hash_find_ptr(&type->record.fields, field_name);
if (UNEXPECTED(!field)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined field '%s' of C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
- zend_tmp_string_release(tmp_field_name);
-
if (cache_slot) {
*cache_slot = type;
*(cache_slot + 1) = field;
@@ -1232,10 +1211,7 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only location");
return value;
} else if (UNEXPECTED(field->is_const)) {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only field '%s'", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
@@ -1249,9 +1225,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
}
/* }}} */
-static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_read_dim(zend_object *obj, zval *offset, int read_type, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_long dim = zval_get_long(offset);
zend_ffi_type *dim_type;
@@ -1307,9 +1283,9 @@ static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type,
}
/* }}} */
-static void zend_ffi_cdata_write_dim(zval *object, zval *offset, zval *value) /* {{{ */
+static void zend_ffi_cdata_write_dim(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_long dim;
void *ptr;
@@ -1662,9 +1638,9 @@ static int zend_ffi_cdata_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-static int zend_ffi_cdata_count_elements(zval *object, zend_long *count) /* {{{ */
+static int zend_ffi_cdata_count_elements(zend_object *obj, zend_long *count) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
if (type->kind != ZEND_FFI_TYPE_ARRAY) {
@@ -1915,9 +1891,9 @@ static zend_object_iterator *zend_ffi_cdata_get_iterator(zend_class_entry *ce, z
}
/* }}} */
-static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
HashTable *ht = NULL;
@@ -2014,23 +1990,29 @@ static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {
}
/* }}} */
-static int zend_ffi_cdata_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+static int zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(obj);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_function *func;
if (type->kind != ZEND_FFI_TYPE_POINTER) {
- zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ if (!check_only) {
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ }
return FAILURE;
}
type = ZEND_FFI_TYPE(type->pointer.type);
if (type->kind != ZEND_FFI_TYPE_FUNC) {
- zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ if (!check_only) {
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ }
return FAILURE;
}
if (!cdata->ptr) {
- zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
+ if (!check_only) {
+ zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
+ }
return FAILURE;
}
@@ -2146,7 +2128,7 @@ static int zend_ffi_ctype_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-static HashTable *zend_ffi_ctype_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return NULL;
}
@@ -2322,9 +2304,9 @@ static void zend_ffi_cdata_free_obj(zend_object *object) /* {{{ */
}
/* }}} */
-static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */
+static zend_object *zend_ffi_cdata_clone_obj(zend_object *obj) /* {{{ */
{
- zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)Z_OBJ_P(zobject);
+ zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(old_cdata->type);
zend_ffi_cdata *new_cdata;
@@ -2341,11 +2323,9 @@ static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */
}
/* }}} */
-static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object);
- zend_string *tmp_var_name;
- zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name);
+ zend_ffi *ffi = (zend_ffi*)obj;
zend_ffi_symbol *sym = NULL;
if (ffi->symbols) {
@@ -2356,12 +2336,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
}
if (!sym) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined C variable '%s'", ZSTR_VAL(var_name));
- zend_tmp_string_release(tmp_var_name);
return &EG(uninitialized_zval);
}
- zend_tmp_string_release(tmp_var_name);
-
if (sym->kind == ZEND_FFI_SYM_VAR) {
zend_ffi_cdata_to_zval(NULL, sym->addr, ZEND_FFI_TYPE(sym->type), read_type, rv, (zend_ffi_flags)sym->is_const, 0);
} else {
@@ -2372,11 +2349,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
}
/* }}} */
-static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_write_var(zend_object *obj, zend_string *var_name, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object);
- zend_string *tmp_var_name;
- zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name);
+ zend_ffi *ffi = (zend_ffi*)obj;
zend_ffi_symbol *sym = NULL;
if (ffi->symbols) {
@@ -2387,12 +2362,9 @@ static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **
}
if (!sym) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined C variable '%s'", ZSTR_VAL(var_name));
- zend_tmp_string_release(tmp_var_name);
return value;
}
- zend_tmp_string_release(tmp_var_name);
-
if (sym->is_const) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only C variable '%s'", ZSTR_VAL(var_name));
return value;
@@ -4418,104 +4390,24 @@ ZEND_METHOD(FFI, isNull) /* {{{ */
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_cdef, 0, 0, 0)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, lib)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_load, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_scope, 0, 0, 1)
- ZEND_ARG_INFO(0, scope_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_new, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, owned)
- ZEND_ARG_INFO(0, persistent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_free, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_cast, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_type, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_typeof, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_array, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, dims)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_addr, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_sizeof, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_alignof, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_memcpy, 0, 0, 3)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, dst)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, src)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_memcmp, 0, 0, 3)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr2)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_memset, 0, 0, 3)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_string, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_isnull, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_ffi_functions[] = {
- ZEND_ME(FFI, cdef, arginfo_func_cdef, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, load, arginfo_func_load, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, scope, arginfo_func_scope, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, new, arginfo_func_new, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, free, arginfo_func_free, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, cast, arginfo_func_cast, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, type, arginfo_func_type, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, typeof, arginfo_func_typeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, arrayType, arginfo_func_array, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, addr, arginfo_func_addr, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, sizeof, arginfo_func_sizeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, alignof, arginfo_func_alignof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, memcpy, arginfo_func_memcpy, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, memcmp, arginfo_func_memcmp, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, memset, arginfo_func_memset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, string, arginfo_func_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, isNull, arginfo_func_isnull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, cdef, arginfo_class_FFI_cdef, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, load, arginfo_class_FFI_load, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, scope, arginfo_class_FFI_scope, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, new, arginfo_class_FFI_new, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, free, arginfo_class_FFI_free, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, cast, arginfo_class_FFI_cast, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, type, arginfo_class_FFI_type, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, typeof, arginfo_class_FFI_typeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, arrayType, arginfo_class_FFI_arrayType, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, addr, arginfo_class_FFI_addr, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, sizeof, arginfo_class_FFI_sizeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, alignof, arginfo_class_FFI_alignof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, memcpy, arginfo_class_FFI_memcpy, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, memcmp, arginfo_class_FFI_memcmp, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, memset, arginfo_class_FFI_memset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, string, arginfo_class_FFI_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, isNull, arginfo_class_FFI_isNull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};
@@ -4641,33 +4533,29 @@ static ZEND_COLD zend_never_inline void zend_bad_array_access(zend_class_entry *
}
/* }}} */
-static ZEND_COLD zval *zend_fake_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_fake_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return NULL;
}
/* }}} */
-static ZEND_COLD void zend_fake_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static ZEND_COLD void zend_fake_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
-static ZEND_COLD int zend_fake_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static ZEND_COLD int zend_fake_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return 0;
}
/* }}} */
-static ZEND_COLD void zend_fake_unset_dimension(zval *object, zval *offset) /* {{{ */
+static ZEND_COLD void zend_fake_unset_dimension(zend_object *obj, zval *offset) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
@@ -4677,38 +4565,34 @@ static ZEND_COLD zend_never_inline void zend_bad_property_access(zend_class_entr
}
/* }}} */
-static ZEND_COLD zval *zend_fake_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_fake_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_property_access(ce);
+ zend_bad_property_access(obj->ce);
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_fake_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_fake_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return value;
}
/* }}} */
-static ZEND_COLD int zend_fake_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_fake_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return 0;
}
/* }}} */
-static ZEND_COLD void zend_fake_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static ZEND_COLD void zend_fake_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
-static zval *zend_fake_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *zend_fake_get_property_ptr_ptr(zend_object *obj, zend_string *member, int type, void **cache_slot) /* {{{ */
{
return NULL;
}
@@ -4722,13 +4606,13 @@ static ZEND_COLD zend_function *zend_fake_get_method(zend_object **obj_ptr, zend
}
/* }}} */
-static HashTable *zend_fake_get_properties(zval *object) /* {{{ */
+static HashTable *zend_fake_get_properties(zend_object *obj) /* {{{ */
{
return (HashTable*)&zend_empty_array;
}
/* }}} */
-static HashTable *zend_fake_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *zend_fake_get_gc(zend_object *ob, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
@@ -4742,74 +4626,67 @@ static ZEND_COLD zend_never_inline void zend_ffi_use_after_free(void) /* {{{ */
}
/* }}} */
-static zend_object *zend_ffi_free_clone_obj(zval *zobject) /* {{{ */
+static zend_object *zend_ffi_free_clone_obj(zend_object *obj) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static ZEND_COLD void zend_ffi_free_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static ZEND_COLD int zend_ffi_free_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static ZEND_COLD int zend_ffi_free_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */
{
zend_ffi_use_after_free();
return 0;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_unset_dimension(zval *object, zval *offset) /* {{{ */
+static ZEND_COLD void zend_ffi_free_unset_dimension(zend_object *obj, zval *offset) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
return value;
}
/* }}} */
-static ZEND_COLD int zend_ffi_free_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_ffi_free_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
return 0;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
-{
- zend_ffi_use_after_free();
-}
-/* }}} */
-
-static zval* zend_ffi_free_get(zval *object, zval *rv) /* {{{ */
+static ZEND_COLD void zend_ffi_free_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
- return NULL;
}
/* }}} */
-static HashTable *zend_ffi_free_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_free_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
@@ -4994,7 +4871,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_handlers.has_dimension = zend_fake_has_dimension;
zend_ffi_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_handlers.get_method = zend_ffi_get_func;
- zend_ffi_handlers.compare_objects = NULL;
+ zend_ffi_handlers.compare = NULL;
zend_ffi_handlers.cast_object = NULL;
zend_ffi_handlers.get_debug_info = NULL;
zend_ffi_handlers.get_closure = NULL;
@@ -5025,7 +4902,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_handlers.get_method = zend_fake_get_method;
zend_ffi_cdata_handlers.get_class_name = zend_ffi_cdata_get_class_name;
zend_ffi_cdata_handlers.do_operation = zend_ffi_cdata_do_operation;
- zend_ffi_cdata_handlers.compare_objects = zend_ffi_cdata_compare_objects;
+ zend_ffi_cdata_handlers.compare = zend_ffi_cdata_compare_objects;
zend_ffi_cdata_handlers.cast_object = zend_ffi_cdata_cast_object;
zend_ffi_cdata_handlers.count_elements = zend_ffi_cdata_count_elements;
zend_ffi_cdata_handlers.get_debug_info = zend_ffi_cdata_get_debug_info;
@@ -5048,7 +4925,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_value_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_cdata_value_handlers.get_method = zend_fake_get_method;
zend_ffi_cdata_value_handlers.get_class_name = zend_ffi_cdata_get_class_name;
- zend_ffi_cdata_value_handlers.compare_objects = zend_ffi_cdata_compare_objects;
+ zend_ffi_cdata_value_handlers.compare = zend_ffi_cdata_compare_objects;
zend_ffi_cdata_value_handlers.cast_object = zend_ffi_cdata_cast_object;
zend_ffi_cdata_value_handlers.count_elements = NULL;
zend_ffi_cdata_value_handlers.get_debug_info = zend_ffi_cdata_get_debug_info;
@@ -5065,14 +4942,13 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_free_handlers.read_dimension = zend_ffi_free_read_dimension;
zend_ffi_cdata_free_handlers.write_dimension = zend_ffi_free_write_dimension;
zend_ffi_cdata_free_handlers.get_property_ptr_ptr = zend_fake_get_property_ptr_ptr;
- zend_ffi_cdata_free_handlers.get = zend_ffi_free_get;
zend_ffi_cdata_free_handlers.has_property = zend_ffi_free_has_property;
zend_ffi_cdata_free_handlers.unset_property = zend_ffi_free_unset_property;
zend_ffi_cdata_free_handlers.has_dimension = zend_ffi_free_has_dimension;
zend_ffi_cdata_free_handlers.unset_dimension = zend_ffi_free_unset_dimension;
zend_ffi_cdata_free_handlers.get_method = zend_fake_get_method;
zend_ffi_cdata_free_handlers.get_class_name = zend_ffi_cdata_get_class_name;
- zend_ffi_cdata_free_handlers.compare_objects = zend_ffi_cdata_compare_objects;
+ zend_ffi_cdata_free_handlers.compare = zend_ffi_cdata_compare_objects;
zend_ffi_cdata_free_handlers.cast_object = NULL;
zend_ffi_cdata_free_handlers.count_elements = NULL;
zend_ffi_cdata_free_handlers.get_debug_info = zend_ffi_free_get_debug_info;
@@ -5102,7 +4978,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_ctype_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_ctype_handlers.get_method = zend_fake_get_method;
zend_ffi_ctype_handlers.get_class_name = zend_ffi_ctype_get_class_name;
- zend_ffi_ctype_handlers.compare_objects = zend_ffi_ctype_compare_objects;
+ zend_ffi_ctype_handlers.compare = zend_ffi_ctype_compare_objects;
zend_ffi_ctype_handlers.cast_object = NULL;
zend_ffi_ctype_handlers.count_elements = NULL;
zend_ffi_ctype_handlers.get_debug_info = zend_ffi_ctype_get_debug_info;
diff --git a/ext/ffi/ffi.g b/ext/ffi/ffi.g
index 4443fb4220..a153854d40 100644
--- a/ext/ffi/ffi.g
+++ b/ext/ffi/ffi.g
@@ -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, |
@@ -32,8 +30,6 @@ php llk.php ffi.g
%{
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php
new file mode 100644
index 0000000000..812217f990
--- /dev/null
+++ b/ext/ffi/ffi.stub.php
@@ -0,0 +1,96 @@
+<?php
+
+class FFI
+{
+ /** @return ?FFI */
+ static function cdef(string $code = UNKNOWN, string $lib = UNKNOWN) {}
+
+ /** @return ?FFI */
+ static function load(string $filename) {}
+
+ /** @return ?FFI */
+ static function scope(string $scope_name) {}
+
+ /**
+ * @param FFI\CType|string $type
+ * @return ?FFI\CData
+ */
+ static function new($type, bool $owned = true, bool $persistent = false) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return void
+ */
+ static function free(FFI\CData $ptr) {}
+
+ /**
+ * @param FFI\CType|string $type
+ * @prefer-ref $ptr
+ * @return ?FFI\CData
+ */
+ static function cast($type, $ptr) {}
+
+ /** @return ?FFI\CType */
+ static function type(string $type) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return FFI\CType
+ */
+ static function typeof(FFI\CData $ptr) {}
+
+ /** @return ?FFI\CType */
+ static function arrayType(FFI\CType $type, array $dims) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return FFI\CData
+ */
+ static function addr(FFI\CData $ptr) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return ?int
+ */
+ static function sizeof(object $ptr) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return ?int
+ */
+ static function alignof(object $ptr) {}
+
+ /**
+ * @prefer-ref $dst
+ * @prefer-ref $src
+ * @param string|FFI\CData $dst
+ * @return void
+ */
+ static function memcpy(FFI\CData $dst, $src, int $size) {}
+
+ /**
+ * @prefer-ref $ptr1
+ * @param string|FFI\CData $ptr1
+ * @prefer-ref $ptr2
+ * @param string|FFI\CData $ptr2
+ * @return ?int
+ */
+ static function memcmp($ptr1, $ptr2, int $size) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return void
+ */
+ static function memset(FFI\CData $ptr, int $ch, int $size) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return ?string
+ */
+ static function string(FFI\CData $ptr, int $size = UNKNOWN) {}
+
+ /**
+ * @prefer-ref $ptr
+ */
+ static function isNull(FFI\CData $ptr) {}
+}
diff --git a/ext/ffi/ffi_arginfo.h b/ext/ffi/ffi_arginfo.h
new file mode 100644
index 0000000000..48fc90c2cd
--- /dev/null
+++ b/ext/ffi/ffi_arginfo.h
@@ -0,0 +1,73 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_cdef, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, lib, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_load, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_scope, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, scope_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_new, 0, 0, 1)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_TYPE_INFO(0, owned, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, persistent, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_free, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_cast, 0, 0, 2)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_type, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_typeof arginfo_class_FFI_free
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_arrayType, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, type, FFI\\CType, 0)
+ ZEND_ARG_TYPE_INFO(0, dims, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_addr arginfo_class_FFI_free
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_sizeof, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, ptr, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_alignof arginfo_class_FFI_sizeof
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_memcpy, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, dst, FFI\\CData, 0)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, src)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_memcmp, 0, 0, 3)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr1)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr2)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_memset, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
+ ZEND_ARG_TYPE_INFO(0, ch, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_string, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_isNull arginfo_class_FFI_free
diff --git a/ext/ffi/ffi_parser.c b/ext/ffi/ffi_parser.c
index cb23b05b78..f87d1edf2e 100644
--- a/ext/ffi/ffi_parser.c
+++ b/ext/ffi/ffi_parser.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/ext/ffi/php_ffi.h b/ext/ffi/php_ffi.h
index b9f01d6e96..5cd949aa70 100644
--- a/ext/ffi/php_ffi.h
+++ b/ext/ffi/php_ffi.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/ext/ffi/tests/045.phpt b/ext/ffi/tests/045.phpt
index 7118df9eb7..8d4558e0d3 100644
--- a/ext/ffi/tests/045.phpt
+++ b/ext/ffi/tests/045.phpt
@@ -23,7 +23,5 @@ try {
--EXPECTF--
bool(true)
bool(false)
-
-Warning: FFI::isNull() expects parameter 1 to be FFI\CData, null given in %s045.php on line %d
-NULL
+TypeError: FFI::isNull() expects parameter 1 to be FFI\CData, null given
FFI\Exception: FFI\Cdata is not a pointer
diff --git a/ext/ffi/tests/200.phpt b/ext/ffi/tests/200.phpt
index dda77a03a0..fb041022ea 100644
--- a/ext/ffi/tests/200.phpt
+++ b/ext/ffi/tests/200.phpt
@@ -11,6 +11,7 @@ try {
?>
--INI--
ffi.enable=1
+opcache.jit=0
--FILE--
<?php
$zend = FFI::cdef("
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 8bb76b5657..48457e3168 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
@@ -34,6 +32,7 @@
#include "ext/standard/info.h"
#include "ext/standard/file.h" /* needed for context stuff */
#include "php_fileinfo.h"
+#include "fileinfo_arginfo.h"
#include "fopen_wrappers.h" /* needed for is_url */
#include "Zend/zend_exceptions.h"
@@ -108,63 +107,13 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_close, 0, 0, 1)
- ZEND_ARG_INFO(0, finfo)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_set_flags, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_set_flags, 0, 0, 1)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_file, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_buffer, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_buffer, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mime_content_type, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ finfo_class_functions
*/
static const zend_function_entry finfo_class_functions[] = {
- ZEND_ME_MAPPING(finfo, finfo_open, arginfo_finfo_open, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_finfo_method_set_flags, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(file, finfo_file, arginfo_finfo_method_file, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_finfo_method_buffer, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(__construct, finfo_open, arginfo_class_finfo___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(file, finfo_file, arginfo_class_finfo_file, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_class_finfo_buffer, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -292,9 +241,8 @@ PHP_FUNCTION(finfo_open)
FILEINFO_DECLARE_INIT_OBJECT(object)
char resolved_path[MAXPATHLEN];
zend_error_handling zeh;
- int flags = object ? ZEND_PARSE_PARAMS_THROW : 0;
- if (zend_parse_parameters_ex(flags, ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
RETURN_FALSE;
}
@@ -382,11 +330,11 @@ PHP_FUNCTION(finfo_close)
zval *zfinfo;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zfinfo) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {
- RETURN_FALSE;
+ return;
}
zend_list_close(Z_RES_P(zfinfo));
@@ -406,15 +354,15 @@ PHP_FUNCTION(finfo_set_flags)
if (object) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &options) == FAILURE) {
- RETURN_FALSE;
+ return;
}
FILEINFO_FROM_OBJECT(finfo, object);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zfinfo, &options) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {
- RETURN_FALSE;
+ return;
}
}
@@ -471,17 +419,17 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
goto common;
}
} else if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr!", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ return;
}
FILEINFO_FROM_OBJECT(finfo, object);
magic = finfo->magic;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lr!", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ return;
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {
- RETURN_FALSE;
+ return;
}
magic = finfo->magic;
}
diff --git a/ext/fileinfo/fileinfo.stub.php b/ext/fileinfo/fileinfo.stub.php
new file mode 100644
index 0000000000..1b7a3b7562
--- /dev/null
+++ b/ext/fileinfo/fileinfo.stub.php
@@ -0,0 +1,54 @@
+<?php
+
+class finfo
+{
+ function __construct(int $options = FILEINFO_NONE, string $arg = "") {}
+
+ /**
+ * @param ?resource $context
+ * @return string|false
+ */
+ function file(string $file_name, int $options = FILEINFO_NONE, $context = null) {}
+
+ /**
+ * @param ?resource $context
+ * @return string|false
+ */
+ function buffer(string $string, int $options = FILEINFO_NONE, $context = null) {}
+
+ /** @return bool */
+ function set_flags(int $options) {}
+}
+
+/** @return resource|false */
+function finfo_open(int $options = FILEINFO_NONE, string $arg = "") {}
+
+/**
+ * @param resource $finfo
+ */
+function finfo_close($finfo): bool {}
+
+/**
+ * @param resource $finfo
+ */
+function finfo_set_flags($finfo, int $options): bool {}
+
+/**
+ * @param resource $finfo
+ * @param ?resource $context
+ * @return string|false
+ */
+function finfo_file($finfo, string $file_name, int $options = FILEINFO_NONE, $context = null) {}
+
+/**
+ * @param resource $finfo
+ * @param ?resource $context
+ * @return string|false
+ */
+function finfo_buffer($finfo, string $string, int $options = FILEINFO_NONE, $context = null) {}
+
+/**
+ * @param resource|string $filename
+ * @return string|false
+ */
+function mime_content_type($filename) {}
diff --git a/ext/fileinfo/fileinfo_arginfo.h b/ext/fileinfo/fileinfo_arginfo.h
new file mode 100644
index 0000000000..b987d8a264
--- /dev/null
+++ b/ext/fileinfo/fileinfo_arginfo.h
@@ -0,0 +1,51 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_buffer, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_set_flags, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_finfo_open arginfo_class_finfo___construct
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_close, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, finfo)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_set_flags, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, finfo)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_file, 0, 0, 2)
+ ZEND_ARG_INFO(0, finfo)
+ ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_buffer, 0, 0, 2)
+ ZEND_ARG_INFO(0, finfo)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mime_content_type, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ZEND_END_ARG_INFO()
diff --git a/ext/fileinfo/php_fileinfo.h b/ext/fileinfo/php_fileinfo.h
index ac43b21050..c4f12abf5f 100644
--- a/ext/fileinfo/php_fileinfo.h
+++ b/ext/fileinfo/php_fileinfo.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/fileinfo/tests/bug61173.phpt b/ext/fileinfo/tests/bug61173.phpt
index 9fbf48b2ec..6487e15bbb 100644
--- a/ext/fileinfo/tests/bug61173.phpt
+++ b/ext/fileinfo/tests/bug61173.phpt
@@ -14,4 +14,4 @@ try {
echo $e->getMessage(), "\n";
}
--EXPECT--
-finfo::finfo() expects at most 2 parameters, 3 given
+finfo::__construct() expects at most 2 parameters, 3 given
diff --git a/ext/fileinfo/tests/bug71527-mb.phpt b/ext/fileinfo/tests/bug71527-mb.phpt
index e04c708849..91bc0510bd 100644
--- a/ext/fileinfo/tests/bug71527-mb.phpt
+++ b/ext/fileinfo/tests/bug71527-mb.phpt
@@ -9,11 +9,8 @@ USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic");
- $info = finfo_file($finfo, __FILE__);
- var_dump($info);
+ var_dump($finfo);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic'. in %sbug71527-mb.php on line %d
-
-Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527-mb.php on line %d
bool(false)
diff --git a/ext/fileinfo/tests/bug71527.phpt b/ext/fileinfo/tests/bug71527.phpt
index 4fa2b30755..74bf9839d5 100644
--- a/ext/fileinfo/tests/bug71527.phpt
+++ b/ext/fileinfo/tests/bug71527.phpt
@@ -9,11 +9,8 @@ USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527.magic");
- $info = finfo_file($finfo, __FILE__);
- var_dump($info);
+ var_dump($finfo);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
-
-Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527.php on line %d
bool(false)
diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt
index 7d865ea4fb..789fc1014d 100644
--- a/ext/fileinfo/tests/finfo_close_error.phpt
+++ b/ext/fileinfo/tests/finfo_close_error.phpt
@@ -12,36 +12,19 @@ Test finfo_close() function : error conditions
echo "*** Testing finfo_close() : error conditions ***\n";
-$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
-$finfo = finfo_open( FILEINFO_MIME, $magicFile );
-$fp = fopen( __FILE__, 'r' );
-
-echo "\n-- Testing finfo_close() function with Zero arguments --\n";
-var_dump( finfo_close() );
-
-echo "\n-- Testing finfo_close() function with more than expected no. of arguments --\n";
-var_dump( finfo_close( $finfo, '10') );
-
echo "\n-- Testing finfo_close() function with wrong resource type --\n";
-var_dump( finfo_close( $fp ) );
+$fp = fopen( __FILE__, 'r' );
+try {
+ var_dump( finfo_close( $fp ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing finfo_close() : error conditions ***
--- Testing finfo_close() function with Zero arguments --
-
-Warning: finfo_close() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing finfo_close() function with more than expected no. of arguments --
-
-Warning: finfo_close() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing finfo_close() function with wrong resource type --
-
-Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d
-bool(false)
+finfo_close(): supplied resource is not a valid file_info resource
===DONE===
diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt
index 6089776aa1..0b93e4cc40 100644
--- a/ext/fileinfo/tests/finfo_open_001.phpt
+++ b/ext/fileinfo/tests/finfo_open_001.phpt
@@ -5,7 +5,12 @@ finfo_open(): Testing magic_file names
--FILE--
<?php
-var_dump(finfo_open(FILEINFO_MIME, "\0"));
+try {
+ var_dump(finfo_open(FILEINFO_MIME, "\0"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
var_dump(finfo_open(FILEINFO_MIME, NULL));
var_dump(finfo_open(FILEINFO_MIME, ''));
var_dump(finfo_open(FILEINFO_MIME, 123));
@@ -14,8 +19,7 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent'));
?>
--EXPECTF--
-Warning: finfo_open() expects parameter 2 to be a valid path, string given in %s on line %d
-bool(false)
+finfo_open() expects parameter 2 to be a valid path, string given
resource(%d) of type (file_info)
resource(%d) of type (file_info)
diff --git a/ext/fileinfo/tests/finfo_open_002.phpt b/ext/fileinfo/tests/finfo_open_002.phpt
index e39d462147..35cf98c34d 100644
--- a/ext/fileinfo/tests/finfo_open_002.phpt
+++ b/ext/fileinfo/tests/finfo_open_002.phpt
@@ -6,7 +6,7 @@ FileInfo - Calling the constructor twice
<?php
$x = new finfo;
-$x->finfo();
+$x->__construct();
echo "done!\n";
diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt
index b4fc57c18c..d37591a2c7 100644
--- a/ext/fileinfo/tests/finfo_open_error.phpt
+++ b/ext/fileinfo/tests/finfo_open_error.phpt
@@ -15,10 +15,13 @@ $magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
echo "*** Testing finfo_open() : error functionality ***\n";
var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) );
-var_dump( finfo_open( array(), $magicFile ) );
-var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) );
var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) );
-var_dump( finfo_open( 'foobar' ) );
+
+try {
+ var_dump( finfo_open( 'foobar' ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
try {
var_dump( new finfo('foobar') );
@@ -31,23 +34,15 @@ try {
--EXPECTF--
*** Testing finfo_open() : error functionality ***
-Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
+Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d
-Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
+Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d
-Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line 12
+Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line %d
bool(false)
-Warning: finfo_open() expects parameter 1 to be int, array given in %sfinfo_open_error.php on line 13
-bool(false)
-
-Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error.php on line 14
-bool(false)
-
-Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line 15
+Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
resource(6) of type (file_info)
-
-Warning: finfo_open() expects parameter 1 to be int, string given in %sfinfo_open_error.php on line 16
-bool(false)
-finfo::finfo() expects parameter 1 to be int, string given
+finfo_open() expects parameter 1 to be int, string given
+finfo::__construct() expects parameter 1 to be int, string given
===DONE===
diff --git a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt
index 412fe5b7f3..4af914b1eb 100644
--- a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt
+++ b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt
@@ -17,14 +17,12 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
-var_dump( finfo_set_flags() );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );
-var_dump( $finfo->set_flags() );
?>
===DONE===
@@ -32,11 +30,5 @@ var_dump( $finfo->set_flags() );
*** Testing finfo_set_flags() : basic functionality ***
bool(true)
bool(true)
-
-Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
bool(true)
-
-Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
===DONE===
diff --git a/ext/fileinfo/tests/finfo_set_flags_basic.phpt b/ext/fileinfo/tests/finfo_set_flags_basic.phpt
index cd7f16c67e..b694350e11 100644
--- a/ext/fileinfo/tests/finfo_set_flags_basic.phpt
+++ b/ext/fileinfo/tests/finfo_set_flags_basic.phpt
@@ -17,14 +17,12 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
-var_dump( finfo_set_flags() );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );
-var_dump( $finfo->set_flags() );
?>
===DONE===
@@ -32,11 +30,5 @@ var_dump( $finfo->set_flags() );
*** Testing finfo_set_flags() : basic functionality ***
bool(true)
bool(true)
-
-Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
bool(true)
-
-Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
===DONE===
diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c
index 5de24d18e1..d9ad4bdf24 100644
--- a/ext/filter/callback_filter.c
+++ b/ext/filter/callback_filter.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/ext/filter/filter.c b/ext/filter/filter.c
index e615edf084..21242d4439 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.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, |
@@ -28,6 +26,7 @@
ZEND_DECLARE_MODULE_GLOBALS(filter)
#include "filter_private.h"
+#include "filter_arginfo.h"
typedef struct filter_list_entry {
const char *name;
@@ -80,45 +79,6 @@ static const filter_list_entry filter_list[] = {
static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len);
static unsigned int php_sapi_filter_init(void);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, variable_name)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1)
- ZEND_ARG_INFO(0, variable)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, definition)
- ZEND_ARG_INFO(0, add_empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, definition)
- ZEND_ARG_INFO(0, add_empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filter_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_has_var, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, variable_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_id, 0, 0, 1)
- ZEND_ARG_INFO(0, filtername)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ filter_functions[]
*/
static const zend_function_entry filter_functions[] = {
@@ -222,8 +182,6 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT);
@@ -276,8 +234,6 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT);
@@ -551,13 +507,8 @@ static zval *php_filter_get_storage(zend_long arg)/* {{{ */
}
array_ptr = !Z_ISUNDEF(IF_G(env_array)) ? &IF_G(env_array) : &PG(http_globals)[TRACK_VARS_ENV];
break;
- case PARSE_SESSION:
- /* FIXME: Implement session source */
- php_error_docref(NULL, E_WARNING, "INPUT_SESSION is not yet implemented");
- break;
- case PARSE_REQUEST:
- /* FIXME: Implement request source */
- php_error_docref(NULL, E_WARNING, "INPUT_REQUEST is not yet implemented");
+ default:
+ php_error_docref(NULL, E_WARNING, "Unknown source");
break;
}
diff --git a/ext/filter/filter.stub.php b/ext/filter/filter.stub.php
new file mode 100644
index 0000000000..a4b15cd4f9
--- /dev/null
+++ b/ext/filter/filter.stub.php
@@ -0,0 +1,35 @@
+<?php
+
+function filter_has_var(int $type, string $variable_name): bool {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_input(int $type, string $variable_name, int $filter = FILTER_DEFAULT, $options = NULL) {}
+
+/**
+ * @param mixed $variable
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_var($variable, int $filter = FILTER_DEFAULT, $options = NULL) {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_input_array(int $type, $options = NULL, bool $add_empty = true) {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_var_array(array $data, $options = NULL, bool $add_empty = true) {}
+
+function filter_list(): array {}
+
+/**
+ * @return int|false
+ */
+function filter_id(string $filtername) {}
diff --git a/ext/filter/filter_arginfo.h b/ext/filter/filter_arginfo.h
new file mode 100644
index 0000000000..f5ed690ce7
--- /dev/null
+++ b/ext/filter/filter_arginfo.h
@@ -0,0 +1,38 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1)
+ ZEND_ARG_INFO(0, variable)
+ ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ ZEND_ARG_TYPE_INFO(0, add_empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, options)
+ ZEND_ARG_TYPE_INFO(0, add_empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_id, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filtername, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index a604908707..3f2fd4a0f9 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.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/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index f32a8b18ce..099211804b 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.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, |
@@ -560,11 +558,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
php_url *url;
size_t old_len = Z_STRLEN_P(value);
- if (flags & (FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)) {
- php_error_docref(NULL, E_DEPRECATED,
- "explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated");
- }
-
php_filter_url(value, flags, option_array, charset);
if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) {
diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h
index 24b177d275..1a544fe435 100644
--- a/ext/filter/php_filter.h
+++ b/ext/filter/php_filter.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/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index 5b4fb4432c..f12cec9c49 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.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/ext/filter/tests/007.phpt b/ext/filter/tests/007.phpt
index 87f9a77a12..dc966b8cc9 100644
--- a/ext/filter/tests/007.phpt
+++ b/ext/filter/tests/007.phpt
@@ -14,20 +14,12 @@ var_dump(filter_has_var(INPUT_GET, "abc"));
var_dump(filter_has_var(INPUT_GET, "nonex"));
var_dump(filter_has_var(INPUT_GET, " "));
var_dump(filter_has_var(INPUT_GET, ""));
-var_dump(filter_has_var(INPUT_GET, array()));
var_dump(filter_has_var(INPUT_POST, "b"));
var_dump(filter_has_var(INPUT_POST, "bbc"));
var_dump(filter_has_var(INPUT_POST, "nonex"));
var_dump(filter_has_var(INPUT_POST, " "));
var_dump(filter_has_var(INPUT_POST, ""));
-var_dump(filter_has_var(INPUT_POST, array()));
-
-var_dump(filter_has_var(-1, ""));
-var_dump(filter_has_var("", ""));
-var_dump(filter_has_var(array(), array()));
-var_dump(filter_has_var(array(), ""));
-var_dump(filter_has_var("", array()));
echo "Done\n";
?>
@@ -37,28 +29,9 @@ bool(true)
bool(false)
bool(false)
bool(false)
-
-Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
-bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
-
-Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
-bool(false)
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d
-bool(false)
Done
diff --git a/ext/filter/tests/008.phpt b/ext/filter/tests/008.phpt
index a3cb7172ff..b34c977425 100644
--- a/ext/filter/tests/008.phpt
+++ b/ext/filter/tests/008.phpt
@@ -6,7 +6,6 @@ filter_list()
<?php
var_dump(filter_list());
-var_dump(filter_list(array()));
echo "Done\n";
?>
@@ -57,7 +56,4 @@ array(22) {
[21]=>
string(8) "callback"
}
-
-Warning: filter_list() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
Done
diff --git a/ext/filter/tests/009.phpt b/ext/filter/tests/009.phpt
index 5c38e5603a..f456dc6dc1 100644
--- a/ext/filter/tests/009.phpt
+++ b/ext/filter/tests/009.phpt
@@ -10,23 +10,15 @@ var_dump(filter_id("string"));
var_dump(filter_id("url"));
var_dump(filter_id("int"));
var_dump(filter_id("none"));
-var_dump(filter_id(array()));
var_dump(filter_id(-1));
-var_dump(filter_id(0,0,0));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(513)
int(513)
int(518)
int(257)
bool(false)
-
-Warning: filter_id() expects parameter 1 to be string, array given in %s on line %d
-NULL
bool(false)
-
-Warning: filter_id() expects exactly 1 parameter, 3 given in %s on line %d
-NULL
Done
diff --git a/ext/filter/tests/010.phpt b/ext/filter/tests/010.phpt
index 3e71d331bd..14f8db01af 100644
--- a/ext/filter/tests/010.phpt
+++ b/ext/filter/tests/010.phpt
@@ -9,7 +9,6 @@ precision=14
var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY));
var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY));
-var_dump(filter_var(1, array()));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 1));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 0));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, array()));
@@ -53,9 +52,6 @@ array(7) {
array(0) {
}
}
-
-Warning: filter_var() expects parameter 2 to be int, array given in %s on line %d
-NULL
string(1) "1"
string(1) "1"
string(1) "1"
diff --git a/ext/filter/tests/011.phpt b/ext/filter/tests/011.phpt
index b5075d1821..1b2a2ec357 100644
--- a/ext/filter/tests/011.phpt
+++ b/ext/filter/tests/011.phpt
@@ -20,12 +20,6 @@ var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT));
var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS));
var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_INT));
-var_dump(filter_var(new stdClass, "d"));
-
-var_dump(filter_input(INPUT_POST, "c", "", ""));
-var_dump(filter_var("", "", "", "", ""));
-var_dump(filter_var(0, 0, 0, 0, 0));
-
echo "Done\n";
?>
--EXPECTF--
@@ -39,16 +33,4 @@ string(6) "string"
float(12345.7)
string(29) "&#60;p&#62;string&#60;/p&#62;"
bool(false)
-
-Warning: filter_var() expects parameter 2 to be int, string given in %s011.php on line %d
-NULL
-
-Warning: filter_input() expects parameter 3 to be int, string given in %s011.php on line %d
-NULL
-
-Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d
-NULL
-
-Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d
-NULL
Done
diff --git a/ext/filter/tests/039.phpt b/ext/filter/tests/039.phpt
index 501414deee..bdd090ae86 100644
--- a/ext/filter/tests/039.phpt
+++ b/ext/filter/tests/039.phpt
@@ -6,7 +6,6 @@ filter_var_array() and different arguments
<?php
echo "-- (1)\n";
-var_dump(filter_var_array(NULL));
var_dump(filter_var_array(array()));
var_dump(filter_var_array(array(1,"blah"=>"hoho")));
var_dump(filter_var_array(array(), -1));
@@ -51,9 +50,6 @@ echo "Done\n";
?>
--EXPECTF--
-- (1)
-
-Warning: filter_var_array() expects parameter 1 to be array, null given in %s on line %d
-NULL
array(0) {
}
array(2) {
diff --git a/ext/filter/tests/040.phpt b/ext/filter/tests/040.phpt
index d77b33135e..f6de3eb84c 100644
--- a/ext/filter/tests/040.phpt
+++ b/ext/filter/tests/040.phpt
@@ -9,9 +9,7 @@ ap[]=1&bp=test&cp=
--FILE--
<?php
-var_dump(filter_has_var());
var_dump(filter_has_var(INPUT_GET,""));
-var_dump(filter_has_var(INPUT_GET,array()));
var_dump(filter_has_var(INPUT_POST, "ap"));
var_dump(filter_has_var(INPUT_POST, "cp"));
var_dump(filter_has_var(INPUT_GET, "a"));
@@ -20,16 +18,10 @@ var_dump(filter_has_var(INPUT_GET, "abc"));
var_dump(filter_has_var(INPUT_GET, "cc"));
var_dump(filter_has_var(-1, "cc"));
var_dump(filter_has_var(0, "cc"));
-var_dump(filter_has_var("", "cc"));
echo "Done\n";
?>
--EXPECTF--
-Warning: filter_has_var() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-bool(false)
-
-Warning: filter_has_var() expects parameter 2 to be string, array given in %s on line %d
bool(false)
bool(true)
bool(true)
@@ -37,9 +29,8 @@ bool(true)
bool(true)
bool(false)
bool(false)
-bool(false)
-bool(false)
-Warning: filter_has_var() expects parameter 1 to be int, string given in %s on line %d
+Warning: filter_has_var(): Unknown source in %s on line %d
+bool(false)
bool(false)
Done
diff --git a/ext/filter/tests/deprecated.phpt b/ext/filter/tests/deprecated.phpt
deleted file mode 100644
index a7771056ef..0000000000
--- a/ext/filter/tests/deprecated.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED are deprecated
---SKIPIF--
-<?php
-if (!extension_loaded('filter')) die('skip filter extension not available');
-?>
---FILE--
-<?php
-var_dump(filter_var('//example.com/', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED));
-var_dump(filter_var('http://', FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED));
-?>
-===DONE===
---EXPECTF--
-Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in %s
-bool(false)
-
-Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in %s
-bool(false)
-===DONE===
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index e5355b1bd4..cb8161a456 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.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/ext/ftp/ftp.h b/ext/ftp/ftp.h
index 2b1338d81d..27c39b5486 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.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/ext/ftp/ftp.stub.php b/ext/ftp/ftp.stub.php
new file mode 100644
index 0000000000..83a419e5a7
--- /dev/null
+++ b/ext/ftp/ftp.stub.php
@@ -0,0 +1,149 @@
+<?php
+
+/** @return resource|false */
+function ftp_connect(string $host, int $port = 21, int $timeout = 90) {}
+
+#ifdef HAVE_FTP_SSL
+/** @return resource|false */
+function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90) {}
+#endif
+
+/** @param resource $ftp */
+function ftp_login($ftp, string $username, string $password): bool {}
+
+/**
+ * @param resource $ftp
+ * @return string|false
+ */
+function ftp_pwd($ftp) {}
+
+/** @param resource $ftp */
+function ftp_cdup($ftp): bool {}
+
+/** @param resource $ftp */
+function ftp_chdir($ftp, string $directory): bool {}
+
+/** @param resource $ftp */
+function ftp_exec($ftp, string $command): bool {}
+
+/** @param resource $ftp */
+function ftp_raw($ftp, string $command): array {}
+
+/**
+ * @param resource $ftp
+ * @return string|false
+ */
+function ftp_mkdir($ftp, string $directory) {}
+
+/** @param resource $ftp */
+function ftp_rmdir($ftp, string $directory): bool {}
+
+/**
+ * @param resource $ftp
+ * @return int|false
+ */
+function ftp_chmod($ftp, int $mode, string $filename) {}
+
+/** @param resource $ftp */
+function ftp_alloc($ftp, int $size, &$response = UNKNOWN): bool {}
+
+/**
+ * @param resource $ftp
+ * @return array|false
+ */
+function ftp_nlist($ftp, string $directory) {}
+
+/**
+ * @param resource $ftp
+ * @return array|false
+ */
+function ftp_rawlist($ftp, string $directory, bool $recurse = false) {}
+
+/**
+ * @param resource $ftp
+ * @return array|false
+ */
+function ftp_mlsd($ftp, string $directory) {}
+
+/**
+ * @param resource $ftp
+ * @return string|false
+ */
+function ftp_systype($ftp) {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ */
+function ftp_fget($ftp, $fp, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): bool {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ * @return int|false
+ */
+function ftp_nb_fget($ftp, $fp, string $remote_file, int $mode = FTP_BINARY, int $resumpos = 0) {}
+
+/** @param resource $ftp */
+function ftp_pasv($ftp, bool $pasv): bool {}
+
+/** @param resource $ftp */
+function ftp_get($ftp, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): bool {}
+
+/** @param resource $ftp */
+function ftp_nb_get($ftp, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resume_pos = 0): int {}
+
+/** @param resource $ftp */
+function ftp_nb_continue($ftp): int {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ */
+function ftp_fput($ftp, string $remote_file, $fp, int $mode = FTP_BINARY, int $startpos = 0): bool {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ * @return int|false
+ */
+function ftp_nb_fput($ftp, string $remote_file, $fp, $mode = FTP_BINARY, $startpos = 0) {}
+
+/** @param resource $ftp */
+function ftp_put($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): bool {}
+
+/** @param resource $ftp */
+function ftp_append($ftp, string $remove_file, string $local_file, int $mode = FTP_BINARY): bool {}
+
+/**
+ * @param resource $ftp
+ * @return int|false
+ */
+function ftp_nb_put($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0) {}
+
+/** @param resource $ftp */
+function ftp_size($ftp, string $filename): int {}
+
+/** @param resource $ftp */
+function ftp_mdtm($ftp, string $filename): int {}
+
+/** @param resource $ftp */
+function ftp_rename($ftp, string $src, string $dest): bool {}
+
+/** @param resource $ftp */
+function ftp_delete($ftp, string $file): bool {}
+
+/** @param resource $ftp */
+function ftp_site($ftp, string $cmd): bool {}
+
+/** @param resource $ftp */
+function ftp_close($ftp): bool {}
+
+/** @param resource $ftp */
+function ftp_set_option($ftp, int $option, $value): bool {}
+
+/**
+ * @param resource $ftp
+ * @return int|bool
+ */
+function ftp_get_option($ftp, int $option) {}
diff --git a/ext/ftp/ftp_arginfo.h b/ext/ftp/ftp_arginfo.h
new file mode 100644
index 0000000000..d55b76a686
--- /dev/null
+++ b/ext/ftp/ftp_arginfo.h
@@ -0,0 +1,191 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_connect, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_FTP_SSL)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_ssl_connect, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_login, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_pwd, 0, 0, 1)
+ ZEND_ARG_INFO(0, ftp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_cdup, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_chdir, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_exec, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_raw, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_mkdir, 0, 0, 2)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_rmdir arginfo_ftp_chdir
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_chmod, 0, 0, 3)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_alloc, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ ZEND_ARG_INFO(1, response)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_nlist arginfo_ftp_mkdir
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_rawlist, 0, 0, 2)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, recurse, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_mlsd arginfo_ftp_mkdir
+
+#define arginfo_ftp_systype arginfo_ftp_pwd
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fget, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resumepos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fget, 0, 0, 3)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resumpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_pasv, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, pasv, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_get, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resumepos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_get, 0, 3, IS_LONG, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resume_pos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_continue, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, ftp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fput, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, startpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fput, 0, 0, 3)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_INFO(0, startpos)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_put, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, startpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_append, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remove_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_put, 0, 0, 3)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, startpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_size, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_mdtm arginfo_ftp_size
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_rename, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, src, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, dest, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_delete, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_site, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, cmd, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_close arginfo_ftp_cdup
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_set_option, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_get_option, 0, 0, 2)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index e3b425ef0f..0b38c251f6 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.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, |
@@ -34,219 +32,11 @@
#include "php_ftp.h"
#include "ftp.h"
+#include "ftp_arginfo.h"
static int le_ftpbuf;
#define le_ftpbuf_name "FTP Buffer"
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_connect, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_FTP_SSL
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_ssl_connect, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_login, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, username)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_pwd, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_cdup, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_chdir, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_exec, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, command)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_raw, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, command)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_mkdir, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_rmdir, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_chmod, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_alloc, 0, 0, 2)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(1, response)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_nlist, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_rawlist, 0, 0, 2)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
- ZEND_ARG_INFO(0, recursive)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_mlsd, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_systype, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fget, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resumepos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fget, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resumepos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_pasv, 0, 0, 2)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, pasv)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_get, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resume_pos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_get, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resume_pos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_nb_continue, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fput, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fput, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_put, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_append, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_put, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_size, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_mdtm, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_rename, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, src)
- ZEND_ARG_INFO(0, dest)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_delete, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, file)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_site, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, cmd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_close, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_set_option, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_get_option, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
static const zend_function_entry php_ftp_functions[] = {
PHP_FE(ftp_connect, arginfo_ftp_connect)
#ifdef HAVE_FTP_SSL
@@ -450,7 +240,7 @@ PHP_FUNCTION(ftp_login)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* log in */
@@ -476,7 +266,7 @@ PHP_FUNCTION(ftp_pwd)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!(pwd = ftp_pwd(ftp))) {
@@ -500,7 +290,7 @@ PHP_FUNCTION(ftp_cdup)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!ftp_cdup(ftp)) {
@@ -526,7 +316,7 @@ PHP_FUNCTION(ftp_chdir)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* change directories */
@@ -553,7 +343,7 @@ PHP_FUNCTION(ftp_exec)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* execute serverside command */
@@ -580,7 +370,7 @@ PHP_FUNCTION(ftp_raw)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* execute arbitrary ftp command */
@@ -603,7 +393,7 @@ PHP_FUNCTION(ftp_mkdir)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* create directory */
@@ -630,7 +420,7 @@ PHP_FUNCTION(ftp_rmdir)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* remove directorie */
@@ -654,11 +444,11 @@ PHP_FUNCTION(ftp_chmod)
zend_long mode;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlp", &z_ftp, &mode, &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!ftp_chmod(ftp, mode, filename, filename_len)) {
@@ -680,11 +470,11 @@ PHP_FUNCTION(ftp_alloc)
zend_string *response = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &z_ftp, &size, &zresponse) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
ret = ftp_alloc(ftp, size, zresponse ? &response : NULL);
@@ -715,7 +505,7 @@ PHP_FUNCTION(ftp_nlist)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* get list of files */
@@ -746,7 +536,7 @@ PHP_FUNCTION(ftp_rawlist)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* get raw directory listing */
@@ -777,7 +567,7 @@ PHP_FUNCTION(ftp_mlsd)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* get raw directory listing */
@@ -812,7 +602,7 @@ PHP_FUNCTION(ftp_systype)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (NULL == (syst = ftp_syst(ftp))) {
@@ -841,7 +631,7 @@ PHP_FUNCTION(ftp_fget)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_stream_from_res(stream, Z_RES_P(z_file));
XTYPE(xtype, mode);
@@ -887,7 +677,7 @@ PHP_FUNCTION(ftp_nb_fget)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_stream_from_res(stream, Z_RES_P(z_file));
XTYPE(xtype, mode);
@@ -933,7 +723,7 @@ PHP_FUNCTION(ftp_pasv)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!ftp_pasv(ftp, pasv ? 1 : 0)) {
@@ -961,7 +751,7 @@ PHP_FUNCTION(ftp_get)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
XTYPE(xtype, mode);
@@ -1027,7 +817,7 @@ PHP_FUNCTION(ftp_nb_get)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
XTYPE(xtype, mode);
@@ -1095,7 +885,7 @@ PHP_FUNCTION(ftp_nb_continue)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!ftp->nb) {
@@ -1139,7 +929,7 @@ PHP_FUNCTION(ftp_fput)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_stream_from_zval(stream, z_file);
XTYPE(xtype, mode);
@@ -1189,7 +979,7 @@ PHP_FUNCTION(ftp_nb_fput)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_stream_from_res(stream, Z_RES_P(z_file));
XTYPE(xtype, mode);
@@ -1243,7 +1033,7 @@ PHP_FUNCTION(ftp_put)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
XTYPE(xtype, mode);
@@ -1297,7 +1087,7 @@ PHP_FUNCTION(ftp_append)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
XTYPE(xtype, mode);
@@ -1333,7 +1123,7 @@ PHP_FUNCTION(ftp_nb_put)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
XTYPE(xtype, mode);
@@ -1392,7 +1182,7 @@ PHP_FUNCTION(ftp_size)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* get file size */
@@ -1414,7 +1204,7 @@ PHP_FUNCTION(ftp_mdtm)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* get file mod time */
@@ -1436,7 +1226,7 @@ PHP_FUNCTION(ftp_rename)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* rename the file */
@@ -1463,7 +1253,7 @@ PHP_FUNCTION(ftp_delete)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* delete the file */
@@ -1490,7 +1280,7 @@ PHP_FUNCTION(ftp_site)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* send the site command */
@@ -1515,7 +1305,7 @@ PHP_FUNCTION(ftp_close)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
ftp_quit(ftp);
@@ -1537,7 +1327,7 @@ PHP_FUNCTION(ftp_set_option)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch (option) {
@@ -1593,7 +1383,7 @@ PHP_FUNCTION(ftp_get_option)
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch (option) {
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
index f3033df8fe..0d85f64880 100644
--- a/ext/ftp/php_ftp.h
+++ b/ext/ftp/php_ftp.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/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt
index 3fcf272e3b..b95c12c518 100644
--- a/ext/ftp/tests/004.phpt
+++ b/ext/ftp/tests/004.phpt
@@ -8,68 +8,22 @@ require 'skipif.inc';
<?php
require 'server.inc';
+// Negative timeout
+var_dump(ftp_connect('127.0.0.1', 0, -3));
+
$ftp = ftp_connect('127.0.0.1', $port);
if (!$ftp) die("Couldn't connect to the server");
var_dump(ftp_login($ftp, 'user', 'pass'));
-
-var_dump(ftp_systype($ftp));
-
-/* some bogus usage */
-var_dump(ftp_alloc($ftp, array()));
-var_dump(ftp_cdup($ftp, 0));
-var_dump(ftp_chdir($ftp, array()));
-var_dump(ftp_chmod($ftp, 0666));
-var_dump(ftp_close());
-var_dump(ftp_connect('sfjkfjaksfjkasjf'));
-var_dump(ftp_delete($ftp, array()));
-var_dump(ftp_exec($ftp, array()));
-
-var_dump(ftp_systype($ftp, 0));
-var_dump(ftp_pwd($ftp, array()));
-
-var_dump(ftp_login($ftp));
var_dump(ftp_login($ftp, 'user', 'bogus'));
var_dump(ftp_quit($ftp));
?>
--EXPECTF--
-bool(true)
-string(4) "UNIX"
-
-Warning: ftp_alloc() expects parameter 2 to be int, array given in %s004.php on line 12
-bool(false)
-
-Warning: ftp_cdup() expects exactly 1 parameter, 2 given in %s004.php on line 13
-NULL
-
-Warning: ftp_chdir() expects parameter 2 to be string, array given in %s004.php on line 14
-NULL
-
-Warning: ftp_chmod() expects exactly 3 parameters, 2 given in %s on line %d
+Warning: ftp_connect(): Timeout has to be greater than 0 in %s on line %d
bool(false)
+bool(true)
-Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 16
-NULL
-
-Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 17
-bool(false)
-
-Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 18
-NULL
-
-Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 19
-NULL
-
-Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 21
-NULL
-
-Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 22
-NULL
-
-Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 24
-NULL
-
-Warning: ftp_login(): Not logged in. in %s004.php on line 25
+Warning: ftp_login(): Not logged in. in %s on line %d
bool(false)
bool(true)
diff --git a/ext/ftp/tests/006.phpt b/ext/ftp/tests/006.phpt
deleted file mode 100644
index ff0d258917..0000000000
--- a/ext/ftp/tests/006.phpt
+++ /dev/null
@@ -1,108 +0,0 @@
---TEST--
-FTP with bogus parameters
---SKIPIF--
-<?php
-require 'skipif.inc';
-?>
---FILE--
-<?php
-$ftp=null;
-
-var_dump(ftp_connect(array()));
-var_dump(ftp_connect('127.0.0.1', 0, -3));
-var_dump(ftp_raw($ftp));
-var_dump(ftp_mkdir($ftp));
-var_dump(ftp_rmdir($ftp));
-var_dump(ftp_nlist($ftp));
-var_dump(ftp_rawlist($ftp));
-var_dump(ftp_fget($ftp));
-var_dump(ftp_nb_fget($ftp));
-var_dump(ftp_nb_get($ftp));
-var_dump(ftp_pasv($ftp));
-var_dump(ftp_nb_continue());
-var_dump(ftp_fput());
-var_dump(ftp_nb_fput($ftp));
-var_dump(ftp_put($ftp));
-var_dump(ftp_nb_put($ftp));
-var_dump(ftp_size($ftp));
-var_dump(ftp_mdtm($ftp));
-var_dump(ftp_rename($ftp));
-var_dump(ftp_site($ftp));
-var_dump(ftp_set_option($ftp));
-var_dump(ftp_get_option($ftp));
-var_dump(ftp_mlsd($ftp));
-var_dump(ftp_append($ftp));
-
-?>
---EXPECTF--
-Warning: ftp_connect() expects parameter 1 to be string, array given in %s006.php on line 4
-NULL
-
-Warning: ftp_connect(): Timeout has to be greater than 0 in %s006.php on line 5
-bool(false)
-
-Warning: ftp_raw() expects exactly 2 parameters, 1 given in %s006.php on line 6
-NULL
-
-Warning: ftp_mkdir() expects exactly 2 parameters, 1 given in %s006.php on line 7
-NULL
-
-Warning: ftp_rmdir() expects exactly 2 parameters, 1 given in %s006.php on line 8
-NULL
-
-Warning: ftp_nlist() expects exactly 2 parameters, 1 given in %s006.php on line 9
-NULL
-
-Warning: ftp_rawlist() expects at least 2 parameters, 1 given in %s006.php on line 10
-NULL
-
-Warning: ftp_fget() expects at least 3 parameters, 1 given in %s006.php on line 11
-NULL
-
-Warning: ftp_nb_fget() expects at least 3 parameters, 1 given in %s006.php on line 12
-NULL
-
-Warning: ftp_nb_get() expects at least 3 parameters, 1 given in %s006.php on line 13
-NULL
-
-Warning: ftp_pasv() expects exactly 2 parameters, 1 given in %s006.php on line 14
-NULL
-
-Warning: ftp_nb_continue() expects exactly 1 parameter, 0 given in %s006.php on line 15
-NULL
-
-Warning: ftp_fput() expects at least 3 parameters, 0 given in %s006.php on line 16
-NULL
-
-Warning: ftp_nb_fput() expects at least 3 parameters, 1 given in %s006.php on line 17
-NULL
-
-Warning: ftp_put() expects at least 3 parameters, 1 given in %s006.php on line 18
-NULL
-
-Warning: ftp_nb_put() expects at least 3 parameters, 1 given in %s006.php on line 19
-NULL
-
-Warning: ftp_size() expects exactly 2 parameters, 1 given in %s006.php on line 20
-NULL
-
-Warning: ftp_mdtm() expects exactly 2 parameters, 1 given in %s006.php on line 21
-NULL
-
-Warning: ftp_rename() expects exactly 3 parameters, 1 given in %s006.php on line 22
-NULL
-
-Warning: ftp_site() expects exactly 2 parameters, 1 given in %s006.php on line 23
-NULL
-
-Warning: ftp_set_option() expects exactly 3 parameters, 1 given in %s006.php on line 24
-NULL
-
-Warning: ftp_get_option() expects exactly 2 parameters, 1 given in %s006.php on line 25
-NULL
-
-Warning: ftp_mlsd() expects exactly 2 parameters, 1 given in %s006.php on line 26
-NULL
-
-Warning: ftp_append() expects at least 3 parameters, 1 given in %s006.php on line 27
-NULL
diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt
index eebe8cf1e3..0520b37293 100644
--- a/ext/ftp/tests/007.phpt
+++ b/ext/ftp/tests/007.phpt
@@ -11,138 +11,205 @@ require 'skipif.inc';
<?php
$ftp = tmpfile();
-var_dump(ftp_login($ftp, 'user', 'pass'));
-var_dump(ftp_pwd($ftp));
-var_dump(ftp_cdup($ftp));
-var_dump(ftp_chdir($ftp, '~'));
-var_dump(ftp_exec($ftp, 'x'));
-var_dump(ftp_raw($ftp, 'x'));
-var_dump(ftp_mkdir($ftp, '/'));
-var_dump(ftp_rmdir($ftp, '/'));
-var_dump(ftp_chmod($ftp, 7777, '/'));
-var_dump(ftp_alloc($ftp, 7777));
-var_dump(ftp_nlist($ftp, '/'));
-var_dump(ftp_rawlist($ftp, '~'));
-var_dump(ftp_mlsd($ftp, '~'));
-var_dump(ftp_systype($ftp));
-var_dump(ftp_fget($ftp, $ftp, 'remote', 7777));
-var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777));
-var_dump(ftp_pasv($ftp, false));
-var_dump(ftp_get($ftp, 'local', 'remote', 7777));
-var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777));
-var_dump(ftp_nb_continue($ftp));
-var_dump(ftp_fput($ftp, 'remote', $ftp, 9999));
-var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999));
-var_dump(ftp_put($ftp, 'remote', 'local', 9999));
-var_dump(ftp_append($ftp, 'remote', 'local', 9999));
-var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999));
-var_dump(ftp_size($ftp, '~'));
-var_dump(ftp_mdtm($ftp, '~'));
-var_dump(ftp_rename($ftp, 'old', 'new'));
-var_dump(ftp_delete($ftp, 'gone'));
-var_dump(ftp_site($ftp, 'localhost'));
-var_dump(ftp_close($ftp));
-var_dump(ftp_set_option($ftp, 1, 2));
-var_dump(ftp_get_option($ftp, 1));
+try {
+ var_dump(ftp_login($ftp, 'user', 'pass'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_pwd($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_cdup($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_chdir($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_exec($ftp, 'x'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_raw($ftp, 'x'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_mkdir($ftp, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_rmdir($ftp, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_chmod($ftp, 7777, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_alloc($ftp, 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nlist($ftp, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_rawlist($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_mlsd($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_systype($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_fget($ftp, $ftp, 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_pasv($ftp, false));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_get($ftp, 'local', 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_continue($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_fput($ftp, 'remote', $ftp, 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_put($ftp, 'remote', 'local', 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_append($ftp, 'remote', 'local', 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_size($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_mdtm($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_rename($ftp, 'old', 'new'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_delete($ftp, 'gone'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_site($ftp, 'localhost'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_close($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_set_option($ftp, 1, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_get_option($ftp, 1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
fclose($ftp);
?>
---EXPECTF--
-Warning: ftp_login(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_pwd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_cdup(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_chdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_exec(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_raw(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_mkdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_rmdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_chmod(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_alloc(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_rawlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_mlsd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_systype(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_pasv(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_append(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_size(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_mdtm(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_rename(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_delete(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_site(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_close(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_set_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_get_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
+--EXPECT--
+ftp_login(): supplied resource is not a valid FTP Buffer resource
+ftp_pwd(): supplied resource is not a valid FTP Buffer resource
+ftp_cdup(): supplied resource is not a valid FTP Buffer resource
+ftp_chdir(): supplied resource is not a valid FTP Buffer resource
+ftp_exec(): supplied resource is not a valid FTP Buffer resource
+ftp_raw(): supplied resource is not a valid FTP Buffer resource
+ftp_mkdir(): supplied resource is not a valid FTP Buffer resource
+ftp_rmdir(): supplied resource is not a valid FTP Buffer resource
+ftp_chmod(): supplied resource is not a valid FTP Buffer resource
+ftp_alloc(): supplied resource is not a valid FTP Buffer resource
+ftp_nlist(): supplied resource is not a valid FTP Buffer resource
+ftp_rawlist(): supplied resource is not a valid FTP Buffer resource
+ftp_mlsd(): supplied resource is not a valid FTP Buffer resource
+ftp_systype(): supplied resource is not a valid FTP Buffer resource
+ftp_fget(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource
+ftp_pasv(): supplied resource is not a valid FTP Buffer resource
+ftp_get(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_get(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource
+ftp_fput(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource
+ftp_put(): supplied resource is not a valid FTP Buffer resource
+ftp_append(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_put(): supplied resource is not a valid FTP Buffer resource
+ftp_size(): supplied resource is not a valid FTP Buffer resource
+ftp_mdtm(): supplied resource is not a valid FTP Buffer resource
+ftp_rename(): supplied resource is not a valid FTP Buffer resource
+ftp_delete(): supplied resource is not a valid FTP Buffer resource
+ftp_site(): supplied resource is not a valid FTP Buffer resource
+ftp_close(): supplied resource is not a valid FTP Buffer resource
+ftp_set_option(): supplied resource is not a valid FTP Buffer resource
+ftp_get_option(): supplied resource is not a valid FTP Buffer resource
diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt
index 2c5f6f58a6..c52ea56218 100644
--- a/ext/ftp/tests/ftp_get_basic.phpt
+++ b/ext/ftp/tests/ftp_get_basic.phpt
@@ -29,9 +29,6 @@ unlink($tmpfname);
//test non-existent file request
ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII);
-
-//test invalid ftp_get params
-var_dump(ftp_get('foo', 'bar', 'baz'));
?>
--EXPECTF--
bool(true)
@@ -41,6 +38,3 @@ bool(true)
string(21) "BINARYFoo%00Bar%0D%0A"
Warning: ftp_get(): a warning: No such file or directory in %sftp_get_basic.php on line %d
-
-Warning: ftp_get() expects parameter 1 to be resource, string given in %s on line %d
-NULL
diff --git a/ext/ftp/tests/ftp_ssl_connect_error.phpt b/ext/ftp/tests/ftp_ssl_connect_error.phpt
index b0ece5d63b..13c8f9e9c0 100644
--- a/ext/ftp/tests/ftp_ssl_connect_error.phpt
+++ b/ext/ftp/tests/ftp_ssl_connect_error.phpt
@@ -12,14 +12,6 @@ echo "*** Testing ftp_ssl_connect() function : error conditions ***\n";
echo "\n-- Testing ftp_ssl_connect() function on failure --\n";
var_dump(ftp_ssl_connect('totes.invalid'));
-echo "\n-- Testing ftp_ssl_connect() function invalid argument type --\n";
-ftp_ssl_connect([]);
-ftp_ssl_connect('totes.invalid', []);
-ftp_ssl_connect('totes.invalid', 21, []);
-
-echo "\n-- Testing ftp_ssl_connect() function with more than expected no. of arguments --\n";
-ftp_ssl_connect('totes.invalid', 21, 1, []);
-
echo "\n-- Testing ftp_ssl_connect() function timeout warning for value 0 --\n";
ftp_ssl_connect('totes.invalid', 21, 0);
@@ -32,18 +24,6 @@ echo "===DONE===\n";
Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s on line %d
bool(false)
--- Testing ftp_ssl_connect() function invalid argument type --
-
-Warning: ftp_ssl_connect() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: ftp_ssl_connect() expects parameter 2 to be int, array given in %s on line %d
-
-Warning: ftp_ssl_connect() expects parameter 3 to be int, array given in %s on line %d
-
--- Testing ftp_ssl_connect() function with more than expected no. of arguments --
-
-Warning: ftp_ssl_connect() expects at most 3 parameters, 4 given in %s on line %d
-
-- Testing ftp_ssl_connect() function timeout warning for value 0 --
Warning: ftp_ssl_connect(): Timeout has to be greater than 0 in %s on line %d
diff --git a/ext/gd/CREDITS b/ext/gd/CREDITS
index 2393a9f8fc..b9ca3bdaac 100644
--- a/ext/gd/CREDITS
+++ b/ext/gd/CREDITS
@@ -1,2 +1,2 @@
GD imaging
-Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger
+Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger, Mark Randall
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index b6868f53eb..7b973fff79 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.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, |
@@ -35,7 +33,8 @@
#include "php_gd.h"
#include "ext/standard/info.h"
#include "php_open_temporary_file.h"
-
+#include "zend_object_handlers.h"
+#include "zend_interfaces.h"
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
@@ -55,10 +54,10 @@
# include <X11/xpm.h>
#endif
-# include "gd_compat.h"
+#include "gd_compat.h"
-static int le_gd, le_gd_font;
+static int le_gd_font;
#include <gd.h>
#include <gd_errors.h>
@@ -85,7 +84,7 @@ static int le_gd, le_gd_font;
static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int);
#endif
-#include "gd_ctx.c"
+#include "gd_arginfo.h"
/* as it is not really public, duplicate declaration here to avoid
pointless warnings */
@@ -128,739 +127,116 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS);
static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS);
/* End Section filters declarations */
-static gdImagePtr _php_image_create_from_string (zval *Data, char *tn, gdImagePtr (*ioctx_func_p)());
+static gdImagePtr _php_image_create_from_string(zend_string *Data, char *tn, gdImagePtr (*ioctx_func_p)());
static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
static int _php_image_type(char data[12]);
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type);
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_gd_info, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageloadfont, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetstyle, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, styles) /* ARRAY_INFO(0, styles, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatetruecolor, 0)
- ZEND_ARG_INFO(0, x_size)
- ZEND_ARG_INFO(0, y_size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageistruecolor, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagetruecolortopalette, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, ditherFlag)
- ZEND_ARG_INFO(0, colorsWanted)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepalettetotruecolor, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolormatch, 0)
- ZEND_ARG_INFO(0, im1)
- ZEND_ARG_INFO(0, im2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetthickness, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, thickness)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledellipse, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledarc, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, s)
- ZEND_ARG_INFO(0, e)
- ZEND_ARG_INFO(0, col)
- ZEND_ARG_INFO(0, style)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagealphablending, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, blend)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesavealpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, save)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagelayereffect, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, effect)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorallocatealpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorresolvealpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosestalpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorexactalpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopyresampled, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, dst_w)
- ZEND_ARG_INFO(0, dst_h)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_WIN32
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegrabwindow, 0, 0, 1)
- ZEND_ARG_INFO(0, handle)
- ZEND_ARG_INFO(0, client_area)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagegrabscreen, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagerotate, 0, 0, 3)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, bgdcolor)
- ZEND_ARG_INFO(0, ignoretransparent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesettile, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, tile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetbrush, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, brush)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreate, 0)
- ZEND_ARG_INFO(0, x_size)
- ZEND_ARG_INFO(0, y_size)
-ZEND_END_ARG_INFO()
+/* output streaming (formerly gd_ctx.c) */
+static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
-ZEND_BEGIN_ARG_INFO(arginfo_imagetypes, 0)
-ZEND_END_ARG_INFO()
+/*********************************************************
+ *
+ * GD Object Representation
+ *
+ ********************************************************/
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromstring, 0)
- ZEND_ARG_INFO(0, image)
-ZEND_END_ARG_INFO()
+zend_class_entry *gd_image_ce;
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgif, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GD_JPG
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromjpeg, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GD_PNG
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefrompng, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GD_WEBP
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromwebp, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
+typedef struct _gd_ext_image_object {
+ gdImagePtr image;
+ zend_object std;
+} php_gd_image_object;
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromxbm, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
+static zend_object_handlers php_gd_image_object_handlers;
-#if defined(HAVE_GD_XPM)
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromxpm, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromwbmp, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd2, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd2part, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, srcX)
- ZEND_ARG_INFO(0, srcY)
- ZEND_ARG_INFO(0, width)
- ZEND_ARG_INFO(0, height)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_GD_BMP)
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefrombmp, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-#if defined(HAVE_GD_TGA)
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromtga, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
+static const zend_function_entry gd_image_object_methods[] = {
+ PHP_FE_END
+};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagexbm, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, foreground)
-ZEND_END_ARG_INFO()
+static zend_function *php_gd_image_object_get_constructor(zend_object *object)
+{
+ zend_throw_error(NULL, "You cannot initialize a GdImage object except through helper functions");
+ return NULL;
+}
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegif, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
+/**
+ * Returns the underlying php_gd_image_object from a zend_object
+ */
-#ifdef HAVE_GD_PNG
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, quality)
- ZEND_ARG_INFO(0, filters)
-ZEND_END_ARG_INFO()
-#endif
+static zend_always_inline php_gd_image_object* php_gd_exgdimage_from_zobj_p(zend_object* obj)
+{
+ return (php_gd_image_object *) ((char *) (obj) - XtOffsetOf(php_gd_image_object, std));
+}
-#ifdef HAVE_GD_WEBP
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagewebp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, quality)
-ZEND_END_ARG_INFO()
-#endif
+/**
+ * Converts an extension GdImage instance contained within a zval into the gdImagePtr
+ * for use with library APIs
+ */
+static zend_always_inline gdImagePtr php_gd_libgdimageptr_from_zval_p(zval* zp)
+{
+ return php_gd_exgdimage_from_zobj_p(Z_OBJ_P(zp))->image;
+}
-#ifdef HAVE_GD_JPG
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagejpeg, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, quality)
-ZEND_END_ARG_INFO()
-#endif
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagewbmp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, foreground)
-ZEND_END_ARG_INFO()
+zend_object *php_gd_image_object_create(zend_class_entry *class_type)
+{
+ size_t block_len = sizeof(php_gd_image_object) + zend_object_properties_size(class_type);
+ php_gd_image_object *intern = emalloc(block_len);
+ memset(intern, 0, block_len);
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegd, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &php_gd_image_object_handlers;
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegd2, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, chunk_size)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
+ return &intern->std;
+};
-#if defined(HAVE_GD_BMP)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagebmp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, compressed)
-ZEND_END_ARG_INFO()
-#endif
+static void php_gd_image_object_free(zend_object *intern)
+{
+ php_gd_image_object *img_obj_ptr = php_gd_exgdimage_from_zobj_p(intern);
+ gdImageDestroy(img_obj_ptr->image);
+ img_obj_ptr->image = NULL;
-ZEND_BEGIN_ARG_INFO(arginfo_imagedestroy, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorallocate, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepalettecopy, 0)
- ZEND_ARG_INFO(0, dst)
- ZEND_ARG_INFO(0, src)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorat, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosest, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosesthwb, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolordeallocate, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorresolve, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorexact, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorset, 0, 0, 5)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, color)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorsforindex, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagegammacorrect, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, inputgamma)
- ZEND_ARG_INFO(0, outputgamma)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetpixel, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageline, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagedashedline, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagerectangle, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledrectangle, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagearc, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, s)
- ZEND_ARG_INFO(0, e)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageellipse, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilltoborder, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, border)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefill, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorstotal, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolortransparent, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageinterlace, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, interlace)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepolygon, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
- ZEND_ARG_INFO(0, num_pos)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageopenpolygon, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
- ZEND_ARG_INFO(0, num_pos)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledpolygon, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
- ZEND_ARG_INFO(0, num_pos)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefontwidth, 0)
- ZEND_ARG_INFO(0, font)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefontheight, 0)
- ZEND_ARG_INFO(0, font)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagechar, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, c)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecharup, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, c)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagestring, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagestringup, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopy, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopymerge, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
- ZEND_ARG_INFO(0, pct)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopymergegray, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
- ZEND_ARG_INFO(0, pct)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopyresized, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, dst_w)
- ZEND_ARG_INFO(0, dst_h)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesx, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesy, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetclip, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagegetclip, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
+ zend_object_std_dtor(intern);
+};
-#ifdef HAVE_GD_FREETYPE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageftbbox, 0, 0, 4)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefttext, 0, 0, 8)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagettfbbox, 0)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagettftext, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-#endif
+/**
+ * Creates a new GdImage object wrapping the gdImagePtr and attaches it
+ * to the zval (usually return_value).
+ *
+ * This function must only be called once per valid gdImagePtr
+ */
+void php_gd_assign_libgdimageptr_as_extgdimage(zval *val, gdImagePtr image)
+{
+ object_init_ex(val, gd_image_ce);
+ php_gd_exgdimage_from_zobj_p(Z_OBJ_P(val))->image = image;
+}
-ZEND_BEGIN_ARG_INFO_EX(arginfo_image2wbmp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, foreground)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_GD_JPG)
-ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0)
- ZEND_ARG_INFO(0, f_org)
- ZEND_ARG_INFO(0, f_dest)
- ZEND_ARG_INFO(0, d_height)
- ZEND_ARG_INFO(0, d_width)
- ZEND_ARG_INFO(0, d_threshold)
-ZEND_END_ARG_INFO()
-#endif
+static void php_gd_object_minit_helper()
+{
+ zend_class_entry ce;
+ INIT_CLASS_ENTRY(ce, "GdImage", gd_image_object_methods);
+ gd_image_ce = zend_register_internal_class(&ce);
+ gd_image_ce->ce_flags |= ZEND_ACC_FINAL;
+ gd_image_ce->create_object = php_gd_image_object_create;
+ gd_image_ce->serialize = zend_class_serialize_deny;
+ gd_image_ce->unserialize = zend_class_unserialize_deny;
-#if defined(HAVE_GD_PNG)
-ZEND_BEGIN_ARG_INFO(arginfo_png2wbmp, 0)
- ZEND_ARG_INFO(0, f_org)
- ZEND_ARG_INFO(0, f_dest)
- ZEND_ARG_INFO(0, d_height)
- ZEND_ARG_INFO(0, d_width)
- ZEND_ARG_INFO(0, d_threshold)
-ZEND_END_ARG_INFO()
-#endif
+ /* setting up the object handlers for the GdImage class */
+ memcpy(&php_gd_image_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
+ php_gd_image_object_handlers.clone_obj = NULL;
+ php_gd_image_object_handlers.free_obj = php_gd_image_object_free;
+ php_gd_image_object_handlers.get_constructor = php_gd_image_object_get_constructor;
+ php_gd_image_object_handlers.offset = XtOffsetOf(php_gd_image_object, std);
+}
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefilter, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, filtertype)
- ZEND_ARG_INFO(0, arg1)
- ZEND_ARG_INFO(0, arg2)
- ZEND_ARG_INFO(0, arg3)
- ZEND_ARG_INFO(0, arg4)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageconvolution, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, matrix3x3) /* ARRAY_INFO(0, matrix3x3, 0) */
- ZEND_ARG_INFO(0, div)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageflip, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageantialias, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, on)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecrop, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, rect)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecropauto, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, threshold)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagescale, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, new_width)
- ZEND_ARG_INFO(0, new_height)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffine, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, affine)
- ZEND_ARG_INFO(0, clip)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffinematrixget, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageaffinematrixconcat, 0)
- ZEND_ARG_INFO(0, m1)
- ZEND_ARG_INFO(0, m2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagesetinterpolation, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageresolution, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, res_x)
- ZEND_ARG_INFO(0, res_y)
-ZEND_END_ARG_INFO()
-/* }}} */
+/*********************************************************
+ *
+ * Extension Implementation
+ *
+ ********************************************************/
/* {{{ gd_functions[]
*/
@@ -908,7 +284,7 @@ static const zend_function_entry gd_functions[] = {
PHP_FE(imagegrabscreen, arginfo_imagegrabscreen)
#endif
- PHP_FE(imagerotate, arginfo_imagerotate)
+ PHP_FE(imagerotate, arginfo_imagerotate)
PHP_FE(imageflip, arginfo_imageflip)
PHP_FE(imageantialias, arginfo_imageantialias)
@@ -918,7 +294,7 @@ static const zend_function_entry gd_functions[] = {
PHP_FE(imageaffine, arginfo_imageaffine)
PHP_FE(imageaffinematrixconcat, arginfo_imageaffinematrixconcat)
PHP_FE(imageaffinematrixget, arginfo_imageaffinematrixget)
- PHP_FE(imagesetinterpolation, arginfo_imagesetinterpolation)
+ PHP_FE(imagesetinterpolation, arginfo_imagesetinterpolation)
PHP_FE(imagesettile, arginfo_imagesettile)
PHP_FE(imagesetbrush, arginfo_imagesetbrush)
PHP_FE(imagesetstyle, arginfo_imagesetstyle)
@@ -957,7 +333,7 @@ static const zend_function_entry gd_functions[] = {
#ifdef HAVE_GD_JPG
PHP_FE(imagejpeg, arginfo_imagejpeg)
#endif
- PHP_FE(imagewbmp, arginfo_imagewbmp)
+ PHP_FE(imagewbmp, arginfo_imagewbmp)
PHP_FE(imagegd, arginfo_imagegd)
PHP_FE(imagegd2, arginfo_imagegd2)
#ifdef HAVE_GD_BMP
@@ -996,20 +372,13 @@ static const zend_function_entry gd_functions[] = {
PHP_FE(imagetypes, arginfo_imagetypes)
-#if defined(HAVE_GD_JPG)
- PHP_DEP_FE(jpeg2wbmp, arginfo_jpeg2wbmp)
-#endif
-#if defined(HAVE_GD_PNG)
- PHP_DEP_FE(png2wbmp, arginfo_png2wbmp)
-#endif
- PHP_DEP_FE(image2wbmp, arginfo_image2wbmp)
PHP_FE(imagelayereffect, arginfo_imagelayereffect)
- PHP_FE(imagexbm, arginfo_imagexbm)
+ PHP_FE(imagexbm, arginfo_imagexbm)
PHP_FE(imagecolormatch, arginfo_imagecolormatch)
/* gd filters */
- PHP_FE(imagefilter, arginfo_imagefilter)
+ PHP_FE(imagefilter, arginfo_imagefilter)
PHP_FE(imageconvolution, arginfo_imageconvolution)
PHP_FE(imageresolution, arginfo_imageresolution)
@@ -1041,14 +410,6 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_free_gd_image
- */
-static void php_free_gd_image(zend_resource *rsrc)
-{
- gdImageDestroy((gdImagePtr) rsrc->ptr);
-}
-/* }}} */
-
/* {{{ php_free_gd_font
*/
static void php_free_gd_font(zend_resource *rsrc)
@@ -1067,7 +428,6 @@ static void php_free_gd_font(zend_resource *rsrc)
*/
void php_gd_error_method(int type, const char *format, va_list args)
{
-
switch (type) {
#ifndef PHP_WIN32
case GD_DEBUG:
@@ -1090,8 +450,8 @@ void php_gd_error_method(int type, const char *format, va_list args)
*/
PHP_MINIT_FUNCTION(gd)
{
- le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, "gd", module_number);
le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, "gd font", module_number);
+ php_gd_object_minit_helper();
#if defined(HAVE_GD_FREETYPE) && defined(HAVE_GD_BUNDLED)
gdFontCacheMutexSetup();
@@ -1124,7 +484,7 @@ PHP_MINIT_FUNCTION(gd)
REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
- /* GD2 image format types */
+ /* GD2 image format types */
REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT);
@@ -1400,13 +760,6 @@ PHP_FUNCTION(gd_info)
}
/* }}} */
-/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */
-PHP_GD_API int phpi_get_le_gd(void)
-{
- return le_gd;
-}
-/* }}} */
-
#define FLIPWORD(a) (((a & 0xff000000) >> 24) | ((a & 0x00ff0000) >> 8) | ((a & 0x0000ff00) << 8) | ((a & 0x000000ff) << 24))
/* {{{ proto int imageloadfont(string filename)
@@ -1521,21 +874,19 @@ PHP_FUNCTION(imagesetstyle)
gdImagePtr im;
int *stylearr;
int index = 0;
- uint32_t num_styles;
+ uint32_t num_styles;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &IM, &styles) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oa", &IM, gd_image_ce, &styles) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
- num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
- if (num_styles == 0) {
- php_error_docref(NULL, E_WARNING, "styles array must not be empty");
- RETURN_FALSE;
- }
+ num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
+ if (num_styles == 0) {
+ zend_value_error("Styles array must not be empty");
+ return;
+ }
/* copy the style values in the stylearr */
stylearr = safe_emalloc(sizeof(int), num_styles, 0);
@@ -1563,9 +914,14 @@ PHP_FUNCTION(imagecreatetruecolor)
return;
}
- if (x_size <= 0 || y_size <= 0 || x_size >= INT_MAX || y_size >= INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
+ if (x_size <= 0 || x_size >= INT_MAX) {
+ zend_value_error("Invalid width (x_size)");
+ return;
+ }
+
+ if (y_size <= 0 || y_size >= INT_MAX) {
+ zend_value_error("Invalid height (y_size)");
+ return;
}
im = gdImageCreateTrueColor(x_size, y_size);
@@ -1574,7 +930,7 @@ PHP_FUNCTION(imagecreatetruecolor)
RETURN_FALSE;
}
- RETURN_RES(zend_register_resource(im, le_gd));
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -1585,13 +941,11 @@ PHP_FUNCTION(imageistruecolor)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_BOOL(im->trueColor);
}
@@ -1606,18 +960,17 @@ PHP_FUNCTION(imagetruecolortopalette)
zend_long ncolors;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rbl", &IM, &dither, &ncolors) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Obl", &IM, gd_image_ce, &dither, &ncolors) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (ncolors <= 0 || ZEND_LONG_INT_OVFL(ncolors)) {
- php_error_docref(NULL, E_WARNING, "Number of colors has to be greater than zero and no more than %d", INT_MAX);
- RETURN_FALSE;
+ zend_value_error("Number of colors has to be greater than zero and no more than %d", INT_MAX);
+ return;
}
+
if (gdImageTrueColorToPalette(im, dither, (int)ncolors)) {
RETURN_TRUE;
} else {
@@ -1634,13 +987,11 @@ PHP_FUNCTION(imagepalettetotruecolor)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImagePaletteToTrueColor(im) == 0) {
RETURN_FALSE;
@@ -1658,16 +1009,12 @@ PHP_FUNCTION(imagecolormatch)
gdImagePtr im1, im2;
int result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &IM1, &IM2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &IM1, gd_image_ce, &IM2, gd_image_ce) == FAILURE) {
return;
}
- if ((im1 = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM1), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
- if ((im2 = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM2), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im1 = php_gd_libgdimageptr_from_zval_p(IM1);
+ im2 = php_gd_libgdimageptr_from_zval_p(IM2);
result = gdImageColorMatch(im1, im2);
switch (result) {
@@ -1701,13 +1048,11 @@ PHP_FUNCTION(imagesetthickness)
zend_long thick;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &thick) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &thick) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageSetThickness(im, thick);
@@ -1723,16 +1068,13 @@ PHP_FUNCTION(imagefilledellipse)
zend_long cx, cy, w, h, color;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &color) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFilledEllipse(im, cx, cy, w, h, color);
-
RETURN_TRUE;
}
/* }}} */
@@ -1746,13 +1088,11 @@ PHP_FUNCTION(imagefilledarc)
gdImagePtr im;
int e, st;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollllllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
e = E;
if (e < 0) {
@@ -1778,13 +1118,11 @@ PHP_FUNCTION(imagealphablending)
zend_bool blend;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &IM, &blend) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &IM, gd_image_ce, &blend) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageAlphaBlending(im, blend);
@@ -1800,13 +1138,11 @@ PHP_FUNCTION(imagesavealpha)
zend_bool save;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &IM, &save) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &IM, gd_image_ce, &save) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageSaveAlpha(im, save);
@@ -1822,13 +1158,11 @@ PHP_FUNCTION(imagelayereffect)
zend_long effect;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &effect) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &effect) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageAlphaBlending(im, effect);
@@ -1838,8 +1172,8 @@ PHP_FUNCTION(imagelayereffect)
#define CHECK_RGBA_RANGE(component, name) \
if (component < 0 || component > gd##name##Max) { \
- php_error_docref(NULL, E_WARNING, #name " component is out of range"); \
- RETURN_FALSE; \
+ zend_value_error(#name " component is out of range, must be between 0 and %d (inclusive)", gd##name##Max); \
+ return; \
}
/* {{{ proto int imagecolorallocatealpha(resource im, int red, int green, int blue, int alpha)
@@ -1851,13 +1185,11 @@ PHP_FUNCTION(imagecolorallocatealpha)
gdImagePtr im;
int ct = (-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
+ return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1880,13 +1212,11 @@ PHP_FUNCTION(imagecolorresolvealpha)
zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1905,13 +1235,11 @@ PHP_FUNCTION(imagecolorclosestalpha)
zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1930,13 +1258,11 @@ PHP_FUNCTION(imagecolorexactalpha)
zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1956,17 +1282,12 @@ PHP_FUNCTION(imagecopyresampled)
gdImagePtr im_dst, im_src;
int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOllllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
return;
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -2000,7 +1321,7 @@ PHP_FUNCTION(imagegrabwindow)
gdImagePtr im = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &lwindow_handle, &client_area) == FAILURE) {
- RETURN_FALSE;
+ return;
}
window = (HWND) lwindow_handle;
@@ -2048,9 +1369,9 @@ PHP_FUNCTION(imagegrabwindow)
if (!im) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -2105,9 +1426,9 @@ PHP_FUNCTION(imagegrabscreen)
if (!im) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
#endif /* PHP_WIN32 */
@@ -2122,21 +1443,18 @@ PHP_FUNCTION(imagerotate)
zend_long color;
zend_long ignoretransparent = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rdl|l", &SIM, &degrees, &color, &ignoretransparent) == FAILURE) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Odl|l", &SIM, gd_image_ce, &degrees, &color, &ignoretransparent) == FAILURE) {
+ return;
}
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
im_dst = gdImageRotateInterpolated(im_src, (const float)degrees, color);
- if (im_dst != NULL) {
- RETURN_RES(zend_register_resource(im_dst, le_gd));
- } else {
+ if (im_dst == NULL) {
RETURN_FALSE;
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_dst);
}
/* }}} */
@@ -2147,17 +1465,12 @@ PHP_FUNCTION(imagesettile)
zval *IM, *TILE;
gdImagePtr im, tile;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &IM, &TILE) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &IM, gd_image_ce, &TILE, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((tile = (gdImagePtr)zend_fetch_resource(Z_RES_P(TILE), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
+ tile = php_gd_libgdimageptr_from_zval_p(TILE);
gdImageSetTile(im, tile);
@@ -2172,17 +1485,12 @@ PHP_FUNCTION(imagesetbrush)
zval *IM, *TILE;
gdImagePtr im, tile;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &IM, &TILE) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &IM, gd_image_ce, &TILE, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((tile = (gdImagePtr)zend_fetch_resource(Z_RES_P(TILE), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
+ tile = php_gd_libgdimageptr_from_zval_p(TILE);
gdImageSetBrush(im, tile);
@@ -2201,9 +1509,14 @@ PHP_FUNCTION(imagecreate)
return;
}
- if (x_size <= 0 || y_size <= 0 || x_size >= INT_MAX || y_size >= INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
+ if (x_size <= 0 || x_size >= INT_MAX) {
+ zend_value_error("Invalid width (x_size)");
+ return;
+ }
+
+ if (y_size <= 0 || y_size >= INT_MAX) {
+ zend_value_error("Invalid height (y_size)");
+ return;
}
im = gdImageCreate(x_size, y_size);
@@ -2212,7 +1525,7 @@ PHP_FUNCTION(imagecreate)
RETURN_FALSE;
}
- RETURN_RES(zend_register_resource(im, le_gd));
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -2312,12 +1625,12 @@ static int _php_image_type (char data[12])
/* {{{ _php_image_create_from_string
*/
-gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioctx_func_p)())
+gdImagePtr _php_image_create_from_string(zend_string *data, char *tn, gdImagePtr (*ioctx_func_p)())
{
gdImagePtr im;
gdIOCtx *io_ctx;
- io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0);
+ io_ctx = gdNewDynamicCtxEx(ZSTR_LEN(data), ZSTR_VAL(data), 0);
if (!io_ctx) {
return NULL;
@@ -2340,25 +1653,21 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct
Create a new image from the image stream in the string */
PHP_FUNCTION(imagecreatefromstring)
{
- zval *data;
+ zend_string *data;
gdImagePtr im;
int imtype;
char sig[12];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &data) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) {
return;
}
- if (!try_convert_to_string(data)) {
- return;
- }
-
- if (Z_STRLEN_P(data) < sizeof(sig)) {
+ if (ZSTR_LEN(data) < sizeof(sig)) {
php_error_docref(NULL, E_WARNING, "Empty string or invalid image");
RETURN_FALSE;
}
- memcpy(sig, Z_STRVAL_P(data), sizeof(sig));
+ memcpy(sig, ZSTR_VAL(data), sizeof(sig));
imtype = _php_image_type(sig);
@@ -2416,7 +1725,7 @@ PHP_FUNCTION(imagecreatefromstring)
RETURN_FALSE;
}
- RETURN_RES(zend_register_resource(im, le_gd));
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -2438,10 +1747,17 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
return;
}
- if (width < 1 || height < 1) {
- php_error_docref(NULL, E_WARNING, "Zero width or height not allowed");
- RETURN_FALSE;
+
+ if (width < 1) {
+ zend_value_error("Width must be at least 1");
+ return;
+ }
+
+ if (height < 1) {
+ zend_value_error("Height must be at least 1");
+ return;
}
+
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &file, &file_len) == FAILURE) {
return;
@@ -2526,8 +1842,8 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
/* register_im: */
if (im) {
- RETVAL_RES(zend_register_resource(im, le_gd));
php_stream_close(stream);
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
return;
}
@@ -2661,16 +1977,13 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
int argc = ZEND_NUM_ARGS();
int q = -1, t = 1;
- /* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */
/* The quality parameter for gd2 stands for chunk size */
- if (zend_parse_parameters(argc, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) {
+ if (zend_parse_parameters(argc, "O|pll", &imgind, gd_image_ce, &file, &file_len, &quality, &type) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(imgind), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(imgind);
if (argc > 1) {
fn = file;
@@ -2847,22 +2160,16 @@ PHP_FUNCTION(imagebmp)
#endif
/* {{{ proto bool imagedestroy(resource im)
- Destroy an image */
+ Destroy an image - No effect as of PHP 8.0 */
PHP_FUNCTION(imagedestroy)
{
+ /* This function used to free the resource, as resources are no longer used, it does nothing */
zval *IM;
- gdImagePtr im;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- zend_list_close(Z_RES_P(IM));
-
RETURN_TRUE;
}
/* }}} */
@@ -2876,13 +2183,11 @@ PHP_FUNCTION(imagecolorallocate)
gdImagePtr im;
int ct = (-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -2903,17 +2208,12 @@ PHP_FUNCTION(imagepalettecopy)
zval *dstim, *srcim;
gdImagePtr dst, src;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &dstim, &srcim) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &dstim, gd_image_ce, &srcim, gd_image_ce) == FAILURE) {
return;
}
- if ((dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(dstim), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((src = (gdImagePtr)zend_fetch_resource(Z_RES_P(srcim), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ src = php_gd_libgdimageptr_from_zval_p(srcim);
+ dst = php_gd_libgdimageptr_from_zval_p(dstim);
gdImagePaletteCopy(dst, src);
}
@@ -2928,14 +2228,12 @@ PHP_FUNCTION(imagecolorat)
gdImagePtr im;
ZEND_PARSE_PARAMETERS_START(3, 3)
- Z_PARAM_RESOURCE(IM)
+ Z_PARAM_OBJECT_OF_CLASS(IM, gd_image_ce)
Z_PARAM_LONG(x)
Z_PARAM_LONG(y)
ZEND_PARSE_PARAMETERS_END();
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImageTrueColor(im)) {
if (im->tpixels && gdImageBoundsSafe(im, x, y)) {
@@ -2963,13 +2261,11 @@ PHP_FUNCTION(imagecolorclosest)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -2987,13 +2283,11 @@ PHP_FUNCTION(imagecolorclosesthwb)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3012,13 +2306,11 @@ PHP_FUNCTION(imagecolordeallocate)
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &index) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
/* We can return right away for a truecolor image as deallocating colours is meaningless here */
if (gdImageTrueColor(im)) {
@@ -3031,8 +2323,8 @@ PHP_FUNCTION(imagecolordeallocate)
gdImageColorDeallocate(im, col);
RETURN_TRUE;
} else {
- php_error_docref(NULL, E_WARNING, "Color index %d out of range", col);
- RETURN_FALSE;
+ zend_value_error("Color index %d out of range", col);
+ return;
}
}
/* }}} */
@@ -3045,13 +2337,11 @@ PHP_FUNCTION(imagecolorresolve)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3069,13 +2359,11 @@ PHP_FUNCTION(imagecolorexact)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3094,13 +2382,11 @@ PHP_FUNCTION(imagecolorset)
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll|l", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll|l", &IM, gd_image_ce, &color, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3129,13 +2415,11 @@ PHP_FUNCTION(imagecolorsforindex)
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &index) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
col = index;
@@ -3162,20 +2446,18 @@ PHP_FUNCTION(imagegammacorrect)
int i;
double input, output, gamma;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rdd", &IM, &input, &output) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Odd", &IM, gd_image_ce, &input, &output) == FAILURE) {
return;
}
if ( input <= 0.0 || output <= 0.0 ) {
- php_error_docref(NULL, E_WARNING, "Gamma values should be positive");
- RETURN_FALSE;
+ zend_value_error("Gamma values must be positive");
+ return;
}
gamma = input / output;
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImageTrueColor(im)) {
int x, y, c;
@@ -3215,15 +2497,13 @@ PHP_FUNCTION(imagesetpixel)
gdImagePtr im;
ZEND_PARSE_PARAMETERS_START(4, 4)
- Z_PARAM_RESOURCE(IM)
+ Z_PARAM_OBJECT_OF_CLASS(IM, gd_image_ce)
Z_PARAM_LONG(x)
Z_PARAM_LONG(y)
Z_PARAM_LONG(col)
ZEND_PARSE_PARAMETERS_END();
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageSetPixel(im, x, y, col);
RETURN_TRUE;
@@ -3238,13 +2518,11 @@ PHP_FUNCTION(imageline)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (im->AA) {
gdImageSetAntiAliased(im, col);
@@ -3263,13 +2541,11 @@ PHP_FUNCTION(imagedashedline)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageDashedLine(im, x1, y1, x2, y2, col);
RETURN_TRUE;
@@ -3284,13 +2560,11 @@ PHP_FUNCTION(imagerectangle)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageRectangle(im, x1, y1, x2, y2, col);
RETURN_TRUE;
@@ -3305,13 +2579,11 @@ PHP_FUNCTION(imagefilledrectangle)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFilledRectangle(im, x1, y1, x2, y2, col);
RETURN_TRUE;
}
@@ -3326,13 +2598,11 @@ PHP_FUNCTION(imagearc)
gdImagePtr im;
int e, st;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
e = E;
if (e < 0) {
@@ -3357,13 +2627,11 @@ PHP_FUNCTION(imageellipse)
zend_long cx, cy, w, h, color;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &color) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageEllipse(im, cx, cy, w, h, color);
RETURN_TRUE;
@@ -3378,13 +2646,11 @@ PHP_FUNCTION(imagefilltoborder)
zend_long x, y, border, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &x, &y, &border, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &x, &y, &border, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFillToBorder(im, x, y, border, col);
RETURN_TRUE;
@@ -3399,13 +2665,11 @@ PHP_FUNCTION(imagefill)
zend_long x, y, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &x, &y, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &x, &y, &col) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFill(im, x, y, col);
RETURN_TRUE;
@@ -3419,13 +2683,11 @@ PHP_FUNCTION(imagecolorstotal)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_LONG(gdImageColorsTotal(im));
}
@@ -3440,13 +2702,11 @@ PHP_FUNCTION(imagecolortransparent)
gdImagePtr im;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "r|l", &IM, &COL) == FAILURE) {
+ if (zend_parse_parameters(argc, "O|l", &IM, gd_image_ce, &COL) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (argc > 1) {
gdImageColorTransparent(im, COL);
@@ -3465,13 +2725,11 @@ PHP_FUNCTION(imageinterlace)
zend_long INT = 0;
gdImagePtr im;
- if (zend_parse_parameters(argc, "r|l", &IM, &INT) == FAILURE) {
+ if (zend_parse_parameters(argc, "O|l", &IM, gd_image_ce, &INT) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (argc > 1) {
gdImageInterlace(im, INT);
@@ -3495,29 +2753,29 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
gdPointPtr points;
int npoints, col, nelem, i;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rall", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oall", &IM, gd_image_ce, &POINTS, &NPOINTS, &COL) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
npoints = NPOINTS;
col = COL;
nelem = zend_hash_num_elements(Z_ARRVAL_P(POINTS));
if (nelem < 6) {
- php_error_docref(NULL, E_WARNING, "You must have at least 3 points in your array");
- RETURN_FALSE;
+ zend_value_error("You must have at least 3 points in your array");
+ return;
}
+
if (npoints <= 0) {
- php_error_docref(NULL, E_WARNING, "You must give a positive number of points");
- RETURN_FALSE;
+ zend_value_error("You must give a positive number of points");
+ return;
}
+
if (nelem < npoints * 2) {
- php_error_docref(NULL, E_WARNING, "Trying to use %d points in array with only %d points", npoints, nelem/2);
- RETURN_FALSE;
+ zend_value_error("Trying to use %d points in array with only %d points", npoints, nelem/2);
+ return;
}
points = (gdPointPtr) safe_emalloc(npoints, sizeof(gdPoint), 0);
@@ -3694,13 +2952,11 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
unsigned char *str = NULL;
gdFontPtr font;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllsl", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllsl", &IM, gd_image_ce, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
col = COL;
@@ -3787,17 +3043,12 @@ PHP_FUNCTION(imagecopy)
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
return;
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
srcX = SX;
srcY = SY;
@@ -3820,17 +3071,12 @@ PHP_FUNCTION(imagecopymerge)
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX, pct;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOlllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
return;
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -3854,17 +3100,12 @@ PHP_FUNCTION(imagecopymergegray)
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX, pct;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOlllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
return;
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -3888,18 +3129,13 @@ PHP_FUNCTION(imagecopyresized)
gdImagePtr im_dst, im_src;
int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOllllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
return;
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
+
srcX = SX;
srcY = SY;
srcH = SH;
@@ -3910,8 +3146,8 @@ PHP_FUNCTION(imagecopyresized)
dstW = DW;
if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
- php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
+ zend_value_error("Invalid image dimensions");
+ return;
}
gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
@@ -3926,13 +3162,11 @@ PHP_FUNCTION(imagesx)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_LONG(gdImageSX(im));
}
@@ -3945,13 +3179,11 @@ PHP_FUNCTION(imagesy)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_LONG(gdImageSY(im));
}
@@ -3965,13 +3197,11 @@ PHP_FUNCTION(imagesetclip)
gdImagePtr im;
zend_long x1, y1, x2, y2;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &im_zval, &x1, &y1, &x2, &y2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &im_zval, gd_image_ce, &x1, &y1, &x2, &y2) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(im_zval), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(im_zval);
gdImageSetClip(im, x1, y1, x2, y2);
RETURN_TRUE;
@@ -3986,13 +3216,11 @@ PHP_FUNCTION(imagegetclip)
gdImagePtr im;
int x1, y1, x2, y2;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &im_zval) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &im_zval, gd_image_ce) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(im_zval), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(im_zval);
gdImageGetClip(im, &x1, &y1, &x2, &y2);
@@ -4059,17 +3287,15 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
if (argc < 4 || argc > ((extended) ? 5 : 4)) {
ZEND_WRONG_PARAM_COUNT();
} else if (zend_parse_parameters(argc, "ddss|a", &ptsize, &angle, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
- RETURN_FALSE;
+ return;
}
} else {
if (argc < 8 || argc > ((extended) ? 9 : 8)) {
ZEND_WRONG_PARAM_COUNT();
- } else if (zend_parse_parameters(argc, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
- RETURN_FALSE;
- }
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ } else if (zend_parse_parameters(argc, "Oddlllss|a", &IM, gd_image_ce, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
+ return;
}
+ im = php_gd_libgdimageptr_from_zval_p(IM);
}
/* convert angle to radians */
@@ -4124,234 +3350,14 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
/* }}} */
#endif /* HAVE_GD_FREETYPE */
-/* {{{ proto bool image2wbmp(resource im [, string filename [, int foreground]])
- Output WBMP image to browser or file */
-PHP_FUNCTION(image2wbmp)
-{
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", NULL);
-}
-/* }}} */
-
-#if defined(HAVE_GD_JPG)
-/* {{{ proto bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)
- Convert JPEG image to WBMP image */
-PHP_FUNCTION(jpeg2wbmp)
-{
- _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG);
-}
-/* }}} */
-#endif
-
-#if defined(HAVE_GD_PNG)
-/* {{{ proto bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)
- Convert PNG image to WBMP image */
-PHP_FUNCTION(png2wbmp)
-{
- _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG);
-}
-/* }}} */
-#endif
-
-/* {{{ _php_image_convert
- * _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
-{
- char *f_org, *f_dest;
- size_t f_org_len, f_dest_len;
- zend_long height, width, threshold;
- gdImagePtr im_org, im_dest, im_tmp;
- char *fn_org = NULL;
- char *fn_dest = NULL;
- FILE *org, *dest;
- int dest_height = -1;
- int dest_width = -1;
- int org_height, org_width;
- int white, black;
- int color, color_org, median;
- int int_threshold;
- int x, y;
- float x_ratio, y_ratio;
-#ifdef HAVE_GD_JPG
- zend_long ignore_warning;
-#endif
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) {
- return;
- }
-
- fn_org = f_org;
- fn_dest = f_dest;
- dest_height = height;
- dest_width = width;
- int_threshold = threshold;
-
- /* Check threshold value */
- if (int_threshold < 0 || int_threshold > 8) {
- php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'", int_threshold);
- RETURN_FALSE;
- }
-
- /* Check origin file */
- PHP_GD_CHECK_OPEN_BASEDIR(fn_org, "Invalid origin filename");
-
- /* Check destination file */
- PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, "Invalid destination filename");
-
- /* Open origin file */
- org = VCWD_FOPEN(fn_org, "rb");
- if (!org) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' for reading", fn_org);
- RETURN_FALSE;
- }
-
- /* Open destination file */
- dest = VCWD_FOPEN(fn_dest, "wb");
- if (!dest) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' for writing", fn_dest);
- fclose(org);
- RETURN_FALSE;
- }
-
- switch (image_type) {
-
-#ifdef HAVE_GD_JPG
- case PHP_GDIMG_TYPE_JPG:
- ignore_warning = INI_INT("gd.jpeg_ignore_warning");
- im_org = gdImageCreateFromJpegEx(org, ignore_warning);
- if (im_org == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest);
- fclose(org);
- fclose(dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_JPG */
-
-#ifdef HAVE_GD_PNG
- case PHP_GDIMG_TYPE_PNG:
- im_org = gdImageCreateFromPng(org);
- if (im_org == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid PNG file", fn_dest);
- fclose(org);
- fclose(dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_PNG */
-
- default:
- php_error_docref(NULL, E_WARNING, "Format not supported");
- fclose(org);
- fclose(dest);
- RETURN_FALSE;
- break;
- }
-
- fclose(org);
-
- org_width = gdImageSX (im_org);
- org_height = gdImageSY (im_org);
-
- x_ratio = (float) org_width / (float) dest_width;
- y_ratio = (float) org_height / (float) dest_height;
-
- if (x_ratio > 1 && y_ratio > 1) {
- if (y_ratio > x_ratio) {
- x_ratio = y_ratio;
- } else {
- y_ratio = x_ratio;
- }
- dest_width = (int) (org_width / x_ratio);
- dest_height = (int) (org_height / y_ratio);
- } else {
- x_ratio = (float) dest_width / (float) org_width;
- y_ratio = (float) dest_height / (float) org_height;
-
- if (y_ratio < x_ratio) {
- x_ratio = y_ratio;
- } else {
- y_ratio = x_ratio;
- }
- dest_width = (int) (org_width * x_ratio);
- dest_height = (int) (org_height * y_ratio);
- }
-
- im_tmp = gdImageCreate (dest_width, dest_height);
- if (im_tmp == NULL ) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate temporary buffer");
- fclose(dest);
- gdImageDestroy(im_org);
- RETURN_FALSE;
- }
-
- gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height);
-
- gdImageDestroy(im_org);
-
- im_dest = gdImageCreate(dest_width, dest_height);
- if (im_dest == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate destination buffer");
- fclose(dest);
- gdImageDestroy(im_tmp);
- RETURN_FALSE;
- }
-
- white = gdImageColorAllocate(im_dest, 255, 255, 255);
- if (white == -1) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer");
- fclose(dest);
- gdImageDestroy(im_tmp);
- gdImageDestroy(im_dest);
- RETURN_FALSE;
- }
-
- black = gdImageColorAllocate(im_dest, 0, 0, 0);
- if (black == -1) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer");
- fclose(dest);
- gdImageDestroy(im_tmp);
- gdImageDestroy(im_dest);
- RETURN_FALSE;
- }
-
- int_threshold = int_threshold * 32;
-
- for (y = 0; y < dest_height; y++) {
- for (x = 0; x < dest_width; x++) {
- color_org = gdImageGetPixel (im_tmp, x, y);
- median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3;
- if (median < int_threshold) {
- color = black;
- } else {
- color = white;
- }
- gdImageSetPixel (im_dest, x, y, color);
- }
- }
-
- gdImageDestroy (im_tmp );
-
- gdImageWBMP(im_dest, black , dest);
-
- fflush(dest);
- fclose(dest);
-
- gdImageDestroy(im_dest);
-
- RETURN_TRUE;
-}
-/* }}} */
-
/* Section Filters */
#define PHP_GD_SINGLE_RES \
zval *SIM; \
gdImagePtr im_src; \
- if (zend_parse_parameters(1, "r", &SIM) == FAILURE) { \
- RETURN_FALSE; \
+ if (zend_parse_parameters(1, "O", &SIM, gd_image_ce) == FAILURE) { \
+ return; \
} \
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) { \
- RETURN_FALSE; \
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS)
{
@@ -4381,13 +3387,11 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS)
gdImagePtr im_src;
zend_long brightness, tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zll", &SIM, &tmp, &brightness) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oll", &SIM, gd_image_ce, &tmp, &brightness) == FAILURE) {
+ return;
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageBrightness(im_src, (int)brightness) == 1) {
RETURN_TRUE;
@@ -4402,13 +3406,11 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS)
gdImagePtr im_src;
zend_long contrast, tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &SIM, &tmp, &contrast) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oll", &SIM, gd_image_ce, &tmp, &contrast) == FAILURE) {
+ return;
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageContrast(im_src, (int)contrast) == 1) {
RETURN_TRUE;
@@ -4424,13 +3426,11 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
zend_long r,g,b,tmp;
zend_long a = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll|l", &SIM, gd_image_ce, &tmp, &r, &g, &b, &a) == FAILURE) {
+ return;
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) {
RETURN_TRUE;
@@ -4501,13 +3501,11 @@ static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS)
gdImagePtr im_src;
double weight;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rld", &SIM, &tmp, &weight) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Old", &SIM, gd_image_ce, &tmp, &weight) == FAILURE) {
+ return;
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageSmooth(im_src, (float)weight)==1) {
RETURN_TRUE;
@@ -4523,13 +3521,11 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS)
zend_long tmp, blocksize;
zend_bool mode = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll|b", &IM, &tmp, &blocksize, &mode) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oll|b", &IM, gd_image_ce, &tmp, &blocksize, &mode) == FAILURE) {
+ return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImagePixelate(im, (int) blocksize, (const unsigned int) mode)) {
RETURN_TRUE;
@@ -4546,13 +3542,11 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
zend_long tmp;
zend_long scatter_sub, scatter_plus;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll|a", &IM, &tmp, &scatter_sub, &scatter_plus, &hash_colors) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll|a", &IM, gd_image_ce, &tmp, &scatter_sub, &scatter_plus, &hash_colors) == FAILURE) {
+ return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (hash_colors) {
uint32_t i = 0;
@@ -4574,7 +3568,7 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
efree(colors);
} else {
- RETURN_BOOL(gdImageScatter(im, (int) scatter_sub, (int) scatter_plus))
+ RETURN_BOOL(gdImageScatter(im, (int) scatter_sub, (int) scatter_plus));
}
}
@@ -4605,7 +3599,7 @@ PHP_FUNCTION(imagefilter)
if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > IMAGE_FILTER_MAX_ARGS) {
WRONG_PARAM_COUNT;
- } else if (zend_parse_parameters(2, "rl", &tmp, &filtertype) == FAILURE) {
+ } else if (zend_parse_parameters(2, "Ol", &tmp, gd_image_ce, &filtertype) == FAILURE) {
return;
}
@@ -4626,33 +3620,31 @@ PHP_FUNCTION(imageconvolution)
int nelem, i, j, res;
float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "radd", &SIM, &hash_matrix, &div, &offset) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oadd", &SIM, gd_image_ce, &hash_matrix, &div, &offset) == FAILURE) {
+ return;
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix));
if (nelem != 3) {
- php_error_docref(NULL, E_WARNING, "You must have 3x3 array");
- RETURN_FALSE;
+ zend_value_error("Convolution matrix must be a 3x3 array");
+ return;
}
for (i=0; i<3; i++) {
if ((var = zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i))) != NULL && Z_TYPE_P(var) == IS_ARRAY) {
if (zend_hash_num_elements(Z_ARRVAL_P(var)) != 3 ) {
- php_error_docref(NULL, E_WARNING, "You must have 3x3 array");
- RETURN_FALSE;
+ zend_value_error("Convolution matrix must be a 3x3 array, matrix[%d] only has %d elements", i, zend_hash_num_elements(Z_ARRVAL_P(var)));
+ return;
}
for (j=0; j<3; j++) {
if ((var2 = zend_hash_index_find(Z_ARRVAL_P(var), j)) != NULL) {
matrix[i][j] = (float) zval_get_double(var2);
} else {
- php_error_docref(NULL, E_WARNING, "You must have a 3x3 matrix");
- RETURN_FALSE;
+ zend_value_error("Convolution matrix must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)", i, j);
+ return;
}
}
}
@@ -4676,13 +3668,11 @@ PHP_FUNCTION(imageflip)
zend_long mode;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &mode) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
switch (mode) {
case GD_FLIP_VERTICAL:
@@ -4698,8 +3688,8 @@ PHP_FUNCTION(imageflip)
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown flip mode");
- RETURN_FALSE;
+ zend_value_error("Unknown flip mode");
+ return;
}
RETURN_TRUE;
@@ -4714,14 +3704,11 @@ PHP_FUNCTION(imageantialias)
zend_bool alias;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &IM, &alias) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &IM, gd_image_ce, &alias) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (im->trueColor) {
im->AA = alias;
}
@@ -4741,49 +3728,47 @@ PHP_FUNCTION(imagecrop)
zval *z_rect;
zval *tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &IM, &z_rect) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oa", &IM, gd_image_ce, &z_rect) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "x", sizeof("x") -1)) != NULL) {
rect.x = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing x position");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing x position");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "y", sizeof("y") - 1)) != NULL) {
rect.y = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing y position");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing y position");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "width", sizeof("width") - 1)) != NULL) {
rect.width = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing width");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing width");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "height", sizeof("height") - 1)) != NULL) {
rect.height = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing height");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing height");
+ return;
}
im_crop = gdImageCrop(im, &rect);
if (im_crop == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im_crop, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_crop);
}
/* }}} */
@@ -4798,19 +3783,13 @@ PHP_FUNCTION(imagecropauto)
gdImagePtr im;
gdImagePtr im_crop;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ldl", &IM, &mode, &threshold, &color) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ldl", &IM, gd_image_ce, &mode, &threshold, &color) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
switch (mode) {
- case -1:
- php_error_docref(NULL, E_DEPRECATED, "Crop mode -1 is deprecated. Use IMG_CROP_DEFAULT instead.");
- mode = GD_CROP_DEFAULT;
- /* FALLTHRU */
case GD_CROP_DEFAULT:
case GD_CROP_TRANSPARENT:
case GD_CROP_BLACK:
@@ -4821,21 +3800,22 @@ PHP_FUNCTION(imagecropauto)
case GD_CROP_THRESHOLD:
if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
- php_error_docref(NULL, E_WARNING, "Color argument missing with threshold mode");
- RETURN_FALSE;
+ zend_value_error("Color argument missing with threshold mode");
+ return;
}
im_crop = gdImageCropThreshold(im, color, (float) threshold);
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown crop mode");
- RETURN_FALSE;
+ zend_value_error("Unknown crop mode");
+ return;
}
+
if (im_crop == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im_crop, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_crop);
}
/* }}} */
@@ -4850,14 +3830,12 @@ PHP_FUNCTION(imagescale)
zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
gdInterpolationMethod method, old_method;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|ll", &IM, gd_image_ce, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
return;
}
method = tmp_m;
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (tmp_h < 0 || tmp_w < 0) {
/* preserve ratio */
@@ -4890,9 +3868,9 @@ PHP_FUNCTION(imagescale)
if (im_scaled == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im_scaled, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_scaled);
}
/* }}} */
@@ -4912,17 +3890,15 @@ PHP_FUNCTION(imageaffine)
int i, nelems;
zval *zval_affine_elem = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra|a", &IM, &z_affine, &z_rect) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oa|a", &IM, gd_image_ce, &z_affine, &z_rect) == FAILURE) {
return;
}
- if ((src = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ src = php_gd_libgdimageptr_from_zval_p(IM);
if ((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_affine))) != 6) {
- php_error_docref(NULL, E_WARNING, "Affine array must have six elements");
- RETURN_FALSE;
+ zend_value_error("Affine array must have six elements");
+ return;
}
for (i = 0; i < nelems; i++) {
@@ -4938,8 +3914,8 @@ PHP_FUNCTION(imageaffine)
affine[i] = zval_get_double(zval_affine_elem);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %i", i);
- RETURN_FALSE;
+ zend_type_error("Invalid type for element %i", i);
+ return;
}
}
}
@@ -4948,29 +3924,29 @@ PHP_FUNCTION(imageaffine)
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "x", sizeof("x") - 1)) != NULL) {
rect.x = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing x position");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing x position");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "y", sizeof("y") - 1)) != NULL) {
rect.y = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing y position");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing y position");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "width", sizeof("width") - 1)) != NULL) {
rect.width = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing width");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing width");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "height", sizeof("height") - 1)) != NULL) {
rect.height = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing height");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing height");
+ return;
}
pRect = &rect;
} else {
@@ -4987,9 +3963,9 @@ PHP_FUNCTION(imageaffine)
if (dst == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(dst, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, dst);
}
/* }}} */
@@ -5012,21 +3988,22 @@ PHP_FUNCTION(imageaffinematrixget)
case GD_AFFINE_SCALE: {
double x, y;
if (!options || Z_TYPE_P(options) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Array expected as options");
- RETURN_FALSE;
+ zend_type_error("Array expected as options when using translate or scale");
+ return;
}
+
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(options), "x", sizeof("x") - 1)) != NULL) {
x = zval_get_double(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing x position");
- RETURN_FALSE;
+ zend_value_error("Options array is missing x position");
+ return;
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(options), "y", sizeof("y") - 1)) != NULL) {
y = zval_get_double(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing y position");
- RETURN_FALSE;
+ zend_value_error("Options array is missing y position");
+ return;
}
if (type == GD_AFFINE_TRANSLATE) {
@@ -5043,8 +4020,8 @@ PHP_FUNCTION(imageaffinematrixget)
double angle;
if (!options) {
- php_error_docref(NULL, E_WARNING, "Number is expected as option");
- RETURN_FALSE;
+ zend_type_error("Number is expected as option when using rotate or shear");
+ return;
}
angle = zval_get_double(options);
@@ -5060,8 +4037,8 @@ PHP_FUNCTION(imageaffinematrixget)
}
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element " ZEND_LONG_FMT, type);
- RETURN_FALSE;
+ zend_value_error("Invalid type for element " ZEND_LONG_FMT, type);
+ return;
}
if (res == GD_FALSE) {
@@ -5092,8 +4069,8 @@ PHP_FUNCTION(imageaffinematrixconcat)
}
if (((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m1))) != 6) || (nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m2))) != 6) {
- php_error_docref(NULL, E_WARNING, "Affine arrays must have six elements");
- RETURN_FALSE;
+ zend_value_error("Affine arrays must have six elements");
+ return;
}
for (i = 0; i < 6; i++) {
@@ -5109,10 +4086,11 @@ PHP_FUNCTION(imageaffinematrixconcat)
m1[i] = zval_get_double(tmp);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %i", i);
- RETURN_FALSE;
+ zend_type_error("Matrix 1 contains invalid type for element %i", i);
+ return;
}
}
+
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) {
switch (Z_TYPE_P(tmp)) {
case IS_LONG:
@@ -5125,8 +4103,8 @@ PHP_FUNCTION(imageaffinematrixconcat)
m2[i] = zval_get_double(tmp);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %i", i);
- RETURN_FALSE;
+ zend_type_error("Matrix 2 contains invalid type for element %i", i);
+ return;
}
}
}
@@ -5149,13 +4127,11 @@ PHP_FUNCTION(imagesetinterpolation)
gdImagePtr im;
zend_long method = GD_BILINEAR_FIXED;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &IM, &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &IM, gd_image_ce, &method) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (method == -1) {
method = GD_BILINEAR_FIXED;
@@ -5172,13 +4148,11 @@ PHP_FUNCTION(imageresolution)
gdImagePtr im;
zend_long res_x = GD_RESOLUTION, res_y = GD_RESOLUTION;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ll", &IM, &res_x, &res_y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ll", &IM, gd_image_ce, &res_x, &res_y) == FAILURE) {
return;
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
switch (ZEND_NUM_ARGS()) {
case 3:
@@ -5194,3 +4168,208 @@ PHP_FUNCTION(imageresolution)
}
}
/* }}} */
+
+
+/*********************************************************
+ *
+ * Stream Handling
+ * Formerly contained within ext/gd/gd_ctx.c and included
+ * at the the top of this file
+ *
+ ********************************************************/
+
+#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
+
+static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */
+{
+ /* without the following downcast, the write will fail
+ * (i.e., will write a zero byte) for all
+ * big endian architectures:
+ */
+ unsigned char ch = (unsigned char) c;
+ php_write(&ch, 1);
+} /* }}} */
+
+static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
+{
+ return php_write((void *)buf, l);
+} /* }}} */
+
+static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */
+{
+ if(ctx) {
+ efree(ctx);
+ }
+} /* }}} */
+
+static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ {
+ char ch = (char) c;
+ php_stream * stream = (php_stream *)ctx->data;
+ php_stream_write(stream, &ch, 1);
+} /* }}} */
+
+static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
+{
+ php_stream * stream = (php_stream *)ctx->data;
+ return php_stream_write(stream, (void *)buf, l);
+} /* }}} */
+
+static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
+{
+ if(ctx->data) {
+ ctx->data = NULL;
+ }
+ if(ctx) {
+ efree(ctx);
+ }
+} /* }}} */
+
+static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
+{
+
+ if(ctx->data) {
+ php_stream_close((php_stream *) ctx->data);
+ ctx->data = NULL;
+ }
+ if(ctx) {
+ efree(ctx);
+ }
+} /* }}} */
+
+/* {{{ _php_image_output_ctx */
+static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
+{
+ zval *imgind;
+ char *file = NULL;
+ size_t file_len = 0;
+ zend_long quality, basefilter;
+ zend_bool compressed = 1;
+ gdImagePtr im;
+ int argc = ZEND_NUM_ARGS();
+ int q = -1, i;
+ int f = -1;
+ gdIOCtx *ctx = NULL;
+ zval *to_zval = NULL;
+ php_stream *stream;
+ int close_stream = 1;
+
+ /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
+ * from imagey<type>().
+ */
+ switch (image_type) {
+ case PHP_GDIMG_TYPE_XBM:
+ if (zend_parse_parameters(argc, "Op!|ll", &imgind, gd_image_ce, &file, &file_len, &quality, &basefilter) == FAILURE) {
+ return;
+ }
+ break;
+ case PHP_GDIMG_TYPE_BMP:
+ if (zend_parse_parameters(argc, "O|z!b", &imgind, gd_image_ce, &to_zval, &compressed) == FAILURE) {
+ return;
+ }
+ break;
+ default:
+ /* PHP_GDIMG_TYPE_GIF
+ * PHP_GDIMG_TYPE_PNG
+ * PHP_GDIMG_TYPE_JPG
+ * PHP_GDIMG_TYPE_WBM
+ * PHP_GDIMG_TYPE_WEBP
+ * */
+ if (zend_parse_parameters(argc, "O|z!ll", &imgind, gd_image_ce, &to_zval, &quality, &basefilter) == FAILURE) {
+ return;
+ }
+ }
+
+ im = php_gd_libgdimageptr_from_zval_p(imgind);
+
+ if (image_type != PHP_GDIMG_TYPE_BMP && argc >= 3) {
+ q = quality; /* or colorindex for foreground of BW images (defaults to black) */
+ if (argc == 4) {
+ f = basefilter;
+ }
+ }
+
+ if (argc > 1 && to_zval != NULL) {
+ if (Z_TYPE_P(to_zval) == IS_RESOURCE) {
+ php_stream_from_zval_no_verify(stream, to_zval);
+ if (stream == NULL) {
+ RETURN_FALSE;
+ }
+ close_stream = 0;
+ } else if (Z_TYPE_P(to_zval) == IS_STRING) {
+ if (CHECK_ZVAL_NULL_PATH(to_zval)) {
+ zend_type_error("Invalid 2nd parameter, filename must not contain null bytes");
+ return;
+ }
+
+ stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
+ if (stream == NULL) {
+ RETURN_FALSE;
+ }
+ } else {
+ php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream");
+ RETURN_FALSE;
+ }
+ } else if (argc > 1 && file != NULL) {
+ stream = php_stream_open_wrapper(file, "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
+ if (stream == NULL) {
+ RETURN_FALSE;
+ }
+ } else {
+ ctx = ecalloc(1, sizeof(gdIOCtx));
+ ctx->putC = _php_image_output_putc;
+ ctx->putBuf = _php_image_output_putbuf;
+ ctx->gd_free = _php_image_output_ctxfree;
+ }
+
+ if (!ctx) {
+ ctx = ecalloc(1, sizeof(gdIOCtx));
+ ctx->putC = _php_image_stream_putc;
+ ctx->putBuf = _php_image_stream_putbuf;
+ if (close_stream) {
+ ctx->gd_free = _php_image_stream_ctxfreeandclose;
+ } else {
+ ctx->gd_free = _php_image_stream_ctxfree;
+ }
+ ctx->data = (void *)stream;
+ }
+
+ switch(image_type) {
+ case PHP_GDIMG_TYPE_JPG:
+ (*func_p)(im, ctx, q);
+ break;
+ case PHP_GDIMG_TYPE_WEBP:
+ if (q == -1) {
+ q = 80;
+ }
+ (*func_p)(im, ctx, q);
+ break;
+ case PHP_GDIMG_TYPE_PNG:
+ (*func_p)(im, ctx, q, f);
+ break;
+ case PHP_GDIMG_TYPE_XBM:
+ case PHP_GDIMG_TYPE_WBM:
+ if (argc < 3) {
+ for(i=0; i < gdImageColorsTotal(im); i++) {
+ if(!gdImageRed(im, i) && !gdImageGreen(im, i) && !gdImageBlue(im, i)) break;
+ }
+ q = i;
+ }
+ if (image_type == PHP_GDIMG_TYPE_XBM) {
+ (*func_p)(im, file ? file : "", q, ctx);
+ } else {
+ (*func_p)(im, q, ctx);
+ }
+ break;
+ case PHP_GDIMG_TYPE_BMP:
+ (*func_p)(im, ctx, (int) compressed);
+ break;
+ default:
+ (*func_p)(im, ctx);
+ break;
+ }
+
+ ctx->gd_free(ctx);
+
+ RETURN_TRUE;
+}
+/* }}} */ \ No newline at end of file
diff --git a/ext/gd/gd.stub.php b/ext/gd/gd.stub.php
new file mode 100644
index 0000000000..7b639f9371
--- /dev/null
+++ b/ext/gd/gd.stub.php
@@ -0,0 +1,276 @@
+<?php
+
+function gd_info(): array {}
+
+/** @return int|false */
+function imageloadfont(string $filename) {}
+
+function imagesetstyle($im, array $styles): bool {}
+
+/** @return GdImage|false */
+function imagecreatetruecolor(int $x_size, int $y_size) {}
+
+function imageistruecolor(GdImage $im): bool {}
+
+function imagetruecolortopalette(GdImage $im, bool $ditherFlag, int $colorWanted): bool {}
+
+function imagepalettetotruecolor(GdImage $im): bool {}
+
+function imagecolormatch($im1, $im2): bool {}
+
+function imagesetthickness(GdImage $im, int $thickness): bool {}
+
+function imagefilledellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
+
+function imagefilledarc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col, int $style): bool {}
+
+function imagealphablending(GdImage $im, bool $blend): bool {}
+
+function imagesavealpha(GdImage $im, bool $save): bool {}
+
+function imagelayereffect(GdImage $im, int $effect): bool {}
+
+/** @return int|false */
+function imagecolorallocatealpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
+
+/** @return int|false */
+function imagecolorresolvealpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
+
+/** @return int|false */
+function imagecolorclosestalpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
+
+/** @return int|false */
+function imagecolorexactalpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
+
+function imagecopyresampled(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
+
+#ifdef PHP_WIN32
+
+/** @return GdImage|false */
+function imagegrabwindow(int $handle, int $client_area = 0) {}
+
+/** @return GdImage|false */
+function imagegrabscreen() {}
+
+#endif
+
+/** @return GdImage|false */
+function imagerotate(GdImage $im, float $angle, int $bgdcolor, int $ignoretransparent = 0) {}
+
+function imagesettile(GdImage $im, $tile): bool {}
+
+function imagesetbrush(GdImage $im, $brush): bool {}
+
+/** @return GdImage|false */
+function imagecreate(int $x_size, int $y_size) {}
+
+function imagetypes(): int {}
+
+/** @return GdImage|false */
+function imagecreatefromstring(string $image) {}
+
+/** @return GdImage|false */
+function imagecreatefromgif(string $filename) {}
+
+#ifdef HAVE_GD_JPG
+/** @return GdImage|false */
+function imagecreatefromjpeg(string $filename) {}
+#endif
+
+#ifdef HAVE_GD_PNG
+/** @return GdImage|false */
+function imagecreatefrompng(string $filename) {}
+#endif
+
+#ifdef HAVE_GD_WEBP
+/** @return GdImage|false */
+function imagecreatefromwebp(string $filename) {}
+#endif
+
+/** @return GdImage|false */
+function imagecreatefromxbm(string $filename) {}
+
+#ifdef HAVE_GD_XPM
+/** @return GdImage|false */
+function imagecreatefromxpm(string $filename) {}
+#endif
+
+/** @return GdImage|false */
+function imagecreatefromwbmp(string $filename) {}
+
+/** @return GdImage|false */
+function imagecreatefromgd(string $filename) {}
+
+/** @return GdImage|false */
+function imagecreatefromgd2(string $filename) {}
+
+/** @return GdImage|false */
+function imagecreatefromgd2part(string $filename, int $srcX, int $srcY, int $width, int $height) {}
+
+#ifdef HAVE_GD_BMP
+/** @return GdImage|false */
+function imagecreatefrombmp(string $filename) {}
+#endif
+
+#ifdef HAVE_GD_TGA
+/** @return GdImage|false */
+function imagecreatefromtga(string $filename) {}
+#endif
+
+function imagexbm(GdImage $im, ?string $filename, int $foreground = UNKNOWN): bool {}
+
+function imagegif(GdImage $im, $to = NULL): bool {}
+
+#ifdef HAVE_GD_PNG
+function imagepng(GdImage $im, $to = NULL, int $quality = UNKNOWN, int $filters = UNKNOWN): bool {}
+#endif
+
+#ifdef HAVE_GD_WEBP
+function imagewebp(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
+#endif
+
+#ifdef HAVE_GD_JPG
+function imagejpeg(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
+#endif
+
+function imagewbmp(GdImage $im, $to = NULL, int $foreground = UNKNOWN): bool {}
+
+function imagegd(GdImage $im, $to = UNKNOWN): bool {}
+
+function imagegd2(GdImage $im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
+
+#ifdef HAVE_GD_BMP
+function imagebmp(GdImage $im, $to = NULL, int $compressed = 1): bool {}
+#endif
+
+function imagedestroy(GdImage $im): bool {}
+
+/** @return int|false */
+function imagecolorallocate(GdImage $im, int $red, int $green, int $blue) {}
+
+function imagepalettecopy(GdImage $dst, GdImage $src): void {}
+
+/** @return int|false */
+function imagecolorat(GdImage $im, int $x, int $y) {}
+
+/** @return int|false */
+function imagecolorclosest(GdImage $im, int $red, int $green, int $blue) {}
+
+/** @return int|false */
+function imagecolorclosesthwb(GdImage $im, int $red, int $green, int $blue) {}
+
+function imagecolordeallocate(GdImage $im, int $index): bool {}
+
+/** @return int|false */
+function imagecolorresolve(GdImage $im, int $red, int $green, int $blue) {}
+
+/** @return int|false */
+function imagecolorexact(GdImage $im, int $red, int $green, int $blue) {}
+
+/** @return ?false */
+function imagecolorset(GdImage $im, int $color, int $red, int $green, int $blue, int $alpha = 0) {}
+
+/** @return array|false */
+function imagecolorsforindex(GdImage $im, int $index) {}
+
+function imagegammacorrect(GdImage $im, float $inputgamma, float $outputgamma): bool {}
+
+function imagesetpixel(GdImage $im, int $x, int $y, int $col): bool {}
+
+function imageline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagedashedline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagerectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagefilledrectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagearc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col): bool {}
+
+function imageellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
+
+function imagefilltoborder(GdImage $im, int $x, int $y, int $border, int $col): bool {}
+
+function imagefill(GdImage $im, int $x, int $y, int $col): bool {}
+
+function imagecolorstotal(GdImage $im): int {}
+
+function imagecolortransparent(GdImage $im, int $col = UNKNOWN): ?int {}
+
+function imageinterlace(GdImage $im, int $interlace = UNKNOWN): ?int {}
+
+function imagepolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
+
+function imageopenpolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
+
+function imagefilledpolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
+
+function imagefontwidth(int $font): int {}
+
+function imagefontheight(int $font): int {}
+
+function imagechar(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
+
+function imagecharup(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
+
+function imagestring(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
+
+function imagestringup(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
+
+function imagecopy(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): bool {}
+
+function imagecopymerge(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
+
+function imagecopymergegray(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
+
+function imagecopyresized(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
+
+function imagesx(GdImage $im): int {}
+
+function imagesy(GdImage $im): int {}
+
+function imagesetclip(GdImage $im, int $x1, int $x2, int $y1, int $y2): bool {}
+
+function imagegetclip(GdImage $im): array {}
+
+#ifdef HAVE_GD_FREETYPE
+/** @return array|false */
+function imageftbbox(float $size, float $angle, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
+
+function imagefttext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
+
+function imagettfbbox(float $size, float $angle, string $font_file, string $text) {}
+
+function imagettftext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text) {}
+#endif
+
+function imagefilter(GdImage $im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
+
+function imageconvolution(GdImage $im, array $matrix3x3, float $div, float $offset): bool {}
+
+function imageflip(GdImage $im, int $mode): bool {}
+
+function imageantialias(GdImage $im, bool $on): bool {}
+
+/** @return GdImage|false */
+function imagecrop(GdImage $im, array $rect) {}
+
+/** @return GdImage|false */
+function imagecropauto(GdImage $im, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1) {}
+
+/** @return GdImage|false */
+function imagescale(GdImage $im, int $new_width, int $new_height = UNKNOWN, int $mode = IMG_BILINEAR_FIXED) {}
+
+/** @return GdImage|false */
+function imageaffine(GdImage $im, array $affine, array $clip = UNKNOWN) {}
+
+/** @return array|false */
+function imageaffinematrixget(int $type, $options = UNKNOWN) {}
+
+/** @return array|false */
+function imageaffinematrixconcat(array $m1, array $m2) {}
+
+function imagesetinterpolation(GdImage $im, int $method = IMG_BILENEAR_FIXED): bool {}
+
+/** @return array|true */
+function imageresolution(GdImage $im, int $res_x = UNKNOWN, int $res_y = UNKNOWN) {}
diff --git a/ext/gd/gd_arginfo.h b/ext/gd/gd_arginfo.h
new file mode 100644
index 0000000000..1f036c8ea9
--- /dev/null
+++ b/ext/gd/gd_arginfo.h
@@ -0,0 +1,566 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imageloadfont, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetstyle, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, im)
+ ZEND_ARG_TYPE_INFO(0, styles, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatetruecolor, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, x_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y_size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageistruecolor, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagetruecolortopalette, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, ditherFlag, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, colorWanted, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagepalettetotruecolor arginfo_imageistruecolor
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolormatch, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, im1)
+ ZEND_ARG_INFO(0, im2)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetthickness, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, thickness, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledellipse, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledarc, 0, 9, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, s, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, e, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagealphablending, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, blend, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesavealpha, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagelayereffect, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, effect, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorallocatealpha, 0, 0, 5)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alpha, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecolorresolvealpha arginfo_imagecolorallocatealpha
+
+#define arginfo_imagecolorclosestalpha arginfo_imagecolorallocatealpha
+
+#define arginfo_imagecolorexactalpha arginfo_imagecolorallocatealpha
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopyresampled, 0, 10, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_h, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegrabwindow, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, handle, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, client_area, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegrabscreen, 0, 0, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagerotate, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, bgdcolor, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ignoretransparent, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesettile, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, tile)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetbrush, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, brush)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecreate arginfo_imagecreatetruecolor
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagetypes, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefromstring, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, image, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecreatefromgif arginfo_imageloadfont
+
+#if defined(HAVE_GD_JPG)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefromjpeg, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_PNG)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefrompng, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_WEBP)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefromwebp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_imagecreatefromxbm arginfo_imageloadfont
+
+#if defined(HAVE_GD_XPM)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefromxpm, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_imagecreatefromwbmp arginfo_imageloadfont
+
+#define arginfo_imagecreatefromgd arginfo_imageloadfont
+
+#define arginfo_imagecreatefromgd2 arginfo_imageloadfont
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefromgd2part, 0, 0, 5)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, srcX, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, srcY, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, height, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_BMP)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefrombmp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_TGA)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecreatefromtga, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagexbm, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, foreground, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegif, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_PNG)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepng, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filters, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_WEBP)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagewebp, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_JPG)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagejpeg, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagewbmp, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, foreground, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagegd arginfo_imagegif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd2, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_BMP)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagebmp, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, compressed, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_imagedestroy arginfo_imageistruecolor
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorallocate, 0, 0, 4)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepalettecopy, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, dst, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorat, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecolorclosest arginfo_imagecolorallocate
+
+#define arginfo_imagecolorclosesthwb arginfo_imagecolorallocate
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolordeallocate, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecolorresolve arginfo_imagecolorallocate
+
+#define arginfo_imagecolorexact arginfo_imagecolorallocate
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorset, 0, 0, 5)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alpha, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorsforindex, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegammacorrect, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, inputgamma, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, outputgamma, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetpixel, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageline, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagedashedline arginfo_imageline
+
+#define arginfo_imagerectangle arginfo_imageline
+
+#define arginfo_imagefilledrectangle arginfo_imageline
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagearc, 0, 8, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, s, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, e, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imageellipse arginfo_imagefilledellipse
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilltoborder, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, border, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagefill arginfo_imagesetpixel
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorstotal, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, IS_LONG, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, interlace, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepolygon, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, points, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, num_pos, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imageopenpolygon arginfo_imagepolygon
+
+#define arginfo_imagefilledpolygon arginfo_imagepolygon
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefontwidth, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagefontheight arginfo_imagefontwidth
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagechar, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, c, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecharup arginfo_imagechar
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagestring, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagestringup arginfo_imagestring
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopy, 0, 8, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_h, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopymerge, 0, 9, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pct, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecopymergegray arginfo_imagecopymerge
+
+#define arginfo_imagecopyresized arginfo_imagecopyresampled
+
+#define arginfo_imagesx arginfo_imagecolorstotal
+
+#define arginfo_imagesy arginfo_imagecolorstotal
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetclip, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y2, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegetclip, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imageftbbox, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, extrainfo, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefttext, 0, 0, 8)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, extrainfo, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagettfbbox, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagettftext, 0, 0, 8)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilter, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, filtertype, IS_LONG, 0)
+ ZEND_ARG_INFO(0, arg1)
+ ZEND_ARG_INFO(0, arg2)
+ ZEND_ARG_INFO(0, arg3)
+ ZEND_ARG_INFO(0, arg4)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageconvolution, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, matrix3x3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, div, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageflip, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageantialias, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, on, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecrop, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, rect, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecropauto, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, threshold, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagescale, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, new_width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, new_height, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffine, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, affine, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, clip, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffinematrixget, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffinematrixconcat, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, m1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, m2, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetinterpolation, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imageresolution, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, res_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, res_y, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
deleted file mode 100644
index 03700ebca8..0000000000
--- a/ext/gd/gd_ctx.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stanislav Malyshev <stas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#include "php_gd.h"
-
-#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
-
-static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */
-{
- /* without the following downcast, the write will fail
- * (i.e., will write a zero byte) for all
- * big endian architectures:
- */
- unsigned char ch = (unsigned char) c;
- php_write(&ch, 1);
-} /* }}} */
-
-static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
-{
- return php_write((void *)buf, l);
-} /* }}} */
-
-static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */
-{
- if(ctx) {
- efree(ctx);
- }
-} /* }}} */
-
-static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ {
- char ch = (char) c;
- php_stream * stream = (php_stream *)ctx->data;
- php_stream_write(stream, &ch, 1);
-} /* }}} */
-
-static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
-{
- php_stream * stream = (php_stream *)ctx->data;
- return php_stream_write(stream, (void *)buf, l);
-} /* }}} */
-
-static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
-{
- if(ctx->data) {
- ctx->data = NULL;
- }
- if(ctx) {
- efree(ctx);
- }
-} /* }}} */
-
-static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
-{
-
- if(ctx->data) {
- php_stream_close((php_stream *) ctx->data);
- ctx->data = NULL;
- }
- if(ctx) {
- efree(ctx);
- }
-} /* }}} */
-
-/* {{{ _php_image_output_ctx */
-static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
-{
- zval *imgind;
- char *file = NULL;
- size_t file_len = 0;
- zend_long quality, basefilter;
- zend_bool compressed = 1;
- gdImagePtr im;
- int argc = ZEND_NUM_ARGS();
- int q = -1, i;
- int f = -1;
- gdIOCtx *ctx = NULL;
- zval *to_zval = NULL;
- php_stream *stream;
- int close_stream = 1;
-
- /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
- * from image<type>().
- */
- switch (image_type) {
- case PHP_GDIMG_TYPE_XBM:
- if (zend_parse_parameters(argc, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
- return;
- }
- break;
- case PHP_GDIMG_TYPE_BMP:
- if (zend_parse_parameters(argc, "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) {
- return;
- }
- break;
- default:
- /* PHP_GDIMG_TYPE_GIF
- * PHP_GDIMG_TYPE_PNG
- * PHP_GDIMG_TYPE_JPG
- * PHP_GDIMG_TYPE_WBM
- * PHP_GDIMG_TYPE_WEBP
- * */
- if (zend_parse_parameters(argc, "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
- return;
- }
- }
-
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(imgind), "Image", phpi_get_le_gd())) == NULL) {
- RETURN_FALSE;
- }
-
- if (image_type != PHP_GDIMG_TYPE_BMP && argc >= 3) {
- q = quality; /* or colorindex for foreground of BW images (defaults to black) */
- if (argc == 4) {
- f = basefilter;
- }
- }
-
- if (argc > 1 && to_zval != NULL) {
- if (Z_TYPE_P(to_zval) == IS_RESOURCE) {
- php_stream_from_zval_no_verify(stream, to_zval);
- if (stream == NULL) {
- RETURN_FALSE;
- }
- close_stream = 0;
- } else if (Z_TYPE_P(to_zval) == IS_STRING) {
- if (CHECK_ZVAL_NULL_PATH(to_zval)) {
- php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
- RETURN_FALSE;
- }
-
- stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
- if (stream == NULL) {
- RETURN_FALSE;
- }
- } else {
- php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream");
- RETURN_FALSE;
- }
- } else if (argc > 1 && file != NULL) {
- stream = php_stream_open_wrapper(file, "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
- if (stream == NULL) {
- RETURN_FALSE;
- }
- } else {
- ctx = ecalloc(1, sizeof(gdIOCtx));
- ctx->putC = _php_image_output_putc;
- ctx->putBuf = _php_image_output_putbuf;
- ctx->gd_free = _php_image_output_ctxfree;
- }
-
- if (!ctx) {
- ctx = ecalloc(1, sizeof(gdIOCtx));
- ctx->putC = _php_image_stream_putc;
- ctx->putBuf = _php_image_stream_putbuf;
- if (close_stream) {
- ctx->gd_free = _php_image_stream_ctxfreeandclose;
- } else {
- ctx->gd_free = _php_image_stream_ctxfree;
- }
- ctx->data = (void *)stream;
- }
-
- switch(image_type) {
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, ctx, q);
- break;
- case PHP_GDIMG_TYPE_WEBP:
- if (q == -1) {
- q = 80;
- }
- (*func_p)(im, ctx, q);
- break;
- case PHP_GDIMG_TYPE_PNG:
- (*func_p)(im, ctx, q, f);
- break;
- case PHP_GDIMG_TYPE_XBM:
- case PHP_GDIMG_TYPE_WBM:
- if (argc < 3) {
- for(i=0; i < gdImageColorsTotal(im); i++) {
- if(!gdImageRed(im, i) && !gdImageGreen(im, i) && !gdImageBlue(im, i)) break;
- }
- q = i;
- }
- if (image_type == PHP_GDIMG_TYPE_XBM) {
- (*func_p)(im, file ? file : "", q, ctx);
- } else {
- (*func_p)(im, q, ctx);
- }
- break;
- case PHP_GDIMG_TYPE_BMP:
- (*func_p)(im, ctx, (int) compressed);
- break;
- default:
- (*func_p)(im, ctx);
- break;
- }
-
- ctx->gd_free(ctx);
-
- RETURN_TRUE;
-}
-/* }}} */
diff --git a/ext/gd/libgd/gd_xbm.c b/ext/gd/libgd/gd_xbm.c
index dae2e62152..dabdf0a38f 100644
--- a/ext/gd/libgd/gd_xbm.c
+++ b/ext/gd/libgd/gd_xbm.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/ext/gd/php_gd.h b/ext/gd/php_gd.h
index 4f5116335b..4f08357880 100644
--- a/ext/gd/php_gd.h
+++ b/ext/gd/php_gd.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, |
@@ -202,10 +200,6 @@ PHP_FUNCTION(imagedashedline);
PHP_FUNCTION(imagettfbbox);
PHP_FUNCTION(imagettftext);
-PHP_FUNCTION(jpeg2wbmp);
-PHP_FUNCTION(png2wbmp);
-PHP_FUNCTION(image2wbmp);
-
PHP_FUNCTION(imagecolormatch);
PHP_FUNCTION(imagelayereffect);
diff --git a/ext/gd/tests/bug38212-mb.phpt b/ext/gd/tests/bug38212-mb.phpt
index a7a3d65f13..d69d604e5d 100644
--- a/ext/gd/tests/bug38212-mb.phpt
+++ b/ext/gd/tests/bug38212-mb.phpt
@@ -6,12 +6,20 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$file = __DIR__ . '/bug38212ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2';
$im1 = imagecreatetruecolor(10,100);
imagefill($im1, 0,0, 0xffffff);
imagegd2($im1, $file);
-$im = imagecreatefromgd2part($file, 0,0, -25,10);
+
+trycatch_dump(
+ fn() => imagecreatefromgd2part($file, 0,0, -25, 10),
+ fn() => imagecreatefromgd2part($file, 0,0, 10, -25)
+);
+
unlink($file);
?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
+--EXPECT--
+!! [ValueError] Width must be at least 1
+!! [ValueError] Height must be at least 1
diff --git a/ext/gd/tests/bug38212.phpt b/ext/gd/tests/bug38212.phpt
index 039c6f971b..8645989e09 100644
--- a/ext/gd/tests/bug38212.phpt
+++ b/ext/gd/tests/bug38212.phpt
@@ -6,12 +6,20 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$file = __DIR__ . '/bug38212.gd2';
$im1 = imagecreatetruecolor(10,100);
imagefill($im1, 0,0, 0xffffff);
imagegd2($im1, $file);
-$im = imagecreatefromgd2part($file, 0,0, -25,10);
+
+trycatch_dump(
+ fn() => imagecreatefromgd2part($file, 0,0, -25, 10),
+ fn() => imagecreatefromgd2part($file, 0,0, 10, -25)
+);
+
unlink($file);
?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
+--EXPECT--
+!! [ValueError] Width must be at least 1
+!! [ValueError] Height must be at least 1
diff --git a/ext/gd/tests/bug39286-mb.phpt b/ext/gd/tests/bug39286-mb.phpt
deleted file mode 100644
index 87390cb489..0000000000
--- a/ext/gd/tests/bug39286-mb.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #39508 (imagefill crashes with small images 3 pixels or less)
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
-?>
---FILE--
-<?php
-$img =imagecreatefromgd2part("fooç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png",0, 100, 0, 100);
-?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
diff --git a/ext/gd/tests/bug39286.phpt b/ext/gd/tests/bug39286.phpt
deleted file mode 100644
index 4fe4769a7b..0000000000
--- a/ext/gd/tests/bug39286.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #39508 (imagefill crashes with small images 3 pixels or less)
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
-?>
---FILE--
-<?php
-$img =imagecreatefromgd2part("foo.png",0, 100, 0, 100);
-?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
diff --git a/ext/gd/tests/bug41442.phpt b/ext/gd/tests/bug41442.phpt
index 5c590deb77..351734931a 100644
--- a/ext/gd/tests/bug41442.phpt
+++ b/ext/gd/tests/bug41442.phpt
@@ -31,7 +31,9 @@ var_dump(imagecreatefromstring($str2));
echo "Done\n";
?>
---EXPECTF--
-resource(%d) of type (gd)
-resource(%d) of type (gd)
+--EXPECT--
+object(GdImage)#2 (0) {
+}
+object(GdImage)#2 (0) {
+}
Done
diff --git a/ext/gd/tests/bug66356.phpt b/ext/gd/tests/bug66356.phpt
index 7dbfb1b40e..0e13bca9b3 100644
--- a/ext/gd/tests/bug66356.phpt
+++ b/ext/gd/tests/bug66356.phpt
@@ -28,8 +28,10 @@ var_dump(imagecrop($img, array("x" => 0x7fffff00, "y" => 0, "width" => 10, "heig
var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" => 65535)));
?>
--EXPECTF--
-resource(%d) of type (gd)
-resource(%d) of type (gd)
+object(GdImage)#2 (0) {
+}
+object(GdImage)#2 (0) {
+}
Array
(
[x] => a
@@ -39,11 +41,13 @@ Array
)
Warning: imagecrop(): one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
- in %sbug66356.php on line %d
+ in %s on line %d
bool(false)
-resource(%d) of type (gd)
-resource(%d) of type (gd)
+object(GdImage)#2 (0) {
+}
+object(GdImage)#2 (0) {
+}
Warning: imagecrop(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
- in %sbug66356.php on line %d
+ in %s on line %d
bool(false)
diff --git a/ext/gd/tests/bug67248.phpt b/ext/gd/tests/bug67248.phpt
index 5cae5f8c98..c9a9588343 100644
--- a/ext/gd/tests/bug67248.phpt
+++ b/ext/gd/tests/bug67248.phpt
@@ -7,21 +7,19 @@ Bug #67248 (imageaffinematrixget missing check of parameters)
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
for($i=0;$i<7;$i++) {
- imageaffinematrixget($i);
+ trycatch_dump(
+ fn() => imageaffinematrixget($i)
+ );
}
?>
---EXPECTF--
-Warning: imageaffinematrixget(): Array expected as options in %s on line %d
-
-Warning: imageaffinematrixget(): Array expected as options in %s on line %d
-
-Warning: imageaffinematrixget(): Number is expected as option in %s on line %d
-
-Warning: imageaffinematrixget(): Number is expected as option in %s on line %d
-
-Warning: imageaffinematrixget(): Number is expected as option in %s on line %d
-
-Warning: imageaffinematrixget(): Invalid type for element 5 in %s on line %d
-
-Warning: imageaffinematrixget(): Invalid type for element 6 in %s on line %d
+--EXPECT--
+!! [TypeError] Array expected as options when using translate or scale
+!! [TypeError] Array expected as options when using translate or scale
+!! [TypeError] Number is expected as option when using rotate or shear
+!! [TypeError] Number is expected as option when using rotate or shear
+!! [TypeError] Number is expected as option when using rotate or shear
+!! [ValueError] Invalid type for element 5
+!! [ValueError] Invalid type for element 6
diff --git a/ext/gd/tests/bug70976.phpt b/ext/gd/tests/bug70976.phpt
index b4f5c9b78b..cd10a8ffc0 100644
--- a/ext/gd/tests/bug70976.phpt
+++ b/ext/gd/tests/bug70976.phpt
@@ -10,4 +10,5 @@ $img = imagerotate(imagecreate(10,10),45,0x7ffffff9);
var_dump($img);
?>
--EXPECT--
-resource(5) of type (gd)
+object(GdImage)#2 (0) {
+}
diff --git a/ext/gd/tests/bug72494.phpt b/ext/gd/tests/bug72494.phpt
index 4cca9aec8e..b01a19179a 100644
--- a/ext/gd/tests/bug72494.phpt
+++ b/ext/gd/tests/bug72494.phpt
@@ -6,10 +6,14 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$im = imagecreate(10,10);
-imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
+
+trycatch_dump(
+ fn() => imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337)
+);
+
?>
-===DONE===
---EXPECTF--
-Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
-===DONE===
+--EXPECT--
+!! [ValueError] Color argument missing with threshold mode
diff --git a/ext/gd/tests/bug72697.phpt b/ext/gd/tests/bug72697.phpt
index 97bd3bdf88..2c293d14be 100644
--- a/ext/gd/tests/bug72697.phpt
+++ b/ext/gd/tests/bug72697.phpt
@@ -8,10 +8,16 @@ if (PHP_INT_MAX !== 9223372036854775807) die("skip for 64-bit long systems only"
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$img=imagecreatetruecolor(10, 10);
-imagetruecolortopalette($img, false, PHP_INT_MAX / 8);
+
+trycatch_dump(
+ fn() => imagetruecolortopalette($img, false, PHP_INT_MAX / 8)
+);
+
?>
DONE
---EXPECTF--
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than 2147483647 in %sbug72697.php on line %d
+--EXPECT--
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
DONE
diff --git a/ext/gd/tests/bug72709.phpt b/ext/gd/tests/bug72709.phpt
index 1c5b1f4ae0..2963f1c104 100644
--- a/ext/gd/tests/bug72709.phpt
+++ b/ext/gd/tests/bug72709.phpt
@@ -7,12 +7,18 @@ if (!extension_loaded('gd')) die('skip ext/gd not available');
--FILE--
<?php
$im = imagecreatetruecolor(1, 1);
-var_dump(imagesetstyle($im, array()));
+
+try {
+ var_dump(imagesetstyle($im, array()));
+}
+catch (\Error $ex) {
+ echo $ex->getMessage() . "\n";
+}
+
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
---EXPECTF--
-Warning: imagesetstyle(): styles array must not be empty in %s%ebug72709.php on line %d
-bool(false)
+--EXPECT--
+Styles array must not be empty
====DONE====
diff --git a/ext/gd/tests/bug72730.phpt b/ext/gd/tests/bug72730.phpt
index 403354d1e2..09b6657add 100644
--- a/ext/gd/tests/bug72730.phpt
+++ b/ext/gd/tests/bug72730.phpt
@@ -6,10 +6,15 @@ if (!function_exists("imagecreatetruecolor")) die("skip");
?>
--FILE--
<?php
+
+require __DIR__ . '/func.inc';
+
$img = imagecreatetruecolor(1, 1);
-imagegammacorrect($img, -1, 1337);
+
+trycatch_dump(
+ fn() => imagegammacorrect($img, -1, 1337)
+);
+
?>
-DONE
---EXPECTF--
-Warning: imagegammacorrect(): Gamma values should be positive in %sbug72730.php on line %d
-DONE
+--EXPECT--
+!! [ValueError] Gamma values must be positive
diff --git a/ext/gd/tests/bug73968.phpt b/ext/gd/tests/bug73968.phpt
index 2211840f58..c1101c61bf 100644
--- a/ext/gd/tests/bug73968.phpt
+++ b/ext/gd/tests/bug73968.phpt
@@ -9,7 +9,6 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
var_dump($im);
?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--EXPECT--
+object(GdImage)#1 (0) {
+}
diff --git a/ext/gd/tests/bug74435.phpt b/ext/gd/tests/bug74435.phpt
index 9d11eb3839..78f2103247 100644
--- a/ext/gd/tests/bug74435.phpt
+++ b/ext/gd/tests/bug74435.phpt
@@ -21,7 +21,6 @@ for ($i = 0; $i < $width; $i += 16) {
}
}
?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--EXPECT--
+object(GdImage)#1 (0) {
+}
diff --git a/ext/gd/tests/bug77269.phpt b/ext/gd/tests/bug77269.phpt
index c89f674b8a..527f26c397 100644
--- a/ext/gd/tests/bug77269.phpt
+++ b/ext/gd/tests/bug77269.phpt
@@ -10,9 +10,8 @@ memory_limit=2G
--FILE--
<?php
$im = imagecreate(2**28, 1);
-if(is_resource($im)) {
- imagescale($im, 1, 1, IMG_TRIANGLE);
-}
+imagescale($im, 1, 1, IMG_TRIANGLE);
+
?>
===DONE===
--EXPECTF--
diff --git a/ext/gd/tests/bug77391.phpt b/ext/gd/tests/bug77391.phpt
index aa76c1470e..fbfa8a8026 100644
--- a/ext/gd/tests/bug77391.phpt
+++ b/ext/gd/tests/bug77391.phpt
@@ -9,7 +9,6 @@ if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstrea
<?php
var_dump(imagecreatefrombmp(__DIR__ . '/bug77391.bmp'));
?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--EXPECT--
+object(GdImage)#1 (0) {
+}
diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc
index 34d9c47155..faa0b06816 100644
--- a/ext/gd/tests/func.inc
+++ b/ext/gd/tests/func.inc
@@ -146,3 +146,21 @@ function save_actual_image($image)
$filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
imagepng($image, $filename);
}
+
+/**
+ * Replicates write errors to the output log, but by catching
+ * and formatting exceptions instead so they have a consistent
+ * output
+ */
+
+function trycatch_dump(...$tests) {
+ foreach ($tests as $test) {
+ try {
+ var_dump($test());
+ }
+ catch (\Error $e) {
+ echo '!! [' . get_class($e) . '] ' . $e->getMessage() . "\n";
+ }
+ }
+}
+
diff --git a/ext/gd/tests/gdimage_prevent_cloning.phpt b/ext/gd/tests/gdimage_prevent_cloning.phpt
new file mode 100644
index 0000000000..0f5c198e88
--- /dev/null
+++ b/ext/gd/tests/gdimage_prevent_cloning.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Checks that GdImage instances cannot be cloned
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+
+ $img_src = imagecreatetruecolor(32, 32);
+ $img_dst = clone $img_src;
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Trying to clone an uncloneable object of class GdImage in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/gd/tests/gdimage_prevent_serialization.phpt b/ext/gd/tests/gdimage_prevent_serialization.phpt
new file mode 100644
index 0000000000..ef08444d37
--- /dev/null
+++ b/ext/gd/tests/gdimage_prevent_serialization.phpt
@@ -0,0 +1,21 @@
+--TEST--
+GdImage instances must not be serialized
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+
+ $img_src = imagecreatetruecolor(32, 32);
+ var_dump(serialize($img_src));
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception: Serialization of 'GdImage' is not allowed in %s:%d
+Stack trace:
+#0 %s(%d): serialize(Object(GdImage))
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/gd/tests/image2wbmp_error.phpt b/ext/gd/tests/image2wbmp_error.phpt
deleted file mode 100644
index 8d8d836ef7..0000000000
--- a/ext/gd/tests/image2wbmp_error.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-image2wbmp() is deprecated
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 0, 0, 0);
-image2wbmp($im, __DIR__ . '/image2wbmp_error.wbmp');
-?>
-===DONE===
---CLEAN--
-<?php
-unlink(__DIR__ . '/image2wbmp_error.wbmp');
-?>
---EXPECTF--
-Deprecated: Function image2wbmp() is deprecated in %s on line %d
-===DONE===
diff --git a/ext/gd/tests/imageantialias_error1.phpt b/ext/gd/tests/imageantialias_error1.phpt
deleted file mode 100644
index 8a9d5315a6..0000000000
--- a/ext/gd/tests/imageantialias_error1.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource in imageantialias() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imageantialias($image, true));
-?>
---EXPECTF--
-Warning: imageantialias(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagebmp_nullbyte_injection.phpt b/ext/gd/tests/imagebmp_nullbyte_injection.phpt
index 0b6d1843d3..00d0a7168c 100644
--- a/ext/gd/tests/imagebmp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagebmp_nullbyte_injection.phpt
@@ -8,10 +8,11 @@ if (!gd_info()['BMP Support']) die('skip BMP support not available');
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagebmp($image, "./foo\0bar"));
+try {
+ imagebmp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: imagebmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
-===DONE===
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagechar_error2.phpt b/ext/gd/tests/imagechar_error2.phpt
deleted file mode 100644
index 1666788ead..0000000000
--- a/ext/gd/tests/imagechar_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagechar() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagechar(tmpfile(), 1, 5, 5, 'C', 1);
-
-?>
---EXPECTF--
-Warning: imagechar(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error2.phpt b/ext/gd/tests/imagecharup_error2.phpt
deleted file mode 100644
index e2db7bb558..0000000000
--- a/ext/gd/tests/imagecharup_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagecharup() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1);
-
-?>
---EXPECTF--
-Warning: imagecharup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecolorallocate_variation5.phpt b/ext/gd/tests/imagecolorallocate_variation5.phpt
index ac3e4bb20e..ae6acb18f6 100644
--- a/ext/gd/tests/imagecolorallocate_variation5.phpt
+++ b/ext/gd/tests/imagecolorallocate_variation5.phpt
@@ -11,6 +11,8 @@ if(!function_exists('imagecreatetruecolor')) {
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
* Description: Allocate a color for an image
* Source code: ext/gd/gd.c
@@ -38,14 +40,17 @@ $values = array(
// loop through each element of the array for blue
foreach($values as $key => $value) {
- echo "\n--$key--\n";
- var_dump( imagecolorallocate($im, $value, $green, $blue) );
- var_dump( imagecolorallocate($im, $red, $value, $blue) );
- var_dump( imagecolorallocate($im, $red, $green, $value) );
+ echo "\n--$key--\n";
+
+ trycatch_dump(
+ fn() => imagecolorallocate($im, $value, $green, $blue),
+ fn() => imagecolorallocate($im, $red, $value, $blue),
+ fn() => imagecolorallocate($im, $red, $green, $value)
+ );
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing imagecolorallocate() : usage variations ***
--Octal 000--
@@ -59,15 +64,9 @@ int(657930)
int(657930)
--Octal -012--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Octal 0377--
int(16714250)
@@ -85,15 +84,9 @@ int(657930)
int(657930)
--Hexa-decimal -0xA--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Hexa-decimal 0xFF--
int(16714250)
diff --git a/ext/gd/tests/imagecolorallocate_variation6.phpt b/ext/gd/tests/imagecolorallocate_variation6.phpt
index a3649be71f..9f21739ff1 100644
--- a/ext/gd/tests/imagecolorallocate_variation6.phpt
+++ b/ext/gd/tests/imagecolorallocate_variation6.phpt
@@ -11,6 +11,8 @@ if(!function_exists('imagecreatetruecolor')) {
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
* Description: Allocate a color for an image
* Source code: ext/gd/gd.c
@@ -34,75 +36,42 @@ foreach($values as $key => $value) {
//Need to be created every time to get expected return value
$im_palette = imagecreate(200, 200);
$im_true_color = imagecreatetruecolor(200, 200);
- var_dump( imagecolorallocate($im_palette, $value, 0, 0) );
- var_dump( imagecolorallocate($im_true_color, $value, 0, 0) );
- var_dump( imagecolorallocate($im_palette, 0, $value, 0) );
- var_dump( imagecolorallocate($im_true_color, 0, $value, 0) );
- var_dump( imagecolorallocate($im_palette, 0, 0, $value) );
- var_dump( imagecolorallocate($im_true_color, 0, 0, $value) );
+
+ trycatch_dump(
+ fn() => imagecolorallocate($im_palette, $value, 0, 0),
+ fn() => imagecolorallocate($im_true_color, $value, 0, 0),
+ fn() => imagecolorallocate($im_palette, 0, $value, 0),
+ fn() => imagecolorallocate($im_true_color, 0, $value, 0),
+ fn() => imagecolorallocate($im_palette, 0, 0, $value),
+ fn() => imagecolorallocate($im_true_color, 0, 0, $value)
+ );
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing imagecolorallocate() : usage variations ***
--Decimal 256--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Octal 0400--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Hexa-decimal 0x100--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
===DONE===
diff --git a/ext/gd/tests/imagecolorallocatealpha_error1.phpt b/ext/gd/tests/imagecolorallocatealpha_error1.phpt
deleted file mode 100644
index 793c02d106..0000000000
--- a/ext/gd/tests/imagecolorallocatealpha_error1.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Testing imagecolorallocatealpha(): Wrong types for parameter 1
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$resource = tmpfile();
-
-imagecolorallocatealpha($resource, 255, 255, 255, 50);
-imagecolorallocatealpha('string', 255, 255, 255, 50);
-imagecolorallocatealpha(array(), 255, 255, 255, 50);
-imagecolorallocatealpha(null, 255, 255, 255, 50);
-?>
---EXPECTF--
-Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d
-
-Warning: imagecolorallocatealpha() expects parameter 1 to be resource, %s given in %s on line %d
-
-Warning: imagecolorallocatealpha() expects parameter 1 to be resource, array given in %s on line %d
-
-Warning: imagecolorallocatealpha() expects parameter 1 to be resource, null given in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error1.phpt b/ext/gd/tests/imagecolordeallocate_error1.phpt
deleted file mode 100644
index 82460139b6..0000000000
--- a/ext/gd/tests/imagecolordeallocate_error1.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Testing imagecolordeallocate() of GD library with invalid resource type
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$image = imagecreatetruecolor(180, 30);
-$white = imagecolorallocate($image, 255, 255, 255);
-
-$resource = tmpfile();
-
-$result = imagecolordeallocate($resource, $white);
-
-?>
---EXPECTF--
-Warning: imagecolordeallocate(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error3.phpt b/ext/gd/tests/imagecolordeallocate_error3.phpt
index e9be1ea66a..f81b52192a 100644
--- a/ext/gd/tests/imagecolordeallocate_error3.phpt
+++ b/ext/gd/tests/imagecolordeallocate_error3.phpt
@@ -9,14 +9,17 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+require_once __DIR__ . '/func.inc';
+
$image = imagecreate(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$totalColors = imagecolorstotal($image);
-$result = imagecolordeallocate($image, $totalColors + 100);
-var_dump($result);
+trycatch_dump(
+ fn() => imagecolordeallocate($image, $totalColors + 100)
+);
+
?>
---EXPECTF--
-Warning: imagecolordeallocate(): Color index 101 out of range in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Color index 101 out of range
diff --git a/ext/gd/tests/imagecolordeallocate_error4.phpt b/ext/gd/tests/imagecolordeallocate_error4.phpt
index 22fc2fa3ef..4d3009dcae 100644
--- a/ext/gd/tests/imagecolordeallocate_error4.phpt
+++ b/ext/gd/tests/imagecolordeallocate_error4.phpt
@@ -9,14 +9,17 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+
+require_once __DIR__ . '/func.inc';
$image = imagecreate(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$totalColors = imagecolorstotal($image);
-$result = imagecolordeallocate($image, -1.0);
-var_dump($result);
+trycatch_dump(
+ fn() => imagecolordeallocate($image, -1.0)
+);
+
?>
---EXPECTF--
-Warning: imagecolordeallocate(): Color index -1 out of range in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Color index -1 out of range
diff --git a/ext/gd/tests/imagecolorstotal_error.phpt b/ext/gd/tests/imagecolorstotal_error.phpt
deleted file mode 100644
index 59999423ca..0000000000
--- a/ext/gd/tests/imagecolorstotal_error.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-Test imagecolorstotal() function : error conditions - Pass incorrect number of arguments
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('imagecolorstotal')) {
- die('skip imagecolorstotal function is not available');
-}
-?>
---FILE--
-<?php
-/* Prototype : int imagecolorstotal ( resource $image )
- * Description: Find out the number of colors in an image's palette
- * Source code: ext/gd/gd.c
- */
-
-echo "*** Testing imagecolorstotal() : error conditions ***\n";
-
-// Get a resource
-$im = fopen(__FILE__, 'r');
-
-echo "\n-- Testing imagecolorstotal() function with Zero arguments --\n";
-var_dump( imagecolorstotal() );
-
-echo "\n-- Testing imagecolorstotal() function with more than expected no. of arguments --\n";
-$extra_arg = false;
-var_dump( imagecolorstotal($im, $extra_arg) );
-
-echo "\n-- Testing imagecolorstotal() function with a invalid resource\n";
-var_dump( imagecolorstotal($im) );
-
-fclose($im);
-?>
-===DONE===
---EXPECTF--
-*** Testing imagecolorstotal() : error conditions ***
-
--- Testing imagecolorstotal() function with Zero arguments --
-
-Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing imagecolorstotal() function with more than expected no. of arguments --
-
-Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing imagecolorstotal() function with a invalid resource
-
-Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/gd/tests/imageconvolution_error2.phpt b/ext/gd/tests/imageconvolution_error2.phpt
index 217e3e1547..d26851c26c 100644
--- a/ext/gd/tests/imageconvolution_error2.phpt
+++ b/ext/gd/tests/imageconvolution_error2.phpt
@@ -9,6 +9,8 @@ if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(180, 30);
// Writes the text and apply a gaussian blur on the image
@@ -19,8 +21,10 @@ $gaussian = array(
array(2.0, 4.0, 2.0)
);
-var_dump(imageconvolution($image, $gaussian, 16, 0));
+trycatch_dump(
+ fn() => imageconvolution($image, $gaussian, 16, 0)
+);
+
?>
---EXPECTF--
-Warning: imageconvolution(): You must have 3x3 array in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Convolution matrix must be a 3x3 array
diff --git a/ext/gd/tests/imageconvolution_error3.phpt b/ext/gd/tests/imageconvolution_error3.phpt
index 5f1ddc95be..8974fdbda0 100644
--- a/ext/gd/tests/imageconvolution_error3.phpt
+++ b/ext/gd/tests/imageconvolution_error3.phpt
@@ -9,6 +9,8 @@ if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(180, 30);
// Writes the text and apply a gaussian blur on the image
@@ -20,8 +22,18 @@ $gaussian = array(
array(1.0, 2.0)
);
-var_dump(imageconvolution($image, $gaussian, 16, 0));
+$gaussian_bad_key = array(
+ array(1.0, 2.0, 1.0),
+ array(2.0, 4.0, 2.0),
+ array(1.0, 2.0, 'x' => 1.0)
+);
+
+trycatch_dump(
+ fn() => imageconvolution($image, $gaussian, 16, 0),
+ fn() => imageconvolution($image, $gaussian_bad_key, 16, 0)
+);
+
?>
---EXPECTF--
-Warning: imageconvolution(): You must have 3x3 array in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Convolution matrix must be a 3x3 array, matrix[2] only has 2 elements
+!! [ValueError] Convolution matrix must be a 3x3 array, matrix[2][2] cannot be found (missing integer key)
diff --git a/ext/gd/tests/imagecreate_error.phpt b/ext/gd/tests/imagecreate_error.phpt
new file mode 100644
index 0000000000..9fd8679c13
--- /dev/null
+++ b/ext/gd/tests/imagecreate_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagecreate(): error on out of bound parameters
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreate")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+
+require __DIR__ . '/func.inc';
+
+trycatch_dump(
+ fn() => imagecreate(-1, 30),
+ fn() => imagecreate(30, -1)
+);
+
+?>
+--EXPECT--
+!! [ValueError] Invalid width (x_size)
+!! [ValueError] Invalid height (y_size)
diff --git a/ext/gd/tests/imagecreatetruecolor_error2.phpt b/ext/gd/tests/imagecreatetruecolor_error2.phpt
index 3ab4cf1e1f..e2784b1530 100644
--- a/ext/gd/tests/imagecreatetruecolor_error2.phpt
+++ b/ext/gd/tests/imagecreatetruecolor_error2.phpt
@@ -9,16 +9,15 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
-$image = imagecreatetruecolor(-1, 30);
-$image = imagecreatetruecolor(30, -1);
-$image = imagecreatetruecolor(999999999999999999999999999, 30);
-$image = imagecreatetruecolor(30, 999999999999999999999999999);
-?>
---EXPECTF--
-Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
-Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
+require __DIR__ . '/func.inc';
-Warning: imagecreatetruecolor() expects parameter 1 to be int, float given in %s on line %d
+trycatch_dump(
+ fn() => imagecreatetruecolor(-1, 30),
+ fn() => imagecreatetruecolor(30, -1)
+);
-Warning: imagecreatetruecolor() expects parameter 2 to be int, float given in %s on line %d
+?>
+--EXPECT--
+!! [ValueError] Invalid width (x_size)
+!! [ValueError] Invalid height (y_size)
diff --git a/ext/gd/tests/imageellipse_error7.phpt b/ext/gd/tests/imageellipse_error7.phpt
deleted file mode 100644
index 0b4c1f549d..0000000000
--- a/ext/gd/tests/imageellipse_error7.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing wrong param passing imageellipse() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-// Create a resource
-$image = tmpfile();
-
-// try to draw a white ellipse
-imageellipse($image, 200, 150, 300, 200, 16777215);
-?>
---EXPECTF--
-Warning: imageellipse(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagefilledpolygon_negative.phpt b/ext/gd/tests/imagefilledpolygon_negative.phpt
index a572a195f5..165fa1c13b 100644
--- a/ext/gd/tests/imagefilledpolygon_negative.phpt
+++ b/ext/gd/tests/imagefilledpolygon_negative.phpt
@@ -6,10 +6,16 @@ imagefilledpolygon() with a negative num of points
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$im = imagecreate(100, 100);
$black = imagecolorallocate($im, 0, 0, 0);
-if (imagefilledpolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)) echo "should be false";
+
+trycatch_dump(
+ fn() => imagefilledpolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)
+);
+
imagedestroy($im);
?>
---EXPECTF--
-Warning: imagefilledpolygon(): You must give a positive number of points in %s on line %d
+--EXPECT--
+!! [ValueError] You must give a positive number of points
diff --git a/ext/gd/tests/imagefilltoborder_error6.phpt b/ext/gd/tests/imagefilltoborder_error6.phpt
deleted file mode 100644
index 421c5932ee..0000000000
--- a/ext/gd/tests/imagefilltoborder_error6.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Testing wrong param passing imagefilltoborder() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
-
-// Draw an ellipse to fill with a black border
-imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
-
-// Try to fill border
-$image_foo = tmpfile();
-imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
-
-?>
---EXPECTF--
-Warning: imagefilltoborder(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagefilter_error1.phpt b/ext/gd/tests/imagefilter_error1.phpt
index 41637994b4..407944d899 100644
--- a/ext/gd/tests/imagefilter_error1.phpt
+++ b/ext/gd/tests/imagefilter_error1.phpt
@@ -11,8 +11,11 @@ if (!extension_loaded("gd")) die("skip GD not present");
<?php
$image = imagecreatetruecolor(180, 30);
-var_dump(imagefilter($image));
+try {
+ var_dump(imagefilter($image));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: Wrong parameter count for imagefilter() in %s on line %d
-NULL
+--EXPECT--
+Wrong parameter count for imagefilter()
diff --git a/ext/gd/tests/imagefilter_error10.phpt b/ext/gd/tests/imagefilter_error10.phpt
deleted file mode 100644
index 0cea9aa3c1..0000000000
--- a/ext/gd/tests/imagefilter_error10.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of EMBOSS in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_EMBOSS));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error11.phpt b/ext/gd/tests/imagefilter_error11.phpt
deleted file mode 100644
index 2f162045b8..0000000000
--- a/ext/gd/tests/imagefilter_error11.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource passing of EDGEDETECT in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_EDGEDETECT));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error12.phpt b/ext/gd/tests/imagefilter_error12.phpt
deleted file mode 100644
index 29664518a0..0000000000
--- a/ext/gd/tests/imagefilter_error12.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of COLORIZE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 255, 255, 255));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error15.phpt b/ext/gd/tests/imagefilter_error15.phpt
deleted file mode 100644
index 9c76bf24ab..0000000000
--- a/ext/gd/tests/imagefilter_error15.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of CONTRAST in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 2));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error17.phpt b/ext/gd/tests/imagefilter_error17.phpt
deleted file mode 100644
index 9a3ba39439..0000000000
--- a/ext/gd/tests/imagefilter_error17.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of GRAYSCALE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_GRAYSCALE));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error18.phpt b/ext/gd/tests/imagefilter_error18.phpt
deleted file mode 100644
index d96d02426f..0000000000
--- a/ext/gd/tests/imagefilter_error18.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of NEGATE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_NEGATE));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error20.phpt b/ext/gd/tests/imagefilter_error20.phpt
deleted file mode 100644
index f1a330dbed..0000000000
--- a/ext/gd/tests/imagefilter_error20.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of BRIGHTNESS in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 1));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error4.phpt b/ext/gd/tests/imagefilter_error4.phpt
deleted file mode 100644
index f60ce11b42..0000000000
--- a/ext/gd/tests/imagefilter_error4.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of PIXELATE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 3));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error6.phpt b/ext/gd/tests/imagefilter_error6.phpt
deleted file mode 100644
index 1ace03cba3..0000000000
--- a/ext/gd/tests/imagefilter_error6.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of SMOOTH in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 3.0));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error7.phpt b/ext/gd/tests/imagefilter_error7.phpt
deleted file mode 100644
index 4e095801e8..0000000000
--- a/ext/gd/tests/imagefilter_error7.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of MEAN_REMOVAL in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_MEAN_REMOVAL));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error8.phpt b/ext/gd/tests/imagefilter_error8.phpt
deleted file mode 100644
index 5086e6421d..0000000000
--- a/ext/gd/tests/imagefilter_error8.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of SELECTIVE_BLUR in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_SELECTIVE_BLUR));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error9.phpt b/ext/gd/tests/imagefilter_error9.phpt
deleted file mode 100644
index 268a65f0f7..0000000000
--- a/ext/gd/tests/imagefilter_error9.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of GAUSSIAN_BLUR in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagegammacorrect_error2.phpt b/ext/gd/tests/imagegammacorrect_error2.phpt
deleted file mode 100644
index fd6d136ae8..0000000000
--- a/ext/gd/tests/imagegammacorrect_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error with non-Image resource paramenter of imagegammacorrect() of GD library,
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-$gamma = imagegammacorrect($image, 1, 5);
-
-?>
---EXPECTF--
-Warning: imagegammacorrect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
index 2fc3050421..30394cc1a5 100644
--- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
@@ -7,8 +7,11 @@ Testing null byte injection in imagegd2
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegd2($image, "./foo\0bar"));
+try {
+ imagegd($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+--EXPECT--
+imagegd() expects parameter 2 to be a valid path, string given
diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt
index f5479a0050..f53d9b5dac 100644
--- a/ext/gd/tests/imagegd_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt
@@ -7,8 +7,11 @@ Testing null byte injection in imagegd
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegd($image, "./foo\0bar"));
+try {
+ imagegd($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+--EXPECT--
+imagegd() expects parameter 2 to be a valid path, string given
diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt
index c5acdd489e..4518ecad27 100644
--- a/ext/gd/tests/imagegif_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegif_nullbyte_injection.phpt
@@ -4,15 +4,14 @@ Testing null byte injection in imagegif
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegif($image, "./foo\0bar"));
+try {
+ imagegif($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imageinterlace_error2.phpt b/ext/gd/tests/imageinterlace_error2.phpt
deleted file mode 100644
index e20f3ae901..0000000000
--- a/ext/gd/tests/imageinterlace_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing resource that is not a image to imageinterlace() of GD library
---CREDITS--
-Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = fopen('php://stdin', 'r');
-var_dump(imageinterlace($image));
-?>
---EXPECTF--
-Warning: imageinterlace(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imageistruecolor_error1.phpt b/ext/gd/tests/imageistruecolor_error1.phpt
deleted file mode 100644
index ab0a9fe653..0000000000
--- a/ext/gd/tests/imageistruecolor_error1.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Testing imageistruecolor(): wrong parameters
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
- if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
-?>
---FILE--
-<?php
-$image = imagecreatetruecolor(180, 30);
-$resource = tmpfile();
-
-imageistruecolor('string');
-imageistruecolor($resource);
-imageistruecolor(array());
-?>
---EXPECTF--
-Warning: imageistruecolor() expects parameter 1 to be resource, string given in %s on line %d
-
-Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
-
-Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d
diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
index 29cb537c3a..1a7f6da03c 100644
--- a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
print 'skip jpeg support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagejpeg($image, "./foo\0bar"));
+try {
+ imagejpeg($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagelayereffect_error3.phpt b/ext/gd/tests/imagelayereffect_error3.phpt
deleted file mode 100644
index 63d1e0e951..0000000000
--- a/ext/gd/tests/imagelayereffect_error3.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing imagelayereffect() with invalid resource of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
- if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
-?>
---FILE--
-<?php
-$resource = tmpfile();
-$layer = imagelayereffect($resource, IMG_EFFECT_REPLACE);
-?>
---EXPECTF--
-Warning: imagelayereffect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagepalettetotruecolor_basic.phpt b/ext/gd/tests/imagepalettetotruecolor_basic.phpt
index 63a2b51e77..89fb514a5f 100644
--- a/ext/gd/tests/imagepalettetotruecolor_basic.phpt
+++ b/ext/gd/tests/imagepalettetotruecolor_basic.phpt
@@ -9,7 +9,7 @@ Carlos André Ferrari <caferrari [at] gmail [dot] com>
--FILE--
<?php
$im = imagecreate(100, 100);
-var_dump(is_resource($im));
+var_dump($im instanceof GdImage);
var_dump(imageistruecolor($im));
var_dump(imagepalettetotruecolor($im));
var_dump(imageistruecolor($im));
diff --git a/ext/gd/tests/imagepalettetotruecolor_error3.phpt b/ext/gd/tests/imagepalettetotruecolor_error3.phpt
deleted file mode 100644
index 42a7e71773..0000000000
--- a/ext/gd/tests/imagepalettetotruecolor_error3.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-imagepalettetotruecollor must return an error if not an image resource is given
---CREDITS--
-Carlos André Ferrari <caferrari [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available.");
-?>
---FILE--
-<?php
-$im = fopen('php://memory', 'w');
-imagepalettetotruecolor($im);
-?>
---EXPECTF--
-Warning: imagepalettetotruecolor(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt
index 271d4d5bd3..86d614ab60 100644
--- a/ext/gd/tests/imagepng_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagepng_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
print 'skip png support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagepng($image, "./foo\0bar"));
+try {
+ imagepng($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagepolygon_negative.phpt b/ext/gd/tests/imagepolygon_negative.phpt
index d122a3bbaa..96b2e7591e 100644
--- a/ext/gd/tests/imagepolygon_negative.phpt
+++ b/ext/gd/tests/imagepolygon_negative.phpt
@@ -6,10 +6,16 @@ imagepolygon() with a negative num of points
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$im = imagecreate(100, 100);
$black = imagecolorallocate($im, 0, 0, 0);
-if (imagepolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)) echo "should be false";
+
+trycatch_dump(
+ fn() => imagepolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)
+);
+
imagedestroy($im);
?>
---EXPECTF--
-Warning: imagepolygon(): You must give a positive number of points in %s on line %d
+--EXPECT--
+!! [ValueError] You must give a positive number of points
diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt
deleted file mode 100644
index 4e2e665bda..0000000000
--- a/ext/gd/tests/imagerectangle_error2.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a resource
-$image = tmpfile();
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, 2 );
-?>
---EXPECTF--
-Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagesetthickness_error1.phpt b/ext/gd/tests/imagesetthickness_error1.phpt
deleted file mode 100644
index f54270afbc..0000000000
--- a/ext/gd/tests/imagesetthickness_error1.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Testing imagetruecolortopalette(): wrong types for first parameter
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$resource = tmpfile();
-
-imagesetthickness('string', 5);
-imagesetthickness(array(), 5);
-imagesetthickness($resource, 5);
-?>
---EXPECTF--
-Warning: imagesetthickness() expects parameter 1 to be resource, %s given in %s on line %d
-
-Warning: imagesetthickness() expects parameter 1 to be resource, array given in %s on line %d
-
-Warning: imagesetthickness(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestring_error2.phpt b/ext/gd/tests/imagestring_error2.phpt
deleted file mode 100644
index e4b22651c6..0000000000
--- a/ext/gd/tests/imagestring_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagestring() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagestring(tmpfile(), 1, 5, 5, 'String', 1);
-
-?>
---EXPECTF--
-Warning: imagestring(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error2.phpt b/ext/gd/tests/imagestringup_error2.phpt
deleted file mode 100644
index 871dd54fde..0000000000
--- a/ext/gd/tests/imagestringup_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagestringup() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1);
-
-?>
---EXPECTF--
-Warning: imagestringup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagetruecolortopalette_error1.phpt b/ext/gd/tests/imagetruecolortopalette_error1.phpt
deleted file mode 100644
index 3418449c01..0000000000
--- a/ext/gd/tests/imagetruecolortopalette_error1.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Testing imagetruecolortopalette(): wrong parameters for parameter 1
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
- if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
-?>
---FILE--
-<?php
-$resource = tmpfile();
-
-imagetruecolortopalette($resource, true, 2);
-imagetruecolortopalette('string', true, 2);
-imagetruecolortopalette(array(), true, 2);
-imagetruecolortopalette(null, true, 2);
-?>
---EXPECTF--
-Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d
diff --git a/ext/gd/tests/imagetruecolortopalette_error3.phpt b/ext/gd/tests/imagetruecolortopalette_error3.phpt
index d89bbcb31b..40dc306116 100644
--- a/ext/gd/tests/imagetruecolortopalette_error3.phpt
+++ b/ext/gd/tests/imagetruecolortopalette_error3.phpt
@@ -9,20 +9,14 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(50, 50);
-$resource = tmpfile();
-imagetruecolortopalette($image, true, 'string');
-imagetruecolortopalette($image, true, $resource);
-imagetruecolortopalette($image, true, array());
-imagetruecolortopalette($image, true, null);
+trycatch_dump(
+ fn() => imagetruecolortopalette($image, true, null)
+);
?>
---EXPECTF--
-Warning: imagetruecolortopalette() expects parameter 3 to be int, string given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 3 to be int, resource given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 3 to be int, array given in %s on line %d
-
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d
+--EXPECT--
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
diff --git a/ext/gd/tests/imagetruecolortopalette_error4.phpt b/ext/gd/tests/imagetruecolortopalette_error4.phpt
index 2db042e89f..055fc657b2 100644
--- a/ext/gd/tests/imagetruecolortopalette_error4.phpt
+++ b/ext/gd/tests/imagetruecolortopalette_error4.phpt
@@ -9,13 +9,16 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(50, 50);
-imagetruecolortopalette($image, true, 0);
-imagetruecolortopalette($image, true, -1);
+trycatch_dump(
+ fn() => imagetruecolortopalette($image, true, 0),
+ fn() => imagetruecolortopalette($image, true, -1)
+);
?>
---EXPECTF--
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s line %d
-
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s line %d
+--EXPECT--
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
index fc5d238f41..cce38a63df 100644
--- a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
print 'skip wbmp support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagewbmp($image, "./foo\0bar"));
+try {
+ imagewbmp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
index d778d0a379..82e45aca02 100644
--- a/ext/gd/tests/imagewebp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['WebP Support']) || $support['WebP Support'] === false) {
print 'skip webp support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagewebp($image, "./foo\0bar"));
+try {
+ imagewebp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagexbm_nullbyte_injection.phpt b/ext/gd/tests/imagexbm_nullbyte_injection.phpt
index b485315064..a24aa3c007 100644
--- a/ext/gd/tests/imagexbm_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagexbm_nullbyte_injection.phpt
@@ -7,10 +7,11 @@ if(!extension_loaded('gd')) die('skip gd extension not available');
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagexbm($image, "./foo\0bar"));
+try {
+ imagexbm($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECTF--
-Warning: imagexbm() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
-===DONE===
+imagexbm() expects parameter 2 to be a valid path, string given
diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt
deleted file mode 100644
index e8e0a7cf2e..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error1.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong threshold value param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.jpg';
-$file2 = __DIR__ .'/simpletext.wbmp';
-
-// Save the image as 'simpletext.jpg'
-imagejpeg($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-jpeg2wbmp($file, $file2, 20, 120, 9);
-jpeg2wbmp($file, $file2, 20, 120, -1);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.jpg');
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt b/ext/gd/tests/jpeg2wbmp_error2-mb.phpt
deleted file mode 100644
index 6c4019a935..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong origin filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-$file = __DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp';
-jpeg2wbmp('', $file, 20, 120, 8);
-jpeg2wbmp(null, $file, 20, 120, 8);
-jpeg2wbmp(false, $file, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp');
-?>
diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt
deleted file mode 100644
index 7ddc151d78..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error2.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong origin filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-$file = __DIR__ .'/simpletext.wbmp';
-jpeg2wbmp('', $file, 20, 120, 8);
-jpeg2wbmp(null, $file, 20, 120, 8);
-jpeg2wbmp(false, $file, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt
deleted file mode 100644
index 1d4c82b06e..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error3.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong destination filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.jpg';
-
-// Save the image as 'simpletext.jpg'
-imagejpeg($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-jpeg2wbmp($file, '', 20, 120, 8);
-jpeg2wbmp($file, null, 20, 120, 8);
-jpeg2wbmp($file, false, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.jpg');
-?>
diff --git a/ext/gd/tests/lines.phpt b/ext/gd/tests/lines.phpt
index dda8497222..9401b6c82d 100644
--- a/ext/gd/tests/lines.phpt
+++ b/ext/gd/tests/lines.phpt
@@ -9,10 +9,6 @@ imageline no AA
$im = imagecreatetruecolor(6,6);
imagefill($im, 0,0, 0xffffff);
-// Wrong argument count
-imageline($im, 0,0, 5,5);
-
-
// Horizontal line
imageline($im, 0,5, 5,5, 0x00ff00);
@@ -105,7 +101,6 @@ if ($p3) {
?>
--EXPECTF--
-Warning: imageline() expects exactly 6 parameters, 5 given in %s on line %d
Horizontal: ok
Vertical: ok
Diagonal: ok
diff --git a/ext/gd/tests/png2wbmp_error1-mb.phpt b/ext/gd/tests/png2wbmp_error1-mb.phpt
deleted file mode 100644
index ac0753fb6c..0000000000
--- a/ext/gd/tests/png2wbmp_error1-mb.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong threshold value param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png';
-$file2 = __DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp';
-
-// Save the image as 'simpletext.png'
-imagepng($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-png2wbmp($file, $file2, 20, 120, 9);
-png2wbmp($file, $file2, 20, 120, -1);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png');
-unlink(__DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp');
-?>
diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt
deleted file mode 100644
index 5805dfa7a0..0000000000
--- a/ext/gd/tests/png2wbmp_error1.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong threshold value param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.png';
-$file2 = __DIR__ .'/simpletext.wbmp';
-
-// Save the image as 'simpletext.png'
-imagepng($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-png2wbmp($file, $file2, 20, 120, 9);
-png2wbmp($file, $file2, 20, 120, -1);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.png');
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt
deleted file mode 100644
index 3bfff05891..0000000000
--- a/ext/gd/tests/png2wbmp_error2.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong origin filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-$file = __DIR__ .'/simpletext.wbmp';
-png2wbmp('', $file, 20, 120, 8);
-png2wbmp(null, $file, 20, 120, 8);
-png2wbmp(false, $file, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt
deleted file mode 100644
index 8bf0aa25bb..0000000000
--- a/ext/gd/tests/png2wbmp_error3.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong destination filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.png';
-
-// Save the image as 'simpletext.png'
-imagepng($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-png2wbmp($file, '', 20, 120, 8);
-png2wbmp($file, null, 20, 120, 8);
-png2wbmp($file, false, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.png');
-?>
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
index 003787f5c0..d373b32b23 100644
--- a/ext/gettext/gettext.c
+++ b/ext/gettext/gettext.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, |
@@ -27,66 +25,7 @@
#include <stdio.h>
#include "ext/standard/info.h"
#include "php_gettext.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_textdomain, 0)
- ZEND_ARG_INFO(0, domain)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gettext, 0)
- ZEND_ARG_INFO(0, msgid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dgettext, 0)
- ZEND_ARG_INFO(0, domain_name)
- ZEND_ARG_INFO(0, msgid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dcgettext, 0)
- ZEND_ARG_INFO(0, domain_name)
- ZEND_ARG_INFO(0, msgid)
- ZEND_ARG_INFO(0, category)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bindtextdomain, 0)
- ZEND_ARG_INFO(0, domain_name)
- ZEND_ARG_INFO(0, dir)
-ZEND_END_ARG_INFO()
-
-#if HAVE_NGETTEXT
-ZEND_BEGIN_ARG_INFO(arginfo_ngettext, 0)
- ZEND_ARG_INFO(0, msgid1)
- ZEND_ARG_INFO(0, msgid2)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_DNGETTEXT
-ZEND_BEGIN_ARG_INFO(arginfo_dngettext, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, msgid1)
- ZEND_ARG_INFO(0, msgid2)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_DCNGETTEXT
-ZEND_BEGIN_ARG_INFO(arginfo_dcngettext, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, msgid1)
- ZEND_ARG_INFO(0, msgid2)
- ZEND_ARG_INFO(0, count)
- ZEND_ARG_INFO(0, category)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_BIND_TEXTDOMAIN_CODESET
-ZEND_BEGIN_ARG_INFO(arginfo_bind_textdomain_codeset, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, codeset)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
+#include "gettext_arginfo.h"
/* {{{ php_gettext_functions[]
*/
diff --git a/ext/gettext/gettext.stub.php b/ext/gettext/gettext.stub.php
new file mode 100644
index 0000000000..a1c09d2bd9
--- /dev/null
+++ b/ext/gettext/gettext.stub.php
@@ -0,0 +1,36 @@
+<?php
+
+/** @return string|false */
+function textdomain(?string $domain) {}
+
+/** @return string|false */
+function gettext(string $msgid) {}
+
+/** @return string|false */
+function dgettext(string $domain_name, string $msgid) {}
+
+/** @return string|false */
+function dcgettext(string $domain_name, string $msgid, int $category) {}
+
+/** @return string|false */
+function bindtextdomain(string $domain_name, string $dir) {}
+
+#if HAVE_NGETTEXT
+/** @return string|false */
+function ngettext(string $msgid1, string $msgid2, int $n) {}
+#endif
+
+#if HAVE_DNGETTEXT
+/** @return string|false */
+function dngettext(string $domain, string $msgid1, string $msgid2, int $count) {}
+#endif
+
+#if HAVE_DCNGETTEXT
+/** @return string|false */
+function dcngettext(string $domain, string $msgid1, string $msgid2, int $count, int $category) {}
+#endif
+
+#if HAVE_BIND_TEXTDOMAIN_CODESET
+/** @return string|false */
+function bind_textdomain_codeset(string $domain, string $codeset) {}
+#endif
diff --git a/ext/gettext/gettext_arginfo.h b/ext/gettext/gettext_arginfo.h
new file mode 100644
index 0000000000..ee248aafae
--- /dev/null
+++ b/ext/gettext/gettext_arginfo.h
@@ -0,0 +1,59 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_textdomain, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gettext, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, msgid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dgettext, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, domain_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dcgettext, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, domain_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, category, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bindtextdomain, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, domain_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, dir, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_NGETTEXT
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ngettext, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, msgid1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, n, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_DNGETTEXT
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dngettext, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_DCNGETTEXT
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dcngettext, 0, 0, 5)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, category, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_BIND_TEXTDOMAIN_CODESET
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bind_textdomain_codeset, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, codeset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h
index 2f07554596..e008a61b8c 100644
--- a/ext/gettext/php_gettext.h
+++ b/ext/gettext/php_gettext.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/ext/gettext/tests/dcngettext.phpt b/ext/gettext/tests/dcngettext.phpt
index 4bf493507b..f004febcb6 100644
--- a/ext/gettext/tests/dcngettext.phpt
+++ b/ext/gettext/tests/dcngettext.phpt
@@ -8,7 +8,6 @@ if (!function_exists("dcngettext")) die("skip dcngettext() doesn't exist");
--FILE--
<?php
-var_dump(dcngettext(1,1,1,1));
var_dump(dcngettext(1,1,1,1,1));
var_dump(dcngettext("test","test","test",1,1));
var_dump(dcngettext("test","test","test",0,0));
@@ -18,9 +17,7 @@ var_dump(dcngettext("","","",0,0));
echo "Done\n";
?>
---EXPECTF--
-Warning: dcngettext() expects exactly 5 parameters, 4 given in %s on line %d
-bool(false)
+--EXPECT--
string(1) "1"
string(4) "test"
string(4) "test"
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index c2ac6d0a1e..5a4e748702 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.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, |
@@ -30,110 +28,13 @@
#include "zend_exceptions.h"
#include <gmp.h>
+#include "gmp_arginfo.h"
/* Needed for gmp_random() */
#include "ext/standard/php_rand.h"
#include "ext/standard/php_lcg.h"
#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_init, 0, 0, 1)
- ZEND_ARG_INFO(0, number)
- ZEND_ARG_INFO(0, base)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_import, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, word_size)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_export, 0, 0, 1)
- ZEND_ARG_INFO(0, gmpnumber)
- ZEND_ARG_INFO(0, word_size)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_intval, 0, 0, 1)
- ZEND_ARG_INFO(0, gmpnumber)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_strval, 0, 0, 1)
- ZEND_ARG_INFO(0, gmpnumber)
- ZEND_ARG_INFO(0, base)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_unary, 0, 0, 1)
- ZEND_ARG_INFO(0, a)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_binary, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, b)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, b)
- ZEND_ARG_INFO(0, round)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_pow, 0, 0, 2)
- ZEND_ARG_INFO(0, base)
- ZEND_ARG_INFO(0, exp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_powm, 0, 0, 3)
- ZEND_ARG_INFO(0, base)
- ZEND_ARG_INFO(0, exp)
- ZEND_ARG_INFO(0, mod)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_root, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, nth)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_prob_prime, 0, 0, 1)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, reps)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0)
- ZEND_ARG_INFO(0, limiter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_seed, 0, 0, 1)
- ZEND_ARG_INFO(0, seed)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_bits, 0, 0, 1)
- ZEND_ARG_INFO(0, bits)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_range, 0, 0, 2)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, max)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_setbit, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, set_clear)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_bit, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_scan, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, start)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
ZEND_DECLARE_MODULE_GLOBALS(gmp)
static ZEND_GINIT_FUNCTION(gmp);
@@ -145,53 +46,52 @@ static const zend_function_entry gmp_functions[] = {
ZEND_FE(gmp_export, arginfo_gmp_export)
ZEND_FE(gmp_intval, arginfo_gmp_intval)
ZEND_FE(gmp_strval, arginfo_gmp_strval)
- ZEND_FE(gmp_add, arginfo_gmp_binary)
- ZEND_FE(gmp_sub, arginfo_gmp_binary)
- ZEND_FE(gmp_mul, arginfo_gmp_binary)
- ZEND_FE(gmp_div_qr, arginfo_gmp_div)
- ZEND_FE(gmp_div_q, arginfo_gmp_div)
- ZEND_FE(gmp_div_r, arginfo_gmp_div)
+ ZEND_FE(gmp_add, arginfo_gmp_add)
+ ZEND_FE(gmp_sub, arginfo_gmp_sub)
+ ZEND_FE(gmp_mul, arginfo_gmp_mul)
+ ZEND_FE(gmp_div_qr, arginfo_gmp_div_qr)
+ ZEND_FE(gmp_div_q, arginfo_gmp_div_q)
+ ZEND_FE(gmp_div_r, arginfo_gmp_div_r)
ZEND_FALIAS(gmp_div, gmp_div_q, arginfo_gmp_div)
- ZEND_FE(gmp_mod, arginfo_gmp_binary)
- ZEND_FE(gmp_divexact, arginfo_gmp_binary)
- ZEND_FE(gmp_neg, arginfo_gmp_unary)
- ZEND_FE(gmp_abs, arginfo_gmp_unary)
- ZEND_FE(gmp_fact, arginfo_gmp_unary)
- ZEND_FE(gmp_sqrt, arginfo_gmp_unary)
- ZEND_FE(gmp_sqrtrem, arginfo_gmp_unary)
+ ZEND_FE(gmp_mod, arginfo_gmp_mod)
+ ZEND_FE(gmp_divexact, arginfo_gmp_divexact)
+ ZEND_FE(gmp_neg, arginfo_gmp_neg)
+ ZEND_FE(gmp_abs, arginfo_gmp_abs)
+ ZEND_FE(gmp_fact, arginfo_gmp_fact)
+ ZEND_FE(gmp_sqrt, arginfo_gmp_sqrt)
+ ZEND_FE(gmp_sqrtrem, arginfo_gmp_sqrtrem)
ZEND_FE(gmp_root, arginfo_gmp_root)
- ZEND_FE(gmp_rootrem, arginfo_gmp_root)
+ ZEND_FE(gmp_rootrem, arginfo_gmp_rootrem)
ZEND_FE(gmp_pow, arginfo_gmp_pow)
ZEND_FE(gmp_powm, arginfo_gmp_powm)
- ZEND_FE(gmp_perfect_square, arginfo_gmp_unary)
- ZEND_FE(gmp_perfect_power, arginfo_gmp_unary)
+ ZEND_FE(gmp_perfect_square, arginfo_gmp_perfect_square)
+ ZEND_FE(gmp_perfect_power, arginfo_gmp_perfect_power)
ZEND_FE(gmp_prob_prime, arginfo_gmp_prob_prime)
- ZEND_FE(gmp_gcd, arginfo_gmp_binary)
- ZEND_FE(gmp_gcdext, arginfo_gmp_binary)
- ZEND_FE(gmp_lcm, arginfo_gmp_binary)
- ZEND_FE(gmp_invert, arginfo_gmp_binary)
- ZEND_FE(gmp_jacobi, arginfo_gmp_binary)
- ZEND_FE(gmp_legendre, arginfo_gmp_binary)
- ZEND_FE(gmp_kronecker, arginfo_gmp_binary)
- ZEND_FE(gmp_cmp, arginfo_gmp_binary)
- ZEND_FE(gmp_sign, arginfo_gmp_unary)
- ZEND_DEP_FE(gmp_random, arginfo_gmp_random)
+ ZEND_FE(gmp_gcd, arginfo_gmp_gcd)
+ ZEND_FE(gmp_gcdext, arginfo_gmp_gcdext)
+ ZEND_FE(gmp_lcm, arginfo_gmp_lcm)
+ ZEND_FE(gmp_invert, arginfo_gmp_invert)
+ ZEND_FE(gmp_jacobi, arginfo_gmp_jacobi)
+ ZEND_FE(gmp_legendre, arginfo_gmp_legendre)
+ ZEND_FE(gmp_kronecker, arginfo_gmp_kronecker)
+ ZEND_FE(gmp_cmp, arginfo_gmp_cmp)
+ ZEND_FE(gmp_sign, arginfo_gmp_sign)
ZEND_FE(gmp_random_seed, arginfo_gmp_random_seed)
ZEND_FE(gmp_random_bits, arginfo_gmp_random_bits)
ZEND_FE(gmp_random_range, arginfo_gmp_random_range)
- ZEND_FE(gmp_and, arginfo_gmp_binary)
- ZEND_FE(gmp_or, arginfo_gmp_binary)
- ZEND_FE(gmp_com, arginfo_gmp_unary)
- ZEND_FE(gmp_xor, arginfo_gmp_binary)
+ ZEND_FE(gmp_and, arginfo_gmp_and)
+ ZEND_FE(gmp_or, arginfo_gmp_or)
+ ZEND_FE(gmp_com, arginfo_gmp_com)
+ ZEND_FE(gmp_xor, arginfo_gmp_xor)
ZEND_FE(gmp_setbit, arginfo_gmp_setbit)
- ZEND_FE(gmp_clrbit, arginfo_gmp_bit)
- ZEND_FE(gmp_testbit, arginfo_gmp_bit)
- ZEND_FE(gmp_scan0, arginfo_gmp_scan)
- ZEND_FE(gmp_scan1, arginfo_gmp_scan)
- ZEND_FE(gmp_popcount, arginfo_gmp_unary)
- ZEND_FE(gmp_hamdist, arginfo_gmp_binary)
- ZEND_FE(gmp_nextprime, arginfo_gmp_unary)
- ZEND_FE(gmp_binomial, arginfo_gmp_binary)
+ ZEND_FE(gmp_clrbit, arginfo_gmp_clrbit)
+ ZEND_FE(gmp_testbit, arginfo_gmp_testbit)
+ ZEND_FE(gmp_scan0, arginfo_gmp_scan0)
+ ZEND_FE(gmp_scan1, arginfo_gmp_scan1)
+ ZEND_FE(gmp_popcount, arginfo_gmp_popcount)
+ ZEND_FE(gmp_hamdist, arginfo_gmp_hamdist)
+ ZEND_FE(gmp_nextprime, arginfo_gmp_nextprime)
+ ZEND_FE(gmp_binomial, arginfo_gmp_binomial)
PHP_FE_END
};
/* }}} */
@@ -408,24 +308,24 @@ static inline void gmp_create(zval *target, mpz_ptr *gmpnum_target) /* {{{ */
}
/* }}} */
-static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
+static int gmp_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
mpz_ptr gmpnum;
switch (type) {
case IS_STRING:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
gmp_strval(writeobj, gmpnum, 10);
return SUCCESS;
case IS_LONG:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
return SUCCESS;
case IS_DOUBLE:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
ZVAL_DOUBLE(writeobj, mpz_get_d(gmpnum));
return SUCCESS;
case _IS_NUMBER:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
if (mpz_fits_slong_p(gmpnum)) {
ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
} else {
@@ -438,10 +338,10 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
}
/* }}} */
-static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable *gmp_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
HashTable *ht, *props = zend_std_get_properties(obj);
- mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(obj);
+ mpz_ptr gmpnum = GET_GMP_OBJECT_FROM_OBJ(obj)->num;
zval zv;
*is_temp = 1;
@@ -454,10 +354,10 @@ static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
-static zend_object *gmp_clone_obj(zval *obj) /* {{{ */
+static zend_object *gmp_clone_obj(zend_object *obj) /* {{{ */
{
- gmp_object *old_object = GET_GMP_OBJECT_FROM_ZVAL(obj);
- gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(Z_OBJCE_P(obj)));
+ gmp_object *old_object = GET_GMP_OBJECT_FROM_OBJ(obj);
+ gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(obj->ce));
zend_objects_clone_members( &new_object->std, &old_object->std);
@@ -555,13 +455,15 @@ static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op
}
/* }}} */
-static int gmp_compare(zval *result, zval *op1, zval *op2) /* {{{ */
+static int gmp_compare(zval *op1, zval *op2) /* {{{ */
{
- gmp_cmp(result, op1, op2);
- if (Z_TYPE_P(result) == IS_FALSE) {
- ZVAL_LONG(result, 1);
+ zval result;
+
+ gmp_cmp(&result, op1, op2);
+ if (Z_TYPE(result) == IS_FALSE) {
+ return 1;
}
- return SUCCESS;
+ return Z_LVAL(result);
}
/* }}} */
@@ -578,7 +480,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len,
php_var_serialize(&buf, &zv, &serialize_data);
zval_ptr_dtor_str(&zv);
- ZVAL_ARR(&zv, zend_std_get_properties(object));
+ ZVAL_ARR(&zv, zend_std_get_properties(Z_OBJ_P(object)));
php_var_serialize(&buf, &zv, &serialize_data);
PHP_VAR_SERIALIZE_DESTROY(serialize_data);
@@ -597,14 +499,12 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
zval *zv;
int retval = FAILURE;
php_unserialize_data_t unserialize_data;
- zval object_copy;
+ zend_object *zobj;
PHP_VAR_UNSERIALIZE_INIT(unserialize_data);
gmp_create(object, &gmpnum);
- /* The "object" variable may be modified during the execution of this unserialize handler
- * (it may turn into a reference). Keep the original object around for further operations. */
- ZVAL_OBJ(&object_copy, Z_OBJ_P(object));
+ zobj = Z_OBJ_P(object);
p = buf;
max = buf + buf_len;
@@ -628,7 +528,7 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
if (zend_hash_num_elements(Z_ARRVAL_P(zv)) != 0) {
zend_hash_copy(
- zend_std_get_properties(&object_copy), Z_ARRVAL_P(zv),
+ zend_std_get_properties(zobj), Z_ARRVAL_P(zv),
(copy_ctor_func_t) zval_add_ref
);
}
@@ -1863,28 +1763,6 @@ static void gmp_init_random(void)
}
}
-/* {{{ proto GMP gmp_random([int limiter])
- Gets random number */
-ZEND_FUNCTION(gmp_random)
-{
- zend_long limiter = 20;
- mpz_ptr gmpnum_result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &limiter) == FAILURE) {
- return;
- }
-
- INIT_GMP_RETVAL(gmpnum_result);
- gmp_init_random();
-
-#ifdef GMP_LIMB_BITS
- mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS);
-#else
- mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * __GMP_BITS_PER_MP_LIMB);
-#endif
-}
-/* }}} */
-
/* {{{ proto GMP gmp_random_seed(mixed seed)
Seed the RNG */
ZEND_FUNCTION(gmp_random_seed)
diff --git a/ext/gmp/gmp.stub.php b/ext/gmp/gmp.stub.php
new file mode 100644
index 0000000000..1102b0af95
--- /dev/null
+++ b/ext/gmp/gmp.stub.php
@@ -0,0 +1,307 @@
+<?php
+
+/**
+ * @param int|bool|string $number
+ * @return GMP|false
+ */
+function gmp_init($number, int $base = 0) {}
+
+/** @return GMP|false */
+function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) {}
+
+/**
+ * @param GMP|int|bool|string $gmpnumber
+ * @return string|false
+ */
+function gmp_export($gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) {}
+
+/** @param GMP|int|bool|string $gmpnumber */
+function gmp_intval($gmpnumber): int {}
+
+/**
+ * @param GMP|int|bool|string $gmpnumber
+ * @return GMP|false
+ */
+function gmp_strval($gmpnumber, int $base = 10) {}
+
+ /**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_add($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_sub($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_mul($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return array|false
+ */
+function gmp_div_qr($a, $b, int $round = GMP_ROUND_ZERO) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_div_q($a, $b, int $round = GMP_ROUND_ZERO) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_div_r($a, $b, int $round = GMP_ROUND_ZERO) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_div($a, $b, int $round = GMP_ROUND_ZERO) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_mod($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_divexact($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ */
+function gmp_neg($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ */
+function gmp_abs($a) {}
+
+/**
+ * @param GMP|int $a
+ * @return GMP|false
+ */
+function gmp_fact($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ */
+function gmp_sqrt($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return array|false
+ */
+function gmp_sqrtrem($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ **/
+function gmp_root($a, int $nth) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return array|false
+ **/
+function gmp_rootrem($a, int $nth) {}
+
+/**
+ * @param GMP|int|bool|string $base
+ * @return GMP|false
+ **/
+function gmp_pow($base, int $exp) {}
+
+/**
+ * @param GMP|int|bool|string $base
+ * @param GMP|int|bool|string $exp
+ * @param GMP|int|bool|string $mod
+ * @return GMP|false
+ **/
+function gmp_powm($base, $exp, $mod) {}
+
+/** @param GMP|int|bool|string $a **/
+function gmp_perfect_square($a): bool {}
+
+/** @param GMP|int|bool|string $a **/
+function gmp_perfect_power($a): bool {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return int|false
+ */
+function gmp_prob_prime($a, int $reps = 10) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_gcd($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP
+ */
+function gmp_gcdext($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_lcm($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_invert($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return int|false
+ */
+function gmp_jacobi($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return int|false
+ */
+function gmp_legendre($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return int|false
+ */
+function gmp_kronecker($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return int|false
+ */
+function gmp_cmp($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return int|false
+ */
+function gmp_sign($a) {}
+
+/**
+ * @param GMP|int|bool|string $seed
+ * @return null|false
+ */
+function gmp_random_seed($seed) {}
+
+/** @return GMP|false */
+function gmp_random_bits(int $bits) {}
+
+/**
+ * @param GMP|int|bool|string $min
+ * @param GMP|int|bool|string $max
+ * @return GMP|false
+ **/
+function gmp_random_range($min, $max) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_and($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_or($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ */
+function gmp_com($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return GMP|false
+ */
+function gmp_xor($a, $b) {}
+
+/** @return null|false */
+function gmp_setbit(GMP $a, int $index, bool $set_clear = true) {}
+
+/** @return null|false */
+function gmp_clrbit(GMP $a, int $index) {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_testbit($a, int $index): bool {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return int|false
+ */
+function gmp_scan0($a, int $start) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return int|false
+ */
+function gmp_scan1($a, int $start) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return int|false
+ */
+function gmp_popcount($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ * @return int|false
+ */
+function gmp_hamdist($a, $b) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ */
+function gmp_nextprime($a) {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @return GMP|false
+ */
+function gmp_binomial($a, int $b) {}
diff --git a/ext/gmp/gmp_arginfo.h b/ext/gmp/gmp_arginfo.h
new file mode 100644
index 0000000000..c380b9a526
--- /dev/null
+++ b/ext/gmp/gmp_arginfo.h
@@ -0,0 +1,166 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_init, 0, 0, 1)
+ ZEND_ARG_INFO(0, number)
+ ZEND_ARG_TYPE_INFO(0, base, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_import, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, word_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_export, 0, 0, 1)
+ ZEND_ARG_INFO(0, gmpnumber)
+ ZEND_ARG_TYPE_INFO(0, word_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_intval, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, gmpnumber)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_strval, 0, 0, 1)
+ ZEND_ARG_INFO(0, gmpnumber)
+ ZEND_ARG_TYPE_INFO(0, base, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_add, 0, 0, 2)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_sub arginfo_gmp_add
+
+#define arginfo_gmp_mul arginfo_gmp_add
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div_qr, 0, 0, 2)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ ZEND_ARG_TYPE_INFO(0, round, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_div_q arginfo_gmp_div_qr
+
+#define arginfo_gmp_div_r arginfo_gmp_div_qr
+
+#define arginfo_gmp_div arginfo_gmp_div_qr
+
+#define arginfo_gmp_mod arginfo_gmp_add
+
+#define arginfo_gmp_divexact arginfo_gmp_add
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_neg, 0, 0, 1)
+ ZEND_ARG_INFO(0, a)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_abs arginfo_gmp_neg
+
+#define arginfo_gmp_fact arginfo_gmp_neg
+
+#define arginfo_gmp_sqrt arginfo_gmp_neg
+
+#define arginfo_gmp_sqrtrem arginfo_gmp_neg
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_root, 0, 0, 2)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, nth, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_rootrem arginfo_gmp_root
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_pow, 0, 0, 2)
+ ZEND_ARG_INFO(0, base)
+ ZEND_ARG_TYPE_INFO(0, exp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_powm, 0, 0, 3)
+ ZEND_ARG_INFO(0, base)
+ ZEND_ARG_INFO(0, exp)
+ ZEND_ARG_INFO(0, mod)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_perfect_square, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, a)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_perfect_power arginfo_gmp_perfect_square
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_prob_prime, 0, 0, 1)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, reps, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_gcd arginfo_gmp_add
+
+#define arginfo_gmp_gcdext arginfo_gmp_add
+
+#define arginfo_gmp_lcm arginfo_gmp_add
+
+#define arginfo_gmp_invert arginfo_gmp_add
+
+#define arginfo_gmp_jacobi arginfo_gmp_add
+
+#define arginfo_gmp_legendre arginfo_gmp_add
+
+#define arginfo_gmp_kronecker arginfo_gmp_add
+
+#define arginfo_gmp_cmp arginfo_gmp_add
+
+#define arginfo_gmp_sign arginfo_gmp_neg
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_seed, 0, 0, 1)
+ ZEND_ARG_INFO(0, seed)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_bits, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, bits, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_range, 0, 0, 2)
+ ZEND_ARG_INFO(0, min)
+ ZEND_ARG_INFO(0, max)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_and arginfo_gmp_add
+
+#define arginfo_gmp_or arginfo_gmp_add
+
+#define arginfo_gmp_com arginfo_gmp_neg
+
+#define arginfo_gmp_xor arginfo_gmp_add
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_setbit, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, a, GMP, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, set_clear, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_clrbit, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, a, GMP, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_testbit, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_scan0, 0, 0, 2)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_scan1 arginfo_gmp_scan0
+
+#define arginfo_gmp_popcount arginfo_gmp_neg
+
+#define arginfo_gmp_hamdist arginfo_gmp_add
+
+#define arginfo_gmp_nextprime arginfo_gmp_neg
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_binomial, 0, 0, 2)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, b, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index 6994814b06..5f2456e989 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.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/ext/gmp/tests/gmp_abs.phpt b/ext/gmp/tests/gmp_abs.phpt
index 811ab3d5ee..236acc4684 100644
--- a/ext/gmp/tests/gmp_abs.phpt
+++ b/ext/gmp/tests/gmp_abs.phpt
@@ -15,8 +15,6 @@ var_dump(gmp_strval(gmp_abs("0000")));
var_dump(gmp_strval(gmp_abs("09876543")));
var_dump(gmp_strval(gmp_abs("-099987654")));
-var_dump(gmp_abs());
-var_dump(gmp_abs(1,2));
var_dump(gmp_abs(array()));
echo "Done\n";
@@ -39,12 +37,6 @@ string(1) "0"
Warning: gmp_abs(): Unable to convert variable to GMP - string is not an integer in %s on line %d
string(1) "0"
-Warning: gmp_abs() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gmp_abs() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: gmp_abs(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_and.phpt b/ext/gmp/tests/gmp_and.phpt
index 2fb27c3e70..b582a6b480 100644
--- a/ext/gmp/tests/gmp_and.phpt
+++ b/ext/gmp/tests/gmp_and.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_and($n, "34332")));
$n1 = gmp_init("987657878765436543456");
var_dump(gmp_strval(gmp_and($n, $n1)));
-var_dump(gmp_and($n, $n1, 1));
-var_dump(gmp_and(1));
var_dump(gmp_and(array(), 1));
var_dump(gmp_and(1, array()));
var_dump(gmp_and(array(), array()));
@@ -37,12 +35,6 @@ string(1) "0"
string(4) "1536"
string(15) "424703623692768"
-Warning: gmp_and() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_and() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_clrbit.phpt b/ext/gmp/tests/gmp_clrbit.phpt
index 0aab89dd37..255b9947b9 100644
--- a/ext/gmp/tests/gmp_clrbit.phpt
+++ b/ext/gmp/tests/gmp_clrbit.phpt
@@ -28,10 +28,11 @@ gmp_clrbit($n, 20);
var_dump(gmp_strval($n));
$n = array();
-gmp_clrbit($n, 3);
-gmp_clrbit($n, 3, 1);
-gmp_clrbit($n);
-gmp_clrbit();
+try {
+ gmp_clrbit($n, 3);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -46,12 +47,5 @@ Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line
string(7) "1000000"
string(7) "1000000"
string(30) "238462734628347239571822592658"
-
-Warning: gmp_clrbit() expects parameter 1 to be GMP, array given in %s on line %d
-
-Warning: gmp_clrbit() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: gmp_clrbit() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: gmp_clrbit() expects exactly 2 parameters, 0 given in %s on line %d
+gmp_clrbit() expects parameter 1 to be GMP, array given
Done
diff --git a/ext/gmp/tests/gmp_cmp.phpt b/ext/gmp/tests/gmp_cmp.phpt
index 2e48d3b83b..4748e7db87 100644
--- a/ext/gmp/tests/gmp_cmp.phpt
+++ b/ext/gmp/tests/gmp_cmp.phpt
@@ -17,10 +17,7 @@ var_dump(gmp_cmp(0,$n) < 0);
$n1 = gmp_init("827278512385463739");
var_dump(gmp_cmp($n1,$n));
-var_dump(gmp_cmp($n1,$n,1));
var_dump(gmp_cmp(array(),array()));
-var_dump(gmp_cmp(array()));
-var_dump(gmp_cmp());
echo "Done\n";
?>
@@ -34,15 +31,6 @@ int(-1)
bool(true)
int(0)
-Warning: gmp_cmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: gmp_cmp(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_cmp() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_cmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_com.phpt b/ext/gmp/tests/gmp_com.phpt
index ae6ec59200..97299dd064 100644
--- a/ext/gmp/tests/gmp_com.phpt
+++ b/ext/gmp/tests/gmp_com.phpt
@@ -19,7 +19,6 @@ $n = gmp_init("98765463337");
var_dump(gmp_strval(gmp_com($n)));
var_dump(gmp_strval(gmp_com(array())));
-var_dump(gmp_strval(gmp_com()));
echo "Done\n";
?>
@@ -38,9 +37,4 @@ string(12) "-98765463338"
Warning: gmp_com(): Unable to convert variable to GMP - wrong type in %s on line %d
string(1) "0"
-
-Warning: gmp_com() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
-bool(false)
Done
diff --git a/ext/gmp/tests/gmp_div_q.phpt b/ext/gmp/tests/gmp_div_q.phpt
index afc64c3547..9fd94efdac 100644
--- a/ext/gmp/tests/gmp_div_q.phpt
+++ b/ext/gmp/tests/gmp_div_q.phpt
@@ -5,9 +5,6 @@ gmp_div_q() tests
--FILE--
<?php
-var_dump(gmp_div_q());
-var_dump(gmp_div_q(""));
-
var_dump(gmp_div_q(0,1));
var_dump(gmp_div_q(1,0));
var_dump(gmp_div_q(12653,23482734));
@@ -27,11 +24,6 @@ var_dump(gmp_div_q(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_div_q() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_div_q() expects at least 2 parameters, 1 given in %s on line %d
-NULL
object(GMP)#%d (1) {
["num"]=>
string(1) "0"
diff --git a/ext/gmp/tests/gmp_div_qr.phpt b/ext/gmp/tests/gmp_div_qr.phpt
index 936fbc6ef1..373beb5701 100644
--- a/ext/gmp/tests/gmp_div_qr.phpt
+++ b/ext/gmp/tests/gmp_div_qr.phpt
@@ -5,9 +5,6 @@ gmp_div_qr() tests
--FILE--
<?php
-var_dump(gmp_div_qr());
-var_dump(gmp_div_qr(""));
-
var_dump(gmp_div_qr(0,1));
var_dump(gmp_div_qr(1,0));
var_dump(gmp_div_qr(gmp_init(1), gmp_init(0)));
@@ -29,11 +26,6 @@ var_dump(gmp_div_qr(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_div_qr() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_div_qr() expects at least 2 parameters, 1 given in %s on line %d
-NULL
array(2) {
[0]=>
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_div_r.phpt b/ext/gmp/tests/gmp_div_r.phpt
index bab243e465..2b19ed1f48 100644
--- a/ext/gmp/tests/gmp_div_r.phpt
+++ b/ext/gmp/tests/gmp_div_r.phpt
@@ -5,9 +5,6 @@ gmp_div_r() tests
--FILE--
<?php
-var_dump(gmp_div_r());
-var_dump(gmp_div_r(""));
-
var_dump($r = gmp_div_r(0,1));
var_dump($r = gmp_div_r(1,0));
var_dump($r = gmp_div_r(12653,23482734));
@@ -27,11 +24,6 @@ var_dump(gmp_div_r(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_div_r() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_div_r() expects at least 2 parameters, 1 given in %s on line %d
-NULL
object(GMP)#%d (1) {
["num"]=>
string(1) "0"
diff --git a/ext/gmp/tests/gmp_divexact.phpt b/ext/gmp/tests/gmp_divexact.phpt
index 53f0c677ab..c6183cb734 100644
--- a/ext/gmp/tests/gmp_divexact.phpt
+++ b/ext/gmp/tests/gmp_divexact.phpt
@@ -10,9 +10,6 @@ if (!defined('GMP_VERSION') || version_compare("4.2.1", GMP_VERSION, ">=")) {
--FILE--
<?php
-var_dump(gmp_divexact(1, 1, 1));
-var_dump(gmp_divexact());
-
$r = gmp_divexact("233", "23345555555555555555555555");
var_dump(gmp_strval($r));
@@ -39,11 +36,6 @@ var_dump(gmp_strval($r));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_divexact() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_divexact() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
string(1) "0"
Warning: gmp_divexact(): Zero operand not allowed in %s on line %d
diff --git a/ext/gmp/tests/gmp_export.phpt b/ext/gmp/tests/gmp_export.phpt
index 52449ecf0a..bbc26d086c 100644
--- a/ext/gmp/tests/gmp_export.phpt
+++ b/ext/gmp/tests/gmp_export.phpt
@@ -50,9 +50,6 @@ foreach ($export as $k => $test) {
var_dump($passed);
-// Invalid arguments (zpp failure)
-var_dump(gmp_export());
-
// Invalid word sizes
var_dump(gmp_export(123, -1));
var_dump(gmp_export(123, 0));
@@ -63,9 +60,6 @@ var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
--EXPECTF--
bool(true)
-Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_export(): Word size must be positive, -1 given in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_fact.phpt b/ext/gmp/tests/gmp_fact.phpt
index 032f735435..d861fae40e 100644
--- a/ext/gmp/tests/gmp_fact.phpt
+++ b/ext/gmp/tests/gmp_fact.phpt
@@ -21,8 +21,6 @@ var_dump(gmp_strval(gmp_fact($n)));
$n = gmp_init(-10);
var_dump(gmp_strval(gmp_fact($n)));
-var_dump(gmp_fact());
-var_dump(gmp_fact(1,1));
var_dump(gmp_fact(array()));
var_dump(gmp_strval(gmp_fact(array())));
@@ -50,12 +48,6 @@ string(9) "479001600"
Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d
string(1) "0"
-Warning: gmp_fact() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gmp_fact() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: gmp_fact(): Number has to be an integer in %s on line %d
object(GMP)#%d (1) {
["num"]=>
diff --git a/ext/gmp/tests/gmp_gcd.phpt b/ext/gmp/tests/gmp_gcd.phpt
index cf4eac9e92..4e130a1fd9 100644
--- a/ext/gmp/tests/gmp_gcd.phpt
+++ b/ext/gmp/tests/gmp_gcd.phpt
@@ -21,13 +21,10 @@ $n = gmp_init("8127346234");
var_dump(gmp_strval(gmp_gcd($n,$n)));
$n = gmp_init("8127346234");
var_dump(gmp_strval(gmp_gcd($n,0)));
-var_dump(gmp_gcd($n,$n,1));
-var_dump(gmp_gcd($n,array(),1));
-var_dump(gmp_gcd(array(),$n,1));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "3"
string(5) "12387"
string(3) "224"
@@ -39,13 +36,4 @@ string(1) "2"
string(1) "1"
string(10) "8127346234"
string(10) "8127346234"
-
-Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_gcdext.phpt b/ext/gmp/tests/gmp_gcdext.phpt
index 4adecf25d2..d02f341129 100644
--- a/ext/gmp/tests/gmp_gcdext.phpt
+++ b/ext/gmp/tests/gmp_gcdext.phpt
@@ -31,9 +31,6 @@ foreach ($a as $val) {
var_dump(gmp_gcdext($val[0],array()));
var_dump(gmp_gcdext(array(),array()));
-var_dump(gmp_gcdext(array(),array(),1));
-var_dump(gmp_gcdext(array()));
-var_dump(gmp_gcdext());
echo "Done\n";
?>
@@ -64,13 +61,4 @@ bool(false)
Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_hamdist.phpt b/ext/gmp/tests/gmp_hamdist.phpt
index 60ef89f84d..7057c5f32a 100644
--- a/ext/gmp/tests/gmp_hamdist.phpt
+++ b/ext/gmp/tests/gmp_hamdist.phpt
@@ -16,11 +16,9 @@ var_dump(gmp_hamdist($n, "8333765434567897654333334567"));
var_dump(gmp_hamdist($n, $n));
var_dump(gmp_hamdist($n, $n1));
-var_dump(gmp_hamdist($n, $n1, 1));
var_dump(gmp_hamdist($n, array()));
var_dump(gmp_hamdist(array(), $n));
var_dump(gmp_hamdist(array(), array()));
-var_dump(gmp_hamdist());
echo "Done\n";
?>
@@ -33,9 +31,6 @@ int(43)
int(0)
int(26)
-Warning: gmp_hamdist() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
@@ -44,7 +39,4 @@ bool(false)
Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_hamdist() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_import.phpt b/ext/gmp/tests/gmp_import.phpt
index a9e9314483..b3c4e0154a 100644
--- a/ext/gmp/tests/gmp_import.phpt
+++ b/ext/gmp/tests/gmp_import.phpt
@@ -47,9 +47,6 @@ foreach ($import as $k => $test) {
var_dump($passed);
-// Invalid arguments (zpp failure)
-var_dump(gmp_import());
-
// Invalid word sizes
var_dump(gmp_import('a', -1));
var_dump(gmp_import('a', 0));
@@ -65,9 +62,6 @@ var_dump(gmp_import('a', 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
--EXPECTF--
bool(true)
-Warning: gmp_import() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_import(): Word size must be positive, -1 given in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_init.phpt b/ext/gmp/tests/gmp_init.phpt
index a35f12345c..7da7c8e55e 100644
--- a/ext/gmp/tests/gmp_init.phpt
+++ b/ext/gmp/tests/gmp_init.phpt
@@ -7,9 +7,6 @@ gmp_init() basic tests
var_dump(gmp_init("98765678"));
var_dump(gmp_strval(gmp_init("98765678")));
-var_dump(gmp_strval(gmp_init()));
-var_dump(gmp_init());
-var_dump(gmp_init(1,2,3,4));
var_dump(gmp_init(1,-1));
var_dump(gmp_init("",36));
var_dump(gmp_init("foo",3));
@@ -24,17 +21,6 @@ object(GMP)#%d (1) {
}
string(8) "98765678"
-Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
-bool(false)
-
-Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gmp_init() expects at most 2 parameters, 4 given in %s on line %d
-NULL
-
Warning: gmp_init(): Bad base for conversion: -1 (should be between 2 and %d) in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_intval.phpt b/ext/gmp/tests/gmp_intval.phpt
index f30b391573..019ab3d070 100644
--- a/ext/gmp/tests/gmp_intval.phpt
+++ b/ext/gmp/tests/gmp_intval.phpt
@@ -5,7 +5,6 @@ gmp_intval() tests
--FILE--
<?php
-var_dump(gmp_intval(1,1));
var_dump(gmp_intval(""));
var_dump(gmp_intval(1.0001));
var_dump(gmp_intval("1.0001"));
@@ -25,8 +24,6 @@ var_dump(gmp_intval($g));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_intval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
int(0)
int(1)
int(1)
diff --git a/ext/gmp/tests/gmp_invert.phpt b/ext/gmp/tests/gmp_invert.phpt
index 8c1d7c577c..40793afd53 100644
--- a/ext/gmp/tests/gmp_invert.phpt
+++ b/ext/gmp/tests/gmp_invert.phpt
@@ -19,8 +19,6 @@ $n1 = gmp_init("3498273496234234523451");
var_dump(gmp_strval(gmp_invert($n, $n1)));
var_dump(gmp_strval(gmp_invert($n1, $n)));
-var_dump(gmp_invert($n1, $n, 10));
-var_dump(gmp_invert($n1));
var_dump(gmp_invert(array(), 1));
var_dump(gmp_invert(1, array()));
var_dump(gmp_invert(array(), array()));
@@ -38,12 +36,6 @@ string(1) "0"
string(22) "3498273496234234523441"
string(1) "1"
-Warning: gmp_invert() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_invert() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_jacobi.phpt b/ext/gmp/tests/gmp_jacobi.phpt
index da92b87401..2040b666f6 100644
--- a/ext/gmp/tests/gmp_jacobi.phpt
+++ b/ext/gmp/tests/gmp_jacobi.phpt
@@ -24,10 +24,6 @@ var_dump(gmp_jacobi(3, array()));
var_dump(gmp_jacobi(array(), 3));
var_dump(gmp_jacobi(array(), array()));
-var_dump(gmp_jacobi(array(), array(), 1));
-var_dump(gmp_jacobi(array()));
-var_dump(gmp_jacobi());
-
echo "Done\n";
?>
--EXPECTF--
@@ -57,13 +53,4 @@ bool(false)
Warning: gmp_jacobi(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_jacobi() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_jacobi() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_jacobi() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_legendre.phpt b/ext/gmp/tests/gmp_legendre.phpt
index 71191e133d..6b6197f25a 100644
--- a/ext/gmp/tests/gmp_legendre.phpt
+++ b/ext/gmp/tests/gmp_legendre.phpt
@@ -24,10 +24,6 @@ var_dump(gmp_legendre(3, array()));
var_dump(gmp_legendre(array(), 3));
var_dump(gmp_legendre(array(), array()));
-var_dump(gmp_legendre(array(), array(), 1));
-var_dump(gmp_legendre(array()));
-var_dump(gmp_legendre());
-
echo "Done\n";
?>
--EXPECTF--
@@ -57,13 +53,4 @@ bool(false)
Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_legendre() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_legendre() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_legendre() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_mod.phpt b/ext/gmp/tests/gmp_mod.phpt
index 4f216965c9..135c2ca11c 100644
--- a/ext/gmp/tests/gmp_mod.phpt
+++ b/ext/gmp/tests/gmp_mod.phpt
@@ -5,8 +5,6 @@ gmp_mod tests()
--FILE--
<?php
-var_dump(gmp_mod());
-var_dump(gmp_mod(""));
var_dump(gmp_mod("",""));
var_dump(gmp_mod(0,1));
var_dump(gmp_mod(0,-1));
@@ -22,12 +20,6 @@ var_dump(gmp_mod($a, $b));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_mod() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_mod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_mod(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_neg.phpt b/ext/gmp/tests/gmp_neg.phpt
index c457fa6574..777de69105 100644
--- a/ext/gmp/tests/gmp_neg.phpt
+++ b/ext/gmp/tests/gmp_neg.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_intval(gmp_neg($n)));
$n = gmp_init("12345678901234567890");
var_dump(gmp_strval(gmp_neg($n)));
-var_dump(gmp_neg(1,1));
-var_dump(gmp_neg());
var_dump(gmp_neg(array()));
echo "Done\n";
@@ -35,12 +33,6 @@ int(0)
int(0)
string(21) "-12345678901234567890"
-Warning: gmp_neg() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: gmp_neg() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_or.phpt b/ext/gmp/tests/gmp_or.phpt
index ef486df8e9..affd6ae5b8 100644
--- a/ext/gmp/tests/gmp_or.phpt
+++ b/ext/gmp/tests/gmp_or.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_or($n, "34332")));
$n1 = gmp_init("987657878765436543456");
var_dump(gmp_strval(gmp_or($n, $n1)));
-var_dump(gmp_or($n, $n1, 1));
-var_dump(gmp_or(1));
var_dump(gmp_or(array(), 1));
var_dump(gmp_or(1, array()));
var_dump(gmp_or(array(), array()));
@@ -37,12 +35,6 @@ string(1) "0"
string(15) "987657876576252"
string(21) "987658441719689394144"
-Warning: gmp_or() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_or() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_or(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_perfect_square.phpt b/ext/gmp/tests/gmp_perfect_square.phpt
index 0f519c7b79..b477910378 100644
--- a/ext/gmp/tests/gmp_perfect_square.phpt
+++ b/ext/gmp/tests/gmp_perfect_square.phpt
@@ -21,7 +21,6 @@ var_dump(gmp_perfect_square($n));
$n = gmp_init(-5);
var_dump(gmp_perfect_square($n));
-var_dump(gmp_perfect_square());
var_dump(gmp_perfect_square(array()));
echo "Done\n";
@@ -39,9 +38,6 @@ bool(false)
bool(true)
bool(false)
-Warning: gmp_perfect_square() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_perfect_square(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_popcount.phpt b/ext/gmp/tests/gmp_popcount.phpt
index 26a7b5af8d..76dc2a89c0 100644
--- a/ext/gmp/tests/gmp_popcount.phpt
+++ b/ext/gmp/tests/gmp_popcount.phpt
@@ -13,7 +13,6 @@ var_dump(gmp_popcount("-23476123423433"));
$n = gmp_init("9876546789222");
var_dump(gmp_popcount($n));
var_dump(gmp_popcount(array()));
-var_dump(gmp_popcount());
echo "Done\n";
?>
@@ -27,7 +26,4 @@ int(20)
Warning: gmp_popcount(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_popcount() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_pow.phpt b/ext/gmp/tests/gmp_pow.phpt
index 5424d410a0..e9525867e1 100644
--- a/ext/gmp/tests/gmp_pow.phpt
+++ b/ext/gmp/tests/gmp_pow.phpt
@@ -21,11 +21,11 @@ var_dump(gmp_strval(gmp_pow($n,10)));
$n = gmp_init("-20");
var_dump(gmp_strval(gmp_pow($n,10)));
-var_dump(gmp_pow(2,10,1));
-var_dump(gmp_pow(2));
-var_dump(gmp_pow());
-var_dump(gmp_pow(array(), array()));
-var_dump(gmp_pow(2,array()));
+try {
+ var_dump(gmp_pow(2,array()));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(gmp_pow(array(),10));
echo "Done\n";
@@ -47,21 +47,7 @@ Warning: gmp_pow(): Negative exponent not supported in %s on line %d
string(1) "0"
string(14) "10240000000000"
string(14) "10240000000000"
-
-Warning: gmp_pow() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects parameter 2 to be int, array given in %s on line %d
-NULL
+gmp_pow() expects parameter 2 to be int, array given
Warning: gmp_pow(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_pown.phpt b/ext/gmp/tests/gmp_pown.phpt
index b732aa331f..9a5b5deb11 100644
--- a/ext/gmp/tests/gmp_pown.phpt
+++ b/ext/gmp/tests/gmp_pown.phpt
@@ -26,9 +26,6 @@ var_dump(gmp_powm(array(),$e,$m));
var_dump(gmp_powm($n,array(),$m));
var_dump(gmp_powm($n,$e,array()));
var_dump(gmp_powm(array(),array(),array()));
-var_dump(gmp_powm(array(),array()));
-var_dump(gmp_powm(array()));
-var_dump(gmp_powm());
$n = gmp_init("-5");
var_dump(gmp_powm(10, $n, 10));
@@ -67,15 +64,6 @@ bool(false)
Warning: gmp_powm(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: gmp_powm() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: gmp_powm() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_powm() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
Warning: gmp_powm(): Second parameter cannot be less than 0 in %s on line %d
bool(false)
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_prob_prime.phpt b/ext/gmp/tests/gmp_prob_prime.phpt
index 99735bd7c0..2872e01d84 100644
--- a/ext/gmp/tests/gmp_prob_prime.phpt
+++ b/ext/gmp/tests/gmp_prob_prime.phpt
@@ -28,7 +28,6 @@ var_dump(gmp_prob_prime($n));
$n = gmp_init(0);
var_dump(gmp_prob_prime($n));
-var_dump(gmp_prob_prime());
var_dump(gmp_prob_prime(array()));
echo "Done\n";
@@ -73,9 +72,6 @@ int(0)
int(0)
int(0)
-Warning: gmp_prob_prime() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_prob_prime(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_random.phpt b/ext/gmp/tests/gmp_random.phpt
deleted file mode 100644
index ab2b11b3f7..0000000000
--- a/ext/gmp/tests/gmp_random.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-gmp_random() basic tests
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---FILE--
-<?php
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(-1)));
-var_dump(gmp_strval(gmp_random(0)));
-var_dump(gmp_strval(gmp_random(10)));
-var_dump(gmp_strval(gmp_random("-10")));
-var_dump(gmp_strval(gmp_random(-10)));
-
-var_dump(gmp_random(array()));
-var_dump(gmp_random(array(),1));
-var_dump(gmp_random(""));
-var_dump(gmp_random("test"));
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(1) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects parameter 1 to be int, array given in %s on line %d
-NULL
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d
-NULL
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d
-NULL
-Done
diff --git a/ext/gmp/tests/gmp_random_bits.phpt b/ext/gmp/tests/gmp_random_bits.phpt
index b4aa5d7b73..42b90d6fe3 100644
--- a/ext/gmp/tests/gmp_random_bits.phpt
+++ b/ext/gmp/tests/gmp_random_bits.phpt
@@ -5,7 +5,6 @@ gmp_random_bits() basic tests
--FILE--
<?php
-var_dump(gmp_random_bits());
var_dump(gmp_random_bits(0));
var_dump(gmp_random_bits(-1));
@@ -34,9 +33,6 @@ while (1) {
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_random_bits() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_random_bits(): The number of bits must be positive in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_random_range.phpt b/ext/gmp/tests/gmp_random_range.phpt
index 654ffbefb3..fec8274167 100644
--- a/ext/gmp/tests/gmp_random_range.phpt
+++ b/ext/gmp/tests/gmp_random_range.phpt
@@ -9,8 +9,6 @@ $minusTen = gmp_init(-10);
$plusTen = gmp_init(10);
$zero = gmp_init(0);
-var_dump(gmp_random_range());
-var_dump(gmp_random_range(10));
var_dump(gmp_random_range(10, -10));
var_dump(gmp_random_range($plusTen, $minusTen));
@@ -64,12 +62,6 @@ while (1) {
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_random_range() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_random_range() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_random_range(): The minimum value must be less than the maximum value in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_random_seed-32bit.phpt b/ext/gmp/tests/gmp_random_seed-32bit.phpt
deleted file mode 100644
index 95d8dd50f9..0000000000
--- a/ext/gmp/tests/gmp_random_seed-32bit.phpt
+++ /dev/null
@@ -1,232 +0,0 @@
---TEST--
-gmp_random_seed() basic tests
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
-<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
---INI--
-error_reporting=E_ALL&~E_DEPRECATED
---FILE--
-<?php
-
-// zero int
-var_dump(gmp_random_seed(0));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// zero gmp
-var_dump(gmp_random_seed(gmp_init(0)));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// negative int
-var_dump(gmp_random_seed(-100));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// negative gmp
-var_dump(gmp_random_seed(gmp_init(-100)));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// positive int
-var_dump(gmp_random_seed(100));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// positive gmp
-var_dump(gmp_random_seed(100));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-$seed = gmp_init(1);
-$seed <<= 512;
-
-// large negative gmp
-var_dump(gmp_random_seed($seed * -1));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// large positive gmp
-var_dump(gmp_random_seed($seed));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// standard non conversion error
-var_dump(gmp_random_seed('not a number'));
-
-
-echo "Done\n";
-?>
---EXPECTF--
-NULL
-string(193) "2000022451473107283132031190545479155678097978829612864726689673263990484954900429188146529905019042225609517482723730948135765344007937183893986134210303199345433818579954244943136664096571499"
-string(10) "3792281639"
-string(97) "1281406676617847191505318987040099388645126071814252743902229506206669580396236451813261179688680"
-string(2) "86"
-string(30) "539590049119295715487546581833"
-string(301) "1421393257467327495225454368915273750356127352353055226245692071178379257048985726109650766437957017507708821700349355658110489309871463201057688894986035545794429493563972043777521547094922637182497036750765553664196591958728194711096442220858890056073974348364544481270013556644174056049511198143353"
-string(4) "8971"
-string(4) "7838"
-string(5) "-7823"
-NULL
-string(193) "2000022451473107283132031190545479155678097978829612864726689673263990484954900429188146529905019042225609517482723730948135765344007937183893986134210303199345433818579954244943136664096571499"
-string(10) "3792281639"
-string(97) "1281406676617847191505318987040099388645126071814252743902229506206669580396236451813261179688680"
-string(2) "86"
-string(30) "539590049119295715487546581833"
-string(301) "1421393257467327495225454368915273750356127352353055226245692071178379257048985726109650766437957017507708821700349355658110489309871463201057688894986035545794429493563972043777521547094922637182497036750765553664196591958728194711096442220858890056073974348364544481270013556644174056049511198143353"
-string(4) "8971"
-string(4) "7838"
-string(5) "-7823"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "4314861641594785951065006537821497084129700255567731661104366342587560122488351847486220156468888511744226746306538524023190734733433083354034308520246964938498767672539252131810891590624763642"
-string(10) "3301287097"
-string(97) "1532710025135934106005683287301200805525218110207399702226596673360222079570223526337866801028045"
-string(3) "317"
-string(30) "949682013136255600092941702271"
-string(302) "10419061168407861659407303769436775291881708415032871985692089124472434944956010985892897595466043265819000974537553172663152640727594826474137173310039809413311432062725623183603946900548710858191078057179743726366436832870919212340219523613153893742764101120396858424887711932475871305848021245801132"
-string(4) "2417"
-string(5) "-7975"
-string(4) "-378"
-NULL
-string(193) "4314861641594785951065006537821497084129700255567731661104366342587560122488351847486220156468888511744226746306538524023190734733433083354034308520246964938498767672539252131810891590624763642"
-string(10) "3301287097"
-string(97) "1532710025135934106005683287301200805525218110207399702226596673360222079570223526337866801028045"
-string(3) "317"
-string(30) "949682013136255600092941702271"
-string(302) "10419061168407861659407303769436775291881708415032871985692089124472434944956010985892897595466043265819000974537553172663152640727594826474137173310039809413311432062725623183603946900548710858191078057179743726366436832870919212340219523613153893742764101120396858424887711932475871305848021245801132"
-string(4) "2417"
-string(5) "-7975"
-string(4) "-378"
-
-Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
-bool(false)
-Done
diff --git a/ext/gmp/tests/gmp_random_seed.phpt b/ext/gmp/tests/gmp_random_seed.phpt
index e143a5153e..80f49ee32c 100644
--- a/ext/gmp/tests/gmp_random_seed.phpt
+++ b/ext/gmp/tests/gmp_random_seed.phpt
@@ -3,18 +3,12 @@ gmp_random_seed() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
---INI--
-error_reporting=E_ALL&~E_DEPRECATED
--FILE--
<?php
// zero int
var_dump(gmp_random_seed(0));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -27,10 +21,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// zero gmp
var_dump(gmp_random_seed(gmp_init(0)));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -43,10 +33,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// negative int
var_dump(gmp_random_seed(-100));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -59,10 +45,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// negative gmp
var_dump(gmp_random_seed(gmp_init(-100)));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -75,10 +57,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// positive int
var_dump(gmp_random_seed(100));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -91,10 +69,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// positive gmp
var_dump(gmp_random_seed(100));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -110,10 +84,6 @@ $seed <<= 512;
// large negative gmp
var_dump(gmp_random_seed($seed * -1));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -126,10 +96,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// large positive gmp
var_dump(gmp_random_seed($seed));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -147,85 +113,61 @@ echo "Done\n";
?>
--EXPECTF--
NULL
-string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219"
-string(18) "255344473360201232"
-string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022"
-string(3) "766"
-string(31) "1251852006013618829761115383588"
-string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417"
-string(4) "5969"
-string(5) "-4126"
-string(4) "-926"
+string(3) "107"
+string(30) "576055025228722307492589900056"
+string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464"
+string(4) "4098"
+string(3) "866"
+string(5) "-4602"
NULL
-string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219"
-string(18) "255344473360201232"
-string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022"
-string(3) "766"
-string(31) "1251852006013618829761115383588"
-string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417"
-string(4) "5969"
-string(5) "-4126"
-string(4) "-926"
+string(3) "107"
+string(30) "576055025228722307492589900056"
+string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464"
+string(4) "4098"
+string(3) "866"
+string(5) "-4602"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354"
-string(19) "1662391866670215057"
-string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273"
-string(3) "888"
-string(30) "136524289584478309125073026188"
-string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176"
-string(4) "8559"
-string(4) "9426"
-string(5) "-2932"
+string(3) "762"
+string(30) "822340340897453415684831711085"
+string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830"
+string(4) "9636"
+string(5) "-9848"
+string(5) "-9648"
NULL
-string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354"
-string(19) "1662391866670215057"
-string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273"
-string(3) "888"
-string(30) "136524289584478309125073026188"
-string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176"
-string(4) "8559"
-string(4) "9426"
-string(5) "-2932"
+string(3) "762"
+string(30) "822340340897453415684831711085"
+string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830"
+string(4) "9636"
+string(5) "-9848"
+string(5) "-9648"
Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_remroot.phpt b/ext/gmp/tests/gmp_remroot.phpt
index acd8f84925..1316d7651c 100644
--- a/ext/gmp/tests/gmp_remroot.phpt
+++ b/ext/gmp/tests/gmp_remroot.phpt
@@ -5,8 +5,6 @@ gmp_rootrem() basic tests
--FILE--
<?php
-var_dump(gmp_rootrem());
-
var_dump(gmp_rootrem(1000, 3));
var_dump(gmp_rootrem(100, 3));
var_dump(gmp_rootrem(-100, 3));
@@ -21,8 +19,6 @@ var_dump(gmp_rootrem(100, -3));
?>
--EXPECTF--
-Warning: gmp_rootrem() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
array(2) {
[0]=>
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_root.phpt b/ext/gmp/tests/gmp_root.phpt
index 654e2ffeb6..47c1fcc608 100644
--- a/ext/gmp/tests/gmp_root.phpt
+++ b/ext/gmp/tests/gmp_root.phpt
@@ -5,8 +5,6 @@ gmp_root() basic tests
--FILE--
<?php
-var_dump(gmp_root());
-
var_dump(gmp_root(1000, 3));
var_dump(gmp_root(100, 3));
var_dump(gmp_root(-100, 3));
@@ -21,8 +19,6 @@ var_dump(gmp_root(100, -3));
?>
--EXPECTF--
-Warning: gmp_root() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
object(GMP)#%d (1) {
["num"]=>
string(2) "10"
diff --git a/ext/gmp/tests/gmp_scan0.phpt b/ext/gmp/tests/gmp_scan0.phpt
index fb70cf8b25..c06f91f7dd 100644
--- a/ext/gmp/tests/gmp_scan0.phpt
+++ b/ext/gmp/tests/gmp_scan0.phpt
@@ -15,8 +15,6 @@ $n = gmp_init("24234527465274");
var_dump(gmp_scan0($n, 10));
var_dump(gmp_scan0(array(), 200));
-var_dump(gmp_scan0(array()));
-var_dump(gmp_scan0());
echo "Done\n";
?>
@@ -31,10 +29,4 @@ int(13)
Warning: gmp_scan0(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_scan0() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_scan0() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_scan1.phpt b/ext/gmp/tests/gmp_scan1.phpt
index a89a9195b0..43a2fdfa1b 100644
--- a/ext/gmp/tests/gmp_scan1.phpt
+++ b/ext/gmp/tests/gmp_scan1.phpt
@@ -15,8 +15,6 @@ $n = gmp_init("24234527465274");
var_dump(gmp_scan1($n, 10));
var_dump(gmp_scan1(array(), 200));
-var_dump(gmp_scan1(array()));
-var_dump(gmp_scan1());
echo "Done\n";
?>
@@ -31,10 +29,4 @@ int(10)
Warning: gmp_scan1(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_scan1() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_scan1() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_setbit.phpt b/ext/gmp/tests/gmp_setbit.phpt
index 2eac23db0e..15270eaf7b 100644
--- a/ext/gmp/tests/gmp_setbit.phpt
+++ b/ext/gmp/tests/gmp_setbit.phpt
@@ -32,12 +32,17 @@ gmp_setbit($n, 3);
var_dump(gmp_strval($n));
$b = "";
-gmp_setbit($b, 23);
-gmp_setbit($b);
-gmp_setbit($b, 23,1,1);
-gmp_setbit($b,array());
+try {
+ gmp_setbit($b, 23);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$a = array();
-gmp_setbit($a,array());
+try {
+ gmp_setbit($a, array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -52,14 +57,6 @@ string(1) "7"
string(12) "100008388608"
string(12) "100000000000"
string(12) "100000000008"
-
-Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d
-
-Warning: gmp_setbit() expects at least 2 parameters, 1 given in %s on line %d
-
-Warning: gmp_setbit() expects at most 3 parameters, 4 given in %s on line %d
-
-Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d
-
-Warning: gmp_setbit() expects parameter 1 to be GMP, array given in %s on line %d
+gmp_setbit() expects parameter 1 to be GMP, string given
+gmp_setbit() expects parameter 1 to be GMP, array given
Done
diff --git a/ext/gmp/tests/gmp_sign.phpt b/ext/gmp/tests/gmp_sign.phpt
index 7ac03013d4..ac01845395 100644
--- a/ext/gmp/tests/gmp_sign.phpt
+++ b/ext/gmp/tests/gmp_sign.phpt
@@ -13,9 +13,7 @@ var_dump(gmp_sign("-34535345345"));
var_dump(gmp_sign("+34534573457345"));
$n = gmp_init("098909878976786545");
var_dump(gmp_sign($n));
-var_dump(gmp_sign($n, $n));
var_dump(gmp_sign(array()));
-var_dump(gmp_sign());
echo "Done\n";
?>
@@ -32,12 +30,6 @@ bool(false)
Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in %s on line %d
int(0)
-Warning: gmp_sign() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: gmp_sign(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_sign() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_sqrt.phpt b/ext/gmp/tests/gmp_sqrt.phpt
index e824de3706..03c460b79a 100644
--- a/ext/gmp/tests/gmp_sqrt.phpt
+++ b/ext/gmp/tests/gmp_sqrt.phpt
@@ -18,8 +18,6 @@ var_dump(gmp_strval(gmp_sqrt($n)));
$n = gmp_init(777);
var_dump(gmp_strval(gmp_sqrt($n)));
-var_dump(gmp_sqrt($n, 1));
-var_dump(gmp_sqrt());
var_dump(gmp_sqrt(array()));
echo "Done\n";
@@ -39,12 +37,6 @@ Warning: gmp_sqrt(): Number has to be greater than or equal to 0 in %s on line %
string(1) "0"
string(2) "27"
-Warning: gmp_sqrt() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: gmp_sqrt() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_sqrt(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_sqrtrem.phpt b/ext/gmp/tests/gmp_sqrtrem.phpt
index 595a1dc45a..c19969158e 100644
--- a/ext/gmp/tests/gmp_sqrtrem.phpt
+++ b/ext/gmp/tests/gmp_sqrtrem.phpt
@@ -51,7 +51,6 @@ var_dump(gmp_strval($r[0]));
var_dump(gmp_strval($r[1]));
var_dump(gmp_sqrtrem(array()));
-var_dump(gmp_sqrtrem());
echo "Done\n";
?>
@@ -82,7 +81,4 @@ string(1) "1"
Warning: gmp_sqrtrem(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_sqrtrem() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_strval.phpt b/ext/gmp/tests/gmp_strval.phpt
index cfa7335667..b349d31699 100644
--- a/ext/gmp/tests/gmp_strval.phpt
+++ b/ext/gmp/tests/gmp_strval.phpt
@@ -5,11 +5,8 @@ gmp_strval() tests
--FILE--
<?php
-var_dump(gmp_strval());
var_dump(gmp_strval(""));
-var_dump(gmp_strval("", ""));
var_dump(gmp_strval("", -1));
-var_dump(gmp_strval(-1, ""));
$fp = fopen(__FILE__, "r");
var_dump(gmp_strval($fp));
@@ -26,29 +23,18 @@ var_dump(gmp_strval($g, -1));
var_dump(gmp_strval($g, 100000));
var_dump(gmp_strval($g, 10));
-var_dump(gmp_strval(array(1,2), array(1,2)));
-var_dump(gmp_strval(new stdclass, new stdclass));
var_dump(gmp_strval(array(1,2)));
var_dump(gmp_strval(new stdclass));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_strval() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
-Warning: gmp_strval() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line %d
bool(false)
-Warning: gmp_strval() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
string(7) "9765456"
@@ -68,12 +54,6 @@ Warning: gmp_strval(): Bad base for conversion: 100000 (should be between 2 and
bool(false)
string(8) "-3373333"
-Warning: gmp_strval() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
-Warning: gmp_strval() expects parameter 2 to be int, object given in %s on line %d
-NULL
-
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_sub.phpt b/ext/gmp/tests/gmp_sub.phpt
index fabc0c0ebb..b8dce49774 100644
--- a/ext/gmp/tests/gmp_sub.phpt
+++ b/ext/gmp/tests/gmp_sub.phpt
@@ -5,10 +5,7 @@ gmp_sub() tests
--FILE--
<?php
-var_dump(gmp_sub());
-var_dump(gmp_sub(""));
var_dump(gmp_sub("", ""));
-var_dump(gmp_sub("", "", ""));
var_dump(gmp_sub(array(), array()));
var_dump($g = gmp_sub(10000, 10001));
@@ -23,18 +20,9 @@ var_dump(gmp_strval($g));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_sub() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_sub() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_sub(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
-Warning: gmp_sub() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_testbit.phpt b/ext/gmp/tests/gmp_testbit.phpt
index bdabe3d841..f18af5d44d 100644
--- a/ext/gmp/tests/gmp_testbit.phpt
+++ b/ext/gmp/tests/gmp_testbit.phpt
@@ -5,8 +5,6 @@ gmp_testbit() basic tests
--FILE--
<?php
-var_dump(gmp_testbit());
-
$n = gmp_init(0);
var_dump(gmp_testbit($n, -10));
var_dump(gmp_testbit($n, 0));
@@ -40,9 +38,6 @@ var_dump(gmp_strval($n));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_testbit() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
bool(false)
bool(false)
diff --git a/ext/gmp/tests/gmp_xor.phpt b/ext/gmp/tests/gmp_xor.phpt
index 9bf31f02f4..cc508907aa 100644
--- a/ext/gmp/tests/gmp_xor.phpt
+++ b/ext/gmp/tests/gmp_xor.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_xor($n, "34332")));
$n1 = gmp_init("987657878765436543456");
var_dump(gmp_strval(gmp_xor($n, $n1)));
-var_dump(gmp_xor($n, $n1, 1));
-var_dump(gmp_xor(1));
var_dump(gmp_xor(array(), 1));
var_dump(gmp_xor(1, array()));
var_dump(gmp_xor(array(), array()));
@@ -37,12 +35,6 @@ string(1) "0"
string(15) "987657876574716"
string(21) "987658017016065701376"
-Warning: gmp_xor() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_xor() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_xor(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/hash/config.m4 b/ext/hash/config.m4
index 03c4d83968..d84e89cc6b 100644
--- a/ext/hash/config.m4
+++ b/ext/hash/config.m4
@@ -11,9 +11,6 @@ if test "$PHP_MHASH" != "no"; then
AC_DEFINE(PHP_MHASH_BC, 1, [ ])
fi
-dnl Defined for BC.
-AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
-
if test $ac_cv_c_bigendian_php = yes; then
EXT_HASH_SHA3_SOURCES="hash_sha3.c"
AC_DEFINE(HAVE_SLOW_HASH3, 1, [Define is hash3 algo is available])
diff --git a/ext/hash/config.w32 b/ext/hash/config.w32
index 3ed785bfda..5d6be6b922 100644
--- a/ext/hash/config.w32
+++ b/ext/hash/config.w32
@@ -6,9 +6,6 @@ if (PHP_MHASH != 'no') {
AC_DEFINE('PHP_MHASH_BC', 1);
}
-// Defined for BC.
-AC_DEFINE('HAVE_HASH_EXT', 1);
-
PHP_HASH = 'yes';
EXTENSION('hash', 'hash.c hash_md.c hash_sha.c hash_ripemd.c hash_haval.c ' +
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 856ae0e11b..6b869affde 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.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, |
@@ -29,6 +27,8 @@
#include "zend_interfaces.h"
#include "zend_exceptions.h"
+#include "hash_arginfo.h"
+
HashTable php_hash_hashtable;
zend_class_entry *php_hashcontext_ce;
static zend_object_handlers php_hashcontext_handlers;
@@ -252,18 +252,18 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
ops = php_hash_fetch_ops(algo, algo_len);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", algo);
+ return;
}
else if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "Non-cryptographic hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Non-cryptographic hashing algorithm: %s", algo);
+ return;
}
if (isfilename) {
if (CHECK_NULL_PATH(data, data_len)) {
- php_error_docref(NULL, E_WARNING, "Invalid path");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Invalid path");
+ return;
}
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, FG(default_context));
if (!stream) {
@@ -358,19 +358,19 @@ PHP_FUNCTION(hash_init)
ops = php_hash_fetch_ops(ZSTR_VAL(algo), ZSTR_LEN(algo));
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
+ return;
}
if (options & PHP_HASH_HMAC) {
if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "HMAC requested with a non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "HMAC requested with a non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
+ return;
}
if (!key || (ZSTR_LEN(key) == 0)) {
/* Note: a zero length key is no key at all */
- php_error_docref(NULL, E_WARNING, "HMAC requested without a key");
- RETURN_FALSE;
+ zend_throw_error(NULL, "HMAC requested without a key");
+ return;
}
}
@@ -414,8 +414,8 @@ PHP_FUNCTION(hash_init)
#define PHP_HASHCONTEXT_VERIFY(func, hash) { \
if (!hash->context) { \
- php_error(E_WARNING, "%s(): supplied resource is not a valid Hash Context resource", func); \
- RETURN_NULL(); \
+ zend_throw_error(NULL, "%s(): supplied resource is not a valid Hash Context resource", func); \
+ return; \
} \
}
@@ -581,11 +581,13 @@ PHP_FUNCTION(hash_copy)
return;
}
- RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(zhash));
+ RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(Z_OBJ_P(zhash)));
if (php_hashcontext_from_object(Z_OBJ_P(return_value))->context == NULL) {
zval_ptr_dtor(return_value);
- RETURN_FALSE;
+
+ zend_throw_error(NULL, "Cannot copy hash");
+ return;
}
}
/* }}} */
@@ -596,6 +598,10 @@ PHP_FUNCTION(hash_algos)
{
zend_string *str;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&php_hash_hashtable, str) {
add_next_index_str(return_value, zend_string_copy(str));
@@ -610,6 +616,10 @@ PHP_FUNCTION(hash_hmac_algos)
zend_string *str;
const php_hash_ops *ops;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY_PTR(&php_hash_hashtable, str, ops) {
if (ops->is_crypto) {
@@ -637,28 +647,28 @@ PHP_FUNCTION(hash_hkdf)
ops = php_hash_fetch_ops(ZSTR_VAL(algo), ZSTR_LEN(algo));
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
+ return;
}
if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "Non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "Non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
+ return;
}
if (ZSTR_LEN(ikm) == 0) {
- php_error_docref(NULL, E_WARNING, "Input keying material cannot be empty");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Input keying material cannot be empty");
+ return;
}
if (length < 0) {
- php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
+ return;
} else if (length == 0) {
length = ops->digest_size;
} else if (length > (zend_long) (ops->digest_size * 255)) {
- php_error_docref(NULL, E_WARNING, "Length must be less than or equal to %zd: " ZEND_LONG_FMT, ops->digest_size * 255, length);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Length must be less than or equal to %zd: " ZEND_LONG_FMT, ops->digest_size * 255, length);
+ return;
}
context = emalloc(ops->context_size);
@@ -737,27 +747,27 @@ PHP_FUNCTION(hash_pbkdf2)
ops = php_hash_fetch_ops(algo, algo_len);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", algo);
+ return;
}
else if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "Non-cryptographic hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Non-cryptographic hashing algorithm: %s", algo);
+ return;
}
if (iterations <= 0) {
- php_error_docref(NULL, E_WARNING, "Iterations must be a positive integer: " ZEND_LONG_FMT, iterations);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Iterations must be a positive integer: " ZEND_LONG_FMT, iterations);
+ return;
}
if (length < 0) {
- php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
+ return;
}
if (salt_len > INT_MAX - 4) {
- php_error_docref(NULL, E_WARNING, "Supplied salt is too long, max of INT_MAX - 4 bytes: %zd supplied", salt_len);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Supplied salt is too long, max of INT_MAX - 4 bytes: %zd supplied", salt_len);
+ return;
}
context = emalloc(ops->context_size);
@@ -862,13 +872,13 @@ PHP_FUNCTION(hash_equals)
/* We only allow comparing string to prevent unexpected results. */
if (Z_TYPE_P(known_zval) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Expected known_string to be a string, %s given", zend_zval_type_name(known_zval));
- RETURN_FALSE;
+ zend_type_error("Expected known_string to be a string, %s given", zend_zval_type_name(known_zval));
+ return;
}
if (Z_TYPE_P(user_zval) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Expected user_string to be a string, %s given", zend_zval_type_name(user_zval));
- RETURN_FALSE;
+ zend_type_error("Expected user_string to be a string, %s given", zend_zval_type_name(user_zval));
+ return;
}
if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) {
@@ -1149,12 +1159,12 @@ static void php_hashcontext_dtor(zend_object *obj) {
/* }}} */
/* {{{ php_hashcontext_clone */
-static zend_object *php_hashcontext_clone(zval *pzv) {
- php_hashcontext_object *oldobj = php_hashcontext_from_object(Z_OBJ_P(pzv));
- zend_object *znew = php_hashcontext_create(Z_OBJCE_P(pzv));
+static zend_object *php_hashcontext_clone(zend_object *zobj) {
+ php_hashcontext_object *oldobj = php_hashcontext_from_object(zobj);
+ zend_object *znew = php_hashcontext_create(zobj->ce);
php_hashcontext_object *newobj = php_hashcontext_from_object(znew);
- zend_objects_clone_members(znew, Z_OBJ_P(pzv));
+ zend_objects_clone_members(znew, zobj);
newobj->ops = oldobj->ops;
newobj->options = oldobj->options;
@@ -1302,143 +1312,6 @@ PHP_MINFO_FUNCTION(hash)
}
/* }}} */
-/* {{{ arginfo */
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_md5, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_md5_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_sha1, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_sha1_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash, 0, 0, 2)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_file, 0, 0, 2)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hmac, 0, 0, 3)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hmac_file, 0, 0, 3)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_init, 0, 0, 1)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_update, 0)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_update_stream, 0, 0, 2)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, handle)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_update_file, 0, 0, 2)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, stream_context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_final, 0, 0, 1)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_copy, 0)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_algos, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_pbkdf2, 0, 0, 4)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, iterations)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_equals, 0)
- ZEND_ARG_INFO(0, known_string)
- ZEND_ARG_INFO(0, user_string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hkdf, 0, 0, 2)
- ZEND_ARG_INFO(0, ikm)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, salt)
-ZEND_END_ARG_INFO()
-
-/* BC Land */
-#ifdef PHP_MHASH_BC
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_block_size, 0)
- ZEND_ARG_INFO(0, hash)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_hash_name, 0)
- ZEND_ARG_INFO(0, hash)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_keygen_s2k, 0)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, input_password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, bytes)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_count, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash, 0, 0, 2)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-#endif
-
-/* }}} */
-
/* {{{ hash_functions[]
*/
static const zend_function_entry hash_functions[] = {
@@ -1461,17 +1334,6 @@ static const zend_function_entry hash_functions[] = {
PHP_FE(hash_equals, arginfo_hash_equals)
PHP_FE(hash_hkdf, arginfo_hash_hkdf)
- /* BC Land */
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
- PHP_NAMED_FE(md5, php_if_md5, arginfo_hash_md5)
- PHP_NAMED_FE(md5_file, php_if_md5_file, arginfo_hash_md5_file)
-#endif /* PHP_HASH_MD5_NOT_IN_CORE */
-
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
- PHP_NAMED_FE(sha1, php_if_sha1, arginfo_hash_sha1)
- PHP_NAMED_FE(sha1_file, php_if_sha1_file, arginfo_hash_sha1_file)
-#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
-
#ifdef PHP_MHASH_BC
PHP_FE(mhash_keygen_s2k, arginfo_mhash_keygen_s2k)
PHP_FE(mhash_get_block_size, arginfo_mhash_get_block_size)
diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php
new file mode 100644
index 0000000000..5f28ad9799
--- /dev/null
+++ b/ext/hash/hash.stub.php
@@ -0,0 +1,60 @@
+<?php
+
+/** @return string|false */
+function hash(string $algo, string $data, bool $raw_output = false) {}
+
+/** @return string|false */
+function hash_file(string $algo, string $filename, bool $raw_output = false) {}
+
+/** @return string|false */
+function hash_hmac(string $algo, string $data, string $key, bool $raw_output = false) {}
+
+/** @return string|false */
+function hash_hmac_file(string $algo, string $data, string $key, bool $raw_output = false) {}
+
+function hash_init(string $algo, int $options = 0, string $key = UNKNOWN): HashContext {}
+
+/** @return true */
+function hash_update(HashContext $context, string $data): bool {}
+
+/** @param resource $handle */
+function hash_update_stream(HashContext $context, $handle, int $length = -1): int {}
+
+/** @param resource $stream_context */
+function hash_update_file(HashContext $context, string $filename, $stream_context = UNKNOWN): bool {}
+
+function hash_final(HashContext $context, bool $raw_output = false): string {}
+
+function hash_copy(HashContext $context): HashContext {}
+
+function hash_algos(): array {}
+
+function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $raw_output = false): string {}
+
+/**
+ * @param $known_string no type juggling is performed
+ * @param $user_string no type juggling is performed
+ */
+function hash_equals(string $known_string, string $user_string) : bool {}
+
+function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = '', string $salt = ''): string {}
+
+#ifdef PHP_MHASH_BC
+/** @return int|false */
+function mhash_get_block_size(int $hash) {}
+
+/** @return string|false */
+function mhash_get_hash_name(int $hash) {}
+
+/** @return string|false */
+function mhash_keygen_s2k(int $hash, string $input_password, string $salt, int $bytes) {}
+
+function mhash_count(): int {}
+
+/** @return string|false */
+function mhash(int $hash, string $data, string $key = UNKNOWN) {}
+#endif
+
+class HashContext {
+ private function __construct() {}
+}
diff --git a/ext/hash/hash_adler32.c b/ext/hash/hash_adler32.c
index 12bc44e446..8d2d2fcb93 100644
--- a/ext/hash/hash_adler32.c
+++ b/ext/hash/hash_adler32.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/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h
new file mode 100644
index 0000000000..6ba7a403cb
--- /dev/null
+++ b/ext/hash/hash_arginfo.h
@@ -0,0 +1,114 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_hash, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_file, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hmac, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_hash_hmac_file arginfo_hash_hmac
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_stream, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, stream_context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_final, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_copy, 0, 1, HashContext, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_algos, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_pbkdf2, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, known_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, user_string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ikm, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, info, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash_get_block_size, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+#define arginfo_mhash_get_hash_name arginfo_mhash_get_block_size
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash_keygen_s2k, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, input_password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bytes, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mhash_count, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_HashContext___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/hash/hash_crc32.c b/ext/hash/hash_crc32.c
index 95f3600dca..52c67717ff 100644
--- a/ext/hash/hash_crc32.c
+++ b/ext/hash/hash_crc32.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/ext/hash/hash_fnv.c b/ext/hash/hash_fnv.c
index 0ebe867b49..976c53b527 100644
--- a/ext/hash/hash_fnv.c
+++ b/ext/hash/hash_fnv.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/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index f51b310b70..a9e689de16 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.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/ext/hash/hash_haval.c b/ext/hash/hash_haval.c
index af2991e667..92e48669ae 100644
--- a/ext/hash/hash_haval.c
+++ b/ext/hash/hash_haval.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/ext/hash/hash_joaat.c b/ext/hash/hash_joaat.c
index fe04ed9cf2..d6311e81de 100644
--- a/ext/hash/hash_joaat.c
+++ b/ext/hash/hash_joaat.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/ext/hash/hash_md.c b/ext/hash/hash_md.c
index 497c7d9d8d..e5cbb49b01 100644
--- a/ext/hash/hash_md.c
+++ b/ext/hash/hash_md.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, |
@@ -92,355 +90,6 @@ static void Decode(uint32_t *output, const unsigned char *input, unsigned int le
}
/* }}} */
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
-
-/* MD5 */
-
-PHP_HASH_API void make_digest(char *md5str, unsigned char *digest)
-{
- php_hash_bin2hex(md5str, digest, 16);
- md5str[32] = '\0';
-}
-
-/* {{{ proto string md5(string str, [ bool raw_output])
- Calculate the md5 hash of a string */
-PHP_NAMED_FUNCTION(php_if_md5)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- PHP_MD5_CTX context;
- unsigned char digest[16];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- PHP_MD5Init(&context);
- PHP_MD5Update(&context, arg, arg_len);
- PHP_MD5Final(digest, &context);
- if (raw_output) {
- RETURN_STRINGL(digest, 16);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(32, 0));
- make_digest(Z_STRVAL_P(return_value), digest);
- }
-
-}
-/* }}} */
-
-/* {{{ proto string md5_file(string filename [, bool raw_output])
- Calculate the md5 hash of given filename */
-PHP_NAMED_FUNCTION(php_if_md5_file)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- unsigned char buf[1024];
- unsigned char digest[16];
- PHP_MD5_CTX context;
- int n;
- php_stream *stream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
- if (!stream) {
- RETURN_FALSE;
- }
-
- PHP_MD5Init(&context);
-
- while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- PHP_MD5Update(&context, buf, n);
- }
-
- PHP_MD5Final(digest, &context);
-
- php_stream_close(stream);
-
- if (n<0) {
- RETURN_FALSE;
- }
-
- if (raw_output) {
- RETURN_STRINGL(digest, 16);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(32, 0));
- make_digest(Z_STRVAL_P(return_value), digest);
- }
-}
-/* }}} */
-
-/*
- * The remaining code is the reference MD5 code (md5c.c) from rfc1321
- */
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* Constants for MD5Transform routine.
- */
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform(uint32_t[4], const unsigned char[64]);
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* {{{ PHP_MD5Init
- * MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-/* }}} */
-
-/* {{{ PHP_MD5Update
- MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX * context, const unsigned char *input,
- size_t inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((uint32_t) inputLen << 3))
- < ((uint32_t) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((uint32_t) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- MD5Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_MD5Final
- MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-PHP_HASH_API void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode(bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_MD5Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_MD5Update(context, bits, 8);
-
- /* Store state in digest */
- Encode(digest, context->state, 16);
-
- /* Zeroize sensitive information.
- */
- ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
-}
-/* }}} */
-
-/* {{{ MD5Transform
- * MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform(state, block)
-uint32_t state[4];
-const unsigned char block[64];
-{
- uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
- FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
- FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
- FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
- FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
- FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
- FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
- FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
- FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
- FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
- GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
- GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
- GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
- GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
- GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
- HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
- HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
- HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
- HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
- HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
- HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
- II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
- II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
- II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information. */
- ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
-}
-/* }}} */
-
-#endif /* PHP_HASH_MD5_NOT_IN_CORE */
-
/* MD4 */
#define MD4_F(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
diff --git a/ext/hash/hash_ripemd.c b/ext/hash/hash_ripemd.c
index 083e6a9955..84a29f6486 100644
--- a/ext/hash/hash_ripemd.c
+++ b/ext/hash/hash_ripemd.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/ext/hash/hash_sha.c b/ext/hash/hash_sha.c
index 4e0e1c1797..30ab0d22ad 100644
--- a/ext/hash/hash_sha.c
+++ b/ext/hash/hash_sha.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, |
@@ -75,333 +73,6 @@ const php_hash_ops php_hash_sha1_ops = {
1
};
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
-
-PHP_HASH_API void make_sha1_digest(char *sha1str, unsigned char *digest)
-{
- php_hash_bin2hex(sha1str, digest, 20);
- sha1str[40] = '\0';
-}
-
-/* {{{ proto string sha1(string str [, bool raw_output])
- Calculate the sha1 hash of a string */
-PHP_FUNCTION(sha1)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- PHP_SHA1_CTX context;
- unsigned char digest[20];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- PHP_SHA1Init(&context);
- PHP_SHA1Update(&context, arg, arg_len);
- PHP_SHA1Final(digest, &context);
- if (raw_output) {
- RETURN_STRINGL(digest, 20);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(40, 0));
- make_sha1_digest(Z_STRVAL_P(return_value), digest);
- }
-
-}
-
-/* }}} */
-
-/* {{{ proto string sha1_file(string filename [, bool raw_output])
- Calculate the sha1 hash of given filename */
-PHP_FUNCTION(sha1_file)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- unsigned char buf[1024];
- unsigned char digest[20];
- PHP_SHA1_CTX context;
- int n;
- php_stream *stream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
- if (!stream) {
- RETURN_FALSE;
- }
-
- PHP_SHA1Init(&context);
-
- while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- PHP_SHA1Update(&context, buf, n);
- }
-
- PHP_SHA1Final(digest, &context);
-
- php_stream_close(stream);
-
- if (n<0) {
- RETURN_FALSE;
- }
-
- if (raw_output) {
- RETURN_STRINGL(digest, 20);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(40, 0));
- make_sha1_digest(Z_STRVAL_P(return_value), digest);
- }
-}
-/* }}} */
-
-/* F, G, H and I are basic SHA1 functions.
- */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) ((x) ^ (y) ^ (z))
-#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y))))
-#define I(x, y, z) ((x) ^ (y) ^ (z))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* W[i]
- */
-#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \
- (x[i&15]=ROTATE_LEFT(tmp, 1)) )
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- */
-#define FF(a, b, c, d, e, w) { \
- (e) += F ((b), (c), (d)) + (w) + (uint32_t)(0x5A827999); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define GG(a, b, c, d, e, w) { \
- (e) += G ((b), (c), (d)) + (w) + (uint32_t)(0x6ED9EBA1); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define HH(a, b, c, d, e, w) { \
- (e) += H ((b), (c), (d)) + (w) + (uint32_t)(0x8F1BBCDC); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define II(a, b, c, d, e, w) { \
- (e) += I ((b), (c), (d)) + (w) + (uint32_t)(0xCA62C1D6); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-
-
-/* {{{ PHP_SHA1Init
- * SHA1 initialization. Begins an SHA1 operation, writing a new context.
- */
-PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
- context->state[4] = 0xc3d2e1f0;
-}
-/* }}} */
-
-/* {{{ SHA1Transform
- * SHA1 basic transformation. Transforms state based on block.
- */
-static void SHA1Transform(uint32_t state[5], const unsigned char block[64])
-{
- uint32_t a = state[0], b = state[1], c = state[2];
- uint32_t d = state[3], e = state[4], x[16], tmp;
-
- SHADecode32(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, e, x[0]); /* 1 */
- FF(e, a, b, c, d, x[1]); /* 2 */
- FF(d, e, a, b, c, x[2]); /* 3 */
- FF(c, d, e, a, b, x[3]); /* 4 */
- FF(b, c, d, e, a, x[4]); /* 5 */
- FF(a, b, c, d, e, x[5]); /* 6 */
- FF(e, a, b, c, d, x[6]); /* 7 */
- FF(d, e, a, b, c, x[7]); /* 8 */
- FF(c, d, e, a, b, x[8]); /* 9 */
- FF(b, c, d, e, a, x[9]); /* 10 */
- FF(a, b, c, d, e, x[10]); /* 11 */
- FF(e, a, b, c, d, x[11]); /* 12 */
- FF(d, e, a, b, c, x[12]); /* 13 */
- FF(c, d, e, a, b, x[13]); /* 14 */
- FF(b, c, d, e, a, x[14]); /* 15 */
- FF(a, b, c, d, e, x[15]); /* 16 */
- FF(e, a, b, c, d, W(16)); /* 17 */
- FF(d, e, a, b, c, W(17)); /* 18 */
- FF(c, d, e, a, b, W(18)); /* 19 */
- FF(b, c, d, e, a, W(19)); /* 20 */
-
- /* Round 2 */
- GG(a, b, c, d, e, W(20)); /* 21 */
- GG(e, a, b, c, d, W(21)); /* 22 */
- GG(d, e, a, b, c, W(22)); /* 23 */
- GG(c, d, e, a, b, W(23)); /* 24 */
- GG(b, c, d, e, a, W(24)); /* 25 */
- GG(a, b, c, d, e, W(25)); /* 26 */
- GG(e, a, b, c, d, W(26)); /* 27 */
- GG(d, e, a, b, c, W(27)); /* 28 */
- GG(c, d, e, a, b, W(28)); /* 29 */
- GG(b, c, d, e, a, W(29)); /* 30 */
- GG(a, b, c, d, e, W(30)); /* 31 */
- GG(e, a, b, c, d, W(31)); /* 32 */
- GG(d, e, a, b, c, W(32)); /* 33 */
- GG(c, d, e, a, b, W(33)); /* 34 */
- GG(b, c, d, e, a, W(34)); /* 35 */
- GG(a, b, c, d, e, W(35)); /* 36 */
- GG(e, a, b, c, d, W(36)); /* 37 */
- GG(d, e, a, b, c, W(37)); /* 38 */
- GG(c, d, e, a, b, W(38)); /* 39 */
- GG(b, c, d, e, a, W(39)); /* 40 */
-
- /* Round 3 */
- HH(a, b, c, d, e, W(40)); /* 41 */
- HH(e, a, b, c, d, W(41)); /* 42 */
- HH(d, e, a, b, c, W(42)); /* 43 */
- HH(c, d, e, a, b, W(43)); /* 44 */
- HH(b, c, d, e, a, W(44)); /* 45 */
- HH(a, b, c, d, e, W(45)); /* 46 */
- HH(e, a, b, c, d, W(46)); /* 47 */
- HH(d, e, a, b, c, W(47)); /* 48 */
- HH(c, d, e, a, b, W(48)); /* 49 */
- HH(b, c, d, e, a, W(49)); /* 50 */
- HH(a, b, c, d, e, W(50)); /* 51 */
- HH(e, a, b, c, d, W(51)); /* 52 */
- HH(d, e, a, b, c, W(52)); /* 53 */
- HH(c, d, e, a, b, W(53)); /* 54 */
- HH(b, c, d, e, a, W(54)); /* 55 */
- HH(a, b, c, d, e, W(55)); /* 56 */
- HH(e, a, b, c, d, W(56)); /* 57 */
- HH(d, e, a, b, c, W(57)); /* 58 */
- HH(c, d, e, a, b, W(58)); /* 59 */
- HH(b, c, d, e, a, W(59)); /* 60 */
-
- /* Round 4 */
- II(a, b, c, d, e, W(60)); /* 61 */
- II(e, a, b, c, d, W(61)); /* 62 */
- II(d, e, a, b, c, W(62)); /* 63 */
- II(c, d, e, a, b, W(63)); /* 64 */
- II(b, c, d, e, a, W(64)); /* 65 */
- II(a, b, c, d, e, W(65)); /* 66 */
- II(e, a, b, c, d, W(66)); /* 67 */
- II(d, e, a, b, c, W(67)); /* 68 */
- II(c, d, e, a, b, W(68)); /* 69 */
- II(b, c, d, e, a, W(69)); /* 70 */
- II(a, b, c, d, e, W(70)); /* 71 */
- II(e, a, b, c, d, W(71)); /* 72 */
- II(d, e, a, b, c, W(72)); /* 73 */
- II(c, d, e, a, b, W(73)); /* 74 */
- II(b, c, d, e, a, W(74)); /* 75 */
- II(a, b, c, d, e, W(75)); /* 76 */
- II(e, a, b, c, d, W(76)); /* 77 */
- II(d, e, a, b, c, W(77)); /* 78 */
- II(c, d, e, a, b, W(78)); /* 79 */
- II(b, c, d, e, a, W(79)); /* 80 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
- state[4] += e;
-
- /* Zeroize sensitive information. */
- ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
-}
-/* }}} */
-
-/* {{{ PHP_SHA1Update
- SHA1 block update operation. Continues an SHA1 message-digest
- operation, processing another message block, and updating the
- context.
- */
-PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input,
- size_t inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((uint32_t) inputLen << 3))
- < ((uint32_t) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((uint32_t) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- SHA1Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- SHA1Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_SHA1Final
- SHA1 finalization. Ends an SHA1 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-PHP_HASH_API void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- bits[7] = context->count[0] & 0xFF;
- bits[6] = (context->count[0] >> 8) & 0xFF;
- bits[5] = (context->count[0] >> 16) & 0xFF;
- bits[4] = (context->count[0] >> 24) & 0xFF;
- bits[3] = context->count[1] & 0xFF;
- bits[2] = (context->count[1] >> 8) & 0xFF;
- bits[1] = (context->count[1] >> 16) & 0xFF;
- bits[0] = (context->count[1] >> 24) & 0xFF;
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_SHA1Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_SHA1Update(context, bits, 8);
-
- /* Store state in digest */
- SHAEncode32(digest, context->state, 20);
-
- /* Zeroize sensitive information.
- */
- ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
-}
-/* }}} */
-
-#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
-
/* sha224/sha256 */
const php_hash_ops php_hash_sha256_ops = {
diff --git a/ext/hash/hash_sha3.c b/ext/hash/hash_sha3.c
index 77cec630d8..85be0e85c9 100644
--- a/ext/hash/hash_sha3.c
+++ b/ext/hash/hash_sha3.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/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c
index 867556acc5..fae767f2fe 100644
--- a/ext/hash/hash_snefru.c
+++ b/ext/hash/hash_snefru.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/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index 4d126f0d8f..399e95af0e 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.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/ext/hash/hash_whirlpool.c b/ext/hash/hash_whirlpool.c
index 3bd9bd13da..5be7f80eea 100644
--- a/ext/hash/hash_whirlpool.c
+++ b/ext/hash/hash_whirlpool.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/ext/hash/php_hash.h b/ext/hash/php_hash.h
index 8e919e2a6f..ddb28f46e3 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.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/ext/hash/php_hash_adler32.h b/ext/hash/php_hash_adler32.h
index 63f32ab536..184091c971 100644
--- a/ext/hash/php_hash_adler32.h
+++ b/ext/hash/php_hash_adler32.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/ext/hash/php_hash_crc32.h b/ext/hash/php_hash_crc32.h
index 6308b005e3..346011e417 100644
--- a/ext/hash/php_hash_crc32.h
+++ b/ext/hash/php_hash_crc32.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/ext/hash/php_hash_crc32_tables.h b/ext/hash/php_hash_crc32_tables.h
index 8e2feccc01..6b342c83da 100644
--- a/ext/hash/php_hash_crc32_tables.h
+++ b/ext/hash/php_hash_crc32_tables.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/ext/hash/php_hash_fnv.h b/ext/hash/php_hash_fnv.h
index f00a469423..1cb8c78d29 100644
--- a/ext/hash/php_hash_fnv.h
+++ b/ext/hash/php_hash_fnv.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/ext/hash/php_hash_gost.h b/ext/hash/php_hash_gost.h
index 3837eeb263..537e3d0bdc 100644
--- a/ext/hash/php_hash_gost.h
+++ b/ext/hash/php_hash_gost.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/ext/hash/php_hash_haval.h b/ext/hash/php_hash_haval.h
index 1188b79cc3..1033fd59dc 100644
--- a/ext/hash/php_hash_haval.h
+++ b/ext/hash/php_hash_haval.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/ext/hash/php_hash_joaat.h b/ext/hash/php_hash_joaat.h
index b9e7e7a7ee..ede108f1bb 100644
--- a/ext/hash/php_hash_joaat.h
+++ b/ext/hash/php_hash_joaat.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/ext/hash/php_hash_md.h b/ext/hash/php_hash_md.h
index 0073488c14..aed999261e 100644
--- a/ext/hash/php_hash_md.h
+++ b/ext/hash/php_hash_md.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, |
@@ -20,58 +18,8 @@
#ifndef PHP_HASH_MD_H
#define PHP_HASH_MD_H
-/* When SHA is removed from Core,
- the ext/standard/sha1.c file can be removed
- and the ext/standard/sha1.h file can be reduced to:
- #define PHP_HASH_SHA1_NOT_IN_CORE
- #include "ext/hash/php_hash_sha.h"
- Don't forget to remove md5() and md5_file() entries from basic_functions.c
- */
-
#include "ext/standard/md5.h"
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* MD5 context. */
-typedef struct {
- uint32_t state[4]; /* state (ABCD) */
- uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} PHP_MD5_CTX;
-
-PHP_HASH_API void make_digest(char *md5str, unsigned char *digest);
-PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX *);
-PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, size_t);
-PHP_HASH_API void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
-
-PHP_NAMED_FUNCTION(php_if_md5);
-PHP_NAMED_FUNCTION(php_if_md5_file);
-#endif /* PHP_HASH_MD5_NOT_IN_CORE */
-
/* MD4 context */
typedef struct {
uint32_t state[4];
diff --git a/ext/hash/php_hash_ripemd.h b/ext/hash/php_hash_ripemd.h
index e8f1678166..131dd0ad8f 100644
--- a/ext/hash/php_hash_ripemd.h
+++ b/ext/hash/php_hash_ripemd.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/ext/hash/php_hash_sha.h b/ext/hash/php_hash_sha.h
index 4903f8d8b2..95471e7398 100644
--- a/ext/hash/php_hash_sha.h
+++ b/ext/hash/php_hash_sha.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, |
@@ -20,34 +18,9 @@
#ifndef PHP_HASH_SHA_H
#define PHP_HASH_SHA_H
-/* When SHA is removed from Core,
- the ext/standard/sha1.c file can be removed
- and the ext/standard/sha1.h file can be reduced to:
- #define PHP_HASH_SHA1_NOT_IN_CORE
- #include "ext/hash/php_hash_sha.h"
- Don't forget to remove sha1() and sha1_file() from basic_functions.c
- */
#include "ext/standard/sha1.h"
#include "ext/standard/basic_functions.h"
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
-
-/* SHA1 context. */
-typedef struct {
- uint32_t state[5]; /* state (ABCD) */
- uint32_t count[2]; /* number of bits, modulo 2^64 */
- unsigned char buffer[64]; /* input buffer */
-} PHP_SHA1_CTX;
-
-PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX *);
-PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t);
-PHP_HASH_API void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
-
-PHP_FUNCTION(sha1);
-PHP_FUNCTION(sha1_file);
-
-#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
-
/* SHA224 context. */
typedef struct {
uint32_t state[8]; /* state */
diff --git a/ext/hash/php_hash_sha3.h b/ext/hash/php_hash_sha3.h
index 0608f4005e..256da7bda6 100644
--- a/ext/hash/php_hash_sha3.h
+++ b/ext/hash/php_hash_sha3.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/ext/hash/php_hash_snefru.h b/ext/hash/php_hash_snefru.h
index 2040fbfc94..25ba1183e3 100644
--- a/ext/hash/php_hash_snefru.h
+++ b/ext/hash/php_hash_snefru.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/ext/hash/php_hash_snefru_tables.h b/ext/hash/php_hash_snefru_tables.h
index 20d385443d..bed4befae3 100644
--- a/ext/hash/php_hash_snefru_tables.h
+++ b/ext/hash/php_hash_snefru_tables.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/ext/hash/php_hash_tiger.h b/ext/hash/php_hash_tiger.h
index b80e4e3254..4476639040 100644
--- a/ext/hash/php_hash_tiger.h
+++ b/ext/hash/php_hash_tiger.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/ext/hash/php_hash_tiger_tables.h b/ext/hash/php_hash_tiger_tables.h
index 3dbdc0a4c6..d5e94badc7 100644
--- a/ext/hash/php_hash_tiger_tables.h
+++ b/ext/hash/php_hash_tiger_tables.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/ext/hash/php_hash_whirlpool.h b/ext/hash/php_hash_whirlpool.h
index 3a2e98cff2..f96da414a5 100644
--- a/ext/hash/php_hash_whirlpool.h
+++ b/ext/hash/php_hash_whirlpool.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/ext/hash/php_hash_whirlpool_tables.h b/ext/hash/php_hash_whirlpool_tables.h
index 2127ccca59..a42d20a8b6 100644
--- a/ext/hash/php_hash_whirlpool_tables.h
+++ b/ext/hash/php_hash_whirlpool_tables.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/ext/hash/tests/hash_equals.phpt b/ext/hash/tests/hash_equals.phpt
index 0c8ab42f93..1716d3be66 100644
--- a/ext/hash/tests/hash_equals.phpt
+++ b/ext/hash/tests/hash_equals.phpt
@@ -2,21 +2,36 @@
Hash: hash_equals() test
--FILE--
<?php
-var_dump(hash_equals("same", "same"));
-var_dump(hash_equals("not1same", "not2same"));
-var_dump(hash_equals("short", "longer"));
-var_dump(hash_equals("longer", "short"));
-var_dump(hash_equals("", "notempty"));
-var_dump(hash_equals("notempty", ""));
-var_dump(hash_equals("", ""));
-var_dump(hash_equals(123, "NaN"));
-var_dump(hash_equals("NaN", 123));
-var_dump(hash_equals(123, 123));
-var_dump(hash_equals(null, ""));
-var_dump(hash_equals(null, 123));
-var_dump(hash_equals(null, null));
+
+function trycatch_dump(...$tests) {
+ foreach ($tests as $test) {
+ try {
+ var_dump($test());
+ }
+ catch (\Error $e) {
+ echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n";
+ }
+ }
+}
+
+trycatch_dump(
+ fn() => hash_equals("same", "same"),
+ fn() => hash_equals("not1same", "not2same"),
+ fn() => hash_equals("short", "longer"),
+ fn() => hash_equals("longer", "short"),
+ fn() => hash_equals("", "notempty"),
+ fn() => hash_equals("notempty", ""),
+ fn() => hash_equals("", ""),
+ fn() => hash_equals(123, "NaN"),
+ fn() => hash_equals("NaN", 123),
+ fn() => hash_equals(123, 123),
+ fn() => hash_equals(null, ""),
+ fn() => hash_equals(null, 123),
+ fn() => hash_equals(null, null),
+);
+
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(false)
bool(false)
@@ -24,21 +39,9 @@ bool(false)
bool(false)
bool(false)
bool(true)
-
-Warning: hash_equals(): Expected known_string to be a string, int given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected user_string to be a string, int given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, int given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
-bool(false)
+[TypeError] Expected known_string to be a string, int given
+[TypeError] Expected user_string to be a string, int given
+[TypeError] Expected known_string to be a string, int given
+[TypeError] Expected known_string to be a string, null given
+[TypeError] Expected known_string to be a string, null given
+[TypeError] Expected known_string to be a string, null given
diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt
index e760819e69..f879d491d7 100644
--- a/ext/hash/tests/hash_error.phpt
+++ b/ext/hash/tests/hash_error.phpt
@@ -10,14 +10,6 @@ Hash: hash() function : error conditions
*/
echo "*** Testing hash() : error conditions ***\n";
-echo "\n-- Testing hash() function with less than expected no. of arguments --\n";
-var_dump(hash());
-var_dump(hash('adler32'));
-
-echo "\n-- Testing hash() function with more than expected no. of arguments --\n";
-$extra_arg= 10;
-var_dump(hash('adler32', '', false, $extra_arg));
-
echo "\n-- Testing hash() function with invalid hash algorithm --\n";
var_dump(hash('foo', ''));
@@ -26,19 +18,6 @@ var_dump(hash('foo', ''));
--EXPECTF--
*** Testing hash() : error conditions ***
--- Testing hash() function with less than expected no. of arguments --
-
-Warning: hash() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing hash() function with more than expected no. of arguments --
-
-Warning: hash() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing hash() function with invalid hash algorithm --
Warning: hash(): Unknown hashing algorithm: foo in %s on line %d
diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt
index a634070de5..b001001861 100644
--- a/ext/hash/tests/hash_file_error.phpt
+++ b/ext/hash/tests/hash_file_error.phpt
@@ -24,13 +24,6 @@ var_dump( hash_file( 'foobar', $filename ) );
echo "\n-- Testing hash_file() function with a non-existent file --\n";
var_dump( hash_file( 'md5', 'nonexistent.txt' ) );
-echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n";
-var_dump( hash_file( 'md5' ) );
-
-echo "\n-- Testing hash_file() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( hash_file( 'md5', $filename, false, $extra_arg ) );
-
?>
===DONE===
--CLEAN--
@@ -52,14 +45,4 @@ bool(false)
Warning: hash_file(%s): failed to open stream: No such file or directory in %s on line %d
bool(false)
-
--- Testing hash_file() function with less than expected no. of arguments --
-
-Warning: hash_file() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing hash_file() function with more than expected no. of arguments --
-
-Warning: hash_file() expects at most 3 parameters, 4 given in %s on line %d
-NULL
===DONE===
diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt
index 82acdbab04..debd166cfd 100644
--- a/ext/hash/tests/hash_hkdf_edges.phpt
+++ b/ext/hash/tests/hash_hkdf_edges.phpt
@@ -16,7 +16,13 @@ echo 'Length < digestSize: ', bin2hex(hash_hkdf('md5', $ikm, 7)), "\n";
echo 'Length % digestSize != 0: ', bin2hex(hash_hkdf('md5', $ikm, 17)), "\n";
echo 'Algo name case-sensitivity: ', (bin2hex(hash_hkdf('Md5', $ikm, 7)) === '98b16391063ece' ? 'true' : 'false'), "\n";
echo "Non-crypto algo name case-sensitivity:\n";
-var_dump(hash_hkdf('jOaAt', $ikm));
+
+try {
+ var_dump(hash_hkdf('jOaAt', $ikm));
+}
+catch (\Error $e) {
+ echo '[Error] ' . $e->getMessage() . "\n";
+}
?>
--EXPECTF--
@@ -25,6 +31,4 @@ Length < digestSize: 98b16391063ece
Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f
Algo name case-sensitivity: true
Non-crypto algo name case-sensitivity:
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: jOaAt in %s on line %d
-bool(false)
+[Error] Non-cryptographic hashing algorithm: jOaAt
diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt
index b833054e80..335988b965 100644
--- a/ext/hash/tests/hash_hkdf_error.phpt
+++ b/ext/hash/tests/hash_hkdf_error.phpt
@@ -3,96 +3,71 @@ Hash: hash_hkdf() function: error conditions
--FILE--
<?php
+error_reporting(E_ALL);
+
/* Prototype : string hkdf ( string $algo , string $ikm [, int $length , string $info = '' , string $salt = '' ] )
* Description: HMAC-based Key Derivation Function
* Source code: ext/hash/hash.c
*/
+function trycatch_dump(...$tests) {
+ foreach ($tests as $test) {
+ try {
+ var_dump($test());
+ }
+ catch (\Error $e) {
+ echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n";
+ }
+ }
+}
+
$ikm = 'input key material';
echo "*** Testing hash_hkdf(): error conditions ***\n";
-echo "\n-- Testing hash_hkdf() function with less than expected no. of arguments --\n";
-var_dump(hash_hkdf());
-var_dump(hash_hkdf('sha1'));
-
-echo "\n-- Testing hash_hkdf() function with more than expected no. of arguments --\n";
-var_dump(hash_hkdf('sha1', $ikm, 20, '', '', 'extra parameter'));
-
echo "\n-- Testing hash_hkdf() function with invalid hash algorithm --\n";
-var_dump(hash_hkdf('foo', $ikm));
+trycatch_dump(
+ fn() => hash_hkdf('foo', $ikm)
+);
echo "\n-- Testing hash_hkdf() function with non-cryptographic hash algorithm --\n";
-var_dump(hash_hkdf('adler32', $ikm));
-var_dump(hash_hkdf('crc32', $ikm));
-var_dump(hash_hkdf('crc32b', $ikm));
-var_dump(hash_hkdf('fnv132', $ikm));
-var_dump(hash_hkdf('fnv1a32', $ikm));
-var_dump(hash_hkdf('fnv164', $ikm));
-var_dump(hash_hkdf('fnv1a64', $ikm));
-var_dump(hash_hkdf('joaat', $ikm));
+trycatch_dump(
+ fn() => hash_hkdf('adler32', $ikm),
+ fn() => hash_hkdf('crc32', $ikm),
+ fn() => hash_hkdf('crc32b', $ikm),
+ fn() => hash_hkdf('fnv132', $ikm),
+ fn() => hash_hkdf('fnv1a32', $ikm),
+ fn() => hash_hkdf('fnv164', $ikm),
+ fn() => hash_hkdf('fnv1a64', $ikm),
+ fn() => hash_hkdf('joaat', $ikm)
+);
echo "\n-- Testing hash_hkdf() function with invalid parameters --\n";
-var_dump(hash_hkdf('sha1', ''));
-var_dump(hash_hkdf('sha1', $ikm, -1));
-var_dump(hash_hkdf('sha1', $ikm, 20 * 255 + 1)); // Length can't be more than 255 times the hash digest size
+trycatch_dump(
+ fn() => hash_hkdf('sha1', ''),
+ fn() => hash_hkdf('sha1', $ikm, -1),
+ fn() => hash_hkdf('sha1', $ikm, 20 * 255 + 1) // Length can't be more than 255 times the hash digest size
+)
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash_hkdf(): error conditions ***
--- Testing hash_hkdf() function with less than expected no. of arguments --
-
-Warning: hash_hkdf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_hkdf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing hash_hkdf() function with more than expected no. of arguments --
-
-Warning: hash_hkdf() expects at most 5 parameters, 6 given in %s on line %d
-NULL
-
-- Testing hash_hkdf() function with invalid hash algorithm --
-
-Warning: hash_hkdf(): Unknown hashing algorithm: foo in %s on line %d
-bool(false)
+[Error] Unknown hashing algorithm: foo
-- Testing hash_hkdf() function with non-cryptographic hash algorithm --
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: adler32 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: crc32b in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv132 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv1a32 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv164 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv1a64 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: joaat in %s on line %d
-bool(false)
+[Error] Non-cryptographic hashing algorithm: adler32
+[Error] Non-cryptographic hashing algorithm: crc32
+[Error] Non-cryptographic hashing algorithm: crc32b
+[Error] Non-cryptographic hashing algorithm: fnv132
+[Error] Non-cryptographic hashing algorithm: fnv1a32
+[Error] Non-cryptographic hashing algorithm: fnv164
+[Error] Non-cryptographic hashing algorithm: fnv1a64
+[Error] Non-cryptographic hashing algorithm: joaat
-- Testing hash_hkdf() function with invalid parameters --
-
-Warning: hash_hkdf(): Input keying material cannot be empty in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Length must be greater than or equal to 0: -1 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Length must be less than or equal to 5100: 5101 in %s on line %d
-bool(false)
+[Error] Input keying material cannot be empty
+[Error] Length must be greater than or equal to 0: -1
+[Error] Length must be less than or equal to 5100: 5101
===Done===
diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt
index 89d29b8df8..fe9ed734d4 100644
--- a/ext/hash/tests/hash_hmac_error.phpt
+++ b/ext/hash/tests/hash_hmac_error.phpt
@@ -12,49 +12,30 @@ echo "*** Testing hash_hmac() : error conditions ***\n";
$data = "This is a sample string used to test the hash_hmac function with various hashing algorithms";
$key = 'secret';
-echo "\n-- Testing hash_hmac() function with less than expected no. of arguments --\n";
-var_dump(hash_hmac());
-var_dump(hash_hmac('md5'));
-var_dump(hash_hmac('md5', $data));
-
-echo "\n-- Testing hash_hmac() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump(hash_hmac('md5', $data, $key, TRUE, $extra_arg));
-
echo "\n-- Testing hash_hmac() function with invalid hash algorithm --\n";
-var_dump(hash_hmac('foo', $data, $key));
+try {
+ var_dump(hash_hmac('foo', $data, $key));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_hmac() function with non-cryptographic hash algorithm --\n";
-var_dump(hash_hmac('crc32', $data, $key));
+try {
+ var_dump(hash_hmac('crc32', $data, $key));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash_hmac() : error conditions ***
--- Testing hash_hmac() function with less than expected no. of arguments --
-
-Warning: hash_hmac() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_hmac() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: hash_hmac() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing hash_hmac() function with more than expected no. of arguments --
-
-Warning: hash_hmac() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing hash_hmac() function with invalid hash algorithm --
-
-Warning: hash_hmac(): Unknown hashing algorithm: foo in %s on line %d
-bool(false)
+Unknown hashing algorithm: foo
-- Testing hash_hmac() function with non-cryptographic hash algorithm --
-
-Warning: hash_hmac(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
+Non-cryptographic hashing algorithm: crc32
===Done===
diff --git a/ext/hash/tests/hash_hmac_file_basic.phpt b/ext/hash/tests/hash_hmac_file_basic.phpt
index 6e4b4da078..7ce5cba7c4 100644
--- a/ext/hash/tests/hash_hmac_file_basic.phpt
+++ b/ext/hash/tests/hash_hmac_file_basic.phpt
@@ -54,11 +54,6 @@ echo "whirlpool: " . hash_hmac_file('whirlpool', $file, $key) . "\n";
echo "md5(raw): " . bin2hex(hash_hmac_file('md5', $file, $key, TRUE)). "\n";
echo "sha256(raw): " . bin2hex(hash_hmac_file('sha256', $file, $key, TRUE)). "\n";
-echo "Error cases:\n";
-hash_hmac_file();
-hash_hmac_file('foo', $file);
-hash_hmac_file('foo', $file, $key, TRUE, 10);
-
unlink($file);
?>
@@ -83,11 +78,4 @@ tiger192,3: ca89badf843ba68e3fae5832635aa848a72a4bc11676edd4
whirlpool: 37a0fbb90547690d5e5e11c046f6654ffdb7bab15e16d9d79c7d85765cc4bdcbfd9df8db7a3ce9558f3f244fead00ca29cf05297f75596555195a0683f15d69f
md5(raw): 8bddf39dd1c566c27acc7fa85ec36acf
sha256(raw): 9135286ca4c84dec711e4b831f6cd39e672e5ff93d011321274eb76733cc1e40
-Error cases:
-
-Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line %d
-
-Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d
-
-Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
===Done===
diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt
index a3718ebb85..5660b0f40c 100644
--- a/ext/hash/tests/hash_hmac_file_error.phpt
+++ b/ext/hash/tests/hash_hmac_file_error.phpt
@@ -14,53 +14,41 @@ echo "*** Testing hash() : error conditions ***\n";
$file = __DIR__ . "hash_file.txt";
$key = 'secret';
-echo "\n-- Testing hash_hmac_file() function with less than expected no. of arguments --\n";
-var_dump(hash_hmac_file());
-var_dump(hash_hmac_file('crc32'));
-var_dump(hash_hmac_file('crc32', $file));
-
-echo "\n-- Testing hash_hmac_file() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg);
-
echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n";
-hash_hmac_file('foo', $file, $key, TRUE);
+try {
+ var_dump(hash_hmac_file('foo', $file, $key, TRUE));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --\n";
-hash_hmac_file('crc32', $file, $key, TRUE);
+try {
+ var_dump(hash_hmac_file('crc32', $file, $key, TRUE));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_hmac_file() function with bad path --\n";
-hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE);
+try {
+ var_dump(hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash() : error conditions ***
--- Testing hash_hmac_file() function with less than expected no. of arguments --
-
-Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_hmac_file() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing hash_hmac_file() function with more than expected no. of arguments --
-
-Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
-
-- Testing hash_hmac_file() function with invalid hash algorithm --
-
-Warning: hash_hmac_file(): Unknown hashing algorithm: foo in %s on line %d
+Unknown hashing algorithm: foo
-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --
-
-Warning: hash_hmac_file(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
+Non-cryptographic hashing algorithm: crc32
-- Testing hash_hmac_file() function with bad path --
-
-Warning: hash_hmac_file(): Invalid path in %s on line %d
+Invalid path
===Done===
diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt
index e941aabca5..a68a8fc088 100644
--- a/ext/hash/tests/hash_init_error.phpt
+++ b/ext/hash/tests/hash_init_error.phpt
@@ -4,37 +4,48 @@ Hash: hash_init() function - errors test
<?php
echo "*** Testing hash_init(): error conditions ***\n";
-echo "-- Testing hash_init() function with no parameters --\n";
-var_dump(hash_init());
+echo "\n-- Testing hash_init() function with unknown algorithms --\n";
+try {
+ var_dump(hash_init('dummy'));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+echo "\n-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --\n";
+try {
+ var_dump(hash_init('crc32', HASH_HMAC));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+echo "\n-- Testing hash_init() function with HASH_HMAC and no key --\n";
+try {
+ var_dump(hash_init('md5', HASH_HMAC));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(hash_init('md5', HASH_HMAC, null));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "-- Testing hash_init() function with unknown algorithms --\n";
-var_dump(hash_init('dummy'));
-echo "-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --\n";
-var_dump(hash_init('crc32', HASH_HMAC));
-
-echo "-- Testing hash_init() function with HASH_HMAC and no key --\n";
-var_dump(hash_init('md5', HASH_HMAC));
-var_dump(hash_init('md5', HASH_HMAC, null));
?>
---EXPECTF--
+--EXPECT--
*** Testing hash_init(): error conditions ***
--- Testing hash_init() function with no parameters --
-Warning: hash_init() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-- Testing hash_init() function with unknown algorithms --
+Unknown hashing algorithm: dummy
-Warning: hash_init(): Unknown hashing algorithm: dummy in %s on line %d
-bool(false)
-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --
+HMAC requested with a non-cryptographic hashing algorithm: crc32
-Warning: hash_init(): HMAC requested with a non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
-- Testing hash_init() function with HASH_HMAC and no key --
-
-Warning: hash_init(): HMAC requested without a key %s on line %d
-bool(false)
-
-Warning: hash_init(): HMAC requested without a key %s on line %d
-bool(false)
+HMAC requested without a key
+HMAC requested without a key
diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt
index c0a76e17b4..4cb5ede00b 100644
--- a/ext/hash/tests/hash_pbkdf2_error.phpt
+++ b/ext/hash/tests/hash_pbkdf2_error.phpt
@@ -12,72 +12,61 @@ echo "*** Testing hash_pbkdf2() : error conditions ***\n";
$password = 'password';
$salt = 'salt';
-echo "\n-- Testing hash_pbkdf2() function with less than expected no. of arguments --\n";
-var_dump(hash_pbkdf2());
-var_dump(hash_pbkdf2('md5'));
-var_dump(hash_pbkdf2('md5', $password));
-var_dump(hash_pbkdf2('md5', $password, $salt));
-
-echo "\n-- Testing hash_pbkdf2() function with more than expected no. of arguments --\n";
-var_dump(hash_pbkdf2('md5', $password, $salt, 10, 10, true, 'extra arg'));
-
echo "\n-- Testing hash_pbkdf2() function with invalid hash algorithm --\n";
-var_dump(hash_pbkdf2('foo', $password, $salt, 1));
+try {
+ var_dump(hash_pbkdf2('foo', $password, $salt, 1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo "\n-- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --\n";
-var_dump(hash_pbkdf2('crc32', $password, $salt, 1));
+try {
+ var_dump(hash_pbkdf2('crc32', $password, $salt, 1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_pbkdf2() function with invalid iterations --\n";
-var_dump(hash_pbkdf2('md5', $password, $salt, 0));
-var_dump(hash_pbkdf2('md5', $password, $salt, -1));
+try {
+ var_dump(hash_pbkdf2('md5', $password, $salt, 0));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(hash_pbkdf2('md5', $password, $salt, -1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_pbkdf2() function with invalid length --\n";
-var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1));
+try {
+ var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash_pbkdf2() : error conditions ***
--- Testing hash_pbkdf2() function with less than expected no. of arguments --
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 1 given in %s on line %d
-NULL
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 2 given in %s on line %d
-NULL
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 3 given in %s on line %d
-NULL
-
--- Testing hash_pbkdf2() function with more than expected no. of arguments --
-
-Warning: hash_pbkdf2() expects at most 6 parameters, 7 given in %s on line %d
-NULL
-
-- Testing hash_pbkdf2() function with invalid hash algorithm --
-
-Warning: hash_pbkdf2(): Unknown hashing algorithm: foo in %s on line %d
-bool(false)
+Unknown hashing algorithm: foo
-- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --
-
-Warning: hash_pbkdf2(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
+Non-cryptographic hashing algorithm: crc32
-- Testing hash_pbkdf2() function with invalid iterations --
-
-Warning: hash_pbkdf2(): Iterations must be a positive integer: 0 in %s on line %d
-bool(false)
-
-Warning: hash_pbkdf2(): Iterations must be a positive integer: -1 in %s on line %d
-bool(false)
+Iterations must be a positive integer: 0
+Iterations must be a positive integer: -1
-- Testing hash_pbkdf2() function with invalid length --
-
-Warning: hash_pbkdf2(): Length must be greater than or equal to 0: -1 in %s on line %d
-bool(false)
+Length must be greater than or equal to 0: -1
===Done===
diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt
index cd1419fd55..54ef56f08f 100644
--- a/ext/hash/tests/reuse.phpt
+++ b/ext/hash/tests/reuse.phpt
@@ -5,6 +5,12 @@ Hash: Attempt to reuse a closed hash context
$h = hash_init('md5');
hash_final($h);
-hash_update($h, 'foo');
---EXPECTF--
-Warning: hash_update(): supplied resource is not a valid Hash Context resource in %s%eext%ehash%etests%ereuse.php on line %d
+try {
+ hash_update($h, 'foo');
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+--EXPECT--
+hash_update(): supplied resource is not a valid Hash Context resource
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index d4244b19f4..9e4c52d252 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.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, |
@@ -53,71 +51,11 @@
#include "zend_smart_str.h"
#include "ext/standard/base64.h"
#include "ext/standard/quot_print.h"
+#include "iconv_arginfo.h"
#define _php_iconv_memequal(a, b, c) \
(memcmp(a, b, c) == 0)
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_substr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strrpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_encode, 0, 0, 2)
- ZEND_ARG_INFO(0, field_name)
- ZEND_ARG_INFO(0, field_value)
- ZEND_ARG_INFO(0, preference) /* ZEND_ARG_ARRAY_INFO(0, preference, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, encoded_string)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_decode_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, headers)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_iconv, 0)
- ZEND_ARG_INFO(0, in_charset)
- ZEND_ARG_INFO(0, out_charset)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_iconv_set_encoding, 0)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_get_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ iconv_functions[]
*/
static const zend_function_entry iconv_functions[] = {
@@ -2064,7 +2002,7 @@ PHP_FUNCTION(iconv_strlen)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|s",
&str, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2090,15 +2028,16 @@ PHP_FUNCTION(iconv_substr)
size_t charset_len = 0;
zend_string *str;
zend_long offset, length = 0;
+ zend_bool len_is_null = 1;
php_iconv_err_t err;
smart_str retval = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|ls",
- &str, &offset, &length,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l!s",
+ &str, &offset, &length, &len_is_null,
&charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2106,7 +2045,7 @@ PHP_FUNCTION(iconv_substr)
RETURN_FALSE;
}
- if (ZEND_NUM_ARGS() < 3) {
+ if (len_is_null) {
length = ZSTR_LEN(str);
}
@@ -2138,7 +2077,7 @@ PHP_FUNCTION(iconv_strpos)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|ls",
&haystk, &ndl,
&offset, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2192,7 +2131,7 @@ PHP_FUNCTION(iconv_strrpos)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|s",
&haystk, &ndl,
&charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (ZSTR_LEN(ndl) < 1) {
@@ -2237,7 +2176,7 @@ PHP_FUNCTION(iconv_mime_encode)
&field_name, &field_value,
&pref) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (pref != NULL) {
@@ -2335,7 +2274,7 @@ PHP_FUNCTION(iconv_mime_decode)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls",
&encoded_str, &mode, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2375,7 +2314,7 @@ PHP_FUNCTION(iconv_mime_decode_headers)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls",
&encoded_str, &mode, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (charset_len >= ICONV_CSNMAXLEN) {
diff --git a/ext/iconv/iconv.stub.php b/ext/iconv/iconv.stub.php
new file mode 100644
index 0000000000..965c4a7e96
--- /dev/null
+++ b/ext/iconv/iconv.stub.php
@@ -0,0 +1,30 @@
+<?php
+
+/** @return string|false */
+function iconv_strlen(string $str, string $charset = UNKNOWN) {}
+
+/** @return string|false */
+function iconv_substr(string $str, int $offset, ?int $length = null, string $charset = UNKNOWN) {}
+
+/** @return int|false */
+function iconv_strpos(string $haystack, string $needle, int $offset = 0, string $charset = UNKNOWN) {}
+
+/** @return int|false */
+function iconv_strrpos(string $haystack, string $needle, string $charset = UNKNOWN) {}
+
+/** @return string|false */
+function iconv_mime_encode(string $field_name, string $field_value, array $preference = []) {}
+
+/** @return string|false */
+function iconv_mime_decode(string $encoded_string, int $mode = 0, string $charset = UNKNOWN) {}
+
+/** @return array|false */
+function iconv_mime_decode_headers(string $headers, int $mode = 0, string $charset = UNKNOWN) {}
+
+/** @return string|false */
+function iconv(string $in_charset, string $out_charset, string $str) {}
+
+function iconv_set_encoding(string $type, string $charset): bool {}
+
+/** @return array|string|false */
+function iconv_get_encoding(string $type = 'all') {}
diff --git a/ext/iconv/iconv_arginfo.h b/ext/iconv/iconv_arginfo.h
new file mode 100644
index 0000000000..462b1cfbe4
--- /dev/null
+++ b/ext/iconv/iconv_arginfo.h
@@ -0,0 +1,59 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_substr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strpos, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strrpos, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_encode, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, field_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, field_value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, preference, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_decode_headers, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, headers, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, in_charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, out_charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iconv_set_encoding, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_get_encoding, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 980d84c945..23cfdb09e9 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.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/ext/iconv/tests/iconv_mime_decode.phpt b/ext/iconv/tests/iconv_mime_decode.phpt
index c5b76f3ce9..b5dee827df 100644
--- a/ext/iconv/tests/iconv_mime_decode.phpt
+++ b/ext/iconv/tests/iconv_mime_decode.phpt
@@ -6,7 +6,7 @@ iconv_mime_decode()
iconv.internal_charset=iso-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
echo "$errno: $errmsg\n";
}
diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt
index bd090e4d50..e4be799915 100644
--- a/ext/iconv/tests/iconv_mime_encode.phpt
+++ b/ext/iconv/tests/iconv_mime_encode.phpt
@@ -6,7 +6,7 @@ iconv_mime_encode()
iconv.internal_charset=iso-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
echo "$errno: $errmsg\n";
}
diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt
index 28e3fe2320..92492c7244 100644
--- a/ext/iconv/tests/iconv_strpos.phpt
+++ b/ext/iconv/tests/iconv_strpos.phpt
@@ -6,7 +6,7 @@ iconv_strpos()
iconv.internal_charset=ISO-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
echo "$errno: $errmsg\n";
}
diff --git a/ext/iconv/tests/iconv_strrpos.phpt b/ext/iconv/tests/iconv_strrpos.phpt
index ee977f2c31..76b8323d89 100644
--- a/ext/iconv/tests/iconv_strrpos.phpt
+++ b/ext/iconv/tests/iconv_strrpos.phpt
@@ -6,7 +6,7 @@ iconv_strrpos()
iconv.internal_charset=ISO-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
echo "$errno: $errmsg\n";
}
diff --git a/ext/iconv/tests/iconv_substr.phpt b/ext/iconv/tests/iconv_substr.phpt
index 6ca545b2ea..2a514e6f61 100644
--- a/ext/iconv/tests/iconv_substr.phpt
+++ b/ext/iconv/tests/iconv_substr.phpt
@@ -34,6 +34,7 @@ foo("¤¢¤¤¤¦¤¨¤ª¤«¤­¤¯¤±¤³¤µ¤·¤¹", 5, 7, "EUC-JP");
bar("This is a test", 100000);
bar("This is a test", 0, 100000);
bar("This is a test", -3);
+bar("This is a test", -3, null);
bar("This is a test", 0, -9);
bar("This is a test", 0, -100000);
bar("This is a test", -9, -100000);
@@ -50,6 +51,8 @@ string(14) "This is a test"
string(14) "This is a test"
string(3) "est"
string(3) "est"
+string(3) "est"
+string(3) "est"
string(5) "This "
string(5) "This "
bool(false)
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index b5f12f6eee..f39687dbfa 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.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, |
@@ -46,6 +44,7 @@
#undef ERROR
#endif
#include "php_imap.h"
+#include "php_imap_arginfo.h"
#include <time.h>
#include <stdio.h>
@@ -97,373 +96,6 @@ void *fs_get(size_t size);
ZEND_DECLARE_MODULE_GLOBALS(imap)
static PHP_GINIT_FUNCTION(imap);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, n_retries)
- ZEND_ARG_INFO(0, params)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_reopen, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, n_retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_append, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, folder)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_ping, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_recent, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_get_quota, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, qroot)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_get_quotaroot, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_set_quota, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, qroot)
- ZEND_ARG_INFO(0, mailbox_size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setacl, 0, 0, 4)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, rights)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getacl, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_expunge, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_gc, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_close, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_body, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_copy, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msglist)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_move, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_createmailbox, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_renamemailbox, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, old_name)
- ZEND_ARG_INFO(0, new_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_deletemailbox, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_list, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getmailboxes, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_listscan, 0, 0, 4)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_check, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_delete, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_undelete, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_headerinfo, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, from_length)
- ZEND_ARG_INFO(0, subject_length)
- ZEND_ARG_INFO(0, default_host)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_parse_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, headers)
- ZEND_ARG_INFO(0, default_host)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_lsub, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getsubscribed, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_subscribe, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_unsubscribe, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchstructure, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchbody, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, section)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_savebody, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, section)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_base64, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_qprint, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_8bit, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_binary, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mailboxmsginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_write_address, 0, 0, 3)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, personal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_parse_adrlist, 0, 0, 2)
- ZEND_ARG_INFO(0, address_string)
- ZEND_ARG_INFO(0, default_host)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf8, 0, 0, 1)
- ZEND_ARG_INFO(0, mime_encoded_text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf7_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, buf)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf7_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, buf)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_IMAP_MUTF7
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf8_to_mutf7, 0, 0, 1)
- ZEND_ARG_INFO(0, in)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mutf7_to_utf8, 0, 0, 1)
- ZEND_ARG_INFO(0, in)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setflag_full, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, flag)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_clearflag_full, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, flag)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_sort, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, criteria)
- ZEND_ARG_INFO(0, reverse)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, search_criteria)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchheader, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_uid, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_msgno, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, unique_msg_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_status, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_bodystruct, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, section)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetch_overview, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_compose, 0, 0, 2)
- ZEND_ARG_INFO(0, envelope)
- ZEND_ARG_INFO(0, body)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, additional_headers)
- ZEND_ARG_INFO(0, cc)
- ZEND_ARG_INFO(0, bcc)
- ZEND_ARG_INFO(0, rpath)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_search, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, criteria)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imap_alerts, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imap_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imap_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mime_header_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_thread, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_timeout, 0, 0, 1)
- ZEND_ARG_INFO(0, timeout_type)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-/* }}} */
/* {{{ imap_functions[]
*/
@@ -481,7 +113,7 @@ static const zend_function_entry imap_functions[] = {
PHP_FE(imap_body, arginfo_imap_body)
PHP_FE(imap_bodystruct, arginfo_imap_bodystruct)
PHP_FE(imap_fetchbody, arginfo_imap_fetchbody)
- PHP_FE(imap_fetchmime, arginfo_imap_fetchbody)
+ PHP_FE(imap_fetchmime, arginfo_imap_fetchmime)
PHP_FE(imap_savebody, arginfo_imap_savebody)
PHP_FE(imap_fetchheader, arginfo_imap_fetchheader)
PHP_FE(imap_fetchstructure, arginfo_imap_fetchstructure)
@@ -539,13 +171,13 @@ static const zend_function_entry imap_functions[] = {
#endif
PHP_FE(imap_mail, arginfo_imap_mail)
+ PHP_FE(imap_getsubscribed, arginfo_imap_getsubscribed)
+ PHP_FE(imap_getmailboxes, arginfo_imap_getmailboxes)
PHP_FALIAS(imap_header, imap_headerinfo, arginfo_imap_headerinfo)
PHP_FALIAS(imap_listmailbox, imap_list, arginfo_imap_list)
- PHP_FALIAS(imap_getmailboxes, imap_list_full, arginfo_imap_getmailboxes)
PHP_FALIAS(imap_scanmailbox, imap_listscan, arginfo_imap_listscan)
PHP_FALIAS(imap_listsubscribed, imap_lsub, arginfo_imap_lsub)
- PHP_FALIAS(imap_getsubscribed, imap_lsub_full, arginfo_imap_getsubscribed)
PHP_FALIAS(imap_fetchtext, imap_body, arginfo_imap_body)
PHP_FALIAS(imap_scan, imap_listscan, arginfo_imap_listscan)
PHP_FALIAS(imap_create, imap_createmailbox, arginfo_imap_createmailbox)
@@ -1926,7 +1558,7 @@ PHP_FUNCTION(imap_list)
/* {{{ proto array imap_getmailboxes(resource stream_id, string ref, string pattern)
Reads the list of mailboxes and returns a full array of objects containing name, attributes, and delimiter */
/* Author: CJH */
-PHP_FUNCTION(imap_list_full)
+PHP_FUNCTION(imap_getmailboxes)
{
zval *streamind, mboxob;
zend_string *ref, *pat;
@@ -2246,7 +1878,7 @@ PHP_FUNCTION(imap_lsub)
/* {{{ proto array imap_getsubscribed(resource stream_id, string ref, string pattern)
Return a list of subscribed mailboxes, in the same format as imap_getmailboxes() */
/* Author: CJH */
-PHP_FUNCTION(imap_lsub_full)
+PHP_FUNCTION(imap_getsubscribed)
{
zval *streamind, mboxob;
zend_string *ref, *pat;
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
index c23799976c..2019998942 100644
--- a/ext/imap/php_imap.h
+++ b/ext/imap/php_imap.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, |
@@ -163,10 +161,10 @@ PHP_FUNCTION(imap_fetchtext);
PHP_FUNCTION(imap_uid);
PHP_FUNCTION(imap_msgno);
PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
+PHP_FUNCTION(imap_getmailboxes);
PHP_FUNCTION(imap_listscan);
PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
+PHP_FUNCTION(imap_getsubscribed);
PHP_FUNCTION(imap_create);
PHP_FUNCTION(imap_rename);
PHP_FUNCTION(imap_status);
diff --git a/ext/imap/php_imap.stub.php b/ext/imap/php_imap.stub.php
new file mode 100644
index 0000000000..ab3a24b54d
--- /dev/null
+++ b/ext/imap/php_imap.stub.php
@@ -0,0 +1,359 @@
+<?php
+
+/**
+ * @return resource|false
+ */
+function imap_open(string $mailbox, string $user, string $password, int $options = 0, int $n_retries = 0, array $params = UNKNOWN) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_reopen($stream_id, string $mailbox, int $options = 0, int $n_retries = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_close($stream_id, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ * @return int|false
+ */
+function imap_num_msg($stream_id) {}
+
+/**
+ * @param resource $stream_id
+ * @return int|false
+ */
+function imap_num_recent($stream_id) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_headers($stream_id) {}
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN) {}
+
+function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): \stdClass {}
+
+/**
+ * @return string|false
+ */
+function imap_rfc822_write_address(string $mailbox, string $host, string $personal) {}
+
+function imap_rfc822_parse_adrlist(string $address_string, string $default_host): array {}
+
+
+/**
+ * @param resource $stream_id
+ * @return string|false
+ */
+function imap_body($stream_id, int $msg_no, int $options = 0) {}
+
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_bodystruct($stream_id, int $msg_no, string $section) {}
+
+/**
+ * @param resource $stream_id
+ * @return string|false
+ */
+function imap_fetchbody($stream_id, int $msg_no, string $section, int $options = 0) {}
+
+/**
+ * @param resource $stream_id
+ * @return string|false
+ */
+function imap_fetchmime($stream_id, int $msg_no, string $section, int $options = 0) {}
+
+
+/**
+ * @param resource $stream_id
+ * @todo: should $file be `resouce|string`? it looks like it tries to accept anything?
+ */
+function imap_savebody($stream_id, $file, int $msg_no, string $section = '', int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ * @return string|false
+ */
+function imap_fetchheader($stream_id, int $msg_no, int $options = 0) {}
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_fetchstructure($stream_id, int $msg_no, int $options = 0) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_gc($stream_id, int $flags): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_expunge($stream_id): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_delete($stream_id, string $msg_no, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_undelete($stream_id, string $msg_no, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_check($stream_id) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_listscan($stream_id, string $ref, string $pattern, string $content) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_mail_copy($stream_id, string $msglist, string $mailbox, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_mail_move($stream_id, string $sequence, string $mailbox, int $options = 0): bool {}
+
+/**
+ * @return string|false
+ */
+function imap_mail_compose(array $envelope, array $body) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_createmailbox($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_renamemailbox($stream_id, string $old_name, string $new_name): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_deletemailbox($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_subscribe($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_unsubscribe($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_append($stream_id, string $folder, string $message, string $options = UNKNOWN, string $internal_date = UNKNOWN): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_ping($stream_id): bool {}
+
+/**
+ * @return string|false
+ */
+function imap_base64(string $text) {}
+
+/**
+ * @return string|false
+ */
+function imap_qprint(string $text) {}
+
+/**
+ * @return string|false
+ */
+function imap_8bit(string $text) {}
+
+/**
+ * @return string|false
+ */
+function imap_binary(string $text) {}
+
+
+function imap_utf8(string $mime_encoded_text): string {}
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_status($stream_id, string $mailbox, int $options) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_mailboxmsginfo($stream_id): \stdClass {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_setflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_clearflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_sort($stream_id, int $criteria, int $reverse, int $options = 0, string $search_criteria = UNKNOWN, string $charset = UNKNOWN) {}
+
+
+/**
+ * @param resource $stream_id
+ * @return int|false
+ */
+function imap_uid($stream_id, int $msg_no) {}
+
+/**
+ * @param resource $stream_id
+ * @return int|false
+ */
+function imap_msgno($stream_id, int $unique_msg_id) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_list($stream_id, string $ref, string $pattern) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_lsub($stream_id, string $ref, string $pattern) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_getsubscribed($stream_id, string $ref, string $pattern) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_getmailboxes($stream_id, string $ref, string $pattern) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_fetch_overview($stream_id, string $sequence, int $options = 0) {}
+
+/**
+ * @return array|false
+ */
+function imap_alerts() {}
+
+/**
+ * @return array|false
+ */
+function imap_errors() {}
+
+/**
+ * @return string|false
+ */
+function imap_last_error() {}
+
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_search($stream_id, string $criteria, int $options = \SE_FREE, string $charset = '') {}
+
+/**
+ * @return string|false
+ */
+function imap_utf7_decode(string $buf) {}
+
+function imap_utf7_encode(string $buf): string {}
+
+#ifdef HAVE_IMAP_MUTF7
+/**
+ * @return string|false
+ */
+function imap_utf8_to_mutf7(string $in) {}
+
+/**
+ * @return string|false
+ */
+function imap_mutf7_to_utf8(string $in) {}
+#endif
+
+/**
+ * @return array|false
+ */
+function imap_mime_header_decode(string $str) {}
+
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_thread($stream_id, int $options = \SE_FREE) {}
+
+/**
+ * @return int|bool
+ */
+function imap_timeout(int $timeout_type, int $timeout = -1) {}
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_get_quota($stream_id, string $qroot) {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_get_quotaroot($stream_id, string $mbox) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_set_quota($stream_id, string $qroot, int $mailbox_size): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_setacl($stream_id, string $mailbox, string $id, string $rights): bool {}
+
+/**
+ * @param resource $stream_id
+ * @return array|false
+ */
+function imap_getacl($stream_id, string $mailbox) {}
+#endif
+
+function imap_mail(string $to, string $subject, string $message, string $additional_headers = UNKNOWN, string $cc = UNKNOWN, string $bcc = UNKNOWN, string $rpath = UNKNOWN): bool {}
diff --git a/ext/imap/php_imap_arginfo.h b/ext/imap/php_imap_arginfo.h
new file mode 100644
index 0000000000..b39e445758
--- /dev/null
+++ b/ext/imap/php_imap_arginfo.h
@@ -0,0 +1,323 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, user, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, n_retries, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_reopen, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, n_retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_close, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_num_recent arginfo_imap_num_msg
+
+#define arginfo_imap_headers arginfo_imap_num_msg
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_headerinfo, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, from_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, subject_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_imap_rfc822_parse_headers, 0, 1, stdClass, 0)
+ ZEND_ARG_TYPE_INFO(0, headers, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_write_address, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, personal, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_rfc822_parse_adrlist, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, address_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_body, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_bodystruct, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, section, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchbody, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, section, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_fetchmime arginfo_imap_fetchbody
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_savebody, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, file)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, section, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_fetchheader arginfo_imap_body
+
+#define arginfo_imap_fetchstructure arginfo_imap_body
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_gc, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_expunge, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_delete, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_undelete arginfo_imap_delete
+
+#define arginfo_imap_check arginfo_imap_num_msg
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_listscan, 0, 0, 4)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, ref, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail_copy, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msglist, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail_move, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, sequence, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_compose, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, envelope, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, body, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_createmailbox, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_renamemailbox, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, old_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, new_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_deletemailbox arginfo_imap_createmailbox
+
+#define arginfo_imap_subscribe arginfo_imap_createmailbox
+
+#define arginfo_imap_unsubscribe arginfo_imap_createmailbox
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_append, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, folder, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, internal_date, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_ping arginfo_imap_expunge
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_base64, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_qprint arginfo_imap_base64
+
+#define arginfo_imap_8bit arginfo_imap_base64
+
+#define arginfo_imap_binary arginfo_imap_base64
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_utf8, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mime_encoded_text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_status, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_imap_mailboxmsginfo, 0, 1, stdClass, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_setflag_full, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, sequence, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_clearflag_full arginfo_imap_setflag_full
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_sort, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, criteria, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, reverse, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, search_criteria, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_uid, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_msgno, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, unique_msg_id, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_list, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, ref, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_lsub arginfo_imap_list
+
+#define arginfo_imap_getsubscribed arginfo_imap_list
+
+#define arginfo_imap_getmailboxes arginfo_imap_list
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetch_overview, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, sequence, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_alerts, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_errors arginfo_imap_alerts
+
+#define arginfo_imap_last_error arginfo_imap_alerts
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_search, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, criteria, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf7_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_utf7_encode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_IMAP_MUTF7)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf8_to_mutf7, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, in, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP_MUTF7)
+#define arginfo_imap_mutf7_to_utf8 arginfo_imap_utf8_to_mutf7
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mime_header_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_thread, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_timeout, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timeout_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_get_quota, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, qroot, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_get_quotaroot, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mbox, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_set_quota, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, qroot, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mailbox_size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_setacl, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, rights, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getacl, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, additional_headers, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cc, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bcc, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, rpath, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/imap/tests/bug63126.phpt b/ext/imap/tests/bug63126.phpt
index 94c618730c..8eea34cf1d 100644
--- a/ext/imap/tests/bug63126.phpt
+++ b/ext/imap/tests/bug63126.phpt
@@ -6,7 +6,7 @@ extension_loaded('imap') or die('skip imap extension not available in this build
require_once(__DIR__.'/imap_include.inc');
-$in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
+$in = @imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
if (!$in) {
die("skip could not connect to mailbox $default_mailbox");
}
diff --git a/ext/imap/tests/bug75774.phpt b/ext/imap/tests/bug75774.phpt
index ba08ab0439..0d2aeadf01 100644
--- a/ext/imap/tests/bug75774.phpt
+++ b/ext/imap/tests/bug75774.phpt
@@ -10,7 +10,11 @@ extension_loaded('imap') or die('skip imap extension not available in this build
$fn = __DIR__ . DIRECTORY_SEPARATOR . "foo75774";
$var1=fopen($fn, "w");
-imap_append($var1, "", "", "", "");
+try {
+ imap_append($var1, "", "", "", "");
+} catch (Throwable $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
fclose($var1);
unlink($fn);
@@ -20,5 +24,5 @@ unlink($fn);
--EXPECTF--
Warning: imap_append(): internal date not correctly formatted in %s on line %d
-Warning: imap_append(): supplied resource is not a valid imap resource in %s on line %d
+Exception: imap_append(): supplied resource is not a valid imap resource
==DONE==
diff --git a/ext/imap/tests/bug77020.phpt b/ext/imap/tests/bug77020.phpt
index 8a65232eec..357b75333a 100644
--- a/ext/imap/tests/bug77020.phpt
+++ b/ext/imap/tests/bug77020.phpt
@@ -11,5 +11,5 @@ imap_mail('1', 1, NULL);
===DONE===
--EXPECTF--
Warning: imap_mail(): No message string in mail command in %s on line %d
-%s
+%A
===DONE===
diff --git a/ext/imap/tests/imap_close_variation3.phpt b/ext/imap/tests/imap_close_variation3.phpt
deleted file mode 100644
index d282ba1dfd..0000000000
--- a/ext/imap/tests/imap_close_variation3.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-Test imap_close() function : usage variations - different streams
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : bool imap_close(resource $stream_id [, int $options])
- * Description: Close an IMAP stream
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different stream types to imap_close() to test whether it can close them
- */
-
-echo "*** Testing imap_close() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_handle = fopen(__FILE__, 'r'));
-var_dump(imap_close($file_handle));
-var_dump($file_handle);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_close($dir_handle));
-var_dump($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_close() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(%d) of type (stream)
-
-Warning: imap_close(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-resource(%d) of type (stream)
-
--- Directory Resource opened with opendir() --
-resource(%d) of type (stream)
-
-Warning: imap_close(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-resource(%d) of type (stream)
-===DONE===
diff --git a/ext/imap/tests/imap_fetch_overview_variation4.phpt b/ext/imap/tests/imap_fetch_overview_variation4.phpt
deleted file mode 100644
index 2aa89b75b6..0000000000
--- a/ext/imap/tests/imap_fetch_overview_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test imap_fetch_overview() function : usage variations - different resources as $stream_id
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
- * Description: Read an overview of the information in the headers
- * of the given message sequence
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different resource types to imap_fetch_overview() to test behaviour
- */
-
-echo "*** Testing imap_fetch_overview() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_pointer = fopen(__FILE__, 'r+'));
-var_dump(imap_fetch_overview($file_pointer, 1));
-fclose($file_pointer);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_fetch_overview($dir_handle, 1));
-closedir($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_fetch_overview() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(%d) of type (stream)
-
-Warning: imap_fetch_overview(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-
--- Directory Resource opened with opendir() --
-resource(%d) of type (stream)
-
-Warning: imap_fetch_overview(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/imap/tests/imap_fetchbody_variation5.phpt b/ext/imap/tests/imap_fetchbody_variation5.phpt
deleted file mode 100644
index fa32d0e995..0000000000
--- a/ext/imap/tests/imap_fetchbody_variation5.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test imap_fetchbody() function : usage variation - different resources as $stream_id arg
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : string imap_fetchbody(resource $stream_id, int $msg_no, string $section
- * [, int options])
- * Description: Get a specific body section
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different resource types to imap_fetchbody() to test behaviour
- */
-
-echo "*** Testing imap_fetchbody() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_pointer = fopen(__FILE__, 'r+'));
-var_dump(imap_fetchbody($file_pointer, 1));
-fclose($file_pointer);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_fetchbody($dir_handle, 1));
-closedir($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_fetchbody() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(5) of type (stream)
-
-Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Directory Resource opened with opendir() --
-resource(6) of type (stream)
-
-Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/imap/tests/imap_fetchheader_variation4.phpt b/ext/imap/tests/imap_fetchheader_variation4.phpt
deleted file mode 100644
index 05322f1527..0000000000
--- a/ext/imap/tests/imap_fetchheader_variation4.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-Test imap_fetchheader() function : usage variations - diff resource types as $stream_id
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options])
- * Description: Get the full unfiltered header for a message
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different types of resources to imap_fetchheader() to test behaviour
- */
-
-echo "*** Testing imap_fetchheader() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_pointer = fopen(__FILE__, 'r+'));
-var_dump(imap_fetchheader($file_pointer, 1));
-fclose($file_pointer);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_fetchheader($dir_handle, 1));
-closedir($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_fetchheader() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(%d) of type (stream)
-
-Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-
--- Directory Resource opened with opendir() --
-resource(%d) of type (stream)
-
-Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/imap/tests/imap_mutf7_to_utf8.phpt b/ext/imap/tests/imap_mutf7_to_utf8.phpt
index e2c745ecd0..d8bda0c6a9 100644
--- a/ext/imap/tests/imap_mutf7_to_utf8.phpt
+++ b/ext/imap/tests/imap_mutf7_to_utf8.phpt
@@ -8,7 +8,6 @@ imap_mutf7_to_utf8
var_dump(imap_mutf7_to_utf8(""));
var_dump(imap_mutf7_to_utf8(1));
-var_dump(imap_mutf7_to_utf8(array(1,2)));
var_dump(imap_mutf7_to_utf8("t&AOQ-st"));
echo "Done\n";
@@ -16,8 +15,5 @@ echo "Done\n";
--EXPECTF--
string(0) ""
string(1) "1"
-
-Warning: imap_mutf7_to_utf8() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(5) "täst"
Done
diff --git a/ext/imap/tests/imap_utf8.phpt b/ext/imap/tests/imap_utf8.phpt
index a8901555d5..a82c3721c3 100644
--- a/ext/imap/tests/imap_utf8.phpt
+++ b/ext/imap/tests/imap_utf8.phpt
@@ -7,7 +7,6 @@ imap_utf8() tests
var_dump(imap_utf8(""));
var_dump(imap_utf8(1));
-var_dump(imap_utf8(array(1,2)));
var_dump(imap_utf8("test"));
echo "Done\n";
@@ -15,8 +14,5 @@ echo "Done\n";
--EXPECTF--
string(0) ""
string(1) "1"
-
-Warning: imap_utf8() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(4) "%s"
Done
diff --git a/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt b/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
index bea268a457..6046dc1c5f 100644
--- a/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
+++ b/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
@@ -8,7 +8,6 @@ imap_utf8_to_mutf7
var_dump(imap_utf8_to_mutf7(""));
var_dump(imap_utf8_to_mutf7(1));
-var_dump(imap_utf8_to_mutf7(array(1,2)));
var_dump(imap_utf8_to_mutf7("täst"));
echo "Done\n";
@@ -16,8 +15,5 @@ echo "Done\n";
--EXPECTF--
string(0) ""
string(1) "1"
-
-Warning: imap_utf8_to_mutf7() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(8) "t&AOQ-st"
Done
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 0d64efece4..608702ac2b 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -84,6 +82,11 @@ static int BreakIterator_compare_objects(zval *object1,
BreakIterator_object *bio1,
*bio2;
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+ if (Z_TYPE_P(object1) != Z_TYPE_P(object2)) {
+ return 1; /* object and non-object */
+ }
+
bio1 = Z_INTL_BREAKITERATOR_P(object1);
bio2 = Z_INTL_BREAKITERATOR_P(object2);
@@ -96,16 +99,16 @@ static int BreakIterator_compare_objects(zval *object1,
/* }}} */
/* {{{ clone handler for BreakIterator */
-static zend_object *BreakIterator_clone_obj(zval *object)
+static zend_object *BreakIterator_clone_obj(zend_object *object)
{
BreakIterator_object *bio_orig,
*bio_new;
zend_object *ret_val;
- bio_orig = Z_INTL_BREAKITERATOR_P(object);
+ bio_orig = php_intl_breakiterator_fetch_object(object);
intl_errors_reset(INTL_DATA_ERROR_P(bio_orig));
- ret_val = BreakIterator_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = BreakIterator_ce_ptr->create_object(object->ce);
bio_new = php_intl_breakiterator_fetch_object(ret_val);
zend_objects_clone_members(&bio_new->zo, &bio_orig->zo);
@@ -136,7 +139,7 @@ static zend_object *BreakIterator_clone_obj(zval *object)
/* }}} */
/* {{{ get_debug_info handler for BreakIterator */
-static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
+static HashTable *BreakIterator_get_debug_info(zend_object *object, int *is_temp)
{
zval val;
HashTable *debug_info;
@@ -147,7 +150,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- bio = Z_INTL_BREAKITERATOR_P(object);
+ bio = php_intl_breakiterator_fetch_object(object);
biter = bio->biter;
if (biter == NULL) {
@@ -320,7 +323,7 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void)
memcpy(&BreakIterator_handlers, &std_object_handlers,
sizeof BreakIterator_handlers);
BreakIterator_handlers.offset = XtOffsetOf(BreakIterator_object, zo);
- BreakIterator_handlers.compare_objects = BreakIterator_compare_objects;
+ BreakIterator_handlers.compare = BreakIterator_compare_objects;
BreakIterator_handlers.clone_obj = BreakIterator_clone_obj;
BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info;
BreakIterator_handlers.free_obj = BreakIterator_objects_free;
diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h
index a856b7c7e0..ce95c65984 100644
--- a/ext/intl/breakiterator/breakiterator_class.h
+++ b/ext/intl/breakiterator/breakiterator_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index 1635be5601..af36f3d59e 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -278,8 +276,6 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlPartsIterator::getBreakIterator: bad arguments", 0);
return;
}
diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h
index 71a1e35025..0f02fb11ce 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.h
+++ b/ext/intl/breakiterator/breakiterator_iterators.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp
index 6d6211db73..84f946bf76 100644
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -55,9 +53,6 @@ static void _breakiter_factory(const char *func_name,
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!",
&locale_str, &dummy) == FAILURE) {
- spprintf(&msg, 0, "%s: bad arguments", func_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
- efree(msg);
RETURN_NULL();
}
@@ -118,8 +113,6 @@ U_CFUNC PHP_FUNCTION(breakiter_create_code_point_instance)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_create_code_point_instance: bad arguments", 0);
RETURN_NULL();
}
@@ -133,8 +126,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_text: bad arguments", 0);
RETURN_FALSE;
}
@@ -155,8 +146,6 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_set_text: bad arguments", 0);
RETURN_FALSE;
}
@@ -189,9 +178,6 @@ static void _breakiter_no_args_ret_int32(
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- spprintf(&msg, 0, "%s: bad arguments", func_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
- efree(msg);
RETURN_FALSE;
}
@@ -213,9 +199,6 @@ static void _breakiter_int32_ret_int32(
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &arg) == FAILURE) {
- spprintf(&msg, 0, "%s: bad arguments", func_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
- efree(msg);
RETURN_FALSE;
}
@@ -290,8 +273,6 @@ U_CFUNC PHP_FUNCTION(breakiter_current)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_current: bad arguments", 0);
RETURN_FALSE;
}
@@ -324,8 +305,6 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l",
&offset) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_is_boundary: bad arguments", 0);
RETURN_FALSE;
}
@@ -350,8 +329,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &locale_type) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_locale: bad arguments", 0);
RETURN_FALSE;
}
@@ -378,8 +355,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &key_type) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_parts_iterator: bad arguments", 0);
RETURN_FALSE;
}
@@ -403,8 +378,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_error_code: bad arguments", 0);
RETURN_FALSE;
}
@@ -423,8 +396,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_message)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_error_message: bad arguments", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h
index cffe767c55..2aef459441 100644
--- a/ext/intl/breakiterator/breakiterator_methods.h
+++ b/ext/intl/breakiterator/breakiterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp
index bf44678efc..082c02d8b2 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.cpp
+++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h
index 7ecf12deb5..58666502a1 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.h
+++ b/ext/intl/breakiterator/codepointiterator_internal.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp
index f1dd0960e6..62670539c5 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.cpp
+++ b/ext/intl/breakiterator/codepointiterator_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -33,8 +31,6 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "cpbi_get_last_code_point: bad arguments", 0);
RETURN_FALSE;
}
diff --git a/ext/intl/breakiterator/codepointiterator_methods.h b/ext/intl/breakiterator/codepointiterator_methods.h
index 92f255d704..867326cada 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.h
+++ b/ext/intl/breakiterator/codepointiterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index 5529d06718..c32a432642 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -43,8 +41,6 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|b",
&rules, &rules_len, &compiled) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_create_instance: bad arguments", 0);
return;
}
@@ -105,8 +101,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_rules: bad arguments", 0);
RETURN_FALSE;
}
@@ -132,8 +126,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_rule_status: bad arguments", 0);
RETURN_FALSE;
}
@@ -148,8 +140,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_rule_status_vec: bad arguments", 0);
RETURN_FALSE;
}
@@ -188,8 +178,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_binary_rules: bad arguments", 0);
RETURN_FALSE;
}
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
index 3a9209c479..88528f928e 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index 29eb9eef44..449b220909 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -78,17 +76,17 @@ U_CFUNC void calendar_object_construct(zval *object,
}
/* {{{ clone handler for Calendar */
-static zend_object *Calendar_clone_obj(zval *object)
+static zend_object *Calendar_clone_obj(zend_object *object)
{
Calendar_object *co_orig,
*co_new;
zend_object *ret_val;
intl_error_reset(NULL);
- co_orig = Z_INTL_CALENDAR_P(object);
+ co_orig = php_intl_calendar_fetch_object(object);
intl_error_reset(INTL_DATA_ERROR_P(co_orig));
- ret_val = Calendar_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = Calendar_ce_ptr->create_object(object->ce);
co_new = php_intl_calendar_fetch_object(ret_val);
zend_objects_clone_members(&co_new->zo, &co_orig->zo);
@@ -147,7 +145,7 @@ static const struct {
};
/* {{{ get_debug_info handler for Calendar */
-static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
+static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
{
zval zv,
zfields;
@@ -159,7 +157,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- co = Z_INTL_CALENDAR_P(object);
+ co = php_intl_calendar_fetch_object(object);
cal = co->ucal;
if (cal == NULL) {
@@ -179,7 +177,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
HashTable *debug_info_tz;
timezone_object_construct(&cal->getTimeZone(), &ztz , 0);
- debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(&ztz, &is_tmp);
+ debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(Z_OBJ(ztz), &is_tmp);
assert(is_tmp == 1);
array_init(&ztz_debug);
diff --git a/ext/intl/calendar/calendar_class.h b/ext/intl/calendar/calendar_class.h
index 33cd7bc8e3..bd7ddf0aa9 100644
--- a/ext/intl/calendar/calendar_class.h
+++ b/ext/intl/calendar/calendar_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index dfe34a4f03..fc0d10c02c 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -63,8 +61,6 @@ U_CFUNC PHP_FUNCTION(intlcal_create_instance)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zs!",
&zv_timezone, &locale_str, &dummy) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_create_calendar: bad arguments", 0);
RETURN_NULL();
}
@@ -154,8 +150,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssb",
&key, &key_len, &locale, &locale_len, &commonly_used) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_keyword_values_for_locale: bad arguments", 0);
RETURN_FALSE;
}
@@ -190,8 +184,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_now)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_now: bad arguments", 0);
RETURN_FALSE;
}
@@ -203,8 +195,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_available_locales)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_available_locales: bad arguments", 0);
RETURN_FALSE;
}
@@ -228,9 +218,6 @@ static void _php_intlcal_field_uec_ret_in32t_method(
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
- spprintf(&message, 0, "%s: bad arguments", method_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
- efree(message);
RETURN_FALSE;
}
@@ -262,8 +249,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_time: bad arguments", 0);
RETURN_FALSE;
}
@@ -283,8 +268,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Od",
&object, Calendar_ce_ptr, &time_arg) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_time: bad arguments", 0);
RETURN_FALSE;
}
@@ -304,8 +287,6 @@ U_CFUNC PHP_FUNCTION(intlcal_add)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_add: bad arguments", 0);
RETURN_FALSE;
}
@@ -336,8 +317,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Oz!", &object, Calendar_ce_ptr, &zv_timezone) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_time_zone: bad arguments", 0);
RETURN_FALSE;
}
@@ -370,8 +349,6 @@ static void _php_intlcal_before_after(
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, Calendar_ce_ptr, &when_object, Calendar_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_before/after: bad arguments", 0);
RETURN_FALSE;
}
@@ -430,8 +407,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
"Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4,
&arg5, &arg6) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set: bad arguments", 0);
RETURN_FALSE;
}
@@ -489,15 +464,11 @@ U_CFUNC PHP_FUNCTION(intlcal_roll)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
"Olb", &object, Calendar_ce_ptr, &field, &bool_variant_val)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_roll: bad arguments", 0);
RETURN_FALSE;
}
bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0;
} else if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
"Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_roll: bad arguments", 0);
RETURN_FALSE;
}
@@ -535,8 +506,6 @@ U_CFUNC PHP_FUNCTION(intlcal_clear)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(),
getThis(), "O|l!", &object, Calendar_ce_ptr, &field, &field_is_null) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_clear: bad arguments", 0);
RETURN_FALSE;
}
@@ -565,8 +534,6 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_field_difference: bad arguments", 0);
RETURN_FALSE;
}
@@ -605,8 +572,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_day_of_week_type: bad arguments", 0);
RETURN_FALSE;
}
@@ -632,8 +597,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_first_day_of_week: bad arguments", 0);
RETURN_FALSE;
}
@@ -657,9 +620,6 @@ static void _php_intlcal_field_ret_in32t_method(
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
- spprintf(&message, 0, "%s: bad arguments", method_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
- efree(message);
RETURN_FALSE;
}
@@ -697,8 +657,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_locale)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_locale: bad arguments", 0);
RETURN_FALSE;
}
@@ -730,8 +688,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_minimal_days_in_first_week: bad arguments", 0);
RETURN_FALSE;
}
@@ -756,8 +712,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_time_zone: bad arguments", 0);
RETURN_FALSE;
}
@@ -779,8 +733,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_type: bad arguments", 0);
RETURN_FALSE;
}
@@ -796,8 +748,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_weekend_transition: bad arguments", 0);
RETURN_FALSE;
}
@@ -823,8 +773,6 @@ U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_in_daylight_time: bad arguments", 0);
RETURN_FALSE;
}
@@ -846,8 +794,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_equivalent_to)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, Calendar_ce_ptr, &other_object, Calendar_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_equivalent_to: bad arguments", 0);
RETURN_FALSE;
}
@@ -869,8 +815,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_lenient: bad arguments", 0);
RETURN_FALSE;
}
@@ -886,8 +830,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_set)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_set: bad arguments", 0);
RETURN_FALSE;
}
@@ -910,8 +852,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O|d!", &object, Calendar_ce_ptr, &date, &date_is_null) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_weekend: bad arguments", 0);
RETURN_FALSE;
}
@@ -935,8 +875,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_first_day_of_week: bad arguments", 0);
RETURN_FALSE;
}
@@ -960,8 +898,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ob", &object, Calendar_ce_ptr, &is_lenient) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_lenient: bad arguments", 0);
RETURN_FALSE;
}
@@ -979,8 +915,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_minimal_days_in_first_week: bad arguments", 0);
RETURN_FALSE;
}
@@ -1007,8 +941,6 @@ U_CFUNC PHP_FUNCTION(intlcal_equals)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, Calendar_ce_ptr, &other_object, Calendar_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_equals: bad arguments", 0);
RETURN_FALSE;
}
@@ -1032,8 +964,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_repeated_wall_time_option: bad arguments", 0);
RETURN_FALSE;
}
@@ -1048,8 +978,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_skipped_wall_time_option: bad arguments", 0);
RETURN_FALSE;
}
@@ -1065,8 +993,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_repeated_wall_time_option: bad arguments", 0);
RETURN_FALSE;
}
@@ -1090,8 +1016,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_skipped_wall_time_option: bad arguments", 0);
RETURN_FALSE;
}
@@ -1125,15 +1049,13 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s!",
&zv_arg, &locale_str, &locale_str_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_from_date_time: bad arguments", 0);
RETURN_NULL();
}
if (!(Z_TYPE_P(zv_arg) == IS_OBJECT && instanceof_function(
Z_OBJCE_P(zv_arg), php_date_get_date_ce()))) {
object_init_ex(&zv_tmp, php_date_get_date_ce());
- zend_call_method_with_1_params(&zv_tmp, NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
+ zend_call_method_with_1_params(Z_OBJ(zv_tmp), NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
zv_datetime = &zv_tmp;
if (EG(exception)) {
zend_object_store_ctor_failed(Z_OBJ(zv_tmp));
@@ -1151,7 +1073,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
goto error;
}
- zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
+ zend_call_method_with_0_params(Z_OBJ_P(zv_datetime), php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
if (Z_TYPE(zv_timestamp) != IS_LONG) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_from_date_time: bad DateTime; call to "
@@ -1206,8 +1128,6 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_to_date_time: bad arguments", 0);
RETURN_FALSE;
}
@@ -1249,7 +1169,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
/* Finally, instantiate object and call constructor */
object_init_ex(return_value, php_date_get_date_ce());
- zend_call_method_with_2_params(return_value, NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
+ zend_call_method_with_2_params(Z_OBJ_P(return_value), NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
if (EG(exception)) {
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_to_date_time: DateTime constructor has thrown exception",
@@ -1264,7 +1184,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
zval_ptr_dtor(&ts_zval);
/* due to bug #40743, we have to set the time zone again */
- zend_call_method_with_1_params(return_value, NULL, NULL, "settimezone",
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), NULL, NULL, "settimezone",
&retval, timezone_zval);
if (Z_ISUNDEF(retval) || Z_TYPE(retval) == IS_FALSE) {
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
@@ -1286,8 +1206,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_error_code: bad arguments", 0);
RETURN_FALSE;
}
@@ -1306,8 +1224,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_message)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_error_message: bad arguments", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/calendar/calendar_methods.h b/ext/intl/calendar/calendar_methods.h
index 838917cac3..c9c8387d23 100644
--- a/ext/intl/calendar/calendar_methods.h
+++ b/ext/intl/calendar/calendar_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index d96fffda6f..66fdbb2f2f 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -56,7 +54,6 @@ static void _php_intlgregcal_constructor_body(
zend_long largs[6];
UErrorCode status = U_ZERO_ERROR;
int variant;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset(NULL);
// parameter number validation / variant determination
@@ -86,10 +83,8 @@ static void _php_intlgregcal_constructor_body(
// argument parsing
if (variant <= 2) {
- if (zend_parse_parameters_ex(zpp_flags, MIN(ZEND_NUM_ARGS(), 2),
+ if (zend_parse_parameters(MIN(ZEND_NUM_ARGS(), 2),
"|z!s!", &tz_object, &locale, &locale_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_create_instance: bad arguments", 0);
if (!is_constructor) {
zval_ptr_dtor(return_value);
RETVAL_NULL();
@@ -97,11 +92,9 @@ static void _php_intlgregcal_constructor_body(
return;
}
}
- if (variant > 2 && zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(),
+ if (variant > 2 && zend_parse_parameters(ZEND_NUM_ARGS(),
"lll|lll", &largs[0], &largs[1], &largs[2], &largs[3], &largs[4],
&largs[5]) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_create_instance: bad arguments", 0);
if (!is_constructor) {
zval_ptr_dtor(return_value);
RETVAL_NULL();
@@ -232,8 +225,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Od", &object, GregorianCalendar_ce_ptr, &date) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_set_gregorian_change: bad arguments", 0);
RETURN_FALSE;
}
@@ -252,8 +243,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, GregorianCalendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_get_gregorian_change: bad arguments", 0);
RETURN_FALSE;
}
@@ -269,8 +258,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_is_leap_year: bad arguments", 0);
RETURN_FALSE;
}
diff --git a/ext/intl/calendar/gregoriancalendar_methods.h b/ext/intl/calendar/gregoriancalendar_methods.h
index 659566427c..a5351f986f 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.h
+++ b/ext/intl/calendar/gregoriancalendar_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c
index f450091df7..0f73ee8e05 100644
--- a/ext/intl/collator/collator.c
+++ b/ext/intl/collator/collator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator.h b/ext/intl/collator/collator.h
index 65b30ee9b0..78a974496b 100644
--- a/ext/intl/collator/collator.h
+++ b/ext/intl/collator/collator.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c
index 5170d4c720..0198147bf3 100644
--- a/ext/intl/collator/collator_attr.c
+++ b/ext/intl/collator/collator_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -41,9 +39,6 @@ PHP_FUNCTION( collator_get_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, Collator_ce_ptr, &attribute ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_attribute: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -72,9 +67,6 @@ PHP_FUNCTION( collator_set_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oll",
&object, Collator_ce_ptr, &attribute, &value ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_set_attribute: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -102,9 +94,6 @@ PHP_FUNCTION( collator_get_strength )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Collator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_strength: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -131,9 +120,6 @@ PHP_FUNCTION( collator_set_strength )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, Collator_ce_ptr, &strength ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_set_strength: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h
index aefdd15f9f..682e618b9f 100644
--- a/ext/intl/collator/collator_attr.h
+++ b/ext/intl/collator/collator_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index 64ad9823e2..94e13efab7 100644
--- a/ext/intl/collator/collator_class.c
+++ b/ext/intl/collator/collator_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h
index 4ee8aba749..060a899b7a 100644
--- a/ext/intl/collator/collator_class.h
+++ b/ext/intl/collator/collator_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index c95d144f1a..5aed0d16d1 100644
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -49,9 +47,6 @@ PHP_FUNCTION( collator_compare )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oss",
&object, Collator_ce_ptr, &str1, &str1_len, &str2, &str2_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_compare: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/collator/collator_compare.h b/ext/intl/collator/collator_compare.h
index cca9ca29b1..aa58d88ab9 100644
--- a/ext/intl/collator/collator_compare.h
+++ b/ext/intl/collator/collator_compare.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index 2f0a80468e..e19bb719f6 100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -226,33 +224,11 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv )
}
/* Try object's handlers. */
- if( Z_OBJ_HT_P(obj)->get )
- {
- zstr = Z_OBJ_HT_P(obj)->get( obj, rv );
-
- switch( Z_TYPE_P( zstr ) )
- {
- case IS_OBJECT:
- {
- /* Bail out. */
- zval_ptr_dtor( zstr );
- COLLATOR_CONVERT_RETURN_FAILED( obj );
- } break;
-
- case IS_STRING:
- break;
-
- default:
- {
- convert_to_string( zstr );
- } break;
- }
- }
- else if( Z_OBJ_HT_P(obj)->cast_object )
+ if( Z_OBJ_HT_P(obj)->cast_object )
{
zstr = rv;
- if( Z_OBJ_HT_P(obj)->cast_object( obj, zstr, IS_STRING ) == FAILURE )
+ if( Z_OBJ_HT_P(obj)->cast_object( Z_OBJ_P(obj), zstr, IS_STRING ) == FAILURE )
{
/* cast_object failed => bail out. */
zval_ptr_dtor( zstr );
diff --git a/ext/intl/collator/collator_convert.h b/ext/intl/collator/collator_convert.h
index 4cfc8b56ce..7b973a0a30 100644
--- a/ext/intl/collator/collator_convert.h
+++ b/ext/intl/collator/collator_convert.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c
index cb2ff183e2..051bb99cb8 100644
--- a/ext/intl/collator/collator_create.c
+++ b/ext/intl/collator/collator_create.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -25,22 +23,19 @@
#include "intl_data.h"
/* {{{ */
-static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
size_t locale_len = 0;
zval* object;
Collator_object* co;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset( NULL );
object = return_value;
/* Parse parameters. */
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&locale, &locale_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_create: unable to parse input params", 0 );
return FAILURE;
}
@@ -64,7 +59,7 @@ static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
PHP_FUNCTION( collator_create )
{
object_init_ex( return_value, Collator_ce_ptr );
- if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -80,7 +75,7 @@ PHP_METHOD( Collator, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
diff --git a/ext/intl/collator/collator_create.h b/ext/intl/collator/collator_create.h
index b5e9489e3d..7f70fe9e4b 100644
--- a/ext/intl/collator/collator_create.h
+++ b/ext/intl/collator/collator_create.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c
index b485cf14f1..b2dbee9e7a 100644
--- a/ext/intl/collator/collator_error.c
+++ b/ext/intl/collator/collator_error.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -36,9 +34,6 @@ PHP_FUNCTION( collator_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Collator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_error_code: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -67,9 +62,6 @@ PHP_FUNCTION( collator_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Collator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_error_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/collator/collator_error.h b/ext/intl/collator/collator_error.h
index 3c8c10a043..912d8f9d35 100644
--- a/ext/intl/collator/collator_error.h
+++ b/ext/intl/collator/collator_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c
index a561897a16..b71e658e57 100644
--- a/ext/intl/collator/collator_is_numeric.c
+++ b/ext/intl/collator/collator_is_numeric.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h
index f6337aaacc..34b84e9990 100644
--- a/ext/intl/collator/collator_is_numeric.h
+++ b/ext/intl/collator/collator_is_numeric.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c
index 2a379bc977..453d1c4e40 100644
--- a/ext/intl/collator/collator_locale.c
+++ b/ext/intl/collator/collator_locale.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -42,9 +40,6 @@ PHP_FUNCTION( collator_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, Collator_ce_ptr, &type ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_locale: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/collator/collator_locale.h b/ext/intl/collator/collator_locale.h
index b2f837b49a..505e2f17fd 100644
--- a/ext/intl/collator/collator_locale.h
+++ b/ext/intl/collator/collator_locale.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index d1e832aecc..66bfb16e56 100644
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -303,9 +301,6 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa/|l",
&object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_sort_internal: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -397,9 +392,6 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa",
&object, Collator_ce_ptr, &array ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_sort_with_sort_keys: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -563,9 +555,6 @@ PHP_FUNCTION( collator_get_sort_key )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, Collator_ce_ptr, &str, &str_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_sort_key: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/collator/collator_sort.h b/ext/intl/collator/collator_sort.h
index ffaf86e664..5d1d1050d9 100644
--- a/ext/intl/collator/collator_sort.h
+++ b/ext/intl/collator/collator_sort.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp
index b3e8a30f68..d4767dc63b 100644
--- a/ext/intl/common/common_date.cpp
+++ b/ext/intl/common/common_date.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common_date.h b/ext/intl/common/common_date.h
index acb8e68e9a..bb245e36f1 100644
--- a/ext/intl/common/common_date.h
+++ b/ext/intl/common/common_date.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp
index adc7034d36..7367e3ad70 100644
--- a/ext/intl/common/common_enum.cpp
+++ b/ext/intl/common/common_enum.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -211,8 +209,6 @@ static PHP_METHOD(IntlIterator, current)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::current: bad arguments", 0);
return;
}
@@ -228,8 +224,6 @@ static PHP_METHOD(IntlIterator, key)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::key: bad arguments", 0);
return;
}
@@ -247,8 +241,6 @@ static PHP_METHOD(IntlIterator, next)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::next: bad arguments", 0);
return;
}
@@ -264,8 +256,6 @@ static PHP_METHOD(IntlIterator, rewind)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::rewind: bad arguments", 0);
return;
}
@@ -283,8 +273,6 @@ static PHP_METHOD(IntlIterator, valid)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::valid: bad arguments", 0);
return;
}
diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h
index 5b57e5cf18..f004b9be37 100644
--- a/ext/intl/common/common_enum.h
+++ b/ext/intl/common/common_enum.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c
index a4a4e56b0a..4bb21e3583 100644
--- a/ext/intl/common/common_error.c
+++ b/ext/intl/common/common_error.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -54,9 +52,6 @@ PHP_FUNCTION( intl_is_failure )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "l",
&err_code ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intl_is_failure: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -76,9 +71,6 @@ PHP_FUNCTION( intl_error_name )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "l",
&err_code ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intl_error_name: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/common/common_error.h b/ext/intl/common/common_error.h
index 46a26793ee..48a42d41e5 100644
--- a/ext/intl/common/common_error.h
+++ b/ext/intl/common/common_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 8c9377ecae..e09997d9ea 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -594,8 +592,6 @@ static PHP_METHOD(UConverter, setSubstChars) {
int ret = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &chars, &chars_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::setSubstChars(): bad arguments", 0);
RETURN_FALSE;
}
intl_errors_reset(&objval->error);
@@ -729,8 +725,6 @@ static PHP_METHOD(UConverter, reasonText) {
zend_long reason;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &reason) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::reasonText(): bad arguments", 0);
RETURN_FALSE;
}
intl_error_reset(NULL);
@@ -764,8 +758,6 @@ static PHP_METHOD(UConverter, convert) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
&str, &str_len, &reverse) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::convert(): bad arguments", 0);
RETURN_FALSE;
}
intl_errors_reset(&objval->error);
@@ -798,8 +790,6 @@ static PHP_METHOD(UConverter, transcode) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|a!",
&str, &str_len, &dest, &dest_len, &src, &src_len, &options) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::transcode(): bad arguments", 0);
RETURN_FALSE;
}
intl_error_reset(NULL);
@@ -918,8 +908,6 @@ static PHP_METHOD(UConverter, getAliases) {
uint16_t i, count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::getAliases(): bad arguments", 0);
RETURN_FALSE;
}
intl_error_reset(NULL);
@@ -1050,9 +1038,9 @@ static zend_object *php_converter_create_object(zend_class_entry *ce) {
return retval;
}
-static zend_object *php_converter_clone_object(zval *object) {
- php_converter_object *objval, *oldobj = Z_INTL_CONVERTER_P(object);
- zend_object *retval = php_converter_object_ctor(Z_OBJCE_P(object), &objval);
+static zend_object *php_converter_clone_object(zend_object *object) {
+ php_converter_object *objval, *oldobj = php_converter_fetch_object(object);
+ zend_object *retval = php_converter_object_ctor(object->ce, &objval);
UErrorCode error = U_ZERO_ERROR;
intl_errors_reset(&oldobj->error);
diff --git a/ext/intl/converter/converter.h b/ext/intl/converter/converter.h
index 520c7c6c86..5dc0b2773b 100644
--- a/ext/intl/converter/converter.h
+++ b/ext/intl/converter/converter.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c
index b1821ce0d3..8a46d2993b 100644
--- a/ext/intl/dateformat/dateformat.c
+++ b/ext/intl/dateformat/dateformat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -77,8 +75,6 @@ PHP_FUNCTION( datefmt_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_error_code: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -103,9 +99,6 @@ PHP_FUNCTION( datefmt_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_error_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h
index 6139b67951..ebeeaa5963 100644
--- a/ext/intl/dateformat/dateformat.h
+++ b/ext/intl/dateformat/dateformat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c
index d44b3d1789..2183bd92ca 100644
--- a/ext/intl/dateformat/dateformat_attr.c
+++ b/ext/intl/dateformat/dateformat_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -38,8 +36,6 @@ PHP_FUNCTION( datefmt_get_datetype )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_datetype: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -64,8 +60,6 @@ PHP_FUNCTION( datefmt_get_timetype )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_timetype: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -95,8 +89,6 @@ PHP_FUNCTION( datefmt_get_pattern )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_pattern: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -140,8 +132,6 @@ PHP_FUNCTION( datefmt_set_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, IntlDateFormatter_ce_ptr, &value, &value_len ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_set_pattern: unable to parse input params", 0);
RETURN_FALSE;
}
@@ -178,8 +168,6 @@ PHP_FUNCTION( datefmt_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O|l",
&object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_locale: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -207,8 +195,6 @@ PHP_FUNCTION( datefmt_is_lenient )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_is_lenient: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -235,8 +221,6 @@ PHP_FUNCTION( datefmt_set_lenient )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ob",
&object, IntlDateFormatter_ce_ptr,&isLenient ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_set_lenient: unable to parse input params", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h
index e7013a9e2a..321c1d607a 100644
--- a/ext/intl/dateformat/dateformat_attr.h
+++ b/ext/intl/dateformat/dateformat_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp
index fec8eb1a67..985f122068 100644
--- a/ext/intl/dateformat/dateformat_attrcpp.cpp
+++ b/ext/intl/dateformat/dateformat_attrcpp.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -49,8 +47,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timezone_"
- "id: unable to parse input params", 0);
RETURN_FALSE;
}
@@ -75,8 +71,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_timezone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_timezone: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -105,8 +99,6 @@ U_CFUNC PHP_FUNCTION(datefmt_set_timezone)
if ( zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Oz", &object, IntlDateFormatter_ce_ptr, &timezone_zv) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_timezone: "
- "unable to parse input params", 0);
RETURN_FALSE;
}
@@ -132,8 +124,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_calendar: unable to parse input params", 0);
RETURN_FALSE;
}
@@ -159,9 +149,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar_object)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_calendar_object: unable to parse input params",
- 0);
RETURN_FALSE;
}
@@ -196,8 +183,6 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz",
&object, IntlDateFormatter_ce_ptr, &calendar_zv) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_set_calendar: unable to parse input params", 0);
RETURN_FALSE;
}
diff --git a/ext/intl/dateformat/dateformat_attrcpp.h b/ext/intl/dateformat/dateformat_attrcpp.h
index ab69914540..e2f9ffe9b2 100644
--- a/ext/intl/dateformat/dateformat_attrcpp.h
+++ b/ext/intl/dateformat/dateformat_attrcpp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index b923f70508..49dcf43b2f 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -77,14 +75,14 @@ zend_object *IntlDateFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ IntlDateFormatter_object_clone */
-zend_object *IntlDateFormatter_object_clone(zval *object)
+zend_object *IntlDateFormatter_object_clone(zend_object *object)
{
IntlDateFormatter_object *dfo, *new_dfo;
zend_object *new_obj;
- DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
+ dfo = php_intl_dateformatter_fetch_object(object);
- new_obj = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ new_obj = IntlDateFormatter_ce_ptr->create_object(object->ce);
new_dfo = php_intl_dateformatter_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_dfo->zo, &dfo->zo);
diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h
index e96a20b5ee..8a95527695 100644
--- a/ext/intl/dateformat/dateformat_class.h
+++ b/ext/intl/dateformat/dateformat_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp
index 8c2b72a2da..eddc248d09 100644
--- a/ext/intl/dateformat/dateformat_create.cpp
+++ b/ext/intl/dateformat/dateformat_create.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -45,7 +43,7 @@ extern "C" {
UDAT_PATTERN == (i))
/* {{{ */
-static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
zval *object;
const char *locale_str;
@@ -65,16 +63,13 @@ static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
UChar* svalue = NULL; /* UTF-16 pattern_str */
int32_t slength = 0;
IntlDateFormatter_object* dfo;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset(NULL);
object = return_value;
/* Parse parameters. */
- if (zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "s!ll|zzs",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ll|zzs",
&locale_str, &locale_len, &date_type, &time_type, &timezone_zv,
&calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: "
- "unable to parse input parameters", 0);
return FAILURE;
}
@@ -192,7 +187,7 @@ error:
U_CFUNC PHP_FUNCTION( datefmt_create )
{
object_init_ex( return_value, IntlDateFormatter_ce_ptr );
- if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -210,7 +205,7 @@ U_CFUNC PHP_METHOD( IntlDateFormatter, __construct )
/* return_value param is being changed, therefore we will always return
* NULL here */
return_value = ZEND_THIS;
- if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_string *err = intl_error_get_message(NULL);
zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL));
diff --git a/ext/intl/dateformat/dateformat_create.h b/ext/intl/dateformat/dateformat_create.h
index c6e2d0feb8..3bf357b702 100644
--- a/ext/intl/dateformat/dateformat_create.h
+++ b/ext/intl/dateformat/dateformat_create.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_data.c b/ext/intl/dateformat/dateformat_data.c
index 04d37aa7ac..f7e9596ce1 100644
--- a/ext/intl/dateformat/dateformat_data.c
+++ b/ext/intl/dateformat/dateformat_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h
index ed61c75594..eb57fbae5a 100644
--- a/ext/intl/dateformat/dateformat_data.h
+++ b/ext/intl/dateformat/dateformat_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c
index 5e51796cad..fc7340f37e 100644
--- a/ext/intl/dateformat/dateformat_format.c
+++ b/ext/intl/dateformat/dateformat_format.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_format.h b/ext/intl/dateformat/dateformat_format.h
index 02b773f991..b8bd248d23 100644
--- a/ext/intl/dateformat/dateformat_format.h
+++ b/ext/intl/dateformat/dateformat_format.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp
index 90e148bca0..52b5138caa 100644
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_format_object.h b/ext/intl/dateformat/dateformat_format_object.h
index f92296cd59..a4c9c42589 100644
--- a/ext/intl/dateformat/dateformat_format_object.h
+++ b/ext/intl/dateformat/dateformat_format_object.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp
index 7e070ea464..f58317ebc1 100644
--- a/ext/intl/dateformat/dateformat_helpers.cpp
+++ b/ext/intl/dateformat/dateformat_helpers.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h
index 7489effc18..0c88977015 100644
--- a/ext/intl/dateformat/dateformat_helpers.h
+++ b/ext/intl/dateformat/dateformat_helpers.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c
index af96095242..59015cea2c 100644
--- a/ext/intl/dateformat/dateformat_parse.c
+++ b/ext/intl/dateformat/dateformat_parse.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -137,7 +135,6 @@ PHP_FUNCTION(datefmt_parse)
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|z!",
&object, IntlDateFormatter_ce_ptr, &text_to_parse, &text_len, &z_parse_pos ) == FAILURE ){
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_parse: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -182,7 +179,6 @@ PHP_FUNCTION(datefmt_localtime)
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|z!",
&object, IntlDateFormatter_ce_ptr, &text_to_parse, &text_len, &z_parse_pos ) == FAILURE ){
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_parse_to_localtime: unable to parse input params", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/dateformat/dateformat_parse.h b/ext/intl/dateformat/dateformat_parse.h
index 694dbf8d90..e9184864f0 100644
--- a/ext/intl/dateformat/dateformat_parse.h
+++ b/ext/intl/dateformat/dateformat_parse.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c
index 0ccd4b5cbe..98d767c465 100644
--- a/ext/intl/formatter/formatter.c
+++ b/ext/intl/formatter/formatter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter.h b/ext/intl/formatter/formatter.h
index 47ec473aae..054f1d5859 100644
--- a/ext/intl/formatter/formatter.h
+++ b/ext/intl/formatter/formatter.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index b04c33eaad..32717cd3dc 100644
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -39,9 +37,6 @@ PHP_FUNCTION( numfmt_get_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_attribute: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -112,9 +107,6 @@ PHP_FUNCTION( numfmt_get_text_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_text_attribute: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -153,9 +145,6 @@ PHP_FUNCTION( numfmt_set_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Olz",
&object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_attribute: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -216,9 +205,6 @@ PHP_FUNCTION( numfmt_set_text_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols",
&object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_text_attribute: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -257,9 +243,6 @@ PHP_FUNCTION( numfmt_get_symbol )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &symbol ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_symbol: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -306,9 +289,6 @@ PHP_FUNCTION( numfmt_set_symbol )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols",
&object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_symbol: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -351,9 +331,6 @@ PHP_FUNCTION( numfmt_get_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, NumberFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_pattern: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -394,9 +371,6 @@ PHP_FUNCTION( numfmt_set_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, NumberFormatter_ce_ptr, &value, &value_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_pattern: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -432,9 +406,6 @@ PHP_FUNCTION( numfmt_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O|l",
&object, NumberFormatter_ce_ptr, &type ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_locale: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/formatter/formatter_attr.h b/ext/intl/formatter/formatter_attr.h
index fd8b5b0b5c..5451aa0e9a 100644
--- a/ext/intl/formatter/formatter_attr.h
+++ b/ext/intl/formatter/formatter_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index ad39f39392..91efbed94e 100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -61,13 +59,13 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ NumberFormatter_object_clone */
-zend_object *NumberFormatter_object_clone(zval *object)
+zend_object *NumberFormatter_object_clone(zend_object *object)
{
NumberFormatter_object *nfo, *new_nfo;
zend_object *new_obj;
- FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ nfo = php_intl_number_format_fetch_object(object);
+ new_obj = NumberFormatter_ce_ptr->create_object(object->ce);
new_nfo = php_intl_number_format_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_nfo->zo, &nfo->zo);
diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h
index 1d6fa817c9..37b468d868 100644
--- a/ext/intl/formatter/formatter_class.h
+++ b/ext/intl/formatter/formatter_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_data.c b/ext/intl/formatter/formatter_data.c
index fec5320988..165b2c19b3 100644
--- a/ext/intl/formatter/formatter_data.c
+++ b/ext/intl/formatter/formatter_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h
index 8d1bfd12cd..e8c0591fd2 100644
--- a/ext/intl/formatter/formatter_data.h
+++ b/ext/intl/formatter/formatter_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c
index 05ef6789ef..7f8e8091ca 100644
--- a/ext/intl/formatter/formatter_format.c
+++ b/ext/intl/formatter/formatter_format.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -44,9 +42,6 @@ PHP_FUNCTION( numfmt_format )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oz|l",
&object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_format: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -150,9 +145,6 @@ PHP_FUNCTION( numfmt_format_currency )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ods",
&object, NumberFormatter_ce_ptr, &number, &currency, &currency_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_format_currency: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h
index c4d6bfb101..d6c0364962 100644
--- a/ext/intl/formatter/formatter_format.h
+++ b/ext/intl/formatter/formatter_format.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c
index a4671c093a..be66a0d342 100644
--- a/ext/intl/formatter/formatter_main.c
+++ b/ext/intl/formatter/formatter_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -25,7 +23,7 @@
#include "intl_convert.h"
/* {{{ */
-static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
char* pattern = NULL;
@@ -33,15 +31,12 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
zend_long style;
UChar* spattern = NULL;
int32_t spattern_len = 0;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "sl|s",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s",
&locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_create: unable to parse input parameters", 0 );
return FAILURE;
}
@@ -79,7 +74,7 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
PHP_FUNCTION( numfmt_create )
{
object_init_ex( return_value, NumberFormatter_ce_ptr );
- if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -95,7 +90,7 @@ PHP_METHOD( NumberFormatter, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
@@ -117,9 +112,6 @@ PHP_FUNCTION( numfmt_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, NumberFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_error_code: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -144,9 +136,6 @@ PHP_FUNCTION( numfmt_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, NumberFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_error_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/formatter/formatter_main.h b/ext/intl/formatter/formatter_main.h
index 66cf5c1b6b..f932e3cc71 100644
--- a/ext/intl/formatter/formatter_main.h
+++ b/ext/intl/formatter/formatter_main.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index ed338dd7d1..8dc39e81c2 100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -54,9 +52,6 @@ PHP_FUNCTION( numfmt_parse )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|lz!",
&object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "number_parse: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -139,9 +134,6 @@ PHP_FUNCTION( numfmt_parse_currency )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Osz/|z!",
&object, NumberFormatter_ce_ptr, &str, &str_len, &zcurrency, &zposition ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "number_parse_currency: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/formatter/formatter_parse.h b/ext/intl/formatter/formatter_parse.h
index 7a3098fcb2..039669d7fa 100644
--- a/ext/intl/formatter/formatter_parse.h
+++ b/ext/intl/formatter/formatter_parse.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h
index 871e660639..62aa1ec1b2 100644
--- a/ext/intl/grapheme/grapheme.h
+++ b/ext/intl/grapheme/grapheme.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c
index 6e5fc4ffb4..8d2bc7243b 100644
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -63,8 +61,6 @@ PHP_FUNCTION(grapheme_strlen)
UErrorCode status;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &string, &string_len) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strlen: unable to parse input param", 0 );
RETURN_FALSE;
}
@@ -116,8 +112,6 @@ PHP_FUNCTION(grapheme_strpos)
zend_long ret_pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strpos: unable to parse input param", 0 );
RETURN_FALSE;
}
@@ -179,8 +173,6 @@ PHP_FUNCTION(grapheme_stripos)
int is_ascii;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_stripos: unable to parse input param", 0 );
RETURN_FALSE;
}
@@ -248,8 +240,6 @@ PHP_FUNCTION(grapheme_strrpos)
int is_ascii;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strrpos: unable to parse input param", 0 );
RETURN_FALSE;
}
@@ -311,8 +301,6 @@ PHP_FUNCTION(grapheme_strripos)
int is_ascii;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strrpos: unable to parse input param", 0 );
RETURN_FALSE;
}
@@ -391,8 +379,6 @@ PHP_FUNCTION(grapheme_substr)
zend_bool no_length = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!", &str, &str_len, &lstart, &length, &no_length) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_substr: unable to parse input param", 0 );
RETURN_FALSE;
}
@@ -598,10 +584,6 @@ static void strstr_common_handler(INTERNAL_FUNCTION_PARAMETERS, int f_ignore_cas
zend_bool part = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|b", &haystack, &haystack_len, &needle, &needle_len, &part) == FAILURE) {
-
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strstr: unable to parse input param", 0 );
-
RETURN_FALSE;
}
@@ -789,8 +771,6 @@ PHP_FUNCTION(grapheme_extract)
zval *next = NULL; /* return offset of next part of the string */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|llz", &str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_extract: unable to parse input param", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index 5bc23be209..71d6074999 100644
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index 5b942d030e..508b7355f0 100644
--- a/ext/intl/grapheme/grapheme_util.h
+++ b/ext/intl/grapheme/grapheme_util.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index 89aade4dc3..de948e18d9 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.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, |
@@ -33,8 +31,7 @@
/* }}} */
enum {
- INTL_IDN_VARIANT_2003 = 0,
- INTL_IDN_VARIANT_UTS46
+ INTL_IDN_VARIANT_UTS46 = 1
};
/* {{{ grapheme_register_constants
@@ -73,7 +70,6 @@ void idn_register_constants( INIT_FUNC_ARGS )
REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT);
/* VARIANTS */
- REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT);
/* PINFO ERROR CODES */
@@ -176,92 +172,22 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
uidna_close(uts46);
}
-static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS,
- const zend_string *domain, uint32_t option, int mode)
-{
- UChar* ustring = NULL;
- int ustring_len = 0;
- UErrorCode status;
- zend_string *u8str;
-
- /* convert the string to UTF-16. */
- status = U_ZERO_ERROR;
- intl_convert_utf8_to_utf16(&ustring, &ustring_len, ZSTR_VAL(domain), ZSTR_LEN(domain), &status);
-
- if (U_FAILURE(status)) {
- intl_error_set_code(NULL, status);
-
- /* Set error messages. */
- intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 );
- if (ustring) {
- efree(ustring);
- }
- RETURN_FALSE;
- } else {
- UParseError parse_error;
- UChar converted[MAXPATHLEN];
- int32_t converted_ret_len;
-
- status = U_ZERO_ERROR;
-#if defined(__clang__)
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#elif ZEND_GCC_VERSION >= 4008
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
- if (mode == INTL_IDN_TO_ASCII) {
- converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
- } else {
- converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
- }
-#if defined(__clang__)
-# pragma clang diagnostic pop
-#elif ZEND_GCC_VERSION >= 4008
-# pragma GCC diagnostic pop
-#endif
- efree(ustring);
-
- if (U_FAILURE(status)) {
- intl_error_set( NULL, status, "idn_to_ascii: cannot convert to ASCII", 0 );
- RETURN_FALSE;
- }
-
- status = U_ZERO_ERROR;
- u8str = intl_convert_utf16_to_utf8(converted, converted_ret_len, &status);
-
- if (!u8str) {
- /* Set global error code. */
- intl_error_set_code(NULL, status);
-
- /* Set error messages. */
- intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 );
- RETURN_FALSE;
- }
- }
-
- /* return the allocated string, not a duplicate */
- RETVAL_NEW_STR(u8str);
-}
-
static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
zend_string *domain;
zend_long option = 0,
- variant = INTL_IDN_VARIANT_UTS46;
+ variant = INTL_IDN_VARIANT_UTS46;
zval *idna_info = NULL;
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|llz",
&domain, &option, &variant, &idna_info) == FAILURE) {
- php_intl_bad_args("bad arguments");
RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */
}
- if (variant != INTL_IDN_VARIANT_2003 && variant != INTL_IDN_VARIANT_UTS46) {
- php_intl_bad_args("invalid variant, must be one of {"
- "INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46}");
+ if (variant != INTL_IDN_VARIANT_UTS46) {
+ php_intl_bad_args("invalid variant, must be INTL_IDNA_VARIANT_UTS46");
RETURN_FALSE;
}
@@ -275,29 +201,14 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
}
/* don't check options; it wasn't checked before */
- if (variant == INTL_IDN_VARIANT_2003) {
- php_error_docref(NULL, E_DEPRECATED, "INTL_IDNA_VARIANT_2003 is deprecated");
- }
-
if (idna_info != NULL) {
- if (variant == INTL_IDN_VARIANT_2003) {
- php_error_docref(NULL, E_NOTICE,
- "4 arguments were provided, but INTL_IDNA_VARIANT_2003 only "
- "takes 3 - extra argument ignored");
- } else {
- idna_info = zend_try_array_init(idna_info);
- if (!idna_info) {
- return;
- }
+ idna_info = zend_try_array_init(idna_info);
+ if (!idna_info) {
+ return;
}
}
- if (variant == INTL_IDN_VARIANT_2003) {
- php_intl_idn_to(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode);
- }
- else {
- php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info);
- }
+ php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info);
}
/* {{{ proto string idn_to_ascii(string domain[, int options[, int variant[, array &idna_info]]])
diff --git a/ext/intl/idn/idn.h b/ext/intl/idn/idn.h
index e8d1b53a33..801af9ee73 100644
--- a/ext/intl/idn/idn.h
+++ b/ext/intl/idn/idn.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/ext/intl/intl_common.h b/ext/intl/intl_common.h
index 954d2bdd7f..5c087d5088 100644
--- a/ext/intl/intl_common.h
+++ b/ext/intl/intl_common.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convert.c b/ext/intl/intl_convert.c
index e24f2370c2..911493a242 100644
--- a/ext/intl/intl_convert.c
+++ b/ext/intl/intl_convert.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convert.h b/ext/intl/intl_convert.h
index 3c6308a352..d6980133cf 100644
--- a/ext/intl/intl_convert.h
+++ b/ext/intl/intl_convert.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp
index 79f5c8cb6c..a9a855ae3f 100644
--- a/ext/intl/intl_convertcpp.cpp
+++ b/ext/intl/intl_convertcpp.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convertcpp.h b/ext/intl/intl_convertcpp.h
index 4fad9ed052..33ccaa3575 100644
--- a/ext/intl/intl_convertcpp.h
+++ b/ext/intl/intl_convertcpp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_cppshims.h b/ext/intl/intl_cppshims.h
index e2db488d93..34d1172a2c 100644
--- a/ext/intl/intl_cppshims.h
+++ b/ext/intl/intl_cppshims.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h
index 898a174a22..29a053ab20 100644
--- a/ext/intl/intl_data.h
+++ b/ext/intl/intl_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index bdab00cf27..42486aa04b 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h
index 11ac469a7d..927e5cdfd2 100644
--- a/ext/intl/intl_error.h
+++ b/ext/intl/intl_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c
index fa796e3574..6bef6a2b30 100644
--- a/ext/intl/locale/locale.c
+++ b/ext/intl/locale/locale.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h
index 4ebda99887..adf6a450dc 100644
--- a/ext/intl/locale/locale.h
+++ b/ext/intl/locale/locale.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c
index eb797c505d..ebfe9780e2 100644
--- a/ext/intl/locale/locale_class.c
+++ b/ext/intl/locale/locale_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale_class.h b/ext/intl/locale/locale_class.h
index e8e244209a..a566ae4619 100644
--- a/ext/intl/locale/locale_class.h
+++ b/ext/intl/locale/locale_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 4c5476f6aa..f1e4bcaf65 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -227,9 +225,6 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "S", &locale_name) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_set_default: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -397,10 +392,6 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name ,&loc_name_len ) == FAILURE) {
- spprintf(&msg , 0, "locale_get_%s : unable to parse input params", tag_name );
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 );
- efree(msg);
-
RETURN_FALSE;
}
@@ -506,9 +497,6 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
&loc_name, &loc_name_len ,
&disp_loc_name ,&disp_loc_name_len ) == FAILURE)
{
- spprintf(&msg , 0, "locale_get_display_%s : unable to parse input params", tag_name );
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 );
- efree(msg);
RETURN_FALSE;
}
@@ -698,9 +686,6 @@ PHP_FUNCTION( locale_get_keywords )
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name, &loc_name_len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_get_keywords: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -920,8 +905,6 @@ PHP_FUNCTION(locale_compose)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "a",
&arr) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_compose: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -1108,9 +1091,6 @@ PHP_FUNCTION(locale_parse)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name, &loc_name_len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_parse: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -1158,9 +1138,6 @@ PHP_FUNCTION(locale_get_all_variants)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name, &loc_name_len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_parse: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -1264,9 +1241,6 @@ PHP_FUNCTION(locale_filter_matches)
&lang_tag, &lang_tag_len , &loc_range , &loc_range_len ,
&boolCanonical) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_filter_matches: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -1540,7 +1514,6 @@ PHP_FUNCTION(locale_lookup)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS!", &arr, &loc_range, &loc_range_len,
&boolCanonical, &fallback_loc_str) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -1594,8 +1567,6 @@ PHP_FUNCTION(locale_accept_from_http)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &http_accept, &http_accept_len) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_accept_from_http: unable to parse input parameters", 0 );
RETURN_FALSE;
}
if(http_accept_len > ULOC_FULLNAME_CAPACITY) {
diff --git a/ext/intl/locale/locale_methods.h b/ext/intl/locale/locale_methods.h
index 9609c92f4e..3de431e3cd 100644
--- a/ext/intl/locale/locale_methods.h
+++ b/ext/intl/locale/locale_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c
index 2439b5855a..1ae7b0aad5 100644
--- a/ext/intl/msgformat/msgformat.c
+++ b/ext/intl/msgformat/msgformat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -27,7 +25,7 @@
#include "intl_convert.h"
/* {{{ */
-static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
char* pattern;
@@ -36,16 +34,13 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
int spattern_len = 0;
zval* object;
MessageFormatter_object* mfo;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset( NULL );
object = return_value;
/* Parse parameters. */
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "ss",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "ss",
&locale, &locale_len, &pattern, &pattern_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_create: unable to parse input parameters", 0 );
return FAILURE;
}
@@ -98,7 +93,7 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
PHP_FUNCTION( msgfmt_create )
{
object_init_ex( return_value, MessageFormatter_ce_ptr );
- if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -114,7 +109,7 @@ PHP_METHOD( MessageFormatter, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
@@ -137,9 +132,6 @@ PHP_FUNCTION( msgfmt_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_error_code: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -165,9 +157,6 @@ PHP_FUNCTION( msgfmt_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_error_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/msgformat/msgformat.h b/ext/intl/msgformat/msgformat.h
index a0b2c89644..e4a55ffa5e 100644
--- a/ext/intl/msgformat/msgformat.h
+++ b/ext/intl/msgformat/msgformat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c
index 51d9df049f..4fa07a96ea 100644
--- a/ext/intl/msgformat/msgformat_attr.c
+++ b/ext/intl/msgformat/msgformat_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -38,8 +36,6 @@ PHP_FUNCTION( msgfmt_get_pattern )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_pattern: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -71,8 +67,6 @@ PHP_FUNCTION( msgfmt_set_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, MessageFormatter_ce_ptr, &value, &value_len ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_set_pattern: unable to parse input params", 0);
RETURN_FALSE;
}
@@ -127,9 +121,6 @@ PHP_FUNCTION( msgfmt_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_locale: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/msgformat/msgformat_attr.h b/ext/intl/msgformat/msgformat_attr.h
index 891f44c073..0d5371a9cd 100644
--- a/ext/intl/msgformat/msgformat_attr.h
+++ b/ext/intl/msgformat/msgformat_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index a6d5b593a6..2ca12b7819 100644
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -61,13 +59,13 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ MessageFormatter_object_clone */
-zend_object *MessageFormatter_object_clone(zval *object)
+zend_object *MessageFormatter_object_clone(zend_object *object)
{
MessageFormatter_object *mfo, *new_mfo;
zend_object *new_obj;
- MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ mfo = php_intl_messageformatter_fetch_object(object);
+ new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
new_mfo = php_intl_messageformatter_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_mfo->zo, &mfo->zo);
diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h
index 51025f0671..5302813843 100644
--- a/ext/intl/msgformat/msgformat_class.h
+++ b/ext/intl/msgformat/msgformat_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c
index 03dc232f67..6c0b62a6b5 100644
--- a/ext/intl/msgformat/msgformat_data.c
+++ b/ext/intl/msgformat/msgformat_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h
index a4226664ae..e4e04bf203 100644
--- a/ext/intl/msgformat/msgformat_data.h
+++ b/ext/intl/msgformat/msgformat_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c
index a11c167a4b..33b138bed2 100644
--- a/ext/intl/msgformat/msgformat_format.c
+++ b/ext/intl/msgformat/msgformat_format.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -65,9 +63,6 @@ PHP_FUNCTION( msgfmt_format )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa",
&object, MessageFormatter_ce_ptr, &args ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_format: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -99,9 +94,6 @@ PHP_FUNCTION( msgfmt_format_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "ssa",
&slocale, &slocale_len, &pattern, &pattern_len, &args ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_format_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/msgformat/msgformat_format.h b/ext/intl/msgformat/msgformat_format.h
index 12b0e4a283..9694d57f8d 100644
--- a/ext/intl/msgformat/msgformat_format.h
+++ b/ext/intl/msgformat/msgformat_format.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 11ff2f3388..3644e393d3 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h
index df05259574..bb316f1148 100644
--- a/ext/intl/msgformat/msgformat_helpers.h
+++ b/ext/intl/msgformat/msgformat_helpers.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c
index c517288bff..2d082fcdbd 100644
--- a/ext/intl/msgformat/msgformat_parse.c
+++ b/ext/intl/msgformat/msgformat_parse.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -69,9 +67,6 @@ PHP_FUNCTION( msgfmt_parse )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, MessageFormatter_ce_ptr, &source, &source_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_parse: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -104,9 +99,6 @@ PHP_FUNCTION( msgfmt_parse_message )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "sss",
&slocale, &slocale_len, &pattern, &pattern_len, &source, &src_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_parse_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/msgformat/msgformat_parse.h b/ext/intl/msgformat/msgformat_parse.h
index 4a86403a48..8fe1b7beac 100644
--- a/ext/intl/msgformat/msgformat_parse.h
+++ b/ext/intl/msgformat/msgformat_parse.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c
index e05c45875b..104f270e43 100644
--- a/ext/intl/normalizer/normalizer.c
+++ b/ext/intl/normalizer/normalizer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -42,7 +40,6 @@ void normalizer_register_constants( INIT_FUNC_ARGS )
#define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value );
/* Normalization form constants */
- NORMALIZER_EXPOSE_CLASS_CONST( NONE );
NORMALIZER_EXPOSE_CLASS_CONST( FORM_D );
NORMALIZER_EXPOSE_CLASS_CONST( NFD );
NORMALIZER_EXPOSE_CLASS_CONST( FORM_KD );
diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h
index 57f0466782..b0cb116f8f 100644
--- a/ext/intl/normalizer/normalizer.h
+++ b/ext/intl/normalizer/normalizer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -22,7 +20,6 @@
#if U_ICU_VERSION_MAJOR_NUM < 56
#include <unicode/unorm.h>
-#define NORMALIZER_NONE UNORM_NONE
#define NORMALIZER_FORM_D UNORM_NFD
#define NORMALIZER_NFD UNORM_NFD
#define NORMALIZER_FORM_KD UNORM_NFKD
@@ -35,7 +32,6 @@
#else
#include <unicode/unorm2.h>
-#define NORMALIZER_NONE 0x2
#define NORMALIZER_FORM_D 0x4
#define NORMALIZER_NFD NORMALIZER_FORM_D
#define NORMALIZER_FORM_KD 0x8
diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c
index 4e46b2e279..ec96a163e9 100644
--- a/ext/intl/normalizer/normalizer_class.c
+++ b/ext/intl/normalizer/normalizer_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/normalizer/normalizer_class.h b/ext/intl/normalizer/normalizer_class.h
index de5a168a45..881aa80656 100644
--- a/ext/intl/normalizer/normalizer_class.h
+++ b/ext/intl/normalizer/normalizer_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c
index f8336d0101..edb4133414 100644
--- a/ext/intl/normalizer/normalizer_normalize.c
+++ b/ext/intl/normalizer/normalizer_normalize.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -59,26 +57,8 @@ static const UNormalizer2 *intl_get_normalizer(zend_long form, UErrorCode *err)
static int32_t intl_normalize(zend_long form, const UChar *src, int32_t src_len, UChar *dst, int32_t dst_len, UErrorCode *err)
{/*{{{*/
- const UNormalizer2 *norm;
-
- /* Mimic the behavior of ICU < 56. */
- if (UNEXPECTED(NORMALIZER_NONE == form)) {
- /* FIXME This is a noop which should be removed somewhen after PHP 7.3.*/
- zend_error(E_DEPRECATED, "Normalizer::NONE is obsolete with ICU 56 and above and will be removed in later PHP versions");
-
- if (dst_len >= src_len) {
- memmove(dst, src, sizeof(UChar) * src_len);
- dst[src_len] = '\0';
- *err = U_ZERO_ERROR;
- return src_len;
- }
-
- *err = U_BUFFER_OVERFLOW_ERROR;
- return -1;
- }
-
- norm = intl_get_normalizer(form, err);
- if(U_FAILURE(*err)) {
+ const UNormalizer2 *norm = intl_get_normalizer(form, err);
+ if (U_FAILURE(*err)) {
return -1;
}
@@ -127,17 +107,12 @@ PHP_FUNCTION( normalizer_normalize )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "s|l",
&input, &input_len, &form ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "normalizer_normalize: unable to parse input params", 0 );
-
RETURN_FALSE;
}
expansion_factor = 1;
switch(form) {
- case NORMALIZER_NONE:
- break;
case NORMALIZER_FORM_D:
expansion_factor = 3;
break;
@@ -269,15 +244,10 @@ PHP_FUNCTION( normalizer_is_normalized )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "s|l",
&input, &input_len, &form) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "normalizer_is_normalized: unable to parse input params", 0 );
-
RETURN_FALSE;
}
switch(form) {
- /* case NORMALIZER_NONE: not allowed - doesn't make sense */
-
case NORMALIZER_FORM_D:
case NORMALIZER_FORM_KD:
case NORMALIZER_FORM_C:
diff --git a/ext/intl/normalizer/normalizer_normalize.h b/ext/intl/normalizer/normalizer_normalize.h
index 2ed957758a..9c15f348ce 100644
--- a/ext/intl/normalizer/normalizer_normalize.h
+++ b/ext/intl/normalizer/normalizer_normalize.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index b244a29842..72582883af 100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h
index 6b910d76c8..506797a36d 100644
--- a/ext/intl/php_intl.h
+++ b/ext/intl/php_intl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c
index 5c3bc1742e..445910829c 100644
--- a/ext/intl/resourcebundle/resourcebundle.c
+++ b/ext/intl/resourcebundle/resourcebundle.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle.h b/ext/intl/resourcebundle/resourcebundle.h
index 46a6ad5766..c48e7c79b7 100644
--- a/ext/intl/resourcebundle/resourcebundle.h
+++ b/ext/intl/resourcebundle/resourcebundle.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 0f63109eca..9ddafe97ea 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -75,25 +73,22 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce )
/* }}} */
/* {{{ ResourceBundle_ctor */
-static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char *bundlename;
size_t bundlename_len = 0;
const char *locale;
size_t locale_len = 0;
zend_bool fallback = 1;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
zval *object = return_value;
ResourceBundle_object *rb = Z_INTL_RESOURCEBUNDLE_P( object );
intl_error_reset( NULL );
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s!s!|b",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b",
&locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_ctor: unable to parse input parameters", 0 );
return FAILURE;
}
@@ -153,7 +148,7 @@ PHP_METHOD( ResourceBundle, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
@@ -168,7 +163,7 @@ proto ResourceBundle resourcebundle_create( string $locale [, string $bundlename
PHP_FUNCTION( resourcebundle_create )
{
object_init_ex( return_value, ResourceBundle_ce_ptr );
- if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -176,7 +171,7 @@ PHP_FUNCTION( resourcebundle_create )
/* }}} */
/* {{{ resourcebundle_array_fetch */
-static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback)
+static void resourcebundle_array_fetch(zend_object *object, zval *offset, zval *return_value, int fallback)
{
int32_t meindex = 0;
char * mekey = NULL;
@@ -185,7 +180,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
ResourceBundle_object *rb;
intl_error_reset( NULL );
- RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
+ rb = php_intl_resourcebundle_fetch_object(object);
if(Z_TYPE_P(offset) == IS_LONG) {
is_numeric = 1;
@@ -230,7 +225,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
/* }}} */
/* {{{ resourcebundle_array_get */
-zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv)
+zval *resourcebundle_array_get(zend_object *object, zval *offset, int type, zval *rv)
{
if(offset == NULL) {
php_error( E_ERROR, "Cannot apply [] to ResourceBundle object" );
@@ -259,20 +254,17 @@ PHP_FUNCTION( resourcebundle_get )
zval * object;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz|b", &object, ResourceBundle_ce_ptr, &offset, &fallback ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_get: unable to parse input params", 0);
RETURN_FALSE;
}
- resourcebundle_array_fetch(object, offset, return_value, fallback);
+ resourcebundle_array_fetch(Z_OBJ_P(object), offset, return_value, fallback);
}
/* }}} */
/* {{{ resourcebundle_array_count */
-int resourcebundle_array_count(zval *object, zend_long *count)
+int resourcebundle_array_count(zend_object *object, zend_long *count)
{
- ResourceBundle_object *rb;
- RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
+ ResourceBundle_object *rb = php_intl_resourcebundle_fetch_object(object);
if (rb->me == NULL) {
intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR,
@@ -301,8 +293,6 @@ PHP_FUNCTION( resourcebundle_count )
RESOURCEBUNDLE_METHOD_INIT_VARS;
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_count: unable to parse input params", 0);
RETURN_FALSE;
}
@@ -335,8 +325,6 @@ PHP_FUNCTION( resourcebundle_locales )
if( zend_parse_parameters(ZEND_NUM_ARGS(), "s", &bundlename, &bundlename_len ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_locales: unable to parse input params", 0);
RETURN_FALSE;
}
@@ -380,8 +368,6 @@ PHP_FUNCTION( resourcebundle_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, ResourceBundle_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_get_error_code: unable to parse input params", 0 );
RETURN_FALSE;
}
@@ -408,8 +394,6 @@ PHP_FUNCTION( resourcebundle_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, ResourceBundle_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_get_error_message: unable to parse input params", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h
index 0ac3635ba8..c61939dc77 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.h
+++ b/ext/intl/resourcebundle/resourcebundle_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c
index 8bb66a157f..ab10daf82d 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.c
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h
index 01213ac76e..fa2e24d848 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.h
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c
index 607576a2bf..8791384b4d 100644
--- a/ext/intl/spoofchecker/spoofchecker.c
+++ b/ext/intl/spoofchecker/spoofchecker.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker.h b/ext/intl/spoofchecker/spoofchecker.h
index 1cbdd7ea65..884c6715c5 100644
--- a/ext/intl/spoofchecker/spoofchecker.h
+++ b/ext/intl/spoofchecker/spoofchecker.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index d8bca44dba..87f40fef49 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.c
+++ b/ext/intl/spoofchecker/spoofchecker_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -108,15 +106,15 @@ static const zend_function_entry Spoofchecker_class_functions[] = {
};
/* }}} */
-static zend_object *spoofchecker_clone_obj(zval *object) /* {{{ */
+static zend_object *spoofchecker_clone_obj(zend_object *object) /* {{{ */
{
zend_object *new_obj_val;
Spoofchecker_object *sfo, *new_sfo;
- sfo = Z_INTL_SPOOFCHECKER_P(object);
+ sfo = php_intl_spoofchecker_fetch_object(object);
intl_error_reset(SPOOFCHECKER_ERROR_P(sfo));
- new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object));
+ new_obj_val = Spoofchecker_ce_ptr->create_object(object->ce);
new_sfo = php_intl_spoofchecker_fetch_object(new_obj_val);
/* clone standard parts */
zend_objects_clone_members(&new_sfo->zo, &sfo->zo);
diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h
index ba4cc497a1..b8b0e5e287 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.h
+++ b/ext/intl/spoofchecker/spoofchecker_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c
index 999b6af147..67c01a46b6 100644
--- a/ext/intl/spoofchecker/spoofchecker_create.c
+++ b/ext/intl/spoofchecker/spoofchecker_create.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker_create.h b/ext/intl/spoofchecker/spoofchecker_create.h
index 405c1bda12..4b573cbf07 100644
--- a/ext/intl/spoofchecker/spoofchecker_create.h
+++ b/ext/intl/spoofchecker/spoofchecker_create.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c
index 072ed24b7e..918f89d3c9 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.c
+++ b/ext/intl/spoofchecker/spoofchecker_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h
index 227f0e8481..a7774c24ad 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.h
+++ b/ext/intl/spoofchecker/spoofchecker_main.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt
deleted file mode 100644
index 13adc53b03..0000000000
--- a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlBreakIterator::createCodePointInstance(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlBreakIterator::createCodePointInstance(array()));
---EXPECTF--
-Warning: IntlBreakIterator::createCodePointInstance() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::createCodePointInstance(): breakiter_create_code_point_instance: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/breakiter_factories_error.phpt b/ext/intl/tests/breakiter_factories_error.phpt
deleted file mode 100644
index 4f3a912a15..0000000000
--- a/ext/intl/tests/breakiter_factories_error.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-IntlBreakIterator factory methods: argument errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlBreakIterator::createWordInstance(array()));
-var_dump(IntlBreakIterator::createSentenceInstance(NULL, 2));
-var_dump(IntlBreakIterator::createCharacterInstance(NULL, 2));
-var_dump(IntlBreakIterator::createTitleInstance(NULL, 2));
-var_dump(IntlBreakIterator::createLineInstance(NULL, 2));
---EXPECTF--
-Warning: IntlBreakIterator::createWordInstance() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlBreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createSentenceInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createCharacterInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createTitleInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createLineInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
deleted file mode 100644
index da37ffea78..0000000000
--- a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-IntlBreakIterator::first()/last()/previous()/current(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->first(1));
-var_dump($bi->last(1));
-var_dump($bi->previous(1));
-var_dump($bi->current(1));
---EXPECTF--
-Warning: IntlBreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::first(): breakiter_first: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::last(): breakiter_last: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::current(): breakiter_current: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
deleted file mode 100644
index 56ed60ffcf..0000000000
--- a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-IntlBreakIterator::following()/preceding()/isBoundary(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->following(1, 2));
-var_dump($bi->following(array()));
-var_dump($bi->preceding(1, 2));
-var_dump($bi->preceding(array()));
-var_dump($bi->isBoundary(1, 2));
-var_dump($bi->isBoundary(array()));
---EXPECTF--
-Warning: IntlBreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::following() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::preceding() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::isBoundary() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt
deleted file mode 100644
index f318743948..0000000000
--- a/ext/intl/tests/breakiter_getLocale_error.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-IntlBreakIterator::getLocale(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->getLocale(1, 2));
-var_dump($bi->getLocale(array()));
-var_dump($bi->getLocale());
---EXPECTF--
-Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::getLocale() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_getPartsIterator_error.phpt b/ext/intl/tests/breakiter_getPartsIterator_error.phpt
index b756540578..506b376c19 100644
--- a/ext/intl/tests/breakiter_getPartsIterator_error.phpt
+++ b/ext/intl/tests/breakiter_getPartsIterator_error.phpt
@@ -10,23 +10,11 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$it = IntlBreakIterator::createWordInstance(NULL);
-var_dump($it->getPartsIterator(array()));
-var_dump($it->getPartsIterator(1, 2));
var_dump($it->getPartsIterator(-1));
?>
==DONE==
--EXPECTF--
-Warning: IntlBreakIterator::getPartsIterator() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::getPartsIterator() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad key type in %s on line %d
bool(false)
==DONE==
diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt
deleted file mode 100644
index d66b4bb69f..0000000000
--- a/ext/intl/tests/breakiter_getText_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-IntlBreakIterator::getText(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}]+;');
-var_dump($bi->getText(array()));
---EXPECTF--
-Warning: IntlBreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt
deleted file mode 100644
index eb4664308c..0000000000
--- a/ext/intl/tests/breakiter_next_error.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-IntlBreakIterator::next(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->next(1, 2));
-var_dump($bi->next(array()));
---EXPECTF--
-Warning: IntlBreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::next() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt
deleted file mode 100644
index c94a8433f1..0000000000
--- a/ext/intl/tests/breakiter_setText_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-IntlBreakIterator::setText(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}]+;');
-var_dump($bi->setText());
-var_dump($bi->setText(array()));
-var_dump($bi->setText(1,2));
-
-class A {
-function __destruct() { var_dump('destructed'); throw new Exception('e'); }
-function __tostring() { return 'foo'; }
-}
-
-try {
-var_dump($bi->setText(new A));
-} catch (Exception $e) {
-var_dump($e->getMessage());
-}
---EXPECTF--
-Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
-bool(false)
-string(10) "destructed"
-string(1) "e"
diff --git a/ext/intl/tests/calendar_add_error.phpt b/ext/intl/tests/calendar_add_error.phpt
index 017551821d..f0fd43558e 100644
--- a/ext/intl/tests/calendar_add_error.phpt
+++ b/ext/intl/tests/calendar_add_error.phpt
@@ -10,34 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->add(1, 2, 3));
-var_dump($c->add(-1, 2));
-var_dump($c->add(1));
-
-var_dump(intlcal_add($c, 1, 2, 3));
var_dump(intlcal_add(1, 2, 3));
--EXPECTF--
-Warning: IntlCalendar::add() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::add(): intlcal_add: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::add(): intlcal_add: invalid field in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::add() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::add(): intlcal_add: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_add() expects exactly 3 parameters, 4 given in %s on line %d
-
-Warning: intlcal_add(): intlcal_add: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_add() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_add() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_add(1, 2, 3)
#1 {main}
diff --git a/ext/intl/tests/calendar_before_after_error.phpt b/ext/intl/tests/calendar_before_after_error.phpt
index 279e3d816e..4d34ae77f5 100644
--- a/ext/intl/tests/calendar_before_after_error.phpt
+++ b/ext/intl/tests/calendar_before_after_error.phpt
@@ -61,25 +61,18 @@ try {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, IntlCalendar::after() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::after(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, IntlCalendar::before() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::before(): intlcal_before/after: bad arguments
-bool(false)
-error: 0, Argument 1 passed to IntlCalendar::after() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::after() expects exactly 1 parameter, 0 given
-error: 0, Argument 1 passed to IntlCalendar::before() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::before() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::after() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::after(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, IntlCalendar::before() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::before(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, intlcal_after() expects exactly 2 parameters, 1 given
-error: 2, intlcal_after(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, intlcal_before() expects exactly 2 parameters, 1 given
-error: 2, intlcal_before(): intlcal_before/after: bad arguments
-bool(false)
+error: 0, IntlCalendar::after() expects parameter 1 to be IntlCalendar, int given
+
+error: 0, IntlCalendar::before() expects parameter 1 to be IntlCalendar, int given
+
+error: 0, IntlCalendar::after() expects exactly 1 parameter, 2 given
+
+error: 0, IntlCalendar::before() expects exactly 1 parameter, 2 given
+
+error: 0, intlcal_after() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_before() expects exactly 2 parameters, 1 given
diff --git a/ext/intl/tests/calendar_clear_error.phpt b/ext/intl/tests/calendar_clear_error.phpt
index bffa103eac..7fec27399e 100644
--- a/ext/intl/tests/calendar_clear_error.phpt
+++ b/ext/intl/tests/calendar_clear_error.phpt
@@ -12,24 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->clear(1, 2));
var_dump($c->clear(-1));
var_dump(intlcal_clear($c, -1));
var_dump(intlcal_clear(1, 2));
--EXPECTF--
-Warning: IntlCalendar::clear() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::clear(): intlcal_clear: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::clear(): intlcal_clear: invalid field in %s on line %d
bool(false)
Warning: intlcal_clear(): intlcal_clear: invalid field in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_clear() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_clear() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_clear(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_createInstance_error.phpt b/ext/intl/tests/calendar_createInstance_error.phpt
index 5cb9fa1c63..516cc9260e 100644
--- a/ext/intl/tests/calendar_createInstance_error.phpt
+++ b/ext/intl/tests/calendar_createInstance_error.phpt
@@ -12,25 +12,7 @@ class X extends IntlTimeZone {
function __construct() {}
}
-var_dump(IntlCalendar::createInstance(1, 2, 3));
-var_dump(intlcal_create_instance(1, 2, 3));
var_dump(intlcal_create_instance(new X, NULL));
-var_dump(intlcal_create_instance(NULL, array()));
--EXPECTF--
-Warning: IntlCalendar::createInstance() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::createInstance(): intlcal_create_calendar: bad arguments in %s on line %d
-NULL
-
-Warning: intlcal_create_instance() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: intlcal_create_instance(): intlcal_create_calendar: bad arguments in %s on line %d
-NULL
-
Warning: intlcal_create_instance(): intlcal_create_instance: passed IntlTimeZone is not properly constructed in %s on line %d
NULL
-
-Warning: intlcal_create_instance() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: intlcal_create_instance(): intlcal_create_calendar: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/calendar_equals_error.phpt b/ext/intl/tests/calendar_equals_error.phpt
index 4c585a6018..4e6f40b43d 100644
--- a/ext/intl/tests/calendar_equals_error.phpt
+++ b/ext/intl/tests/calendar_equals_error.phpt
@@ -45,13 +45,12 @@ try {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, IntlCalendar::equals() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::equals(): intlcal_equals: bad arguments
-bool(false)
-error: 0, Argument 1 passed to IntlCalendar::equals() must be an instance of IntlCalendar, instance of stdClass given
+error: 0, IntlCalendar::equals() expects exactly 1 parameter, 0 given
-error: 0, Argument 1 passed to IntlCalendar::equals() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::equals() expects parameter 1 to be IntlCalendar, object given
-error: 0, Argument 2 passed to intlcal_equals() must be an instance of IntlCalendar, array given
+error: 0, IntlCalendar::equals() expects exactly 1 parameter, 2 given
-error: 0, Argument 1 passed to intlcal_equals() must be an instance of IntlCalendar, int given
+error: 0, intlcal_equals() expects parameter 2 to be IntlCalendar, array given
+
+error: 0, intlcal_equals() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_fieldDifference_error.phpt b/ext/intl/tests/calendar_fieldDifference_error.phpt
index 4f3fc351cb..1957dbbc2d 100644
--- a/ext/intl/tests/calendar_fieldDifference_error.phpt
+++ b/ext/intl/tests/calendar_fieldDifference_error.phpt
@@ -12,32 +12,27 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->fieldDifference($c, 2, 3));
+try {
+ var_dump($c->fieldDifference($c, 2, 3));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($c->fieldDifference(INF, 2));
-var_dump($c->fieldDifference(1));
-var_dump(intlcal_field_difference($c, 0, 1, 2));
+try {
+ var_dump(intlcal_field_difference($c, 0, 1, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(intlcal_field_difference(1, 0, 1));
--EXPECTF--
-Warning: IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: bad arguments in %s on line %d
-bool(false)
+IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given
Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in %s on line %d
bool(false)
+intlcal_field_difference() expects exactly 3 parameters, 4 given
-Warning: IntlCalendar::fieldDifference() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_field_difference() expects exactly 3 parameters, 4 given in %s on line %d
-
-Warning: intlcal_field_difference(): intlcal_field_difference: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_field_difference() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_field_difference() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_field_difference(1, 0, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_fromDateTime_error.phpt b/ext/intl/tests/calendar_fromDateTime_error.phpt
index 1074159687..6fbaeb57f8 100644
--- a/ext/intl/tests/calendar_fromDateTime_error.phpt
+++ b/ext/intl/tests/calendar_fromDateTime_error.phpt
@@ -10,13 +10,10 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Lisbon');
-var_dump(IntlCalendar::fromDateTime());
-var_dump(IntlCalendar::fromDateTime(0,1,2));
-
try {
-IntlCalendar::fromDateTime("foobar");
+ IntlCalendar::fromDateTime("foobar");
} catch (Exception $e) {
- echo "threw exception, OK";
+ echo "threw exception, OK";
}
class A extends DateTime {
function __construct() {}
@@ -29,18 +26,7 @@ var_dump(IntlCalendar::fromDateTime($date));
$date = new DateTime('2012-01-01 00:00:00 WEST');
var_dump(IntlCalendar::fromDateTime($date));
-
-var_dump(intlcal_from_date_time());
--EXPECTF--
-Warning: IntlCalendar::fromDateTime() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d
-NULL
-
-Warning: IntlCalendar::fromDateTime() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d
-NULL
threw exception, OK
Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d
NULL
@@ -50,8 +36,3 @@ NULL
Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d
NULL
-
-Warning: intlcal_from_date_time() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: intlcal_from_date_time(): intlcal_from_date_time: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/calendar_getAvailableLocales_error.phpt b/ext/intl/tests/calendar_getAvailableLocales_error.phpt
deleted file mode 100644
index 3aee500fea..0000000000
--- a/ext/intl/tests/calendar_getAvailableLocales_error.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IntlCalendar::getAvailableLocales(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(intlcal_get_available_locales(1));
-var_dump(IntlCalendar::getAvailableLocales(2));
---EXPECTF--
-Warning: intlcal_get_available_locales() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_available_locales(): intlcal_get_available_locales: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getAvailableLocales() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getAvailableLocales(): intlcal_get_available_locales: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
index 46fe17d9cd..c138be8196 100644
--- a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
+++ b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
@@ -12,32 +12,14 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->getDayOfWeekType(1, 2));
var_dump($c->getDayOfWeekType(0));
-var_dump($c->getDayOfWeekType());
-var_dump(intlcal_get_day_of_week_type($c, "foo"));
var_dump(intlcal_get_day_of_week_type(1, 1));
--EXPECTF--
-Warning: IntlCalendar::getDayOfWeekType() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: invalid day of week in %s on line %d
bool(false)
-Warning: IntlCalendar::getDayOfWeekType() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_day_of_week_type() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: intlcal_get_day_of_week_type(): intlcal_get_day_of_week_type: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_day_of_week_type() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_day_of_week_type() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_day_of_week_type(1, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getErrorCode_error.phpt b/ext/intl/tests/calendar_getErrorCode_error.phpt
index fd999fbbbf..9dafc0ed94 100644
--- a/ext/intl/tests/calendar_getErrorCode_error.phpt
+++ b/ext/intl/tests/calendar_getErrorCode_error.phpt
@@ -10,18 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getErrorCode(array()));
-
var_dump(intlcal_get_error_code(null));
--EXPECTF--
-Warning: IntlCalendar::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getErrorCode(): intlcal_get_error_code: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_error_code() must be an instance of IntlCalendar, null given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_error_code() expects parameter 1 to be IntlCalendar, null given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_error_code(NULL)
#1 {main}
diff --git a/ext/intl/tests/calendar_getErrorMessage_error.phpt b/ext/intl/tests/calendar_getErrorMessage_error.phpt
index cc52449d94..abdfef45b6 100644
--- a/ext/intl/tests/calendar_getErrorMessage_error.phpt
+++ b/ext/intl/tests/calendar_getErrorMessage_error.phpt
@@ -10,18 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getErrorMessage(array()));
-
var_dump(intlcal_get_error_message(null));
--EXPECTF--
-Warning: IntlCalendar::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getErrorMessage(): intlcal_get_error_message: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_error_message() must be an instance of IntlCalendar, null given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_error_message() expects parameter 1 to be IntlCalendar, null given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_error_message(NULL)
#1 {main}
diff --git a/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt b/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt
index ca2dc4a9f2..f91e81dd69 100644
--- a/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt
+++ b/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getFirstDayOfWeek(1));
-
-var_dump(intlcal_get_first_day_of_week($c, 1));
var_dump(intlcal_get_first_day_of_week(1));
--EXPECTF--
-Warning: IntlCalendar::getFirstDayOfWeek() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getFirstDayOfWeek(): intlcal_get_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_first_day_of_week() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_first_day_of_week(): intlcal_get_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_first_day_of_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_first_day_of_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_first_day_of_week(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt b/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
deleted file mode 100644
index 717c435be7..0000000000
--- a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IntlCalendar::getKeywordValuesForLocale(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(intlcal_get_keyword_values_for_locale(1, 2));
-var_dump(IntlCalendar::getKeywordValuesForLocale(1, 2, array()));
---EXPECTF--
-Warning: intlcal_get_keyword_values_for_locale() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: intlcal_get_keyword_values_for_locale(): intlcal_get_keyword_values_for_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getKeywordValuesForLocale() expects parameter 3 to be bool, array given in %s on line %d
-
-Warning: IntlCalendar::getKeywordValuesForLocale(): intlcal_get_keyword_values_for_locale: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_getLocale_error.phpt b/ext/intl/tests/calendar_getLocale_error.phpt
index 008e1b756e..90102a53f6 100644
--- a/ext/intl/tests/calendar_getLocale_error.phpt
+++ b/ext/intl/tests/calendar_getLocale_error.phpt
@@ -10,34 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getLocale());
-var_dump($c->getLocale(2));
-var_dump($c->getLocale(2, 3));
-
-var_dump(intlcal_get_locale($c));
var_dump(intlcal_get_locale(1));
--EXPECTF--
-Warning: IntlCalendar::getLocale() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getLocale(): intlcal_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getLocale(): intlcal_get_locale: invalid locale type in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getLocale() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getLocale(): intlcal_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_locale() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_locale(): intlcal_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_locale() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught ArgumentCountError: intlcal_get_locale() expects exactly 2 parameters, 1 given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_locale(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt
index a1190e5ce0..64e7530d9c 100644
--- a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt
+++ b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getMinimalDaysInFirstWeek(1));
-
-var_dump(intlcal_get_minimal_days_in_first_week($c, 1));
var_dump(intlcal_get_minimal_days_in_first_week(1));
--EXPECTF--
-Warning: IntlCalendar::getMinimalDaysInFirstWeek() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getMinimalDaysInFirstWeek(): intlcal_get_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_minimal_days_in_first_week() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_minimal_days_in_first_week(): intlcal_get_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_minimal_days_in_first_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_minimal_days_in_first_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_minimal_days_in_first_week(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getNow_error.phpt b/ext/intl/tests/calendar_getNow_error.phpt
deleted file mode 100644
index 712e210851..0000000000
--- a/ext/intl/tests/calendar_getNow_error.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IntlCalendar::getNow(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(intlcal_get_now(1));
-var_dump(IntlCalendar::getNow(2));
---EXPECTF--
-Warning: intlcal_get_now() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_now(): intlcal_get_now: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getNow() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getNow(): intlcal_get_now: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt b/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt
index 06aa679c5a..1e2b3f85db 100644
--- a/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt
+++ b/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt
@@ -10,37 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getSkippedWallTimeOption(1));
-var_dump($c->getRepeatedWallTimeOption(1));
-
-var_dump(intlcal_get_skipped_wall_time_option($c, 1));
-var_dump(intlcal_get_repeated_wall_time_option($c, 1));
-
var_dump(intlcal_get_skipped_wall_time_option(1));
--EXPECTF--
-Warning: IntlCalendar::getSkippedWallTimeOption() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getSkippedWallTimeOption(): intlcal_get_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getRepeatedWallTimeOption() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getRepeatedWallTimeOption(): intlcal_get_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_skipped_wall_time_option() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_skipped_wall_time_option(): intlcal_get_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_repeated_wall_time_option() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_repeated_wall_time_option(): intlcal_get_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_skipped_wall_time_option() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_skipped_wall_time_option() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_skipped_wall_time_option(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getTimeZone_error.phpt b/ext/intl/tests/calendar_getTimeZone_error.phpt
index ea7e85db4c..683d1e66ee 100644
--- a/ext/intl/tests/calendar_getTimeZone_error.phpt
+++ b/ext/intl/tests/calendar_getTimeZone_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getTimeZone(1));
-
-var_dump(intlcal_get_time_zone($c, 1));
var_dump(intlcal_get_time_zone(1));
--EXPECTF--
-Warning: IntlCalendar::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getTimeZone(): intlcal_get_time_zone: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_time_zone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_time_zone(): intlcal_get_time_zone: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_time_zone() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_time_zone() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_time_zone(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getTime_error.phpt b/ext/intl/tests/calendar_getTime_error.phpt
index 61eaea97dc..ca0924ee97 100644
--- a/ext/intl/tests/calendar_getTime_error.phpt
+++ b/ext/intl/tests/calendar_getTime_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getTime(1));
-
-var_dump(intlcal_get_time($c, 1));
var_dump(intlcal_get_time(1));
--EXPECTF--
-Warning: IntlCalendar::getTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getTime(): intlcal_get_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_time() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_time(): intlcal_get_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_time() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_time(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getType_error.phpt b/ext/intl/tests/calendar_getType_error.phpt
index c124151893..1c0e92b07f 100644
--- a/ext/intl/tests/calendar_getType_error.phpt
+++ b/ext/intl/tests/calendar_getType_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getType(1));
-
-var_dump(intlcal_get_type($c, 1));
var_dump(intlcal_get_type(1));
--EXPECTF--
-Warning: IntlCalendar::getType() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getType(): intlcal_get_type: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_type() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_type(): intlcal_get_type: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_type() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_type() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_type(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getWeekendTransition_error.phpt b/ext/intl/tests/calendar_getWeekendTransition_error.phpt
index d61c9d5a25..12bfbaa5fb 100644
--- a/ext/intl/tests/calendar_getWeekendTransition_error.phpt
+++ b/ext/intl/tests/calendar_getWeekendTransition_error.phpt
@@ -11,33 +11,14 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getWeekendTransition());
-var_dump($c->getWeekendTransition(1, 2));
var_dump($c->getWeekendTransition(0));
-var_dump(intlcal_get_weekend_transition($c));
var_dump(intlcal_get_weekend_transition(1, 1));
--EXPECTF--
-Warning: IntlCalendar::getWeekendTransition() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getWeekendTransition() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: invalid day of week in %s on line %d
bool(false)
-Warning: intlcal_get_weekend_transition() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_weekend_transition(): intlcal_get_weekend_transition: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_weekend_transition() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_weekend_transition() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_weekend_transition(1, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt
index 6c6f67f953..828f6a71d0 100644
--- a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt
+++ b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt
@@ -12,11 +12,6 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->getLeastMaximum());
-var_dump($c->getMaximum());
-var_dump($c->getGreatestMinimum());
-var_dump($c->getMinimum());
-
var_dump($c->getLeastMaximum(-1));
var_dump($c->getMaximum(-1));
var_dump($c->getGreatestMinimum(-1));
@@ -53,26 +48,6 @@ try {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECTF--
-Warning: IntlCalendar::getLeastMaximum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getMaximum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getMaximum(): intlcal_get_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getGreatestMinimum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getGreatestMinimum(): intlcal_get_greatest_minimum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getMinimum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getMinimum(): intlcal_get_minimum: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: invalid field in %s on line %d
bool(false)
@@ -96,10 +71,10 @@ bool(false)
Warning: intlcal_get_minimum(): intlcal_get_minimum: invalid field in %s on line %d
bool(false)
-error: 0, Argument 1 passed to intlcal_get_least_maximum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_least_maximum() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_get_maximum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_maximum() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_get_greatest_minimum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_greatest_minimum() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_get_minimum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_minimum() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt
index d7d20ed6cd..3853d612a3 100644
--- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt
+++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt
@@ -12,37 +12,12 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->get());
-var_dump($c->getActualMaximum());
-var_dump($c->getActualMinimum());
-
var_dump($c->get(-1));
var_dump($c->getActualMaximum(-1));
var_dump($c->getActualMinimum(-1));
-var_dump($c->get("s"));
-var_dump($c->getActualMaximum("s"));
-var_dump($c->getActualMinimum("s"));
-
-var_dump($c->get(1, 2));
-var_dump($c->getActualMaximum(1, 2));
-var_dump($c->getActualMinimum(1, 2));
+?>
--EXPECTF--
-Warning: IntlCalendar::get() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMaximum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMinimum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::get(): intlcal_get: invalid field in %s on line %d
bool(false)
@@ -51,33 +26,3 @@ bool(false)
Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: invalid field in %s on line %d
bool(false)
-
-Warning: IntlCalendar::get() expects parameter 1 to be int, string given in %s on line %d
-
-Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMaximum() expects parameter 1 to be int, string given in %s on line %d
-
-Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMinimum() expects parameter 1 to be int, string given in %s on line %d
-
-Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::get() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMaximum() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMinimum() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt
index 37e3816fef..22a4b859ab 100644
--- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt
+++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt
@@ -81,32 +81,26 @@ try {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, intlcal_get() expects exactly 2 parameters, 1 given
-error: 2, intlcal_get(): intlcal_get: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given
-error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given
-error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: bad arguments
-bool(false)
+error: 0, intlcal_get() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given
+
error: 2, intlcal_get(): intlcal_get: invalid field
bool(false)
error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: invalid field
bool(false)
error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: invalid field
bool(false)
-error: 2, intlcal_get() expects parameter 2 to be int, string given
-error: 2, intlcal_get(): intlcal_get: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_maximum() expects parameter 2 to be int, string given
-error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_minimum() expects parameter 2 to be int, string given
-error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: bad arguments
-bool(false)
-error: 0, Argument 1 passed to intlcal_get() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get() expects parameter 2 to be int, string given
+
+error: 0, intlcal_get_actual_maximum() expects parameter 2 to be int, string given
+
+error: 0, intlcal_get_actual_minimum() expects parameter 2 to be int, string given
+
+error: 0, intlcal_get() expects exactly 2 parameters, 1 given
-error: 0, Argument 1 passed to intlcal_get_actual_maximum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given
-error: 0, Argument 1 passed to intlcal_get_actual_minimum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given
diff --git a/ext/intl/tests/calendar_inDaylightTime_error.phpt b/ext/intl/tests/calendar_inDaylightTime_error.phpt
index 6644f477ea..4eab7b2fe4 100644
--- a/ext/intl/tests/calendar_inDaylightTime_error.phpt
+++ b/ext/intl/tests/calendar_inDaylightTime_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->inDaylightTime(1));
-
-var_dump(intlcal_in_daylight_time($c, 1));
var_dump(intlcal_in_daylight_time(1));
--EXPECTF--
-Warning: IntlCalendar::inDaylightTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::inDaylightTime(): intlcal_in_daylight_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_in_daylight_time() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_in_daylight_time(): intlcal_in_daylight_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_in_daylight_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_in_daylight_time() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_in_daylight_time(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_isEquivalentTo_error.phpt b/ext/intl/tests/calendar_isEquivalentTo_error.phpt
index c7e30fd645..9faecdd7e1 100644
--- a/ext/intl/tests/calendar_isEquivalentTo_error.phpt
+++ b/ext/intl/tests/calendar_isEquivalentTo_error.phpt
@@ -49,16 +49,14 @@ try {
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 0, Argument 1 passed to IntlCalendar::isEquivalentTo() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::isEquivalentTo() expects parameter 1 to be IntlCalendar, int given
-error: 2, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::isEquivalentTo(): intlcal_is_equivalent_to: bad arguments
-bool(false)
-error: 0, Argument 1 passed to IntlCalendar::isEquivalentTo() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given
-error: 2, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given
-error: 2, intlcal_is_equivalent_to(): intlcal_is_equivalent_to: bad arguments
-bool(false)
-error: 0, Argument 2 passed to intlcal_is_equivalent_to() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::isEquivalentTo() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_is_equivalent_to() must be an instance of IntlCalendar, int given
+error: 0, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_is_equivalent_to() expects parameter 2 to be IntlCalendar, int given
+
+error: 0, intlcal_is_equivalent_to() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_isLenient_error.phpt b/ext/intl/tests/calendar_isLenient_error.phpt
index 263d82bb37..4edbf70e55 100644
--- a/ext/intl/tests/calendar_isLenient_error.phpt
+++ b/ext/intl/tests/calendar_isLenient_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->isLenient(1));
-
-var_dump(intlcal_is_lenient($c, 1));
var_dump(intlcal_is_lenient(1));
--EXPECTF--
-Warning: IntlCalendar::isLenient() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::isLenient(): intlcal_is_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_is_lenient() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_is_lenient(): intlcal_is_lenient: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_lenient() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_is_lenient() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_lenient(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_isSet_error.phpt b/ext/intl/tests/calendar_isSet_error.phpt
index 7e5b2beaa6..169fb2dd43 100644
--- a/ext/intl/tests/calendar_isSet_error.phpt
+++ b/ext/intl/tests/calendar_isSet_error.phpt
@@ -12,32 +12,14 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->isSet());
-var_dump($c->isSet(1, 2));
var_dump($c->isSet(-1));
-var_dump(intlcal_is_set($c));
var_dump(intlcal_is_set(1, 2));
--EXPECTF--
-Warning: IntlCalendar::isSet() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::isSet(): intlcal_is_set: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::isSet() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::isSet(): intlcal_is_set: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::isSet(): intlcal_is_set: invalid field in %s on line %d
bool(false)
-Warning: intlcal_is_set() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_is_set(): intlcal_is_set: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_set() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_is_set() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_set(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_isWeekend_error.phpt b/ext/intl/tests/calendar_isWeekend_error.phpt
index c1f8180fa3..0ed3e507b0 100644
--- a/ext/intl/tests/calendar_isWeekend_error.phpt
+++ b/ext/intl/tests/calendar_isWeekend_error.phpt
@@ -10,30 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->isWeekend(1, 2));
-var_dump($c->isWeekend("jhhk"));
-
-var_dump(intlcal_is_weekend($c, "jj"));
var_dump(intlcal_is_weekend(1));
--EXPECTF--
-Warning: IntlCalendar::isWeekend() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::isWeekend(): intlcal_is_weekend: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::isWeekend() expects parameter 1 to be float, string given in %s on line %d
-
-Warning: IntlCalendar::isWeekend(): intlcal_is_weekend: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_is_weekend() expects parameter 2 to be float, string given in %s on line %d
-
-Warning: intlcal_is_weekend(): intlcal_is_weekend: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_weekend() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_is_weekend() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_weekend(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_roll_error.phpt b/ext/intl/tests/calendar_roll_error.phpt
index 27160ee8ca..b627e83617 100644
--- a/ext/intl/tests/calendar_roll_error.phpt
+++ b/ext/intl/tests/calendar_roll_error.phpt
@@ -12,28 +12,14 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->roll(1, 2, 3));
var_dump($c->roll(-1, 2));
-var_dump($c->roll(1));
-var_dump(intlcal_roll($c, 1, 2, 3));
var_dump(intlcal_roll(1, 2, 3));
--EXPECTF--
-Warning: IntlCalendar::roll(): intlcal_set: too many arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::roll(): intlcal_roll: invalid field in %s on line %d
bool(false)
-Warning: IntlCalendar::roll() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::roll(): intlcal_roll: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_roll(): intlcal_set: too many arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_roll() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_roll() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_roll(1, 2, 3)
#1 {main}
diff --git a/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt b/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt
index a22c3b2842..bb4e01ca00 100644
--- a/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt
+++ b/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt
@@ -12,30 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->setFirstDayOfWeek());
-var_dump($c->setFirstDayOfWeek(1, 2));
var_dump($c->setFirstDayOfWeek(0));
var_dump(intlcal_set_first_day_of_week($c, 0));
var_dump(intlcal_set_first_day_of_week(1, 2));
--EXPECTF--
-Warning: IntlCalendar::setFirstDayOfWeek() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setFirstDayOfWeek() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: invalid day of week in %s on line %d
bool(false)
Warning: intlcal_set_first_day_of_week(): intlcal_set_first_day_of_week: invalid day of week in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_first_day_of_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_first_day_of_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_first_day_of_week(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_setLenient_error.phpt b/ext/intl/tests/calendar_setLenient_error.phpt
index b2a6f25d5d..896b2e430a 100644
--- a/ext/intl/tests/calendar_setLenient_error.phpt
+++ b/ext/intl/tests/calendar_setLenient_error.phpt
@@ -10,36 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->setLenient());
-var_dump($c->setLenient(array()));
-var_dump($c->setLenient(1, 2));
-
-var_dump(intlcal_set_lenient($c, array()));
var_dump(intlcal_set_lenient(1, false));
--EXPECTF--
-Warning: IntlCalendar::setLenient() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setLenient() expects parameter 1 to be bool, array given in %s on line %d
-
-Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setLenient() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_set_lenient() expects parameter 2 to be bool, array given in %s on line %d
-
-Warning: intlcal_set_lenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_lenient() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_lenient() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_lenient(1, false)
#1 {main}
diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt
index 48d18bf28d..9bf3cb17dc 100644
--- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt
+++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt
@@ -12,30 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->setMinimalDaysInFirstWeek());
-var_dump($c->setMinimalDaysInFirstWeek(1, 2));
var_dump($c->setMinimalDaysInFirstWeek(0));
var_dump(intlcal_set_minimal_days_in_first_week($c, 0));
var_dump(intlcal_set_minimal_days_in_first_week(1, 2));
--EXPECTF--
-Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d
bool(false)
Warning: intlcal_set_minimal_days_in_first_week(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_minimal_days_in_first_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_minimal_days_in_first_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_minimal_days_in_first_week(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt b/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt
index 776cb8b825..079517b290 100644
--- a/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt
+++ b/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt
@@ -12,70 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->setSkippedWallTimeOption());
-var_dump($c->setRepeatedWallTimeOption());
-
-var_dump($c->setSkippedWallTimeOption(1, 2));
-var_dump($c->setRepeatedWallTimeOption(1, 2));
-
-var_dump($c->setSkippedWallTimeOption(array()));
-var_dump($c->setRepeatedWallTimeOption(array()));
-
var_dump($c->setSkippedWallTimeOption(3));
var_dump($c->setRepeatedWallTimeOption(2));
-var_dump(intlcal_set_skipped_wall_time_option($c));
-var_dump(intlcal_set_repeated_wall_time_option($c));
-
var_dump(intlcal_set_repeated_wall_time_option(1, 1));
--EXPECTF--
-Warning: IntlCalendar::setSkippedWallTimeOption() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setRepeatedWallTimeOption() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setSkippedWallTimeOption() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setRepeatedWallTimeOption() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setSkippedWallTimeOption() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setRepeatedWallTimeOption() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: invalid option in %s on line %d
bool(false)
Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: invalid option in %s on line %d
bool(false)
-Warning: intlcal_set_skipped_wall_time_option() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_set_skipped_wall_time_option(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_set_repeated_wall_time_option() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_set_repeated_wall_time_option(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_repeated_wall_time_option() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_repeated_wall_time_option() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_repeated_wall_time_option(1, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_setTimeZone_error.phpt b/ext/intl/tests/calendar_setTimeZone_error.phpt
index dee773d377..3f5e479e79 100644
--- a/ext/intl/tests/calendar_setTimeZone_error.phpt
+++ b/ext/intl/tests/calendar_setTimeZone_error.phpt
@@ -41,13 +41,10 @@ try{
echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments
-bool(false)
-error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments
-bool(false)
-error: 2, intlcal_set_time_zone() expects exactly 2 parameters, 3 given
-error: 2, intlcal_set_time_zone(): intlcal_set_time_zone: bad arguments
-bool(false)
-error: 0, Argument 1 passed to intlcal_set_time_zone() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given
+
+error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given
+
+error: 0, intlcal_set_time_zone() expects exactly 2 parameters, 3 given
+
+error: 0, intlcal_set_time_zone() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_setTime_error.phpt b/ext/intl/tests/calendar_setTime_error.phpt
index d3fa46c591..0fb906bc2f 100644
--- a/ext/intl/tests/calendar_setTime_error.phpt
+++ b/ext/intl/tests/calendar_setTime_error.phpt
@@ -10,30 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->setTime(1, 2));
-var_dump($c->setTime("jjj"));
-
-var_dump(intlcal_set_time($c, 1, 2));
var_dump(intlcal_set_time(1));
--EXPECTF--
-Warning: IntlCalendar::setTime() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setTime(): intlcal_set_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setTime() expects parameter 1 to be float, string given in %s on line %d
-
-Warning: IntlCalendar::setTime(): intlcal_set_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_set_time() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: intlcal_set_time(): intlcal_set_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught ArgumentCountError: intlcal_set_time() expects exactly 2 parameters, 1 given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_time(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_set_error.phpt b/ext/intl/tests/calendar_set_error.phpt
index 5827ad41ec..8f48c0f975 100644
--- a/ext/intl/tests/calendar_set_error.phpt
+++ b/ext/intl/tests/calendar_set_error.phpt
@@ -12,22 +12,12 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->set(1));
-var_dump($c->set(1, 2, 3, 4));
var_dump($c->set(1, 2, 3, 4, 5, 6, 7));
var_dump($c->set(-1, 2));
var_dump(intlcal_set($c, -1, 2));
var_dump(intlcal_set(1, 2, 3));
--EXPECTF--
-Warning: IntlCalendar::set() expects at least 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::set(): intlcal_set: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::set(): intlcal_set: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::set(): intlcal_set: too many arguments in %s on line %d
bool(false)
@@ -37,7 +27,7 @@ bool(false)
Warning: intlcal_set(): intlcal_set: invalid field in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set(1, 2, 3)
#1 {main}
diff --git a/ext/intl/tests/calendar_toDateTime_error.phpt b/ext/intl/tests/calendar_toDateTime_error.phpt
index 584bd28f65..ef799db610 100644
--- a/ext/intl/tests/calendar_toDateTime_error.phpt
+++ b/ext/intl/tests/calendar_toDateTime_error.phpt
@@ -9,11 +9,6 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
ini_set('date.timezone', 'Europe/Lisbon');
-$cal = new IntlGregorianCalendar();
-var_dump($cal->toDateTime(3));
-
-var_dump(intlcal_to_date_time($cal, 3));
-
$cal = new IntlGregorianCalendar("Etc/Unknown");
try {
var_dump($cal->toDateTime());
@@ -23,20 +18,10 @@ var_dump("exception: {$e->getMessage()}");
var_dump(intlcal_to_date_time(3));
--EXPECTF--
-Warning: IntlCalendar::toDateTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_to_date_time() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_to_date_time(): intlcal_to_date_time: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d
string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_to_date_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_to_date_time() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_to_date_time(3)
#1 {main}
diff --git a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt
deleted file mode 100644
index 505a076ca3..0000000000
--- a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-IntlBreakIterator::getLastCodePoint(): bad args
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$it = IntlBreakIterator::createCodePointInstance();
-var_dump($it->getLastCodePoint(array()));
---EXPECTF--
-Warning: IntlCodePointBreakIterator::getLastCodePoint() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCodePointBreakIterator::getLastCodePoint(): cpbi_get_last_code_point: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt
index bfcc951b73..7c1140c09d 100644
--- a/ext/intl/tests/dateformat_formatObject_error.phpt
+++ b/ext/intl/tests/dateformat_formatObject_error.phpt
@@ -10,14 +10,16 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", "Europe/Lisbon");
-var_dump(IntlDateFormatter::formatObject());
-var_dump(IntlDateFormatter::formatObject(1));
var_dump(IntlDateFormatter::formatObject(new stdclass));
class A extends IntlCalendar {function __construct(){}}
var_dump(IntlDateFormatter::formatObject(new A));
class B extends DateTime {function __construct(){}}
-var_dump(IntlDateFormatter::formatObject(new B));
+try {
+ var_dump(IntlDateFormatter::formatObject(new B));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$cal = IntlCalendar::createInstance();
var_dump(IntlDateFormatter::formatObject($cal, -2));
@@ -26,27 +28,18 @@ var_dump(IntlDateFormatter::formatObject($cal, array(1,2,3)));
var_dump(IntlDateFormatter::formatObject($cal, array(array(), 1)));
var_dump(IntlDateFormatter::formatObject($cal, array(1, -2)));
var_dump(IntlDateFormatter::formatObject($cal, ""));
-var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
?>
==DONE==
--EXPECTF--
-Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: IntlDateFormatter::formatObject() expects parameter 1 to be object, int given in %s on line %d
-bool(false)
-
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d
bool(false)
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad IntlCalendar instance: not initialized properly in %s on line %d
bool(false)
-Warning: DateTime::getTimestamp(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
-
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: error calling ::getTimeStamp() on the object in %s on line %d
-bool(false)
+The DateTime object has not been correctly initialized by its constructor
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the date/time format type is invalid in %s on line %d
bool(false)
@@ -65,7 +58,4 @@ bool(false)
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the format is empty in %s on line %d
bool(false)
-
-Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
-bool(false)
==DONE==
diff --git a/ext/intl/tests/dateformat_getCalendarObject_error.phpt b/ext/intl/tests/dateformat_getCalendarObject_error.phpt
deleted file mode 100644
index d5a7833ded..0000000000
--- a/ext/intl/tests/dateformat_getCalendarObject_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-IntlDateFormatter::getCalendarObject(): bad args
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", 'Atlantic/Azores');
-
-$df = new IntlDateFormatter(NULL, 0, 0);
-
-var_dump($df->getCalendarObject(9));
-var_dump(datefmt_get_calendar_object($df, 9));
-var_dump(datefmt_get_calendar_object($df, 9));
-var_dump(datefmt_get_calendar_object(new stdclass));
-
-?>
-==DONE==
---EXPECTF--
-Warning: IntlDateFormatter::getCalendarObject() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlDateFormatter::getCalendarObject(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_calendar_object() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d
-
-Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-==DONE==
diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt b/ext/intl/tests/dateformat_getTimeZone_error.phpt
deleted file mode 100644
index d2ab92d86a..0000000000
--- a/ext/intl/tests/dateformat_getTimeZone_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-IntlDateFormatter::getTimeZone(): bad args
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", 'Atlantic/Azores');
-
-$df = new IntlDateFormatter(NULL, 0, 0);
-
-var_dump($df->getTimeZone(9));
-var_dump(datefmt_get_timezone($df, 9));
-var_dump(datefmt_get_timezone($df, 9));
-var_dump(datefmt_get_timezone(new stdclass));
-
-?>
-==DONE==
---EXPECTF--
-Warning: IntlDateFormatter::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlDateFormatter::getTimeZone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d
-
-Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-==DONE==
diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt b/ext/intl/tests/dateformat_setTimeZone_error.phpt
index b58d159088..a3aabf1427 100644
--- a/ext/intl/tests/dateformat_setTimeZone_error.phpt
+++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt
@@ -12,41 +12,17 @@ ini_set("date.timezone", 'Atlantic/Azores');
$df = new IntlDateFormatter(NULL, 0, 0);
-var_dump($df->setTimeZone());
-var_dump(datefmt_set_timezone());
var_dump($df->setTimeZone(array()));
-var_dump($df->setTimeZone(1, 2));
var_dump($df->setTimeZone('non existing timezone'));
-var_dump(datefmt_set_timezone(new stdclass, 'UTC'));
?>
==DONE==
--EXPECTF--
-Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_set_timezone() expects exactly 2 parameters, 0 given in %s on line %d
-
-Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'Array' in %s on line %d
bool(false)
-Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d
-bool(false)
-
Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'non existing timezone' in %s on line %d
bool(false)
-
-Warning: datefmt_set_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d
-
-Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d
-bool(false)
==DONE==
diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt
index 3d22f7d03d..57658610d5 100644
--- a/ext/intl/tests/dateformat_set_timezone_id2.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt
@@ -9,7 +9,6 @@ date.timezone=Atlantic/Azores
<?php
ini_set("intl.error_level", E_WARNING);
-ini_set("error_reporting", ~E_DEPRECATED);
/*
* Test for the datefmt_set_timezone_id function
diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt
index e25b9bfd7e..8c6a0c341c 100644
--- a/ext/intl/tests/dateformat_set_timezone_id3.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt
@@ -9,7 +9,6 @@ date.timezone=Atlantic/Azores
<?php
ini_set("intl.error_level", E_WARNING);
-ini_set("error_reporting", ~E_DEPRECATED);
/*
* Test for the datefmt_set_timezone_id function
diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt
index 9cfc6f5054..0a8d7f398b 100644
--- a/ext/intl/tests/formatter_fail.phpt
+++ b/ext/intl/tests/formatter_fail.phpt
@@ -27,10 +27,20 @@ function crt($t, $l, $s) {
}
break;
case $t == "C":
- return NumberFormatter::create($l, $s);
+ try {
+ return NumberFormatter::create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
break;
case $t == "P":
- return numfmt_create($l, $s);
+ try {
+ return numfmt_create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
break;
}
}
@@ -50,9 +60,19 @@ try {
$fmt = null;
}
err($fmt);
-$fmt = numfmt_create();
+try {
+ $fmt = numfmt_create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
-$fmt = NumberFormatter::create();
+try {
+ $fmt = NumberFormatter::create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
foreach($args as $arg) {
@@ -67,34 +87,34 @@ foreach($args as $arg) {
?>
--EXPECTF--
ArgumentCountError: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
-Warning: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %sformatter_fail.php on line %d
+IntlException: Constructor failed in %s on line %d
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
TypeError: NumberFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-Warning: numfmt_create() expects parameter 1 to be string, array given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: numfmt_create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %sformatter_fail.php on line %d
+IntlException: Constructor failed in %s on line %d
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
-IntlException: Constructor failed in %sformatter_fail.php on line %d
+IntlException: Constructor failed in %s on line %d
'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
diff --git a/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt b/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt
index a1cfb593d7..37a0315c45 100644
--- a/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt
+++ b/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt
@@ -10,23 +10,11 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->getGregorianChange(1));
-
-var_dump(intlgregcal_get_gregorian_change($c, 1));
var_dump(intlgregcal_get_gregorian_change(1));
---EXPECTF--
-Warning: IntlGregorianCalendar::getGregorianChange() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlGregorianCalendar::getGregorianChange(): intlgregcal_get_gregorian_change: bad arguments in %s on line %d
-bool(false)
-Warning: intlgregcal_get_gregorian_change() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlgregcal_get_gregorian_change(): intlgregcal_get_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_get_gregorian_change() must be an instance of IntlGregorianCalendar, int given in %s:%d
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: intlgregcal_get_gregorian_change() expects parameter 1 to be IntlGregorianCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlgregcal_get_gregorian_change(1)
#1 {main}
diff --git a/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt b/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt
index 9da5aaf418..9b7c3e0be8 100644
--- a/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt
+++ b/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt
@@ -10,41 +10,11 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->isLeapYear(2000, 2011));
-var_dump($c->isLeapYear());
-var_dump($c->isLeapYear("fgdf"));
-
-var_dump(intlgregcal_is_leap_year($c, 1, 2));
-var_dump(intlgregcal_is_leap_year($c));
var_dump(intlgregcal_is_leap_year(1, 2));
---EXPECTF--
-Warning: IntlGregorianCalendar::isLeapYear() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::isLeapYear() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::isLeapYear() expects parameter 1 to be int, string given in %s on line %d
-Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlgregcal_is_leap_year() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: intlgregcal_is_leap_year(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlgregcal_is_leap_year() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlgregcal_is_leap_year(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_is_leap_year() must be an instance of IntlGregorianCalendar, int given in %s:%d
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: intlgregcal_is_leap_year() expects parameter 1 to be IntlGregorianCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlgregcal_is_leap_year(1, 2)
#1 {main}
diff --git a/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt b/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt
deleted file mode 100644
index 0dd27802b5..0000000000
--- a/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-IntlGregorianCalendar::setGregorianChange(): bad arguments
---INI--
-date.timezone=Atlantic/Azores
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$c = new IntlGregorianCalendar();
-var_dump($c->setGregorianChange());
-var_dump($c->setGregorianChange(1, 2));
-var_dump($c->setGregorianChange("sdfds"));
-
-var_dump(intlgregcal_set_gregorian_change($c));
-var_dump(intlgregcal_set_gregorian_change(1, 4.));
---EXPECTF--
-Warning: IntlGregorianCalendar::setGregorianChange() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::setGregorianChange() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::setGregorianChange() expects parameter 1 to be float, string given in %s on line %d
-
-Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlgregcal_set_gregorian_change() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlgregcal_set_gregorian_change(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_set_gregorian_change() must be an instance of IntlGregorianCalendar, int given in %s:%d
-Stack trace:
-#0 %s(%d): intlgregcal_set_gregorian_change(1, 4)
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt
index 6a99bde649..e468e8caf8 100644
--- a/ext/intl/tests/idn_uts46_errors.phpt
+++ b/ext/intl/tests/idn_uts46_errors.phpt
@@ -11,19 +11,12 @@ IDN UTS #46 API error tests
ini_set("intl.error_level", E_WARNING);
echo "=> PHP level errors", "\n";
-echo "bad args:", "\n";
-var_dump(idn_to_ascii("", 0, array()));
-var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46, $foo, null));
-
echo "bad variant:", "\n";
var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46 + 10));
echo "empty domain:", "\n";
var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46));
-echo "fourth arg for 2003 variant (only notice raised):", "\n";
-var_dump(idn_to_ascii("foo.com", 0, INTL_IDNA_VARIANT_2003, $foo));
-
echo "with error, but no details arg:", "\n";
var_dump(idn_to_ascii("www.fußball.com-", 0, INTL_IDNA_VARIANT_UTS46));
@@ -39,33 +32,18 @@ var_dump(idn_to_ascii(
INTL_IDNA_VARIANT_UTS46, $foo));
var_dump($foo);
var_dump($foo["errors"]==IDNA_ERROR_CONTEXTJ);
+
+?>
--EXPECTF--
=> PHP level errors
-bad args:
-
-Warning: idn_to_ascii() expects parameter 3 to be int, array given in %s on line %d
-
-Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d
-NULL
-
-Warning: idn_to_ascii() expects at most 4 parameters, 5 given in %s on line %d
-
-Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d
-NULL
bad variant:
-Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be one of {INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46} in %s on line %d
+Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be INTL_IDNA_VARIANT_UTS46 in %s on line %d
bool(false)
empty domain:
Warning: idn_to_ascii(): idn_to_ascii: empty domain name in %s on line %d
bool(false)
-fourth arg for 2003 variant (only notice raised):
-
-Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d
-
-Notice: idn_to_ascii(): 4 arguments were provided, but INTL_IDNA_VARIANT_2003 only takes 3 - extra argument ignored in %s on line %d
-string(7) "foo.com"
with error, but no details arg:
bool(false)
with error, with details arg:
diff --git a/ext/intl/tests/intl_get_error_code.phpt b/ext/intl/tests/intl_get_error_code.phpt
index 6cd361ba71..797aee4fb7 100644
--- a/ext/intl/tests/intl_get_error_code.phpt
+++ b/ext/intl/tests/intl_get_error_code.phpt
@@ -11,7 +11,7 @@ intl_get_error_code()
// Suppress warning messages.
error_reporting( E_ERROR );
-if( collator_get_locale() !== false )
+if( collator_get_locale(new Collator('en_US'), -1) !== false )
echo "failed\n";
else
{
diff --git a/ext/intl/tests/intl_get_error_message.phpt b/ext/intl/tests/intl_get_error_message.phpt
index f81b5c03d5..e03fb80658 100644
--- a/ext/intl/tests/intl_get_error_message.phpt
+++ b/ext/intl/tests/intl_get_error_message.phpt
@@ -11,11 +11,11 @@ intl_get_error_message()
// Suppress warning messages.
error_reporting( E_ERROR );
-if( collator_get_locale() !== false )
+if( collator_get_locale(new Collator('en_US'), -1) !== false )
echo "failed\n";
else
printf( "%s\n", intl_get_error_message() );
?>
--EXPECT--
-collator_get_locale: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR
+Error getting locale by type: U_ILLEGAL_ARGUMENT_ERROR
diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt
index a2834d8ade..6a29cd6723 100644
--- a/ext/intl/tests/locale_accept.phpt
+++ b/ext/intl/tests/locale_accept.phpt
@@ -19,7 +19,6 @@ function ut_main()
'zh, en-us;q=0.8, en;q=0.7',
'xx, fr-FR;q=0.3, de-DE;q=0.5',
'none',
- array()
);
foreach($http_acc as $http) {
@@ -34,13 +33,9 @@ include_once( 'ut_common.inc' );
ut_run();
?>
---EXPECTF--
-Warning: Locale::acceptFromHttp() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: locale_accept_from_http() expects parameter 1 to be string, array given in %s on line %d
+--EXPECT--
Accepting en-us,en;q=0.5: en_US
Accepting da, en-gb;q=0.8, en;q=0.7: da
Accepting zh, en-us;q=0.8, en;q=0.7: zh
Accepting xx, fr-FR;q=0.3, de-DE;q=0.5: de_DE
Accepting none:
-Accepting Array:
diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt
index 0016de4bb7..688e65a861 100644
--- a/ext/intl/tests/msgfmt_fail2.phpt
+++ b/ext/intl/tests/msgfmt_fail2.phpt
@@ -27,10 +27,20 @@ function crt($t, $l, $s) {
}
break;
case $t == "C":
- return MessageFormatter::create($l, $s);
+ try {
+ return MessageFormatter::create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
break;
case $t == "P":
- return msgfmt_create($l, $s);
+ try {
+ return msgfmt_create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
break;
}
}
@@ -51,9 +61,19 @@ try {
$fmt = null;
}
err($fmt);
-$fmt = msgfmt_create();
+try {
+ $fmt = msgfmt_create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
-$fmt = MessageFormatter::create();
+try {
+ $fmt = MessageFormatter::create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
try {
$fmt = new MessageFormatter('en');
@@ -62,9 +82,19 @@ try {
$fmt = null;
}
err($fmt);
-$fmt = msgfmt_create('en');
+try {
+ $fmt = msgfmt_create('en');
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
-$fmt = MessageFormatter::create('en');
+try {
+ $fmt = MessageFormatter::create('en');
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
foreach($args as $arg) {
@@ -79,53 +109,53 @@ foreach($args as $arg) {
?>
--EXPECTF--
ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
-Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
+'U_ZERO_ERROR'
-Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
TypeError: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt
index 5f8c25ec2f..8f15ffb1d8 100644
--- a/ext/intl/tests/normalizer_normalize.phpt
+++ b/ext/intl/tests/normalizer_normalize.phpt
@@ -19,7 +19,6 @@ function ut_main()
Normalizer::FORM_D,
Normalizer::FORM_KC,
Normalizer::FORM_KD,
- Normalizer::NONE,
);
$forms_str = array (
@@ -27,15 +26,13 @@ function ut_main()
Normalizer::FORM_D => 'UNORM_FORM_D',
Normalizer::FORM_KC => 'UNORM_FORM_KC',
Normalizer::FORM_KD => 'UNORM_FORM_KD',
- Normalizer::NONE => 'UNORM_NONE',
);
/* just make sure all the form constants are defined as in the api spec */
if ( Normalizer::FORM_C != Normalizer::NFC ||
Normalizer::FORM_D != Normalizer::NFD ||
Normalizer::FORM_KC != Normalizer::NFKC ||
- Normalizer::FORM_KD != Normalizer::NFKD ||
- Normalizer::NONE == Normalizer::FORM_C ) {
+ Normalizer::FORM_KD != Normalizer::NFKD) {
$res_str .= "Invalid normalization form declarations!\n";
}
@@ -69,12 +66,7 @@ function ut_main()
{
foreach( $strs as $str )
{
- if (Normalizer::NONE == $form) {
- /* Hide deprecation warning. */
- $str_norm = @ut_norm_normalize( $str, $form );
- } else {
- $str_norm = ut_norm_normalize( $str, $form );
- }
+ $str_norm = ut_norm_normalize( $str, $form );
$error_code = intl_get_error_code();
$error_message = intl_get_error_message();
@@ -150,15 +142,3 @@ ut_run();
is in form 'UNORM_FORM_KD'? = no error info: 'U_ZERO_ERROR' (0)
'%E1%BA%9B' normalized to form 'UNORM_FORM_KD' is 's%CC%87' error info: 'U_ZERO_ERROR' (0)
is in form 'UNORM_FORM_KD'? = no error info: 'U_ZERO_ERROR' (0)
-'ABC' normalized to form 'UNORM_NONE' is 'ABC' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%C3%A4%7C%7C%C3%A5%7C%7C%C3%B6' normalized to form 'UNORM_NONE' is '%C3%A4%7C%7C%C3%A5%7C%7C%C3%B6' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%E2%84%AB%7C%7C%C3%85%7C%7CA%CC%8A' normalized to form 'UNORM_NONE' is '%E2%84%AB%7C%7C%C3%85%7C%7CA%CC%8A' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%E2%84%A6%7C%7C%CE%A9' normalized to form 'UNORM_NONE' is '%E2%84%A6%7C%7C%CE%A9' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%EF%AC%81' normalized to form 'UNORM_NONE' is '%EF%AC%81' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%E1%BA%9B' normalized to form 'UNORM_NONE' is '%E1%BA%9B' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
diff --git a/ext/intl/tests/normalizer_normalize_kc_cf.phpt b/ext/intl/tests/normalizer_normalize_kc_cf.phpt
index 246e41baa2..c7a46e617d 100644
--- a/ext/intl/tests/normalizer_normalize_kc_cf.phpt
+++ b/ext/intl/tests/normalizer_normalize_kc_cf.phpt
@@ -58,12 +58,7 @@ function ut_main()
{
foreach( $strs as $str )
{
- if (Normalizer::NONE == $form) {
- /* Hide deprecation warning. */
- $str_norm = @ut_norm_normalize( $str, $form );
- } else {
- $str_norm = ut_norm_normalize( $str, $form );
- }
+ $str_norm = ut_norm_normalize( $str, $form );
$error_code = intl_get_error_code();
$error_message = intl_get_error_message();
diff --git a/ext/intl/tests/timezone_countEquivalentIDs_error.phpt b/ext/intl/tests/timezone_countEquivalentIDs_error.phpt
index 3087f49cbe..4fc9b02a1d 100644
--- a/ext/intl/tests/timezone_countEquivalentIDs_error.phpt
+++ b/ext/intl/tests/timezone_countEquivalentIDs_error.phpt
@@ -8,25 +8,7 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::countEquivalentIDs());
-var_dump(IntlTimeZone::countEquivalentIDs(array()));
var_dump(IntlTimeZone::countEquivalentIDs("foo\x80"));
-var_dump(IntlTimeZone::countEquivalentIDs("foo bar", 7));
--EXPECTF--
-Warning: IntlTimeZone::countEquivalentIDs() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::countEquivalentIDs() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
-
-Warning: IntlTimeZone::countEquivalentIDs() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_createDefault_error.phpt b/ext/intl/tests/timezone_createDefault_error.phpt
deleted file mode 100644
index f2f2e021b9..0000000000
--- a/ext/intl/tests/timezone_createDefault_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlTimeZone::createDefault(): errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlTimeZone::createDefault(4));
---EXPECTF--
-Warning: IntlTimeZone::createDefault() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::createDefault(): intltz_create_default: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/timezone_createEnumeration_error.phpt b/ext/intl/tests/timezone_createEnumeration_error.phpt
index ea92e28d95..4e190129d4 100644
--- a/ext/intl/tests/timezone_createEnumeration_error.phpt
+++ b/ext/intl/tests/timezone_createEnumeration_error.phpt
@@ -9,12 +9,7 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
var_dump(IntlTimeZone::createEnumeration(array()));
-var_dump(IntlTimeZone::createEnumeration(1, 2));
+?>
--EXPECTF--
Warning: IntlTimeZone::createEnumeration(): intltz_create_enumeration: invalid argument type in %s on line %d
bool(false)
-
-Warning: IntlTimeZone::createEnumeration() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::createEnumeration(): intltz_create_enumeration: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
index 5edfaeaf6b..2b847ec841 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
@@ -8,31 +8,7 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration());
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration(array()));
var_dump(IntlTimeZone::createTimeZoneIDEnumeration(-1));
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration(IntlTimeZone::TYPE_ANY, array()));
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration(IntlTimeZone::TYPE_ANY, "PT", "a80"));
--EXPECTF--
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad zone type in %s on line %d
bool(false)
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 3 to be int, string given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_createTimeZone_error.phpt b/ext/intl/tests/timezone_createTimeZone_error.phpt
index 553223ee4c..a06f26b128 100644
--- a/ext/intl/tests/timezone_createTimeZone_error.phpt
+++ b/ext/intl/tests/timezone_createTimeZone_error.phpt
@@ -8,25 +8,8 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::createTimeZone());
-var_dump(IntlTimeZone::createTimeZone(new stdClass));
-var_dump(IntlTimeZone::createTimeZone("foo bar", 4));
var_dump(IntlTimeZone::createTimeZone("foo\x80"));
+?>
--EXPECTF--
-Warning: IntlTimeZone::createTimeZone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::createTimeZone() expects parameter 1 to be string, object given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::createTimeZone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d
-NULL
-
Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: could not convert time zone id to UTF-16 in %s on line %d
NULL
diff --git a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt
index f50e59f97c..54a70d1f17 100644
--- a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt
+++ b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt
@@ -10,39 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::fromDateTimeZone());
-var_dump(IntlTimeZone::fromDateTimeZone(1,2));
-var_dump(IntlTimeZone::fromDateTimeZone('sdfds'));
-var_dump(IntlTimeZone::fromDateTimeZone(new stdclass));
$dt = new DateTime('2012-08-01 00:00:00 WEST');
var_dump(IntlTimeZone::fromDateTimeZone($dt->getTimeZone()));
-
-var_dump(intltz_from_date_time_zone());
+?>
--EXPECTF--
-Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, object given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d
NULL
-
-Warning: intltz_from_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: intltz_from_date_time_zone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/timezone_getCanonicalID_error.phpt b/ext/intl/tests/timezone_getCanonicalID_error.phpt
index 684d946b1e..c1f7b6927a 100644
--- a/ext/intl/tests/timezone_getCanonicalID_error.phpt
+++ b/ext/intl/tests/timezone_getCanonicalID_error.phpt
@@ -8,19 +8,8 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::getCanonicalID());
-var_dump(IntlTimeZone::getCanonicalID(array()));
var_dump(IntlTimeZone::getCanonicalID("foo\x81"));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getCanonicalID() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getCanonicalID() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
diff --git a/ext/intl/tests/timezone_getDSTSavings_error.phpt b/ext/intl/tests/timezone_getDSTSavings_error.phpt
index 9df04f08c1..c20da9021a 100644
--- a/ext/intl/tests/timezone_getDSTSavings_error.phpt
+++ b/ext/intl/tests/timezone_getDSTSavings_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getDSTSavings(array()));
-
var_dump(intltz_get_dst_savings(null));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getDSTSavings() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getDSTSavings(): intltz_get_dst_savings: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_dst_savings() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_dst_savings() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_dst_savings(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getDisplayName_error.phpt b/ext/intl/tests/timezone_getDisplayName_error.phpt
index 8d30f8840f..7f8d913a17 100644
--- a/ext/intl/tests/timezone_getDisplayName_error.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_error.phpt
@@ -9,38 +9,14 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getDisplayName(array()));
-var_dump($tz->getDisplayName(false, array()));
var_dump($tz->getDisplayName(false, -1));
-var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, array()));
-var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, NULL, NULL));
var_dump(intltz_get_display_name(null, IntlTimeZone::DISPLAY_SHORT, false, 'pt_PT'));
--EXPECTF--
-Warning: IntlTimeZone::getDisplayName() expects parameter 1 to be bool, array given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getDisplayName() expects parameter 2 to be int, array given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: wrong display type in %s on line %d
bool(false)
-Warning: IntlTimeZone::getDisplayName() expects parameter 3 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getDisplayName() expects at most 3 parameters, 4 given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_display_name() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_display_name() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_display_name(NULL, 1, false, 'pt_PT')
#1 {main}
diff --git a/ext/intl/tests/timezone_getEquivalentID_error.phpt b/ext/intl/tests/timezone_getEquivalentID_error.phpt
index facb8fe8cf..12afaee2fa 100644
--- a/ext/intl/tests/timezone_getEquivalentID_error.phpt
+++ b/ext/intl/tests/timezone_getEquivalentID_error.phpt
@@ -8,25 +8,8 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::getEquivalentID('foo'));
-var_dump(IntlTimeZone::getEquivalentID('foo', 'bar'));
-var_dump(IntlTimeZone::getEquivalentID('Europe/Lisbon', 0, 1));
var_dump(IntlTimeZone::getEquivalentID("foo\x80", 0));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getEquivalentID() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getEquivalentID() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getEquivalentID() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
diff --git a/ext/intl/tests/timezone_getErrorCode_error.phpt b/ext/intl/tests/timezone_getErrorCode_error.phpt
index f5b06b0757..5b4a59f17f 100644
--- a/ext/intl/tests/timezone_getErrorCode_error.phpt
+++ b/ext/intl/tests/timezone_getErrorCode_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getErrorCode(array()));
-
var_dump(intltz_get_error_code(null));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getErrorCode(): intltz_get_error_code: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_error_code() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_error_code() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_error_code(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getErrorMessage_error.phpt b/ext/intl/tests/timezone_getErrorMessage_error.phpt
index 6b8ce7d5c8..ffceff358c 100644
--- a/ext/intl/tests/timezone_getErrorMessage_error.phpt
+++ b/ext/intl/tests/timezone_getErrorMessage_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getErrorMessage(array()));
-
var_dump(intltz_get_error_message(null));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getErrorMessage(): intltz_get_error_message: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_error_message() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_error_message() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_error_message(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getGMT_error.phpt b/ext/intl/tests/timezone_getGMT_error.phpt
deleted file mode 100644
index ca478a10d1..0000000000
--- a/ext/intl/tests/timezone_getGMT_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlTimeZone::getGMT(): errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlTimeZone::getGMT(4));
---EXPECTF--
-Warning: IntlTimeZone::getGMT() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getGMT(): intltz_get_gmt: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/timezone_getID_error.phpt b/ext/intl/tests/timezone_getID_error.phpt
index 4d0ffeb96f..1ba7d7482f 100644
--- a/ext/intl/tests/timezone_getID_error.phpt
+++ b/ext/intl/tests/timezone_getID_error.phpt
@@ -8,16 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getID('foo'));
intltz_get_id(null);
+?>
--EXPECTF--
-Warning: IntlTimeZone::getID() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getID(): intltz_get_id: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_id() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_id() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_id(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getOffset_error.phpt b/ext/intl/tests/timezone_getOffset_error.phpt
index d66716e552..95dc638adb 100644
--- a/ext/intl/tests/timezone_getOffset_error.phpt
+++ b/ext/intl/tests/timezone_getOffset_error.phpt
@@ -10,25 +10,14 @@ ini_set("intl.error_level", E_WARNING);
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
var_dump($tz->getOffset(INF, true, $a, $a));
-var_dump($tz->getOffset(time()*1000, true, $a));
-var_dump($tz->getOffset(time()*1000, true, $a, $a, $a));
intltz_get_offset(null, time()*1000, false, $a, $a);
+?>
--EXPECTF--
Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in %s on line %d
bool(false)
-Warning: IntlTimeZone::getOffset() expects exactly 4 parameters, 3 given in %s on line %d
-
-Warning: IntlTimeZone::getOffset(): intltz_get_offset: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getOffset() expects exactly 4 parameters, 5 given in %s on line %d
-
-Warning: IntlTimeZone::getOffset(): intltz_get_offset: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_offset() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_offset() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_offset(NULL, %d, false, NULL, NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getRawOffset_error.phpt b/ext/intl/tests/timezone_getRawOffset_error.phpt
index dc7df51cca..a16b62468b 100644
--- a/ext/intl/tests/timezone_getRawOffset_error.phpt
+++ b/ext/intl/tests/timezone_getRawOffset_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getRawOffset('foo'));
-
intltz_get_raw_offset(null);
+?>
--EXPECTF--
-Warning: IntlTimeZone::getRawOffset() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getRawOffset(): intltz_get_raw_offset: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_raw_offset() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_raw_offset() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_raw_offset(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getRegion_error.phpt b/ext/intl/tests/timezone_getRegion_error.phpt
index 7a9e1e1ca7..28fd73c1a7 100644
--- a/ext/intl/tests/timezone_getRegion_error.phpt
+++ b/ext/intl/tests/timezone_getRegion_error.phpt
@@ -8,27 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::getRegion());
-var_dump(IntlTimeZone::getRegion(array()));
-var_dump(IntlTimeZone::getRegion('Europe/Lisbon', 4));
var_dump(IntlTimeZone::getRegion("foo\x81"));
var_dump(IntlTimeZone::getRegion("foo"));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getRegion() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getRegion() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getRegion() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getRegion(): intltz_get_region: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
diff --git a/ext/intl/tests/timezone_getTZDataVersion_error.phpt b/ext/intl/tests/timezone_getTZDataVersion_error.phpt
deleted file mode 100644
index eab4573a36..0000000000
--- a/ext/intl/tests/timezone_getTZDataVersion_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlTimeZone::getTZDataVersion(): errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlTimeZone::getTZDataVersion('foo'));
---EXPECTF--
-Warning: IntlTimeZone::getTZDataVersion() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getTZDataVersion(): intltz_get_tz_data_version: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_getUnknown_error.phpt b/ext/intl/tests/timezone_getUnknown_error.phpt
deleted file mode 100644
index 57773c256b..0000000000
--- a/ext/intl/tests/timezone_getUnknown_error.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-IntlCalendar::getUnknown(): bad arguments
---INI--
-date.timezone=Atlantic/Azores
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-IntlTimeZone::getUnknown(1);
-
-intltz_get_unknown(1);
---EXPECTF--
-Warning: IntlTimeZone::getUnknown() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getUnknown(): intltz_get_unknown: bad arguments in %s on line %d
-
-Warning: intltz_get_unknown() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: intltz_get_unknown(): intltz_get_unknown: bad arguments in %s on line %d
diff --git a/ext/intl/tests/timezone_hasSameRules_error.phpt b/ext/intl/tests/timezone_hasSameRules_error.phpt
index 4ec73a96a6..07aa15039c 100644
--- a/ext/intl/tests/timezone_hasSameRules_error.phpt
+++ b/ext/intl/tests/timezone_hasSameRules_error.phpt
@@ -31,7 +31,7 @@ try {
}
--EXPECT--
int(0)
-string(99) "Argument 1 passed to IntlTimeZone::hasSameRules() must be an instance of IntlTimeZone, string given"
+string(81) "IntlTimeZone::hasSameRules() expects parameter 1 to be IntlTimeZone, string given"
int(0)
-string(92) "Argument 1 passed to intltz_has_same_rules() must be an instance of IntlTimeZone, null given"
+string(74) "intltz_has_same_rules() expects parameter 1 to be IntlTimeZone, null given"
diff --git a/ext/intl/tests/timezone_toDateTimeZone_error.phpt b/ext/intl/tests/timezone_toDateTimeZone_error.phpt
index d00e78fd3a..9df2bbf70d 100644
--- a/ext/intl/tests/timezone_toDateTimeZone_error.phpt
+++ b/ext/intl/tests/timezone_toDateTimeZone_error.phpt
@@ -10,30 +10,18 @@ ini_set("intl.error_level", E_WARNING);
$tz = IntlTimeZone::createTimeZone('Etc/Unknown');
-var_dump($tz->toDateTimeZone(''));
try {
var_dump($tz->toDateTimeZone());
} catch (Exception $e) {
var_dump($e->getMessage());
}
-var_dump(intltz_to_date_time_zone());
var_dump(intltz_to_date_time_zone(1));
--EXPECTF--
-Warning: IntlTimeZone::toDateTimeZone() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: DateTimeZone constructor threw exception in %s on line %d
string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
-Warning: intltz_to_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: intltz_to_date_time_zone(): intltz_to_date_time_zone: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_to_date_time_zone() must be an instance of IntlTimeZone, int given in %s:%d
+Fatal error: Uncaught TypeError: intltz_to_date_time_zone() expects parameter 1 to be IntlTimeZone, int given in %s:%d
Stack trace:
#0 %s(%d): intltz_to_date_time_zone(1)
#1 {main}
diff --git a/ext/intl/tests/timezone_useDaylightTime_error.phpt b/ext/intl/tests/timezone_useDaylightTime_error.phpt
index c6ab2eefe5..5b37cd16b1 100644
--- a/ext/intl/tests/timezone_useDaylightTime_error.phpt
+++ b/ext/intl/tests/timezone_useDaylightTime_error.phpt
@@ -8,16 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->useDaylightTime('foo'));
intltz_use_daylight_time(null);
+?>
--EXPECTF--
-Warning: IntlTimeZone::useDaylightTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::useDaylightTime(): intltz_use_daylight_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_use_daylight_time() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_use_daylight_time() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_use_daylight_time(NULL)
#1 {main}
diff --git a/ext/intl/tests/transliterator_create_from_rule_error.phpt b/ext/intl/tests/transliterator_create_from_rule_error.phpt
index d1549ec1b6..64c57da854 100644
--- a/ext/intl/tests/transliterator_create_from_rule_error.phpt
+++ b/ext/intl/tests/transliterator_create_from_rule_error.phpt
@@ -6,12 +6,6 @@ Transliterator::createFromRules (error)
<?php
ini_set("intl.error_level", E_WARNING);
-$t = Transliterator::createFromRules();
-echo intl_get_error_message(),"\n";
-
-$t = Transliterator::createFromRules("a","b");
-echo intl_get_error_message(),"\n";
-
$t = Transliterator::createFromRules("\x8Fss");
echo intl_get_error_message(),"\n";
@@ -31,16 +25,6 @@ $t = Transliterator::createFromRules($rules);
echo intl_get_error_message(),"\n";
echo "Done.\n";
--EXPECTF--
-Warning: Transliterator::createFromRules() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: Transliterator::createFromRules(): transliterator_create_from_rules: bad arguments in %s on line %d
-transliterator_create_from_rules: bad arguments: U_ILLEGAL_ARGUMENT_ERROR
-
-Warning: Transliterator::createFromRules() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: Transliterator::createFromRules(): transliterator_create_from_rules: bad arguments in %s on line %d
-transliterator_create_from_rules: bad arguments: U_ILLEGAL_ARGUMENT_ERROR
-
Warning: Transliterator::createFromRules(): String conversion of rules to UTF-16 failed in %s on line %d
String conversion of rules to UTF-16 failed: U_INVALID_CHAR_FOUND
diff --git a/ext/intl/tests/transliterator_create_inverse_error.phpt b/ext/intl/tests/transliterator_create_inverse_error.phpt
index 1a1e80ba68..c8d6bdc5a6 100644
--- a/ext/intl/tests/transliterator_create_inverse_error.phpt
+++ b/ext/intl/tests/transliterator_create_inverse_error.phpt
@@ -7,17 +7,10 @@ Transliterator::createInverse (error)
ini_set("intl.error_level", E_WARNING);
-$tr = Transliterator::create("Katakana-Latin");
-$tr->createInverse(array());
-
-$tr = Transliterator::create("Katakana-Latin");
transliterator_create_inverse("jj");
+?>
--EXPECTF--
-Warning: Transliterator::createInverse() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: Transliterator::createInverse(): transliterator_create_inverse: bad arguments in %s on line %d
-
-Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_create_inverse() must be an instance of Transliterator, string given in %s:%d
+Fatal error: Uncaught TypeError: transliterator_create_inverse() expects parameter 1 to be Transliterator, string given in %s:%d
Stack trace:
#0 %s(%d): transliterator_create_inverse('jj')
#1 {main}
diff --git a/ext/intl/tests/transliterator_get_error_code_error.phpt b/ext/intl/tests/transliterator_get_error_code_error.phpt
index e700d2b172..ed766fd968 100644
--- a/ext/intl/tests/transliterator_get_error_code_error.phpt
+++ b/ext/intl/tests/transliterator_get_error_code_error.phpt
@@ -5,22 +5,10 @@ Transliterator::getErrorCode (error)
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
-$t = Transliterator::create("[\p{Bidi_Mirrored}] Hex");
-echo transliterator_get_error_code(), "\n";
-echo $t->getErrorCode(null), "\n";
echo transliterator_get_error_code(array()), "\n";
+?>
--EXPECTF--
-Warning: transliterator_get_error_code() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: transliterator_get_error_code(): transliterator_get_error_code: unable to parse input params in %s on line %d
-
-
-Warning: Transliterator::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: Transliterator::getErrorCode(): transliterator_get_error_code: unable to parse input params in %s on line %d
-
-
-Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_get_error_code() must be an instance of Transliterator, array given in %s:%d
+Fatal error: Uncaught TypeError: transliterator_get_error_code() expects parameter 1 to be Transliterator, array given in %s:%d
Stack trace:
#0 %s(%d): transliterator_get_error_code(Array)
#1 {main}
diff --git a/ext/intl/tests/transliterator_get_error_message_error.phpt b/ext/intl/tests/transliterator_get_error_message_error.phpt
index ec8282447a..04746c7a5f 100644
--- a/ext/intl/tests/transliterator_get_error_message_error.phpt
+++ b/ext/intl/tests/transliterator_get_error_message_error.phpt
@@ -5,22 +5,10 @@ Transliterator::getErrorMessage (error)
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
-$t = Transliterator::create("[\p{Bidi_Mirrored}] Hex");
-echo transliterator_get_error_message(), "\n";
-echo $t->getErrorMessage(null), "\n";
echo transliterator_get_error_message(array()), "\n";
+?>
--EXPECTF--
-Warning: transliterator_get_error_message() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: transliterator_get_error_message(): transliterator_get_error_message: unable to parse input params in %s on line %d
-
-
-Warning: Transliterator::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: Transliterator::getErrorMessage(): transliterator_get_error_message: unable to parse input params in %s on line %d
-
-
-Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_get_error_message() must be an instance of Transliterator, array given in %s:%d
+Fatal error: Uncaught TypeError: transliterator_get_error_message() expects parameter 1 to be Transliterator, array given in %s:%d
Stack trace:
#0 %s(%d): transliterator_get_error_message(Array)
#1 {main}
diff --git a/ext/intl/tests/transliterator_list_ids_error.phpt b/ext/intl/tests/transliterator_list_ids_error.phpt
deleted file mode 100644
index fa651387f1..0000000000
--- a/ext/intl/tests/transliterator_list_ids_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Transliterator::listIDs (error)
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-ini_set("intl.error_level", E_WARNING);
-var_dump(transliterator_list_ids(array()));
-
-echo "Done.\n";
---EXPECTF--
-Warning: transliterator_list_ids() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: transliterator_list_ids(): transliterator_list_ids: bad arguments in %s on line %d
-bool(false)
-Done.
diff --git a/ext/intl/tests/transliterator_transliterate_error.phpt b/ext/intl/tests/transliterator_transliterate_error.phpt
index cdddcfb87b..da9a887455 100644
--- a/ext/intl/tests/transliterator_transliterate_error.phpt
+++ b/ext/intl/tests/transliterator_transliterate_error.phpt
@@ -10,51 +10,19 @@ ini_set("intl.error_level", E_WARNING);
$tr = Transliterator::create("latin");
//Arguments
-var_dump(transliterator_transliterate());
-var_dump(transliterator_transliterate($tr,array()));
var_dump(transliterator_transliterate($tr,"str",7));
var_dump(transliterator_transliterate($tr,"str",7,6));
-var_dump(transliterator_transliterate($tr,"str",2,-1,"extra"));
-
-//Arguments
-var_dump($tr->transliterate());
-var_dump($tr->transliterate(array()));
//bad UTF-8
transliterator_transliterate($tr, "\x80\x03");
echo "Done.\n";
--EXPECTF--
-Warning: transliterator_transliterate() expects at least 2 parameters, 0 given in %s on line %d
-
-Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
-Warning: transliterator_transliterate() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
Warning: transliterator_transliterate(): transliterator_transliterate: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3) in %s on line %d
bool(false)
Warning: transliterator_transliterate(): transliterator_transliterate: "start" argument should be non-negative and not bigger than "end" (if defined) in %s on line %d
bool(false)
-Warning: transliterator_transliterate() expects at most 4 parameters, 5 given in %s on line %d
-
-Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
-Warning: Transliterator::transliterate() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: Transliterator::transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
-Warning: Transliterator::transliterate() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: Transliterator::transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
Warning: transliterator_transliterate(): String conversion of string to UTF-16 failed in %s on line %d
Done.
diff --git a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt b/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt
deleted file mode 100644
index 4e381289b3..0000000000
--- a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Check the function UConverter::getAvailable with parameter wrong
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php UConverter::getAvailable("This is an ascii string"); ?>
---EXPECTF--
-Warning: UConverter::getAvailable() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index b261f81f81..516b39837c 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -98,7 +96,7 @@ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
goto error;
}
ZVAL_STR(&arg, u8str);
- zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
+ zend_call_method_with_1_params(Z_OBJ_P(ret), NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
if (EG(exception)) {
spprintf(&message, 0,
"%s: DateTimeZone constructor threw exception", func);
@@ -224,17 +222,17 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
/* }}} */
/* {{{ clone handler for TimeZone */
-static zend_object *TimeZone_clone_obj(zval *object)
+static zend_object *TimeZone_clone_obj(zend_object *object)
{
TimeZone_object *to_orig,
*to_new;
zend_object *ret_val;
intl_error_reset(NULL);
- to_orig = Z_INTL_TIMEZONE_P(object);
+ to_orig = php_intl_timezone_fetch_object(object);
intl_error_reset(TIMEZONE_ERROR_P(to_orig));
- ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = TimeZone_ce_ptr->create_object(object->ce);
to_new = php_intl_timezone_fetch_object(ret_val);
zend_objects_clone_members(&to_new->zo, &to_orig->zo);
@@ -270,6 +268,9 @@ static int TimeZone_compare_objects(zval *object1, zval *object2)
{
TimeZone_object *to1,
*to2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+
to1 = Z_INTL_TIMEZONE_P(object1);
to2 = Z_INTL_TIMEZONE_P(object2);
@@ -288,7 +289,7 @@ static int TimeZone_compare_objects(zval *object1, zval *object2)
/* }}} */
/* {{{ get_debug_info handler for TimeZone */
-static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
+static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp)
{
zval zv;
TimeZone_object *to;
@@ -302,7 +303,7 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- to = Z_INTL_TIMEZONE_P(object);
+ to = php_intl_timezone_fetch_object(object);
tz = to->utimezone;
if (tz == NULL) {
@@ -514,7 +515,7 @@ U_CFUNC void timezone_register_IntlTimeZone_class(void)
sizeof TimeZone_handlers);
TimeZone_handlers.offset = XtOffsetOf(TimeZone_object, zo);
TimeZone_handlers.clone_obj = TimeZone_clone_obj;
- TimeZone_handlers.compare_objects = TimeZone_compare_objects;
+ TimeZone_handlers.compare = TimeZone_compare_objects;
TimeZone_handlers.get_debug_info = TimeZone_get_debug_info;
TimeZone_handlers.dtor_obj = TimeZone_objects_dtor;
TimeZone_handlers.free_obj = TimeZone_objects_free;
diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h
index 99e9b56dae..f0fd5cdee8 100644
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 6e1d22324b..f32c5756bf 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -55,8 +53,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone)
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str_id, &str_id_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_time_zone: bad arguments", 0);
RETURN_NULL();
}
@@ -82,8 +78,6 @@ U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O",
&zv_timezone, php_date_get_timezone_ce()) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_from_date_time_zone: bad arguments", 0);
RETURN_NULL();
}
@@ -109,8 +103,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_default)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_default: bad arguments", 0);
RETURN_NULL();
}
@@ -123,8 +115,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_gmt)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_gmt: bad arguments", 0);
RETURN_NULL();
}
@@ -136,8 +126,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_unknown)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_unknown: bad arguments", 0);
RETURN_NULL();
}
@@ -153,8 +141,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
/* double indirection to have the zend engine destroy the new zval that
* results from separation */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_enumeration: bad arguments", 0);
RETURN_FALSE;
}
@@ -215,8 +201,6 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_count_equivalent_ids: bad arguments", 0);
RETURN_FALSE;
}
@@ -246,8 +230,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s!l!",
&zoneType, &region, &region_len, &offset_arg, &arg3isnull) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_time_zone_id_enumeration: bad arguments", 0);
RETURN_FALSE;
}
@@ -287,8 +269,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z",
&str_id, &str_id_len, &is_systemid) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_canonical_id: bad arguments", 0);
RETURN_FALSE;
}
@@ -326,8 +306,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_region)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_region: bad arguments", 0);
RETURN_FALSE;
}
@@ -350,8 +328,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_tz_data_version: bad arguments", 0);
RETURN_FALSE;
}
@@ -373,8 +349,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl",
&str_id, &str_id_len, &index) == FAILURE ||
index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_equivalent_id: bad arguments", 0);
RETURN_FALSE;
}
@@ -401,8 +375,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_id)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_id: bad arguments", 0);
RETURN_FALSE;
}
@@ -426,8 +398,6 @@ U_CFUNC PHP_FUNCTION(intltz_use_daylight_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_use_daylight_time: bad arguments", 0);
RETURN_FALSE;
}
@@ -449,8 +419,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Odbz/z/", &object, TimeZone_ce_ptr, &date, &local, &rawOffsetArg,
&dstOffsetArg) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_offset: bad arguments", 0);
RETURN_FALSE;
}
@@ -475,8 +443,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_raw_offset: bad arguments", 0);
RETURN_FALSE;
}
@@ -494,8 +460,6 @@ U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, TimeZone_ce_ptr, &other_object, TimeZone_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_has_same_rules: bad arguments", 0);
RETURN_FALSE;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -527,8 +491,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_display_name)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type,
&locale_str, &dummy) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_display_name: bad arguments", 0);
RETURN_FALSE;
}
@@ -566,8 +528,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_dst_savings: bad arguments", 0);
RETURN_FALSE;
}
@@ -583,8 +543,6 @@ U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_to_date_time_zone: bad arguments", 0);
RETURN_FALSE;
}
@@ -606,8 +564,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_error_code: bad arguments", 0);
RETURN_FALSE;
}
@@ -626,8 +582,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_message)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_error_message: bad arguments", 0 );
RETURN_FALSE;
}
diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h
index 6e6fa3f472..2f9ec349a1 100644
--- a/ext/intl/timezone/timezone_methods.h
+++ b/ext/intl/timezone/timezone_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c
index a80de4bf9a..b865f97876 100644
--- a/ext/intl/transliterator/transliterator.c
+++ b/ext/intl/transliterator/transliterator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator.h b/ext/intl/transliterator/transliterator.h
index 081a730cbc..9d550bb2a4 100644
--- a/ext/intl/transliterator/transliterator.h
+++ b/ext/intl/transliterator/transliterator.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index 4417fba4f0..5bed10ed6f 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -130,16 +128,16 @@ static zend_object *Transliterator_object_create( zend_class_entry *ce )
*/
/* {{{ clone handler for Transliterator */
-static zend_object *Transliterator_clone_obj( zval *object )
+static zend_object *Transliterator_clone_obj( zend_object *object )
{
Transliterator_object *to_orig,
*to_new;
zend_object *ret_val;
intl_error_reset( NULL );
- to_orig = Z_INTL_TRANSLITERATOR_P( object );
+ to_orig = php_intl_transliterator_fetch_object( object );
intl_error_reset( INTL_DATA_ERROR_P( to_orig ) );
- ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) );
+ ret_val = Transliterator_ce_ptr->create_object( object->ce );
to_new = php_intl_transliterator_fetch_object( ret_val );
zend_objects_clone_members( &to_new->zo, &to_orig->zo );
@@ -189,78 +187,52 @@ err:
}
/* }}} */
-#define TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return_fail) \
- zval tmp_member; \
- if( Z_TYPE_P( member ) != IS_STRING ) \
- { \
- zend_string *_str = \
- zval_try_get_string_func(member); \
- if (UNEXPECTED(!_str)) { return_fail; } \
- ZVAL_STR(&tmp_member, _str); \
- member = &tmp_member; \
- cache_slot = NULL; \
- }
-
-#define TRANSLITERATOR_PROPERTY_HANDLER_EPILOG \
- if( member == &tmp_member ) \
- { \
- zval_ptr_dtor_str( &tmp_member ); \
- }
-
/* {{{ get_property_ptr_ptr handler */
-static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, int type, void **cache_slot )
+static zval *Transliterator_get_property_ptr_ptr( zend_object *object, zend_string *name, int type, void **cache_slot )
{
zval *retval;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return NULL);
-
if(zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 )
{
retval = NULL; /* fallback to read_property */
}
else
{
- retval = zend_std_get_property_ptr_ptr( object, member, type, cache_slot );
+ retval = zend_std_get_property_ptr_ptr( object, name, type, cache_slot );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return retval;
}
/* }}} */
/* {{{ read_property handler */
-static zval *Transliterator_read_property( zval *object, zval *member, int type, void **cache_slot, zval *rv )
+static zval *Transliterator_read_property( zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv )
{
zval *retval;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return &EG(uninitialized_zval));
-
if( ( type != BP_VAR_R && type != BP_VAR_IS ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) )
{
php_error_docref(NULL, E_WARNING, "The property \"id\" is read-only" );
retval = &EG( uninitialized_zval );
}
else
{
- retval = zend_std_read_property( object, member, type, cache_slot, rv );
+ retval = zend_std_read_property( object, name, type, cache_slot, rv );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return retval;
}
/* }}} */
/* {{{ write_property handler */
-static zval *Transliterator_write_property( zval *object, zval *member, zval *value, void **cache_slot )
+static zval *Transliterator_write_property( zend_object *object, zend_string *name, zval *value,
+ void **cache_slot )
{
zend_class_entry *scope;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return value);
if (EG(fake_scope)) {
scope = EG(fake_scope);
@@ -269,17 +241,15 @@ static zval *Transliterator_write_property( zval *object, zval *member, zval *va
}
if( ( scope != Transliterator_ce_ptr ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) )
{
php_error_docref(NULL, E_WARNING, "The property \"id\" is read-only" );
}
else
{
- value = zend_std_write_property( object, member, value, cache_slot );
+ value = zend_std_write_property( object, name, value, cache_slot );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return value;
}
/* }}} */
diff --git a/ext/intl/transliterator/transliterator_class.h b/ext/intl/transliterator/transliterator_class.h
index 83e99b6f73..98f599c81b 100644
--- a/ext/intl/transliterator/transliterator_class.h
+++ b/ext/intl/transliterator/transliterator_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c
index f1518d80a1..b7ca4109e9 100644
--- a/ext/intl/transliterator/transliterator_methods.c
+++ b/ext/intl/transliterator/transliterator_methods.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -115,8 +113,6 @@ PHP_FUNCTION( transliterator_create )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l",
&str_id, &str_id_len, &direction ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_create: bad arguments", 0 );
RETURN_NULL();
}
@@ -149,8 +145,6 @@ PHP_FUNCTION( transliterator_create_from_rules )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l",
&str_rules, &str_rules_len, &direction ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_create_from_rules: bad arguments", 0 );
RETURN_NULL();
}
@@ -214,8 +208,6 @@ PHP_FUNCTION( transliterator_create_inverse )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Transliterator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_create_inverse: bad arguments", 0 );
RETURN_NULL();
}
@@ -250,12 +242,7 @@ PHP_FUNCTION( transliterator_list_ids )
if( zend_parse_parameters_none() == FAILURE )
{
- /* seems to be the convention in this lib to return false instead of
- * null on bad parameter types, except on constructors and factory
- * methods */
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_list_ids: bad arguments", 0 );
- RETURN_FALSE;
+ return;
}
en = utrans_openIDs( &status );
@@ -317,8 +304,6 @@ PHP_FUNCTION( transliterator_transliterate )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "zs|ll",
&arg1, &str, &str_len, &start, &limit ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_transliterate: bad arguments", 0 );
RETURN_FALSE;
}
@@ -351,8 +336,6 @@ PHP_FUNCTION( transliterator_transliterate )
else if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|ll",
&str, &str_len, &start, &limit ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_transliterate: bad arguments", 0 );
RETURN_FALSE;
}
@@ -479,9 +462,6 @@ PHP_FUNCTION( transliterator_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Transliterator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_get_error_code: unable to parse input params", 0 );
-
RETURN_FALSE;
}
@@ -507,9 +487,6 @@ PHP_FUNCTION( transliterator_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Transliterator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_get_error_message: unable to parse input params", 0 );
-
RETURN_FALSE;
}
diff --git a/ext/intl/transliterator/transliterator_methods.h b/ext/intl/transliterator/transliterator_methods.h
index ff0b93a29a..71eb79a3d7 100644
--- a/ext/intl/transliterator/transliterator_methods.h
+++ b/ext/intl/transliterator/transliterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/json/json.c b/ext/json/json.c
index 8474642266..5db3621b32 100644
--- a/ext/json/json.c
+++ b/ext/json/json.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, |
@@ -29,6 +27,7 @@
#include "php_json.h"
#include "php_json_encoder.h"
#include "php_json_parser.h"
+#include "json_arginfo.h"
#include <zend_exceptions.h>
static PHP_MINFO_FUNCTION(json);
@@ -42,27 +41,6 @@ PHP_JSON_API zend_class_entry *php_json_exception_ce;
PHP_JSON_API ZEND_DECLARE_MODULE_GLOBALS(json)
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_json_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, depth)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, json)
- ZEND_ARG_INFO(0, assoc)
- ZEND_ARG_INFO(0, depth)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ json_functions[] */
static const zend_function_entry json_functions[] = {
PHP_FE(json_encode, arginfo_json_encode)
@@ -74,12 +52,8 @@ static const zend_function_entry json_functions[] = {
/* }}} */
/* {{{ JsonSerializable methods */
-ZEND_BEGIN_ARG_INFO(json_serialize_arginfo, 0)
- /* No arguments */
-ZEND_END_ARG_INFO();
-
static const zend_function_entry json_serializable_interface[] = {
- PHP_ABSTRACT_ME(JsonSerializable, jsonSerialize, json_serialize_arginfo)
+ PHP_ABSTRACT_ME(JsonSerializable, jsonSerialize, arginfo_class_JsonSerializable_jsonSerialize)
PHP_FE_END
};
/* }}} */
diff --git a/ext/json/json.stub.php b/ext/json/json.stub.php
new file mode 100644
index 0000000000..6b00648461
--- /dev/null
+++ b/ext/json/json.stub.php
@@ -0,0 +1,16 @@
+<?php
+
+/** @return string|false */
+function json_encode($value, int $options = 0, int $depth = 512) {}
+
+/** @return mixed */
+function json_decode(string $json, ?bool $assoc = null, int $depth = 512, int $options = 0) {}
+
+function json_last_error(): int {}
+
+function json_last_error_msg(): string {}
+
+interface JsonSerializable
+{
+ public function jsonSerialize();
+}
diff --git a/ext/json/json_arginfo.h b/ext/json/json_arginfo.h
new file mode 100644
index 0000000000..b717716790
--- /dev/null
+++ b/ext/json/json_arginfo.h
@@ -0,0 +1,23 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_json_encode, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, depth, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, json, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, assoc, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, depth, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_json_last_error, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_json_last_error_msg, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_JsonSerializable_jsonSerialize, 0, 0, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c
index c0fcbe3282..d08a466643 100644
--- a/ext/json/json_encoder.c
+++ b/ext/json/json_encoder.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/ext/json/json_parser.y b/ext/json/json_parser.y
index ba7311c963..2f8a260c98 100644
--- a/ext/json/json_parser.y
+++ b/ext/json/json_parser.y
@@ -1,8 +1,6 @@
%code top {
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -245,7 +243,6 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
if (Z_TYPE_P(object) == IS_ARRAY) {
zend_symtable_update(Z_ARRVAL_P(object), key, zvalue);
} else {
- zval zkey;
if (ZSTR_LEN(key) > 0 && ZSTR_VAL(key)[0] == '\0') {
parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME;
zend_string_release_ex(key, 0);
@@ -253,8 +250,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
zval_ptr_dtor_nogc(object);
return FAILURE;
}
- ZVAL_NEW_STR(&zkey, key);
- zend_std_write_property(object, &zkey, zvalue, NULL);
+ zend_std_write_property(Z_OBJ_P(object), key, zvalue, NULL);
Z_TRY_DELREF_P(zvalue);
}
zend_string_release_ex(key, 0);
diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re
index a64d09bfc3..5b571e6dd2 100644
--- a/ext/json/json_scanner.re
+++ b/ext/json/json_scanner.re
@@ -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/ext/json/php_json.h b/ext/json/php_json.h
index 99afe8dd2d..4fc7ded7d4 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.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/ext/json/php_json_encoder.h b/ext/json/php_json_encoder.h
index e8266bfd06..8d9825b4fb 100644
--- a/ext/json/php_json_encoder.h
+++ b/ext/json/php_json_encoder.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/ext/json/php_json_parser.h b/ext/json/php_json_parser.h
index 8b6393d100..05f7a061c6 100644
--- a/ext/json/php_json_parser.h
+++ b/ext/json/php_json_parser.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/ext/json/php_json_scanner.h b/ext/json/php_json_scanner.h
index 7a9356146c..7a2d841703 100644
--- a/ext/json/php_json_scanner.h
+++ b/ext/json/php_json_scanner.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/ext/json/tests/001.phpt b/ext/json/tests/001.phpt
index e908b44349..63a303998a 100644
--- a/ext/json/tests/001.phpt
+++ b/ext/json/tests/001.phpt
@@ -5,7 +5,6 @@ json_decode() tests
--FILE--
<?php
-var_dump(json_decode());
var_dump(json_decode(""));
var_dump(json_decode("", 1));
var_dump(json_decode("", 0));
@@ -26,8 +25,6 @@ var_dump(json_decode('{ "": "": "" } }'));
?>
===DONE===
--EXPECTF--
-Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
NULL
NULL
NULL
diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt
index 9906a2b0d4..4089a7897f 100644
--- a/ext/json/tests/json_decode_error.phpt
+++ b/ext/json/tests/json_decode_error.phpt
@@ -6,13 +6,6 @@ Test json_decode() function : error conditions
<?php
echo "*** Testing json_decode() : error conditions ***\n";
-echo "\n-- Testing json_decode() function with no arguments --\n";
-var_dump(json_decode());
-
-echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
-
echo "\n-- Testing json_decode() function with depth below 0 --\n";
var_dump(json_decode('"abc"', true, -1));
@@ -21,16 +14,6 @@ var_dump(json_decode('"abc"', true, -1));
--EXPECTF--
*** Testing json_decode() : error conditions ***
--- Testing json_decode() function with no arguments --
-
-Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing json_decode() function with more than expected no. of arguments --
-
-Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing json_decode() function with depth below 0 --
Warning: json_decode(): Depth must be greater than zero in %s on line %d
diff --git a/ext/json/tests/json_last_error_error.phpt b/ext/json/tests/json_last_error_error.phpt
index e733b32854..cd88ef8a9e 100644
--- a/ext/json/tests/json_last_error_error.phpt
+++ b/ext/json/tests/json_last_error_error.phpt
@@ -6,15 +6,14 @@ json_last_error() failures
<?php
var_dump(json_last_error());
-var_dump(json_last_error(true));
-var_dump(json_last_error('some', 4, 'args', 'here'));
+
+try {
+ var_dump(json_last_error(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
int(0)
-
-Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d
-NULL
+json_last_error() expects exactly 0 parameters, 1 given
diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt
index 719e9fc50c..75b06f72a2 100644
--- a/ext/json/tests/json_last_error_msg_error.phpt
+++ b/ext/json/tests/json_last_error_msg_error.phpt
@@ -6,15 +6,14 @@ json_last_error_msg() failures
<?php
var_dump(json_last_error_msg());
-var_dump(json_last_error_msg(true));
-var_dump(json_last_error_msg('some', 4, 'args', 'here'));
+
+try {
+ var_dump(json_last_error_msg(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
string(8) "No error"
-
-Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d
-NULL
+json_last_error_msg() expects exactly 0 parameters, 1 given
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
index f10cccc460..89c4b19531 100644
--- a/ext/ldap/config.m4
+++ b/ext/ldap/config.m4
@@ -51,7 +51,7 @@ PHP_ARG_WITH([ldap-sasl],
if test "$PHP_LDAP" != "no"; then
- PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
+ PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
if test "$PHP_LDAP" = "yes"; then
for i in /usr/local /usr; do
diff --git a/ext/ldap/config.w32 b/ext/ldap/config.w32
index b947aa5177..1cbbfb8ba8 100644
--- a/ext/ldap/config.w32
+++ b/ext/ldap/config.w32
@@ -17,7 +17,6 @@ if (PHP_LDAP != "no") {
AC_DEFINE('HAVE_LDAP_START_TLS_S', 1);
AC_DEFINE('HAVE_LDAP', 1);
AC_DEFINE('HAVE_LDAP_SASL', 1);
- AC_DEFINE('LDAP_DEPRECATED', 1);
AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1);
AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1);
AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION_S', 1);
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index c09dee52bf..815aecb5e1 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.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, |
@@ -35,6 +33,7 @@
#include "ext/standard/dl.h"
#include "php_ldap.h"
+#include "ldap_arginfo.h"
#ifdef PHP_WIN32
#include <string.h>
@@ -1004,7 +1003,7 @@ PHP_FUNCTION(ldap_connect)
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if (ZEND_NUM_ARGS() == 5) {
@@ -1012,7 +1011,7 @@ PHP_FUNCTION(ldap_connect)
}
#else
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sl", &host, &hostlen, &port) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
#endif
@@ -1125,11 +1124,11 @@ PHP_FUNCTION(ldap_bind)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ss", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
@@ -1182,11 +1181,11 @@ PHP_FUNCTION(ldap_bind_ext)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ssa", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen, &serverctrls) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
@@ -1347,11 +1346,11 @@ PHP_FUNCTION(ldap_sasl_bind)
php_ldap_bictx *ctx;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|sssssss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
ctx = _php_sasl_setdefs(ld->link, sasl_mech, sasl_realm, sasl_authc_id, passwd, sasl_authz_id);
@@ -1380,11 +1379,11 @@ PHP_FUNCTION(ldap_unbind)
ldap_linkdata *ld;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
zend_list_close(Z_RES_P(link));
@@ -1715,7 +1714,7 @@ PHP_FUNCTION(ldap_free_result)
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
zend_list_close(Z_RES_P(result)); /* Delete list entry */
@@ -1736,11 +1735,11 @@ PHP_FUNCTION(ldap_count_entries)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(ldap_count_entries(ld->link, ldap_result));
@@ -1761,11 +1760,11 @@ PHP_FUNCTION(ldap_first_entry)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((entry = ldap_first_entry(ld->link, ldap_result)) == NULL) {
@@ -1794,10 +1793,10 @@ PHP_FUNCTION(ldap_next_entry)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((entry_next = ldap_next_entry(ld->link, resultentry->data)) == NULL) {
@@ -1833,10 +1832,10 @@ PHP_FUNCTION(ldap_get_entries)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
ldap = ld->link;
@@ -1928,11 +1927,11 @@ PHP_FUNCTION(ldap_first_attribute)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((attribute = ldap_first_attribute(ld->link, resultentry->data, &resultentry->ber)) == NULL) {
@@ -1961,11 +1960,11 @@ PHP_FUNCTION(ldap_next_attribute)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (resultentry->ber == NULL) {
@@ -2008,11 +2007,11 @@ PHP_FUNCTION(ldap_get_attributes)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
array_init(return_value);
@@ -2066,11 +2065,11 @@ PHP_FUNCTION(ldap_get_values_len)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attr)) == NULL) {
@@ -2105,11 +2104,11 @@ PHP_FUNCTION(ldap_get_dn)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
text = ldap_get_dn(ld->link, resultentry->data);
@@ -2209,7 +2208,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
num_attribs = zend_hash_num_elements(Z_ARRVAL_P(entry));
@@ -2449,7 +2448,7 @@ static void php_ldap_do_delete(INTERNAL_FUNCTION_PARAMETERS, int ext)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (serverctrls) {
@@ -2598,7 +2597,7 @@ PHP_FUNCTION(ldap_modify_batch)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* perform validation */
@@ -2881,7 +2880,7 @@ PHP_FUNCTION(ldap_errno)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(_get_lderrno(ld->link));
@@ -2915,7 +2914,7 @@ PHP_FUNCTION(ldap_error)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
ld_errno = _get_lderrno(ld->link);
@@ -2942,7 +2941,7 @@ PHP_FUNCTION(ldap_compare)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (serverctrls) {
@@ -2981,39 +2980,6 @@ cleanup:
}
/* }}} */
-/* {{{ proto bool ldap_sort(resource link, resource result, string sortfilter)
- Sort LDAP result entries */
-PHP_FUNCTION(ldap_sort)
-{
- zval *link, *result;
- ldap_linkdata *ld;
- char *sortfilter;
- size_t sflen;
- zend_resource *le;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link, &result, &sortfilter, &sflen) != SUCCESS) {
- RETURN_FALSE;
- }
-
- if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
- }
-
- le = Z_RES_P(result);
- if (le->type != le_result) {
- php_error_docref(NULL, E_WARNING, "Supplied resource is not a valid ldap result resource");
- RETURN_FALSE;
- }
-
- if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) {
- php_error_docref(NULL, E_WARNING, "%s", ldap_err2string(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
Get the current value of various session-wide parameters */
@@ -3028,7 +2994,7 @@ PHP_FUNCTION(ldap_get_option)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch (option) {
@@ -3200,7 +3166,7 @@ PHP_FUNCTION(ldap_set_option)
ldap = NULL;
} else {
if ((ld = (ldap_linkdata *)zend_fetch_resource_ex(link, "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
ldap = ld->link;
}
@@ -3311,7 +3277,7 @@ PHP_FUNCTION(ldap_set_option)
zend_string *val;
val = zval_get_string(newval);
if (EG(exception)) {
- RETURN_FALSE;
+ return;
}
if (ldap_set_option(ldap, option, ZSTR_VAL(val))) {
zend_string_release(val);
@@ -3383,11 +3349,11 @@ PHP_FUNCTION(ldap_parse_result)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
rc = ldap_parse_result(ld->link, ldap_result, &lerrcode,
@@ -3458,11 +3424,11 @@ PHP_FUNCTION(ldap_parse_exop)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
rc = ldap_parse_extended_result(ld->link, ldap_result,
@@ -3513,11 +3479,11 @@ PHP_FUNCTION(ldap_first_reference)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((entry = ldap_first_reference(ld->link, ldap_result)) == NULL) {
@@ -3546,11 +3512,11 @@ PHP_FUNCTION(ldap_next_reference)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((entry_next = ldap_next_reference(ld->link, resultentry->data)) == NULL) {
@@ -3580,11 +3546,11 @@ PHP_FUNCTION(ldap_parse_reference)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ldap_parse_reference(ld->link, resultentry->data, &lreferrals, NULL /* &serverctrls */, 0) != LDAP_SUCCESS) {
@@ -3628,7 +3594,7 @@ static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (newparent_len == 0) {
@@ -3721,7 +3687,7 @@ PHP_FUNCTION(ldap_start_tls)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (((rc = ldap_set_option(ld->link, LDAP_OPT_PROTOCOL_VERSION, &protocol)) != LDAP_SUCCESS) ||
@@ -3779,11 +3745,11 @@ PHP_FUNCTION(ldap_set_rebind_proc)
ldap_linkdata *ld;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &link, &callback) != SUCCESS) {
- RETURN_FALSE;
+ return;
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) {
@@ -3976,7 +3942,7 @@ PHP_FUNCTION(ldap_control_paged_result)
ldap = NULL;
} else {
if ((ld = (ldap_linkdata *)zend_fetch_resource_ex(link, "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
ldap = ld->link;
}
@@ -4065,11 +4031,11 @@ PHP_FUNCTION(ldap_control_paged_result_response)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
rc = ldap_parse_result(ld->link,
@@ -4163,7 +4129,7 @@ PHP_FUNCTION(ldap_exop)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (reqdata) {
@@ -4269,7 +4235,7 @@ PHP_FUNCTION(ldap_exop_passwd)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch (myargcount) {
@@ -4354,7 +4320,7 @@ PHP_FUNCTION(ldap_exop_whoami)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* synchronous call */
@@ -4392,7 +4358,7 @@ PHP_FUNCTION(ldap_exop_refresh)
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ return;
}
lttl = (ber_int_t)zval_get_long(ttl);
@@ -4410,390 +4376,6 @@ PHP_FUNCTION(ldap_exop_refresh)
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
- ZEND_ARG_INFO(0, hostname)
- ZEND_ARG_INFO(0, port)
-#ifdef HAVE_ORALDAP
- ZEND_ARG_INFO(0, wallet)
- ZEND_ARG_INFO(0, wallet_passwd)
- ZEND_ARG_INFO(0, authmode)
-#endif
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_resource, 0, 0, 1)
- ZEND_ARG_INFO(0, link_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind, 0, 0, 1)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, bind_rdn)
- ZEND_ARG_INFO(0, bind_password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, bind_rdn)
- ZEND_ARG_INFO(0, bind_password)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_LDAP_SASL
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sasl_bind, 0, 0, 1)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, binddn)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, sasl_mech)
- ZEND_ARG_INFO(0, sasl_realm)
- ZEND_ARG_INFO(0, sasl_authz_id)
- ZEND_ARG_INFO(0, props)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, base_dn)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, attributes)
- ZEND_ARG_INFO(0, attrsonly)
- ZEND_ARG_INFO(0, sizelimit)
- ZEND_ARG_INFO(0, timelimit)
- ZEND_ARG_INFO(0, deref)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_list, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, base_dn)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, attributes)
- ZEND_ARG_INFO(0, attrsonly)
- ZEND_ARG_INFO(0, sizelimit)
- ZEND_ARG_INFO(0, timelimit)
- ZEND_ARG_INFO(0, deref)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_search, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, base_dn)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, attributes)
- ZEND_ARG_INFO(0, attrsonly)
- ZEND_ARG_INFO(0, sizelimit)
- ZEND_ARG_INFO(0, timelimit)
- ZEND_ARG_INFO(0, deref)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_count_entries, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_entry, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_entries, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_attributes, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
- ZEND_ARG_INFO(0, attribute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values_len, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
- ZEND_ARG_INFO(0, attribute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_dn, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_explode_dn, 0, 0, 2)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, with_attrib)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_dn2ufn, 0, 0, 1)
- ZEND_ARG_INFO(0, dn)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify_batch, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_ARRAY_INFO(0, modifications_info, 0)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_err2str, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_compare, 0, 0, 4)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, attribute)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sort, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(0, sortfilter)
-ZEND_END_ARG_INFO()
-
-#ifdef LDAP_CONTROL_PAGEDRESULTS
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, pagesize)
- ZEND_ARG_INFO(0, iscritical)
- ZEND_ARG_INFO(0, cookie)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(1, cookie)
- ZEND_ARG_INFO(1, estimated)
-ZEND_END_ARG_INFO();
-#endif
-
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename, 0, 0, 5)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, newrdn)
- ZEND_ARG_INFO(0, newparent)
- ZEND_ARG_INFO(0, deleteoldrdn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, newrdn)
- ZEND_ARG_INFO(0, newparent)
- ZEND_ARG_INFO(0, deleteoldrdn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_option, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(1, retval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_option, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, newval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, entry)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_LDAP_PARSE_REFERENCE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_reference, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(1, referrals)
-ZEND_END_ARG_INFO()
-#endif
-
-
-#ifdef HAVE_LDAP_PARSE_RESULT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_result, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(1, errcode)
- ZEND_ARG_INFO(1, matcheddn)
- ZEND_ARG_INFO(1, errmsg)
- ZEND_ARG_INFO(1, referrals)
- ZEND_ARG_INFO(1, serverctrls)
-ZEND_END_ARG_INFO()
-#endif
-#endif
-
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_escape, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, ignore)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-#ifdef STR_TRANSLATION
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_t61_to_8859, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_8859_to_t61, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, reqoid)
- ZEND_ARG_INFO(0, reqdata)
- ZEND_ARG_INFO(0, servercontrols)
- ZEND_ARG_INFO(1, retdata)
- ZEND_ARG_INFO(1, retoid)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_PASSWD
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_passwd, 0, 0, 1)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, oldpw)
- ZEND_ARG_INFO(0, newpw)
- ZEND_ARG_INFO(1, serverctrls)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_WHOAMI_S
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_whoami, 0, 0, 1)
- ZEND_ARG_INFO(0, link)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_REFRESH_S
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_refresh, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, ttl)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_exop, 0, 0, 4)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(1, retdata)
- ZEND_ARG_INFO(1, retoid)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
/*
This is just a small subset of the functionality provided by the LDAP library. All the
operations are synchronous. Referrals are not handled automatically.
@@ -4802,17 +4384,17 @@ ZEND_END_ARG_INFO()
*/
static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_connect, arginfo_ldap_connect)
- PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_resource)
+ PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_close)
PHP_FE(ldap_bind, arginfo_ldap_bind)
PHP_FE(ldap_bind_ext, arginfo_ldap_bind_ext)
#ifdef HAVE_LDAP_SASL
PHP_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind)
#endif
- PHP_FE(ldap_unbind, arginfo_ldap_resource)
+ PHP_FE(ldap_unbind, arginfo_ldap_unbind)
PHP_FE(ldap_read, arginfo_ldap_read)
PHP_FE(ldap_list, arginfo_ldap_list)
PHP_FE(ldap_search, arginfo_ldap_search)
- PHP_FE(ldap_free_result, arginfo_ldap_resource)
+ PHP_FE(ldap_free_result, arginfo_ldap_free_result)
PHP_FE(ldap_count_entries, arginfo_ldap_count_entries)
PHP_FE(ldap_first_entry, arginfo_ldap_first_entry)
PHP_FE(ldap_next_entry, arginfo_ldap_next_entry)
@@ -4841,11 +4423,10 @@ static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext)
/* end gjt mod */
- PHP_FE(ldap_errno, arginfo_ldap_resource)
+ PHP_FE(ldap_errno, arginfo_ldap_errno)
PHP_FE(ldap_err2str, arginfo_ldap_err2str)
- PHP_FE(ldap_error, arginfo_ldap_resource)
+ PHP_FE(ldap_error, arginfo_ldap_error)
PHP_FE(ldap_compare, arginfo_ldap_compare)
- PHP_DEP_FE(ldap_sort, arginfo_ldap_sort)
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
PHP_FE(ldap_rename, arginfo_ldap_rename)
@@ -4861,7 +4442,7 @@ static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_parse_result, arginfo_ldap_parse_result)
#endif
#ifdef HAVE_LDAP_START_TLS_S
- PHP_FE(ldap_start_tls, arginfo_ldap_resource)
+ PHP_FE(ldap_start_tls, arginfo_ldap_start_tls)
#endif
#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
PHP_FE(ldap_exop, arginfo_ldap_exop)
diff --git a/ext/ldap/ldap.stub.php b/ext/ldap/ldap.stub.php
new file mode 100644
index 0000000000..236b69e825
--- /dev/null
+++ b/ext/ldap/ldap.stub.php
@@ -0,0 +1,370 @@
+<?php
+
+//TODO: missing arginfo functions defined in C using
+
+#ifdef HAVE_ORALDAP
+/** @return resource|false */
+function ldap_connect(string $hostname = UNKNOWN, int $port = 389, string $wallet = UNKNOWN, string $wallet_passwd = UNKNOWN, int $authmode = GSLC_SSL_NO_AUTH) {}
+#else
+/** @return resource|false */
+function ldap_connect(string $hostname = UNKNOWN, int $port = 389) {}
+#endif
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_unbind($link_identifier): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_close($link_identifier): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_bind($link_identifier, string $bind_rdn = UNKNOWN, string $bind_password = UNKNOWN): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_bind_ext($link_identifier, string $bind_rdn = UNKNOWN, string $bind_password = UNKNOWN, array $servercontrols = []) {}
+
+#ifdef HAVE_LDAP_SASL
+/**
+ * @param resource $link
+ */
+function ldap_sasl_bind($link, string $binddn = UNKNOWN, string $password = UNKNOWN, string $sasl_mech = UNKNOWN, string $sasl_realm = UNKNOWN, string $sasl_authc_id = UNKNOWN, string $sasl_authz_id = UNKNOWN, string $props = UNKNOWN): bool {}
+#endif
+
+/**
+ * @param resource|array $link_identifier
+ * @param string|array $base_dn
+ * @param string|array $filter
+ * @return resource|false
+ */
+function ldap_read($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {}
+
+/**
+ * @param resource|array $link_identifier
+ * @param string|array $base_dn
+ * @param string|array $filter
+ * @return resource|false
+ */
+function ldap_list($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {}
+
+/**
+ * @param resource|array $link_identifier
+ * @param string|array $base_dn
+ * @param string|array $filter
+ * @return resource|false
+ */
+function ldap_search($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_free_result($link_identifier): bool {}
+
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ */
+function ldap_count_entries($link_identifier, $result_identifier): int {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ * @return resource|false
+ */
+function ldap_first_entry($link_identifier, $result_identifier) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ * @return resource|false
+ */
+function ldap_next_entry($link_identifier, $result_identifier) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ * @return array|false
+ */
+function ldap_get_entries($link_identifier, $result_identifier) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ * @return string|false
+ */
+function ldap_first_attribute($link_identifier, $result_entry_identifier, int $dummy_ber = UNKNOWN) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ * @return string|false
+ */
+function ldap_next_attribute($link_identifier, $result_entry_identifier, int $dummy_ber = UNKNOWN) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_get_attributes($link_identifier, $result_entry_identifier): array {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ * @return array|false
+ */
+function ldap_get_values($link_identifier, $result_entry_identifier, string $attribute) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ * @return array|false
+ */
+function ldap_get_values_len($link_identifier, $result_entry_identifier, string $attribute) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ * @return string|false
+ */
+function ldap_get_dn($link_identifier, $result_entry_identifier) {}
+
+/**
+ * @return array|false
+ */
+function ldap_explode_dn(string $dn, int $with_attrib) {}
+
+/**
+ * @return string|false
+ */
+function ldap_dn2ufn(string $dn) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_add($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_add_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_delete($link_identifier, string $dn, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_delete_ext($link_identifier, string $dn, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_modify($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_modify_batch($link_identifier, string $dn, array $modifications_info, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_mod_add($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_mod_add_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_mod_replace($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_mod_replace_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_mod_del($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_mod_del_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+/**
+ * @param resource $link
+ */
+function ldap_errno($link): int {}
+
+/**
+ * @param resource $link
+ */
+function ldap_error($link): string {}
+
+function ldap_err2str(int $errno): string {}
+
+/**
+ * @param resource $link_identifier
+ * @return bool|int
+ */
+function ldap_compare($link_identifier, string $dn, string $attribute, string $value, array $servercontrols = []) {}
+
+
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+/**
+ * @param resource $link
+ */
+function ldap_control_paged_result($link, int $pagesize, bool $iscritical = false, string $cookie = ''): bool {}
+
+/**
+ * @param resource $link
+ * @param resource $result
+ */
+function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+/**
+ * @param resource $link_identifier
+ */
+function ldap_rename($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_rename_ext($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []) {}
+
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_get_option($link_identifier, int $option, &$retval = null): bool {}
+
+/**
+ * @param ?resource $link_identifier
+ */
+function ldap_set_option($link_identifier, int $option, $newval): bool {}
+
+/**
+ * @param resource $link
+ * @param resource $result
+ * @return resource|false
+ */
+function ldap_first_reference($link, $result) {}
+
+/**
+ * @param resource $link
+ * @param resource $entry
+ * @return resource|false
+ */
+function ldap_next_reference($link, $entry) {}
+
+#ifdef HAVE_LDAP_PARSE_REFERENCE
+/**
+ * @param resource $link
+ * @param resource $entry
+ */
+function ldap_parse_reference($link, $entry, &$referrals): bool {}
+#endif
+
+#ifdef HAVE_LDAP_PARSE_RESULT
+/**
+ * @param resource $link
+ * @param resource $result
+ */
+function ldap_parse_result($link, $result, &$errcode, &$matcheddn = null, &$errmsg = null, &$referrals = null, &$serverctrls = null): bool {}
+#endif
+#endif
+
+#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
+/**
+ * @param resource $link
+ * @param callable $callback
+ */
+function ldap_set_rebind_proc($link, $callback): bool {}
+#endif
+
+#ifdef HAVE_LDAP_START_TLS_S
+function ldap_start_tls($link_identifier): bool {}
+#endif
+
+function ldap_escape(string $value, string $ignore = '', int $flags = 0): string {}
+
+#ifdef STR_TRANSLATION
+/**
+ * @return string|false
+ */
+function ldap_t61_to_8859(string $value) {}
+
+/**
+ * @return string|false
+ */
+function ldap_8859_to_t61(string $value) {}
+#endif
+
+
+#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
+/**
+ * @param resource $link
+ * @return resource|bool
+ */
+function ldap_exop($link, string $reqoid, ?string $reqdata = null, ?array $servercontrols = [], &$retdata = null, &$retoid = null) {}
+#endif
+
+#ifdef HAVE_LDAP_PASSWD
+/**
+ * @param resource $link
+ * @return string|bool
+ */
+function ldap_exop_passwd($link, string $user = '', string $oldpw = '', string $newpw = '', &$serverctrls = null) {}
+#endif
+
+
+#ifdef HAVE_LDAP_WHOAMI_S
+/**
+ * @param resource $link
+ * @return string|bool
+ */
+function ldap_exop_whoami($link) {}
+#endif
+
+
+#ifdef HAVE_LDAP_REFRESH_S
+/**
+ * @param resource $link
+ * @return int|false
+ */
+function ldap_exop_refresh($link, string $dn, $ttl) {}
+#endif
+
+
+#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
+/**
+ * @param resource $link
+ * @param resource $result
+ */
+function ldap_parse_exop($link, $result, &$retdata = null, &$retoid = null): bool {}
+#endif
+
diff --git a/ext/ldap/ldap_arginfo.h b/ext/ldap/ldap_arginfo.h
new file mode 100644
index 0000000000..b5060e3c10
--- /dev/null
+++ b/ext/ldap/ldap_arginfo.h
@@ -0,0 +1,347 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+#if defined(HAVE_ORALDAP)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, wallet, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, wallet_passwd, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, authmode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !(defined(HAVE_ORALDAP))
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_unbind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_close arginfo_ldap_unbind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_bind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, bind_rdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bind_password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, bind_rdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bind_password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_LDAP_SASL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_sasl_bind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, binddn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_mech, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_realm, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_authc_id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_authz_id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, props, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, base_dn)
+ ZEND_ARG_INFO(0, filter)
+ ZEND_ARG_TYPE_INFO(0, attributes, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, attrsonly, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, sizelimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timelimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, deref, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_list arginfo_ldap_read
+
+#define arginfo_ldap_search arginfo_ldap_read
+
+#define arginfo_ldap_free_result arginfo_ldap_unbind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_count_entries, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_next_entry arginfo_ldap_first_entry
+
+#define arginfo_ldap_get_entries arginfo_ldap_first_entry
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_attribute, 0, 0, 2)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ ZEND_ARG_TYPE_INFO(0, dummy_ber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_next_attribute arginfo_ldap_first_attribute
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_attributes, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values, 0, 0, 3)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ ZEND_ARG_TYPE_INFO(0, attribute, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_get_values_len arginfo_ldap_get_values
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_dn, 0, 0, 2)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_explode_dn, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, with_attrib, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_dn2ufn, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_add, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entry, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entry, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_delete, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_modify arginfo_ldap_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_modify_batch, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, modifications_info, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_mod_add arginfo_ldap_add
+
+#define arginfo_ldap_mod_add_ext arginfo_ldap_add_ext
+
+#define arginfo_ldap_mod_replace arginfo_ldap_add
+
+#define arginfo_ldap_mod_replace_ext arginfo_ldap_add_ext
+
+#define arginfo_ldap_mod_del arginfo_ldap_add
+
+#define arginfo_ldap_mod_del_ext arginfo_ldap_add_ext
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, link)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_error, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, link)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_err2str, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_compare, 0, 0, 4)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, attribute, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(LDAP_CONTROL_PAGEDRESULTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, pagesize, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, iscritical, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, cookie, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LDAP_CONTROL_PAGEDRESULTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_INFO(1, cookie)
+ ZEND_ARG_INFO(1, estimated)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_rename, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newrdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newparent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, deleteoldrdn, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newrdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newparent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, deleteoldrdn, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_option, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(1, retval)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_option, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, newval)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, entry)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_reference, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, entry)
+ ZEND_ARG_INFO(1, referrals)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_result, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_INFO(1, errcode)
+ ZEND_ARG_INFO(1, matcheddn)
+ ZEND_ARG_INFO(1, errmsg)
+ ZEND_ARG_INFO(1, referrals)
+ ZEND_ARG_INFO(1, serverctrls)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_START_TLS_S)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_start_tls, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_escape, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ignore, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(STR_TRANSLATION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_t61_to_8859, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(STR_TRANSLATION)
+#define arginfo_ldap_8859_to_t61 arginfo_ldap_t61_to_8859
+#endif
+
+#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, reqoid, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, reqdata, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 1)
+ ZEND_ARG_INFO(1, retdata)
+ ZEND_ARG_INFO(1, retoid)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_PASSWD)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_passwd, 0, 0, 1)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, user, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, oldpw, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newpw, IS_STRING, 0)
+ ZEND_ARG_INFO(1, serverctrls)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_WHOAMI_S)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_whoami, 0, 0, 1)
+ ZEND_ARG_INFO(0, link)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_REFRESH_S)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_refresh, 0, 0, 3)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_INFO(0, ttl)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_exop, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_INFO(1, retdata)
+ ZEND_ARG_INFO(1, retoid)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
index f777fe9a5f..fcda55e92f 100644
--- a/ext/ldap/php_ldap.h
+++ b/ext/ldap/php_ldap.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/ext/ldap/tests/bug48696.phpt b/ext/ldap/tests/bug48696.phpt
deleted file mode 100644
index 8d25b67236..0000000000
--- a/ext/ldap/tests/bug48696.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #48696 (ldap_read() segfaults with invalid parameters)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifbindfailure.inc');
-?>
---FILE--
-<?php
-
-ldap_read(1,1,1);
-
-?>
---EXPECTF--
-Warning: ldap_read(): supplied argument is not a valid ldap link resource in %s on line %d
diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt
index 533496a4b2..14476bb876 100644
--- a/ext/ldap/tests/ldap_add_error.phpt
+++ b/ext/ldap/tests/ldap_add_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_add());
-var_dump(ldap_add($link));
-var_dump(ldap_add($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_add($link, "$base", array(), [], "Additional data"));
-
var_dump(ldap_add($link, "$base", array()));
// Invalid DN
@@ -97,18 +89,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_add() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_add() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_add() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_add() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_add(): Add: Protocol error in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_bind_error.phpt b/ext/ldap/tests/ldap_bind_error.phpt
index a569ce6922..ee16908b57 100644
--- a/ext/ldap/tests/ldap_bind_error.phpt
+++ b/ext/ldap/tests/ldap_bind_error.phpt
@@ -13,9 +13,6 @@ require "connect.inc";
$link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
-// Invalid parameter count
-var_dump(ldap_bind($link, $user, $passwd, null));
-
// Invalid password
var_dump(ldap_bind($link, $user, "ThisIsNotCorrect$passwd"));
@@ -24,9 +21,6 @@ var_dump(ldap_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
?>
===DONE===
--EXPECTF--
-Warning: ldap_bind() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-
Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_compare_error.phpt b/ext/ldap/tests/ldap_compare_error.phpt
index 120dfab059..50e93d660f 100644
--- a/ext/ldap/tests/ldap_compare_error.phpt
+++ b/ext/ldap/tests/ldap_compare_error.phpt
@@ -13,14 +13,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
-// Too few parameters
-var_dump(ldap_compare($link));
-var_dump(ldap_compare($link, $link));
-var_dump(ldap_compare($link, $link, $link));
-
-// Too many parameters
-var_dump(ldap_compare($link, $link, $link, $link, [], "Additional data"));
-
var_dump(
ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"),
ldap_error($link),
@@ -36,18 +28,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
-Warning: ldap_compare() expects at least 4 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_compare() expects at least 4 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_compare() expects at least 4 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_compare() expects at most 5 parameters, 6 given in %s on line %d
-NULL
-
Warning: ldap_compare(): Compare: No such object in %s on line %d
int(-1)
string(14) "No such object"
diff --git a/ext/ldap/tests/ldap_connect_error.phpt b/ext/ldap/tests/ldap_connect_error.phpt
index b93375c39e..24561e1576 100644
--- a/ext/ldap/tests/ldap_connect_error.phpt
+++ b/ext/ldap/tests/ldap_connect_error.phpt
@@ -12,7 +12,6 @@ ldap.max_links=1
require "connect.inc";
// too many arguments
-var_dump(ldap_connect(null, null, null));
var_dump(ldap_connect("ldap://$host:$port/$base"));
$links = array();
@@ -21,9 +20,6 @@ $links[1] = ldap_connect($host, $port);
?>
===DONE===
--EXPECTF--
-Warning: ldap_connect() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
Warning: ldap_connect(): Could not create session handle: %s in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_count_entries_error.phpt b/ext/ldap/tests/ldap_count_entries_error.phpt
deleted file mode 100644
index 552625a7eb..0000000000
--- a/ext/ldap/tests/ldap_count_entries_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_count_entries() - Testing counting LDAP entries that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_count_entries($link));
-var_dump(ldap_count_entries($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_count_entries() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_count_entries(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_delete_error.phpt b/ext/ldap/tests/ldap_delete_error.phpt
index a34d7b39fe..30a4c2e277 100644
--- a/ext/ldap/tests/ldap_delete_error.phpt
+++ b/ext/ldap/tests/ldap_delete_error.phpt
@@ -12,13 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_delete());
-var_dump(ldap_delete($link));
-
-// Too many parameters
-var_dump(ldap_delete($link, "$base", [], "Additional data"));
-
// Invalid DN
var_dump(
ldap_delete($link, "weirdAttribute=val"),
@@ -41,15 +34,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
?>
--EXPECTF--
-Warning: ldap_delete() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_delete() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_delete() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: ldap_delete(): Delete: Invalid DN syntax in %s on line %d
bool(false)
string(17) "Invalid DN syntax"
diff --git a/ext/ldap/tests/ldap_dn2ufn.phpt b/ext/ldap/tests/ldap_dn2ufn.phpt
index 8082e97809..54c90658cf 100644
--- a/ext/ldap/tests/ldap_dn2ufn.phpt
+++ b/ext/ldap/tests/ldap_dn2ufn.phpt
@@ -14,20 +14,15 @@ var_dump(ldap_dn2ufn("cn=bob,ou=users,dc=example,dc=com"));
/* Convert DN with < > characters */
var_dump(ldap_dn2ufn("cn=<bob>,dc=example,dc=com"));
-/* Too many parameters */
-ldap_dn2ufn("cn=bob,dc=example,dc=com", 1);
-
/* Bad DN value */
var_dump(ldap_dn2ufn("bob,dc=example,dc=com"));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(16) "bob, example.com"
string(23) "bob, users, example.com"
bool(false)
-
-Warning: ldap_dn2ufn() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
diff --git a/ext/ldap/tests/ldap_err2str_error.phpt b/ext/ldap/tests/ldap_err2str_error.phpt
deleted file mode 100644
index 0963ac4101..0000000000
--- a/ext/ldap/tests/ldap_err2str_error.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-ldap_err2str() - Incorrect usage of number to string conversion
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-// Too few args
-var_dump(ldap_err2str());
-
-// Too many args
-var_dump(ldap_err2str(1, "Additional data"));
-
-var_dump(ldap_err2str("weird"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_err2str() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_err2str() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: ldap_err2str() expects parameter 1 to be int, string given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_errno_error.phpt b/ext/ldap/tests/ldap_errno_error.phpt
deleted file mode 100644
index a05876c88e..0000000000
--- a/ext/ldap/tests/ldap_errno_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_errno() - ldap_errno() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-// Too few parameters
-var_dump(ldap_errno());
-
-// Too many parameters
-var_dump(ldap_errno(null, null));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_errno() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_errno() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_error_error.phpt b/ext/ldap/tests/ldap_error_error.phpt
deleted file mode 100644
index e74eacf008..0000000000
--- a/ext/ldap/tests/ldap_error_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_error() - ldap_error() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-// Too few parameters
-var_dump(ldap_error());
-
-// Too many parameters
-var_dump(ldap_error(null, null));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_error() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_error() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_explode_dn.phpt b/ext/ldap/tests/ldap_explode_dn.phpt
index 2337ac9eff..aa8ab10088 100644
--- a/ext/ldap/tests/ldap_explode_dn.phpt
+++ b/ext/ldap/tests/ldap_explode_dn.phpt
@@ -23,12 +23,6 @@ var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 0));
/* Explode without attributes and < > characters */
var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 1));
-/* Too few parameters */
-ldap_explode_dn("cn=bob,dc=example,dc=com");
-
-/* Too many parameters */
-ldap_explode_dn("cn=bob,dc=example,dc=com", 1, 1);
-
/* Bad DN value with attributes */
var_dump(ldap_explode_dn("bob,dc=example,dc=com", 0));
@@ -85,10 +79,6 @@ array(5) {
}
bool(false)
bool(false)
-
-Warning: ldap_explode_dn() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: ldap_explode_dn() expects exactly 2 parameters, 3 given in %s on line %d
bool(false)
bool(false)
Done
diff --git a/ext/ldap/tests/ldap_first_attribute_error.phpt b/ext/ldap/tests/ldap_first_attribute_error.phpt
index f7016c539f..9737df96c6 100644
--- a/ext/ldap/tests/ldap_first_attribute_error.phpt
+++ b/ext/ldap/tests/ldap_first_attribute_error.phpt
@@ -10,14 +10,13 @@ Patrick Allaert <patrickallaert@php.net>
require "connect.inc";
$link = ldap_connect($host, $port);
-var_dump(ldap_first_attribute($link));
-var_dump(ldap_first_attribute($link, $link));
+try {
+ var_dump(ldap_first_attribute($link, $link));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
-Warning: ldap_first_attribute() expects %s 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_first_attribute(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
+--EXPECT--
+ldap_first_attribute(): supplied resource is not a valid ldap result entry resource
===DONE===
diff --git a/ext/ldap/tests/ldap_first_entry_error.phpt b/ext/ldap/tests/ldap_first_entry_error.phpt
deleted file mode 100644
index 9f232e0e8f..0000000000
--- a/ext/ldap/tests/ldap_first_entry_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_first_entry() - Testing ldap_first_entry() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_first_entry($link));
-var_dump(ldap_first_entry($link, $link, "Additional data"));
-var_dump(ldap_first_entry($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_first_entry() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_first_entry() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_first_entry(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_first_reference_error.phpt b/ext/ldap/tests/ldap_first_reference_error.phpt
deleted file mode 100644
index d5541e10fc..0000000000
--- a/ext/ldap/tests/ldap_first_reference_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_first_reference() - Testing ldap_first_reference() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_first_reference($link));
-var_dump(ldap_first_reference($link, $link, "Additional data"));
-var_dump(ldap_first_reference($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_first_reference() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_first_reference() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_first_reference(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_free_result_error.phpt b/ext/ldap/tests/ldap_free_result_error.phpt
deleted file mode 100644
index 05623d62d0..0000000000
--- a/ext/ldap/tests/ldap_free_result_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_free_result() - Testing ldap_free_result() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_free_result($link));
-var_dump(ldap_free_result($link, "Additional data"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_free_result(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-
-Warning: ldap_free_result() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_attributes_error.phpt b/ext/ldap/tests/ldap_get_attributes_error.phpt
deleted file mode 100644
index 465ba4fd72..0000000000
--- a/ext/ldap/tests/ldap_get_attributes_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_get_attributes() - Testing ldap_get_attributes() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_get_attributes($link));
-var_dump(ldap_get_attributes($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_attributes() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_attributes(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_dn_error.phpt b/ext/ldap/tests/ldap_get_dn_error.phpt
deleted file mode 100644
index 71df6a3da1..0000000000
--- a/ext/ldap/tests/ldap_get_dn_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_get_dn() - Testing ldap_get_dn() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_get_dn($link));
-var_dump(ldap_get_dn($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_dn() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_dn(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_entries_error.phpt b/ext/ldap/tests/ldap_get_entries_error.phpt
deleted file mode 100644
index 7e0f4c0b98..0000000000
--- a/ext/ldap/tests/ldap_get_entries_error.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-ldap_get_entries() - ldap_get_entries() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-
-// Too few parameters
-var_dump(ldap_get_entries($link));
-
-// Too many parameters
-var_dump(ldap_get_entries($link, $link, "Additional data"));
-
-// Bad parameter
-var_dump(ldap_get_entries($link, "string"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_entries() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_entries() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_get_entries() expects parameter 2 to be resource, string given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_option_error.phpt b/ext/ldap/tests/ldap_get_option_error.phpt
deleted file mode 100644
index cf7a0e5d49..0000000000
--- a/ext/ldap/tests/ldap_get_option_error.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-ldap_get_option() - ldap_get_option() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-$option = null;
-
-// Too few parameters
-var_dump(ldap_get_option());
-var_dump(ldap_get_option($link));
-var_dump(ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION));
-
-// Too many parameters
-var_dump(
- ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option, "Additional data"),
- $option
-);
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_option() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_get_option() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_option() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_get_option() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_values_len_error.phpt b/ext/ldap/tests/ldap_get_values_len_error.phpt
index 8bcaee070f..8040dd6dab 100644
--- a/ext/ldap/tests/ldap_get_values_len_error.phpt
+++ b/ext/ldap/tests/ldap_get_values_len_error.phpt
@@ -15,11 +15,6 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
-// Too few parameters
-var_dump(ldap_get_values_len($link));
-var_dump(ldap_get_values_len($link, $entry));
-var_dump(ldap_get_values_len($link, $entry, "weirdAttribute", "Additional data"));
-
var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute"));
?>
===DONE===
@@ -31,15 +26,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
-Warning: ldap_get_values_len() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_values_len() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_get_values_len() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: ldap_get_values_len(): Cannot get the value(s) of attribute %s in %s on line %d
bool(false)
===DONE===
diff --git a/ext/ldap/tests/ldap_list_error.phpt b/ext/ldap/tests/ldap_list_error.phpt
deleted file mode 100644
index 817622e725..0000000000
--- a/ext/ldap/tests/ldap_list_error.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-ldap_list() - operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-include "connect.inc";
-
-$link = ldap_connect($host, $port);
-
-// Too few parameters
-var_dump(ldap_list());
-var_dump(ldap_list($link));
-var_dump(ldap_list($link, $link));
-
-// Too many parameters
-var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_list() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_list() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_list() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_list() expects at most 9 parameters, 10 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_add_error.phpt b/ext/ldap/tests/ldap_mod_add_error.phpt
index 4bfbaa5551..4cf5ae5725 100644
--- a/ext/ldap/tests/ldap_mod_add_error.phpt
+++ b/ext/ldap/tests/ldap_mod_add_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_mod_add());
-var_dump(ldap_mod_add($link));
-var_dump(ldap_mod_add($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_mod_add($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_mod_add($link, "dc=my-domain,$base", array()));
@@ -57,18 +49,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_mod_add() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_mod_add() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_mod_add() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_mod_add() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_mod_add(): Modify: No such object in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_mod_del_error.phpt b/ext/ldap/tests/ldap_mod_del_error.phpt
index 129d6472c1..1cdf18a0c5 100644
--- a/ext/ldap/tests/ldap_mod_del_error.phpt
+++ b/ext/ldap/tests/ldap_mod_del_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_mod_del());
-var_dump(ldap_mod_del($link));
-var_dump(ldap_mod_del($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_mod_del($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_mod_del($link, "dc=my-domain,$base", array()));
@@ -39,18 +31,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_mod_del() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_mod_del() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_mod_del() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_mod_del() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_mod_del(): Modify: No such object in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_mod_replace_error.phpt b/ext/ldap/tests/ldap_mod_replace_error.phpt
index 4f435b13d2..b920ebafad 100644
--- a/ext/ldap/tests/ldap_mod_replace_error.phpt
+++ b/ext/ldap/tests/ldap_mod_replace_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_mod_replace());
-var_dump(ldap_mod_replace($link));
-var_dump(ldap_mod_replace($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_mod_replace($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array()));
@@ -37,18 +29,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
?>
--EXPECTF--
-Warning: ldap_mod_replace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_mod_replace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_mod_replace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_mod_replace() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_mod_replace(): Modify: No such object in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_modify_batch_error.phpt b/ext/ldap/tests/ldap_modify_batch_error.phpt
index a2d9ef9deb..e1806fdf11 100644
--- a/ext/ldap/tests/ldap_modify_batch_error.phpt
+++ b/ext/ldap/tests/ldap_modify_batch_error.phpt
@@ -20,14 +20,6 @@ $addGivenName = array(
)
);
-// Too few parameters
-var_dump(ldap_modify_batch());
-var_dump(ldap_modify_batch($link));
-var_dump(ldap_modify_batch($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_modify_batch($link, "$base", $addGivenName, [], "Invalid additional parameter"));
-
// DN not found
var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName));
@@ -78,18 +70,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_modify_batch() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_modify_batch() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_modify_batch() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_modify_batch() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_modify_error.phpt b/ext/ldap/tests/ldap_modify_error.phpt
index 31069bb98c..4e10e77349 100644
--- a/ext/ldap/tests/ldap_modify_error.phpt
+++ b/ext/ldap/tests/ldap_modify_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_modify());
-var_dump(ldap_modify($link));
-var_dump(ldap_modify($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_modify($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_modify($link, "cn=not-found,$base", array()));
@@ -57,18 +49,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_modify() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_modify() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_modify() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_modify() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_modify(): Modify: No such object in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_next_attribute_error.phpt b/ext/ldap/tests/ldap_next_attribute_error.phpt
index 0bedf8c33f..9d668d9c1b 100644
--- a/ext/ldap/tests/ldap_next_attribute_error.phpt
+++ b/ext/ldap/tests/ldap_next_attribute_error.phpt
@@ -15,8 +15,6 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
var_dump(
- ldap_next_attribute($link),
- ldap_next_attribute($link, $link),
ldap_next_attribute($link, $entry)
);
?>
@@ -29,12 +27,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
-Warning: ldap_next_attribute() expects %s 2 parameters, 1 given in %s on line %d
-
-Warning: ldap_next_attribute(): supplied resource is not a valid ldap result entry resource in %s on line %d
-
Warning: ldap_next_attribute(): called before calling ldap_first_attribute() or no attributes found in result entry in %s on line %d
-NULL
-bool(false)
bool(false)
===DONE===
diff --git a/ext/ldap/tests/ldap_next_entry_error.phpt b/ext/ldap/tests/ldap_next_entry_error.phpt
deleted file mode 100644
index 59e9cdcab5..0000000000
--- a/ext/ldap/tests/ldap_next_entry_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_next_entry() - Testing ldap_next_entry() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_next_entry($link));
-var_dump(ldap_next_entry($link, $link, "Additional data"));
-var_dump(ldap_next_entry($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_next_entry() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_next_entry() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_next_entry(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_reference_error.phpt b/ext/ldap/tests/ldap_next_reference_error.phpt
deleted file mode 100644
index 0e47c5ef5c..0000000000
--- a/ext/ldap/tests/ldap_next_reference_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_next_reference() - Testing ldap_next_reference() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_next_reference($link));
-var_dump(ldap_next_reference($link, $link, "Additional data"));
-var_dump(ldap_next_reference($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_next_reference() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_next_reference() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_next_reference(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_reference_error.phpt b/ext/ldap/tests/ldap_parse_reference_error.phpt
deleted file mode 100644
index 9d180e717d..0000000000
--- a/ext/ldap/tests/ldap_parse_reference_error.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-ldap_parse_reference() - ldap_parse_reference() operations that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-$link = ldap_connect($host, $port);
-$refs = null;
-var_dump(
- ldap_parse_reference($link, $link),
- ldap_parse_reference($link, $link, $refs),
- ldap_parse_reference($link, $refs, $refs, "Additional data"),
- $refs
-);
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_parse_reference() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: ldap_parse_reference(): supplied resource is not a valid ldap result entry resource in %s on line %d
-
-Warning: ldap_parse_reference() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-bool(false)
-NULL
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_result_error.phpt b/ext/ldap/tests/ldap_parse_result_error.phpt
deleted file mode 100644
index 33f86f40b9..0000000000
--- a/ext/ldap/tests/ldap_parse_result_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-ldap_parse_result() - Testing ldap_parse_result() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-var_dump(ldap_parse_result(null, null));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_parse_result() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_read_error.phpt b/ext/ldap/tests/ldap_read_error.phpt
deleted file mode 100644
index 08f6280490..0000000000
--- a/ext/ldap/tests/ldap_read_error.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-ldap_read() - operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-include "connect.inc";
-
-$link = ldap_connect($host, $port);
-
-// Too few parameters
-var_dump(ldap_read());
-var_dump(ldap_read($link));
-var_dump(ldap_read($link, $link));
-
-// Too many parameters
-var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_read() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_read() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_read() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_read() expects at most 9 parameters, 10 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_read_variation1.phpt b/ext/ldap/tests/ldap_read_variation1.phpt
index 5d65814ec0..d5c731870c 100644
--- a/ext/ldap/tests/ldap_read_variation1.phpt
+++ b/ext/ldap/tests/ldap_read_variation1.phpt
@@ -7,7 +7,9 @@ if (!extension_loaded('ldap')) die('skip ldap extension not available');
--FILE--
<?php
$array = [123, 456, 789];
-@ldap_read(null, null, null, $array);
+try {
+ ldap_read(null, null, null, $array);
+} catch (TypeError $err) {}
var_dump($array);
?>
--EXPECT--
diff --git a/ext/ldap/tests/ldap_rename_error.phpt b/ext/ldap/tests/ldap_rename_error.phpt
index 8a580e5c34..57c2e03e71 100644
--- a/ext/ldap/tests/ldap_rename_error.phpt
+++ b/ext/ldap/tests/ldap_rename_error.phpt
@@ -10,12 +10,7 @@ Patrick Allaert <patrickallaert@php.net>
require "connect.inc";
$link = ldap_connect($host, $port);
-var_dump(ldap_rename($link));
var_dump(ldap_rename($link, "cn=userNotFound,$base", "cn=userZ", "$base", true));
?>
-===DONE===
---EXPECTF--
-Warning: ldap_rename() expects at least 5 parameters, 1 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_sasl_bind_error.phpt b/ext/ldap/tests/ldap_sasl_bind_error.phpt
index 180066bb2c..9feb912c7e 100644
--- a/ext/ldap/tests/ldap_sasl_bind_error.phpt
+++ b/ext/ldap/tests/ldap_sasl_bind_error.phpt
@@ -14,9 +14,6 @@ require "connect.inc";
$link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
-// Invalid parameter count
-var_dump(ldap_sasl_bind());
-
// Invalid DN
var_dump(ldap_sasl_bind($link, "Invalid DN", $passwd, 'DIGEST-MD5', 'realm', $sasl_user));
@@ -33,9 +30,6 @@ var_dump(ldap_sasl_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
?>
===DONE===
--EXPECTF--
-Warning: ldap_sasl_bind() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_search_error.phpt b/ext/ldap/tests/ldap_search_error.phpt
index 795edd3180..c2e9f32456 100644
--- a/ext/ldap/tests/ldap_search_error.phpt
+++ b/ext/ldap/tests/ldap_search_error.phpt
@@ -15,15 +15,9 @@ $link = ldap_connect($host, $port);
$dn = "dc=not-found,$base";
$filter = "(dc=*)";
-$result = ldap_search();
-var_dump($result);
-
$result = ldap_search($link, $dn, $filter);
var_dump($result);
-$result = ldap_search($link, $dn, $filter, NULL);
-var_dump($result);
-
$result = ldap_search($link, $dn, $filter, array(1 => 'top'));
var_dump($result);
@@ -38,15 +32,9 @@ var_dump($result);
?>
===DONE===
--EXPECTF--
-Warning: ldap_search() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
Warning: ldap_search(): Search: No such object in %s on line %d
bool(false)
-Warning: ldap_search() expects parameter 4 to be array, null given in %s on line %d
-NULL
-
Warning: ldap_search(): Array initialization wrong in %s on line %d
bool(false)
diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt
index 3ea49cbc7e..a67f972293 100644
--- a/ext/ldap/tests/ldap_set_option_error.phpt
+++ b/ext/ldap/tests/ldap_set_option_error.phpt
@@ -23,14 +23,6 @@ $controls = array(
"notanarray"
);
-// Too few parameters
-var_dump(ldap_set_option());
-var_dump(ldap_set_option($link));
-var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION));
-
-// Too many parameters
-var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3, "Additional data"));
-
var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 10));
foreach ($controls as $control)
@@ -40,17 +32,6 @@ var_dump(ldap_set_option($link, 999999, 999999));
?>
===DONE===
--EXPECTF--
-Warning: ldap_set_option() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_set_option() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_set_option() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_set_option() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
bool(false)
Warning: ldap_set_option(): Control must have an oid key in %s on line %d
diff --git a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
index c8c7985826..c00891b908 100644
--- a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
+++ b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
@@ -10,7 +10,7 @@ Patrick Allaert <patrickallaert@php.net>
die("skip ldap_set_rebind_proc() does not exist");
}
require "connect.inc";
- $link = fsockopen($host, $port);
+ $link = @fsockopen($host, $port);
if (!$link) {
die("skip no server listening");
}
@@ -33,18 +33,10 @@ function rebind_proc ($ds, $ldap_url) {
}
$link = ldap_connect($host, $port);
-var_dump(ldap_set_rebind_proc($link));
-var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data"));
var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent"));
?>
===DONE===
--EXPECTF--
-Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d
bool(false)
===DONE===
diff --git a/ext/ldap/tests/ldap_sort_basic.phpt b/ext/ldap/tests/ldap_sort_basic.phpt
deleted file mode 100644
index e14381f8c7..0000000000
--- a/ext/ldap/tests/ldap_sort_basic.phpt
+++ /dev/null
@@ -1,201 +0,0 @@
---TEST--
-ldap_sort() - Basic ldap_sort test
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link, $base);
-ldap_add($link, "cn=userC,$base", array(
- "objectclass" => "person",
- "cn" => "userC",
- "sn" => "zzz",
- "userPassword" => "oops",
- "description" => "a user",
-));
-ldap_add($link, "cn=userD,$base", array(
- "objectclass" => "person",
- "cn" => "userD",
- "sn" => "aaa",
- "userPassword" => "oops",
- "description" => "another user",
-));
-ldap_add($link, "cn=userE,$base", array(
- "objectclass" => "person",
- "cn" => "userE",
- "sn" => "a",
- "userPassword" => "oops",
- "description" => "yet another user",
-));
-$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description"));
-var_dump(
- ldap_sort($link, $result, "sn"),
- ldap_get_entries($link, $result)
-);
-?>
-===DONE===
---CLEAN--
-<?php
-include "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "cn=userC,$base");
-ldap_delete($link, "cn=userD,$base");
-ldap_delete($link, "cn=userE,$base");
-remove_dummy_data($link, $base);
-?>
---EXPECTF--
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-bool(true)
-array(7) {
- ["count"]=>
- int(6)
- [0]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(1) "a"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(16) "yet another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userE,%s"
- }
- [1]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "aaa"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(12) "another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userD,%s"
- }
- [2]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN1"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user A"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userA,%s"
- }
- [3]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN2"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user B"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userB,%s"
- }
- [4]=>
- array(4) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN3"
- }
- [0]=>
- string(2) "sn"
- ["count"]=>
- int(1)
- ["dn"]=>
- string(%d) "cn=userC,cn=userB,%s"
- }
- [5]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "zzz"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "a user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userC,%s"
- }
-}
-===DONE===
diff --git a/ext/ldap/tests/ldap_sort_error.phpt b/ext/ldap/tests/ldap_sort_error.phpt
deleted file mode 100644
index c41b56ab51..0000000000
--- a/ext/ldap/tests/ldap_sort_error.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-ldap_sort() - Testing ldap_sort() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_sort($link));
-var_dump(ldap_sort($link, $link));
-var_dump(ldap_sort($link, $link, $link, $link));
-var_dump(ldap_sort($link, $link, $link));
-var_dump(ldap_sort($link, $link, "sn"));
-?>
-===DONE===
---EXPECTF--
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects exactly 3 parameters, 1 given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects exactly 3 parameters, 2 given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects exactly 3 parameters, 4 given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects parameter 3 to be string, resource given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort(): Supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_sort_variation.phpt b/ext/ldap/tests/ldap_sort_variation.phpt
deleted file mode 100644
index bb121b63cb..0000000000
--- a/ext/ldap/tests/ldap_sort_variation.phpt
+++ /dev/null
@@ -1,201 +0,0 @@
---TEST--
-ldap_sort() - Basic ldap_sort test
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link, $base);
-ldap_add($link, "cn=userC,$base", array(
- "objectclass" => "person",
- "cn" => "userC",
- "sn" => "zzz",
- "userPassword" => "oops",
- "description" => "a user",
-));
-ldap_add($link, "cn=userD,$base", array(
- "objectclass" => "person",
- "cn" => "userD",
- "sn" => "aaa",
- "userPassword" => "oops",
- "description" => "another user",
-));
-ldap_add($link, "cn=userE,$base", array(
- "objectclass" => "person",
- "cn" => "userE",
- "sn" => "a",
- "userPassword" => "oops",
- "description" => "yet another user",
-));
-$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description"));
-var_dump(
- ldap_sort($link, $result, "description"),
- ldap_get_entries($link, $result)
-);
-?>
-===DONE===
---CLEAN--
-<?php
-include "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "cn=userC,$base");
-ldap_delete($link, "cn=userD,$base");
-ldap_delete($link, "cn=userE,$base");
-remove_dummy_data($link, $base);
-?>
---EXPECTF--
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-bool(true)
-array(7) {
- ["count"]=>
- int(6)
- [0]=>
- array(4) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN3"
- }
- [0]=>
- string(2) "sn"
- ["count"]=>
- int(1)
- ["dn"]=>
- string(%d) "cn=userC,cn=userB,%s"
- }
- [1]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "zzz"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "a user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userC,%s"
- }
- [2]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "aaa"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(12) "another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userD,%s"
- }
- [3]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN1"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user A"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userA,%s"
- }
- [4]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN2"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user B"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userB,%s"
- }
- [5]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(1) "a"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(16) "yet another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userE,%s"
- }
-}
-===DONE===
diff --git a/ext/ldap/tests/ldap_start_tls_error.phpt b/ext/ldap/tests/ldap_start_tls_error.phpt
deleted file mode 100644
index 686f5331a8..0000000000
--- a/ext/ldap/tests/ldap_start_tls_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_start_tls() - Binding that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
-
-// Invalid parameter count
-var_dump(ldap_start_tls());
-var_dump(ldap_start_tls($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_start_tls() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_start_tls() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_unbind_error.phpt b/ext/ldap/tests/ldap_unbind_error.phpt
deleted file mode 100644
index 85e586eb6f..0000000000
--- a/ext/ldap/tests/ldap_unbind_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-ldap_unbind() - ldap_unbind() operations that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-
-// Too few parameters
-var_dump(ldap_unbind());
-
-// Too many parameters
-var_dump(ldap_unbind($link, "Additional data"));
-
-// Bad parameter
-var_dump(ldap_unbind("string"));
-
-// unbind twice
-var_dump(ldap_unbind($link));
-var_dump(ldap_unbind($link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_unbind() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: ldap_unbind() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: ldap_unbind() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-bool(true)
-
-Warning: ldap_unbind(): supplied resource is not a valid ldap link resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index efccf0a407..9c6a51f5f8 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.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, |
@@ -43,6 +41,7 @@
#endif
#include "php_libxml.h"
+#include "libxml_arginfo.h"
#define PHP_LIBXML_ERROR 0
#define PHP_LIBXML_CTX_ERROR 1
@@ -91,33 +90,6 @@ static int php_libxml_post_deactivate(void);
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_set_streams_context, 0)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_use_internal_errors, 0, 0, 0)
- ZEND_ARG_INFO(0, use_errors)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_get_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_get_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_clear_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_disable_entity_loader, 0, 0, 0)
- ZEND_ARG_INFO(0, disable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_set_external_entity_loader, 0, 0, 1)
- ZEND_ARG_INFO(0, resolver_function)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ extension definition structures */
static const zend_function_entry libxml_functions[] = {
PHP_FE(libxml_set_streams_context, arginfo_libxml_set_streams_context)
@@ -1003,6 +975,10 @@ static PHP_FUNCTION(libxml_get_last_error)
{
xmlErrorPtr error;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
error = xmlGetLastError();
if (error) {
@@ -1034,6 +1010,10 @@ static PHP_FUNCTION(libxml_get_errors)
xmlErrorPtr error;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
if (LIBXML(error_list)) {
array_init(return_value);
@@ -1071,6 +1051,10 @@ static PHP_FUNCTION(libxml_get_errors)
Clear last error from libxml */
static PHP_FUNCTION(libxml_clear_errors)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
xmlResetLastError();
if (LIBXML(error_list)) {
zend_llist_clean(LIBXML(error_list));
diff --git a/ext/libxml/libxml.stub.php b/ext/libxml/libxml.stub.php
new file mode 100644
index 0000000000..0e02c39deb
--- /dev/null
+++ b/ext/libxml/libxml.stub.php
@@ -0,0 +1,17 @@
+<?php
+
+/** @param resource $context */
+function libxml_set_streams_context($context): void {}
+
+function libxml_use_internal_errors(bool $use_errors = UNKNOWN): bool {}
+
+/** @return LibXMLError|false */
+function libxml_get_last_error() {}
+
+function libxml_get_errors(): array {}
+
+function libxml_clear_errors(): void {}
+
+function libxml_disable_entity_loader(bool $disable = true): bool {}
+
+function libxml_set_external_entity_loader(?callable $resolver_function): bool {}
diff --git a/ext/libxml/libxml_arginfo.h b/ext/libxml/libxml_arginfo.h
new file mode 100644
index 0000000000..de111273d8
--- /dev/null
+++ b/ext/libxml/libxml_arginfo.h
@@ -0,0 +1,26 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_streams_context, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_use_internal_errors, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, use_errors, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_get_last_error, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_get_errors, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_clear_errors, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_disable_entity_loader, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, disable, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_external_entity_loader, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, resolver_function, IS_CALLABLE, 1)
+ZEND_END_ARG_INFO()
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index cf936e95de..f913f956d5 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.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/ext/libxml/tests/001.phpt b/ext/libxml/tests/001.phpt
index b636ab7adc..9d25b0d3f4 100644
--- a/ext/libxml/tests/001.phpt
+++ b/ext/libxml/tests/001.phpt
@@ -1,14 +1,13 @@
--TEST--
libxml_use_internal_errors()
--SKIPIF--
-<?php if (!extension_loaded('libxml')) die('skip'); ?>
+<?php if (!extension_loaded('libxml')) die('skip libxml extension not available'); ?>
--FILE--
<?php
var_dump(libxml_use_internal_errors(false));
var_dump(libxml_use_internal_errors(true));
var_dump(libxml_use_internal_errors());
-var_dump(libxml_use_internal_errors(new stdclass));
var_dump(libxml_get_errors());
var_dump(libxml_get_last_error());
@@ -17,13 +16,10 @@ var_dump(libxml_clear_errors());
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
bool(true)
-
-Warning: libxml_use_internal_errors() expects parameter 1 to be bool, object given in %s001.php on line 6
-NULL
array(0) {
}
bool(false)
diff --git a/ext/libxml/tests/002.phpt b/ext/libxml/tests/002.phpt
index f803d7ab1b..75011462f3 100644
--- a/ext/libxml/tests/002.phpt
+++ b/ext/libxml/tests/002.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_get_errors()
--SKIPIF--
-<?php if (!extension_loaded('simplexml')) die('skip'); ?>
+<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not available'); ?>
--FILE--
<?php
diff --git a/ext/libxml/tests/003.phpt b/ext/libxml/tests/003.phpt
index c168785647..b7edac6751 100644
--- a/ext/libxml/tests/003.phpt
+++ b/ext/libxml/tests/003.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_use_internal_errors() memory leaks
--SKIPIF--
-<?php if (!extension_loaded('simplexml')) die('skip'); ?>
+<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not available'); ?>
--FILE--
<?php
var_dump(libxml_use_internal_errors(true));
diff --git a/ext/libxml/tests/004.phpt b/ext/libxml/tests/004.phpt
index f222071abe..d02fba2f6c 100644
--- a/ext/libxml/tests/004.phpt
+++ b/ext/libxml/tests/004.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_streams_context()
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
@@ -18,7 +18,11 @@ $ctxs = array(
foreach ($ctxs as $ctx) {
- var_dump(libxml_set_streams_context($ctx));
+ try {
+ var_dump(libxml_set_streams_context($ctx));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$dom = new DOMDocument();
var_dump($dom->load(__DIR__.'/test.xml'));
}
@@ -28,25 +32,15 @@ echo "Done\n";
?>
--EXPECTF--
Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line %d
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, null given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, string given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, int given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, int given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, object given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, array given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, array given
bool(true)
NULL
bool(true)
diff --git a/ext/libxml/tests/bug42112.phpt b/ext/libxml/tests/bug42112.phpt
index b5a3f40b3e..a1b8871342 100644
--- a/ext/libxml/tests/bug42112.phpt
+++ b/ext/libxml/tests/bug42112.phpt
@@ -1,7 +1,7 @@
--TEST--
Bug #42112 (deleting a node produces memory corruption)
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$xml = <<<EOXML
diff --git a/ext/libxml/tests/bug61367-read.phpt b/ext/libxml/tests/bug61367-read.phpt
index b4ecaa0324..f82ecf138a 100644
--- a/ext/libxml/tests/bug61367-read.phpt
+++ b/ext/libxml/tests/bug61367-read.phpt
@@ -1,10 +1,9 @@
--TEST--
Bug #61367: open_basedir bypass in libxml RSHUTDOWN: read test
--SKIPIF--
-<?php if(!extension_loaded('dom')) echo 'skip'; ?>
+<?php if(!extension_loaded('dom')) echo 'skip dom extension not available'; ?>
--INI--
open_basedir=.
-error_reporting=E_ALL & ~E_NOTICE
--FILE--
<?php
/*
@@ -58,3 +57,7 @@ Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "f
Warning: DOMDocument::loadXML(): Failure to process entity file in Entity, line: 4 in %s on line %d
Warning: DOMDocument::loadXML(): Entity 'file' not defined in Entity, line: 4 in %s on line %d
+
+Warning: Trying to get property 'firstChild' of non-object in %s on line %d
+
+Warning: Trying to get property 'nodeValue' of non-object in %s on line %d
diff --git a/ext/libxml/tests/bug61367-write.phpt b/ext/libxml/tests/bug61367-write.phpt
index 155c9aba9d..5da63d0b71 100644
--- a/ext/libxml/tests/bug61367-write.phpt
+++ b/ext/libxml/tests/bug61367-write.phpt
@@ -1,7 +1,7 @@
--TEST--
Bug #61367: open_basedir bypass in libxml RSHUTDOWN: write test
--SKIPIF--
-<?php if(!extension_loaded('dom')) echo 'skip'; ?>
+<?php if(!extension_loaded('dom')) echo 'skip dom extension not available'; ?>
--INI--
open_basedir=.
--FILE--
diff --git a/ext/libxml/tests/bug63389.phpt b/ext/libxml/tests/bug63389.phpt
index e9498aae08..92c3e83567 100644
--- a/ext/libxml/tests/bug63389.phpt
+++ b/ext/libxml/tests/bug63389.phpt
@@ -1,14 +1,18 @@
--TEST--
Bug #63389 (Missing context check on libxml_set_streams_context() causes memleak)
--SKIPIF--
-<?php if (!extension_loaded('libxml')) die('skip'); ?>
+<?php if (!extension_loaded('libxml')) die('skip libxml extension not available'); ?>
--FILE--
<?php
$fp = fopen("php://input", "r");
libxml_set_streams_context($fp);
-libxml_set_streams_context("a");
+try {
+ libxml_set_streams_context("a");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "okey";
?>
---EXPECTF--
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %sbug63389.php on line %d
+--EXPECT--
+libxml_set_streams_context() expects parameter 1 to be resource, string given
okey
diff --git a/ext/libxml/tests/bug76777.phpt b/ext/libxml/tests/bug76777.phpt
index ce111178f3..5e15024b81 100644
--- a/ext/libxml/tests/bug76777.phpt
+++ b/ext/libxml/tests/bug76777.phpt
@@ -2,7 +2,7 @@
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
--SKIPIF--
<?php
-if (!extension_loaded('libxml')) die('skip');
+if (!extension_loaded('libxml')) die('skip libxml extension not available');
if (!extension_loaded('dom')) die('skip dom extension not available');
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
?>
diff --git a/ext/libxml/tests/libxml_disable_entity_loader.phpt b/ext/libxml/tests/libxml_disable_entity_loader.phpt
index 6477543fb2..7633a889f3 100644
--- a/ext/libxml/tests/libxml_disable_entity_loader.phpt
+++ b/ext/libxml/tests/libxml_disable_entity_loader.phpt
@@ -1,7 +1,10 @@
--TEST--
libxml_disable_entity_loader()
--SKIPIF--
-<?php if (!extension_loaded('libxml') || !extension_loaded('dom') || defined('PHP_WINDOWS_VERSION_MAJOR')) die('skip'); ?>
+<?php
+if (!extension_loaded('libxml')) die('skip libxml extension not available');
+if (!extension_loaded('dom')) die('skip dom extension not available');
+if (defined('PHP_WINDOWS_VERSION_MAJOR')) die('skip not for Windows'); ?>
--FILE--
<?php
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
index 938229ff86..b530276016 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() basic test
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$xml = <<<XML
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
index 40b31ea85d..f47d7e948f 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() error: bad arguments
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$xml = <<<XML
@@ -12,10 +12,6 @@ XML;
$dd = new DOMDocument;
$r = $dd->loadXML($xml);
-var_dump(libxml_set_external_entity_loader([]));
-var_dump(libxml_set_external_entity_loader());
-var_dump(libxml_set_external_entity_loader(function() {}, 2));
-
var_dump(libxml_set_external_entity_loader(function($a, $b, $c, $d) {}));
try {
var_dump($dd->validate());
@@ -25,14 +21,6 @@ try {
echo "Done.\n";
--EXPECTF--
-Warning: libxml_set_external_entity_loader() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
-Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
bool(true)
Warning: DOMDocument::validate(): Could not load the external subset "http://example.com/foobar" in %s on line %d
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt
index d65f77e9f8..02f984f9bc 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() variation: resolve externals and entities
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
chdir(__DIR__);
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
index e51869cf47..8b909c1567 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() variation: restore original handler; returning NULL
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--CLEAN--
<?php
@unlink(__DIR__ . "/foobar.dtd");
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index c57e2b6be1..9651d21131 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.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/ext/mbstring/mb_gpc.h b/ext/mbstring/mb_gpc.h
index b83bf411aa..07c5d1137f 100644
--- a/ext/mbstring/mb_gpc.h
+++ b/ext/mbstring/mb_gpc.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/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index a18d237df2..7741629702 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.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, |
@@ -77,6 +75,7 @@ onig_match(re, str, end, at, region, option)
#endif
#include "zend_multibyte.h"
+#include "mbstring_arginfo.h"
/* }}} */
#if HAVE_MBSTRING
@@ -183,356 +182,6 @@ static const php_mb_nls_ident_list php_mb_default_identify_list[] = {
/* }}} */
-/* {{{ mb_overload_def mb_ovld[] */
-static const struct mb_overload_def mb_ovld[] = {
- {MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"},
- {MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"},
- {MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strpos"},
- {MB_OVERLOAD_STRING, "strrpos", "mb_strrpos", "mb_orig_strrpos"},
- {MB_OVERLOAD_STRING, "stripos", "mb_stripos", "mb_orig_stripos"},
- {MB_OVERLOAD_STRING, "strripos", "mb_strripos", "mb_orig_strripos"},
- {MB_OVERLOAD_STRING, "strstr", "mb_strstr", "mb_orig_strstr"},
- {MB_OVERLOAD_STRING, "strrchr", "mb_strrchr", "mb_orig_strrchr"},
- {MB_OVERLOAD_STRING, "stristr", "mb_stristr", "mb_orig_stristr"},
- {MB_OVERLOAD_STRING, "substr", "mb_substr", "mb_orig_substr"},
- {MB_OVERLOAD_STRING, "strtolower", "mb_strtolower", "mb_orig_strtolower"},
- {MB_OVERLOAD_STRING, "strtoupper", "mb_strtoupper", "mb_orig_strtoupper"},
- {MB_OVERLOAD_STRING, "substr_count", "mb_substr_count", "mb_orig_substr_count"},
- {0, NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0)
- ZEND_ARG_INFO(0, language)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_internal_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_input, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_output, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_order, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substitute_character, 0, 0, 0)
- ZEND_ARG_INFO(0, substchar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 1)
- ZEND_ARG_INFO(0, encoded_string)
- ZEND_ARG_INFO(1, result)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_output_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, contents)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_str_split, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, split_length)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strlen, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_stripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strstr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrchr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_stristr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrichr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substr_count, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strcut, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strwidth, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strimwidth, 0, 0, 3)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, width)
- ZEND_ARG_INFO(0, trimmarker)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_encoding, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, from)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_case, 0, 0, 2)
- ZEND_ARG_INFO(0, sourcestring)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strtoupper, 0, 0, 1)
- ZEND_ARG_INFO(0, sourcestring)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strtolower, 0, 0, 1)
- ZEND_ARG_INFO(0, sourcestring)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_encoding, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding_list)
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mb_list_encodings, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encoding_aliases, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_mimeheader, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, charset)
- ZEND_ARG_INFO(0, transfer)
- ZEND_ARG_INFO(0, linefeed)
- ZEND_ARG_INFO(0, indent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_decode_mimeheader, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_kana, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_variables, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, from)
- ZEND_ARG_VARIADIC_INFO(1, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_numericentity, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, convmap)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, is_hex)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_decode_numericentity, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, convmap)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, is_hex)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_send_mail, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, additional_headers)
- ZEND_ARG_INFO(0, additional_parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_get_info, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_check_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_scrub, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ord, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_chr, 0, 0, 1)
- ZEND_ARG_INFO(0, cp)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-#if HAVE_MBREGEX
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, registers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_eregi, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, registers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, replacement)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_eregi_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, replacement)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_replace_callback, 0, 0, 3)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_split, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_match, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search, 0, 0, 0)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_pos, 0, 0, 0)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_regs, 0, 0, 0)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_init, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mb_ereg_search_getregs, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mb_ereg_search_getpos, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_setpos, 0, 0, 1)
- ZEND_ARG_INFO(0, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_set_options, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-#endif /* HAVE_MBREGEX */
-/* }}} */
-
/* {{{ zend_function_entry mbstring_functions[] */
static const zend_function_entry mbstring_functions[] = {
PHP_FE(mb_convert_case, arginfo_mb_convert_case)
@@ -1481,8 +1130,6 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals)
PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
- STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
- PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals)
STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0",
PHP_INI_SYSTEM | PHP_INI_PERDIR,
@@ -1504,7 +1151,7 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-static void mbstring_internal_encoding_changed_hook() {
+static void mbstring_internal_encoding_changed_hook(void) {
/* One of the internal_encoding / input_encoding / output_encoding ini settings changed. */
if (!MBSTRG(internal_encoding_set)) {
const char *encoding = php_get_internal_encoding();
@@ -1552,7 +1199,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
mbstring_globals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
mbstring_globals->current_filter_illegal_substchar = 0x3f; /* '?' */
mbstring_globals->illegalchars = 0;
- mbstring_globals->func_overload = 0;
mbstring_globals->encoding_translation = 0;
mbstring_globals->strict_detection = 0;
mbstring_globals->outconv = NULL;
@@ -1609,10 +1255,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
sapi_register_post_entries(mbstr_post_entries);
}
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT);
-
REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT);
@@ -1638,39 +1280,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
php_mb_rfc1867_getword_conf,
php_mb_rfc1867_basename);
- /* override original function (deprecated). */
- if (MBSTRG(func_overload)){
- zend_function *func, *orig;
- const struct mb_overload_def *p;
- zend_string *str;
-
- p = &(mb_ovld[0]);
- while (p->type > 0) {
- if ((MBSTRG(func_overload) & p->type) == p->type &&
- !zend_hash_str_exists(CG(function_table), p->save_func, strlen(p->save_func))
- ) {
- func = zend_hash_str_find_ptr(CG(function_table), p->ovld_func, strlen(p->ovld_func));
-
- if ((orig = zend_hash_str_find_ptr(CG(function_table), p->orig_func, strlen(p->orig_func))) == NULL) {
- php_error_docref("ref.mbstring", E_WARNING, "mbstring couldn't find function %s.", p->orig_func);
- return FAILURE;
- } else {
- ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION);
- str = zend_string_init_interned(p->save_func, strlen(p->save_func), 1);
- zend_hash_add_mem(CG(function_table), str, orig, sizeof(zend_internal_function));
- zend_string_release_ex(str, 1);
- function_add_ref(orig);
-
- str = zend_string_init_interned(p->orig_func, strlen(p->orig_func), 1);
- zend_hash_update_mem(CG(function_table), str, func, sizeof(zend_internal_function));
- zend_string_release_ex(str, 1);
- function_add_ref(func);
- }
- }
- p++;
- }
- }
-
return SUCCESS;
}
/* }}} */
@@ -1678,24 +1287,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
/* {{{ PHP_MSHUTDOWN_FUNCTION(mbstring) */
PHP_MSHUTDOWN_FUNCTION(mbstring)
{
- /* clear overloaded function. */
- if (MBSTRG(func_overload)){
- const struct mb_overload_def *p;
- zend_function *orig;
-
- p = &(mb_ovld[0]);
- while (p->type > 0) {
- if ((MBSTRG(func_overload) & p->type) == p->type &&
- (orig = zend_hash_str_find_ptr(CG(function_table), p->save_func, strlen(p->save_func)))) {
-
- zend_hash_str_update_mem(CG(function_table), p->orig_func, strlen(p->orig_func), orig, sizeof(zend_internal_function));
- function_add_ref(orig);
- zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func));
- }
- p++;
- }
- }
-
UNREGISTER_INI_ENTRIES();
zend_multibyte_restore_functions();
@@ -1722,12 +1313,6 @@ PHP_RINIT_FUNCTION(mbstring)
php_mb_populate_current_detect_order_list();
- /* override original function. */
- if (MBSTRG(func_overload)){
- zend_error(E_DEPRECATED, "The mbstring.func_overload directive is deprecated");
-
- CG(compiler_options) |= ZEND_COMPILE_NO_BUILTIN_STRLEN;
- }
#if HAVE_MBREGEX
PHP_RINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
#endif
@@ -2148,26 +1733,24 @@ PHP_FUNCTION(mb_preferred_mime_name)
#define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0)
#define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0)
-/* {{{ proto bool mb_parse_str(string encoded_string [, array result])
+/* {{{ proto bool mb_parse_str(string encoded_string, array &result)
Parses GET/POST/COOKIE data and sets global variables */
PHP_FUNCTION(mb_parse_str)
{
- zval *track_vars_array = NULL;
- char *encstr = NULL;
+ zval *track_vars_array;
+ char *encstr;
size_t encstr_len;
php_mb_encoding_handler_info_t info;
const mbfl_encoding *detected;
track_vars_array = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &encstr, &encstr_len, &track_vars_array) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &encstr, &encstr_len, &track_vars_array) == FAILURE) {
return;
}
- if (track_vars_array != NULL) {
- track_vars_array = zend_try_array_init(track_vars_array);
- if (!track_vars_array) {
- return;
- }
+ track_vars_array = zend_try_array_init(track_vars_array);
+ if (!track_vars_array) {
+ return;
}
encstr = estrndup(encstr, encstr_len);
@@ -2181,22 +1764,7 @@ PHP_FUNCTION(mb_parse_str)
info.num_from_encodings = MBSTRG(http_input_list_size);
info.from_language = MBSTRG(language);
- if (track_vars_array != NULL) {
- detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr);
- } else {
- zval tmp;
- zend_array *symbol_table;
- if (zend_forbid_dynamic_call("mb_parse_str() with a single argument") == FAILURE) {
- efree(encstr);
- return;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Calling mb_parse_str() without the result argument is deprecated");
-
- symbol_table = zend_rebuild_symbol_table();
- ZVAL_ARR(&tmp, symbol_table);
- detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr);
- }
+ detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr);
MBSTRG(http_input_identify) = detected;
@@ -2980,11 +2548,6 @@ PHP_FUNCTION(mb_substr)
real_len = 0;
}
- if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING)
- && (real_from > mbfl_strlen(&string))) {
- RETURN_FALSE;
- }
-
ret = mbfl_substr(&string, &result, real_from, real_len);
if (NULL == ret) {
RETURN_FALSE;
@@ -4068,14 +3631,20 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
{
char *str, *encoding = NULL;
size_t str_len, encoding_len;
- zval *zconvmap, *hash_entry;
+ zval *hash_entry;
HashTable *target_hash;
int i, *convmap, *mapelm, mapsize=0;
zend_bool is_hex = 0;
mbfl_string string, result, *ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|sb", &str, &str_len, &zconvmap, &encoding, &encoding_len, &is_hex) == FAILURE) {
- return;
+ if (type == 0) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sh|sb", &str, &str_len, &target_hash, &encoding, &encoding_len, &is_hex) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sh|s", &str, &str_len, &target_hash, &encoding, &encoding_len) == FAILURE) {
+ return;
+ }
}
string.no_language = MBSTRG(language);
@@ -4097,23 +3666,18 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
}
/* conversion map */
- convmap = NULL;
- if (Z_TYPE_P(zconvmap) == IS_ARRAY) {
- target_hash = Z_ARRVAL_P(zconvmap);
- i = zend_hash_num_elements(target_hash);
- if (i > 0) {
- convmap = (int *)safe_emalloc(i, sizeof(int), 0);
- mapelm = convmap;
- mapsize = 0;
- ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
- *mapelm++ = zval_get_long(hash_entry);
- mapsize++;
- } ZEND_HASH_FOREACH_END();
- }
- }
- if (convmap == NULL) {
- RETURN_FALSE;
+ i = zend_hash_num_elements(target_hash);
+ if (i % 4 != 0) {
+ zend_value_error("count($convmap) must be a multiple of 4");
+ return;
}
+ convmap = (int *)safe_emalloc(i, sizeof(int), 0);
+ mapelm = convmap;
+ mapsize = 0;
+ ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
+ *mapelm++ = zval_get_long(hash_entry);
+ mapsize++;
+ } ZEND_HASH_FOREACH_END();
mapsize /= 4;
ret = mbfl_html_numeric_entity(&string, &result, convmap, mapsize, type);
@@ -4626,8 +4190,7 @@ PHP_FUNCTION(mb_get_info)
size_t typ_len;
size_t n;
char *name;
- const struct mb_overload_def *over_func;
- zval row1, row2;
+ zval row;
const mbfl_language *lang = mbfl_no2language(MBSTRG(language));
const mbfl_encoding **entry;
@@ -4649,20 +4212,6 @@ PHP_FUNCTION(mb_get_info)
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
add_assoc_string(return_value, "http_output_conv_mimetypes", name);
}
- add_assoc_long(return_value, "func_overload", MBSTRG(func_overload));
- if (MBSTRG(func_overload)){
- over_func = &(mb_ovld[0]);
- array_init(&row1);
- while (over_func->type > 0) {
- if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) {
- add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func);
- }
- over_func++;
- }
- add_assoc_zval(return_value, "func_overload_list", &row1);
- } else {
- add_assoc_string(return_value, "func_overload_list", "no overload");
- }
if (lang != NULL) {
if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) {
add_assoc_string(return_value, "mail_charset", name);
@@ -4687,12 +4236,12 @@ PHP_FUNCTION(mb_get_info)
entry = MBSTRG(current_detect_order_list);
if (n > 0) {
size_t i;
- array_init(&row2);
+ array_init(&row);
for (i = 0; i < n; i++) {
- add_next_index_string(&row2, (*entry)->name);
+ add_next_index_string(&row, (*entry)->name);
entry++;
}
- add_assoc_zval(return_value, "detect_order", &row2);
+ add_assoc_zval(return_value, "detect_order", &row);
}
if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
add_assoc_string(return_value, "substitute_character", "none");
@@ -4724,21 +4273,6 @@ PHP_FUNCTION(mb_get_info)
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
RETVAL_STRING(name);
}
- } else if (!strcasecmp("func_overload", typ)) {
- RETVAL_LONG(MBSTRG(func_overload));
- } else if (!strcasecmp("func_overload_list", typ)) {
- if (MBSTRG(func_overload)){
- over_func = &(mb_ovld[0]);
- array_init(return_value);
- while (over_func->type > 0) {
- if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) {
- add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func);
- }
- over_func++;
- }
- } else {
- RETVAL_STRING("no overload");
- }
} else if (!strcasecmp("mail_charset", typ)) {
if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) {
RETVAL_STRING(name);
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
index eb2d0bce3f..1928030381 100644
--- a/ext/mbstring/mbstring.h
+++ b/ext/mbstring/mbstring.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, |
@@ -153,7 +151,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring)
int filter_illegal_substchar;
int current_filter_illegal_mode;
int current_filter_illegal_substchar;
- zend_long func_overload;
enum mbfl_no_language language;
zend_bool encoding_translation;
zend_bool strict_detection;
@@ -175,17 +172,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring)
#endif
ZEND_END_MODULE_GLOBALS(mbstring)
-#define MB_OVERLOAD_MAIL 1
-#define MB_OVERLOAD_STRING 2
-#define MB_OVERLOAD_REGEX 4
-
-struct mb_overload_def {
- int type;
- char *orig_func;
- char *ovld_func;
- char *save_func;
-};
-
#define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v)
#if defined(ZTS) && defined(COMPILE_DL_MBSTRING)
diff --git a/ext/mbstring/mbstring.stub.php b/ext/mbstring/mbstring.stub.php
new file mode 100644
index 0000000000..ed017a3fa2
--- /dev/null
+++ b/ext/mbstring/mbstring.stub.php
@@ -0,0 +1,179 @@
+<?php
+
+/** @return string|false */
+function mb_language(string $language = UNKNOWN) {}
+
+/** @return string|false */
+function mb_internal_encoding(string $encoding = UNKNOWN) {}
+
+/** @return array|string|false */
+function mb_http_input(string $type = UNKNOWN) {}
+
+/** @return string|false */
+function mb_http_output(string $encoding = UNKNOWN) {}
+
+/** @return array|bool */
+function mb_detect_order($encoding = UNKNOWN) {}
+
+/** @return string|int|bool */
+function mb_substitute_character($substchar = UNKNOWN) {}
+
+/** @return string|false */
+function mb_preferred_mime_name(string $encoding) {}
+
+function mb_parse_str(string $encoded_string, &$result): bool {}
+
+function mb_output_handler(string $contents, int $status): string {}
+
+/** @return array|false */
+function mb_str_split(string $str, int $split_length = 1, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_strlen(string $str, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_strpos(string $haystack, string $needle, int $offset = 0, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_strrpos(string $haystack, string $needle, $offset = UNBEK, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_stripos(string $haystack, string $needle, int $offset = 0, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_strripos(string $haystack, string $needle, int $offset = 0, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_strstr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_strrchr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_stristr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_strrichr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_substr_count(string $haystack, string $needle, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_substr(string $str, int $start, ?int $length = null, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_strcut(string $str, int $start, ?int $length = null, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_strwidth(string $str, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_strimwidth(string $str, int $start, int $width, string $trimmarker = UNKNOWN, string $encoding = UNKNOWN) {}
+
+/**
+ * @param array|string $str
+ * @return array|string|false
+ */
+function mb_convert_encoding($str, string $to, $from = UNKNOWN) {}
+
+/** @return string|false */
+function mb_convert_case(string $sourcestring, int $mode, ?string $encoding = null) {}
+
+/** @return string|false */
+function mb_strtoupper(string $sourcestring, ?string $encoding = null) {}
+
+/** @return string|false */
+function mb_strtolower(string $sourcestring, ?string $encoding = null) {}
+
+/**
+ * @param array|string $encoding_list
+ * @return string|false
+ */
+function mb_detect_encoding(string $str, $encoding_list = null, bool $strict = false) {}
+
+function mb_list_encodings(): array {}
+
+/** @return array|false */
+function mb_encoding_aliases(string $encoding) {}
+
+/** @return string|false */
+function mb_encode_mimeheader(string $str, string $charset = UNKNOWN, string $transfer = UNKNOWN, string $linefeed = UNKNOWN, int $indent = 0) {}
+
+/** @return string|false */
+function mb_decode_mimeheader(string $string) {}
+
+/** @return string|false */
+function mb_convert_kana(string $str, string $option = UNKNOWN, string $encoding = UNKNOWN) {}
+
+/**
+ * @param array|string $from
+ * @return string|false
+ */
+function mb_convert_variables(string $to, $from, &$var, &...$vars) {}
+
+/** @return string|false */
+function mb_encode_numericentity(string $string, array $convmap, string $encoding = UNKNOWN, bool $is_hex = false) {}
+
+/** @return string|false */
+function mb_decode_numericentity(string $string, array $convmap, string $encoding = UNKNOWN) {}
+
+function mb_send_mail(string $to, string $subject, string $message, $additional_headers = UNKNOWN, string $additional_parameters = UNKNOWN): bool {}
+
+/** @return array|string|int|false */
+function mb_get_info(string $type = UNKNOWN) {}
+
+function mb_check_encoding($var = UNBEK, string $encoding = UNKNOWN): bool {}
+
+/** @return string|false */
+function mb_scrub(string $str, string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_ord(string $str, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function mb_chr(int $cp, string $encoding = UNKNOWN) {}
+
+#if HAVE_MBREGEX
+/** @return string|bool */
+function mb_regex_encoding(string $encoding = UNKNOWN) {}
+
+/** @return int|false */
+function mb_ereg(string $pattern, string $string, &$registers = UNKNOWN) {}
+
+/** @return int|false */
+function mb_eregi(string $pattern, string $string, &$registers = UNKNOWN) {}
+
+/** @return string|false|null */
+function mb_ereg_replace(string $pattern, string $replacement, string $string, string $option = UNKNOWN) {}
+
+/** @return string|false|null */
+function mb_eregi_replace(string $pattern, string $replacement, string $string, string $option = UNKNOWN) {}
+
+/** @return string|false|null */
+function mb_ereg_replace_callback(string $pattern, callable $callback, string $string, string $option = UNKNOWN) {}
+
+/** @return array|false */
+function mb_split(string $pattern, string $string, int $limit = -1) {}
+
+function mb_ereg_match(string $pattern, string $string, string $option = UNKNOWN): bool {}
+
+/** @return array|bool */
+function mb_ereg_search(string $pattern = UNKNOWN, string $option = UNKNOWN) {}
+
+/** @return array|bool */
+function mb_ereg_search_pos(string $pattern = UNKNOWN, string $option = UNKNOWN) {}
+
+/** @return array|bool */
+function mb_ereg_search_regs(string $pattern = UNKNOWN, string $option = UNKNOWN) {}
+
+function mb_ereg_search_init(string $string, string $pattern = UNKNOWN, string $option = UNKNOWN): bool {}
+
+/** @return array|false */
+function mb_ereg_search_getregs() {}
+
+function mb_ereg_search_getpos(): int {}
+
+function mb_ereg_search_setpos(int $position): bool {}
+
+function mb_regex_set_options(string $options = UNKNOWN): string {}
+#endif
diff --git a/ext/mbstring/mbstring_arginfo.h b/ext/mbstring/mbstring_arginfo.h
new file mode 100644
index 0000000000..6697236c8b
--- /dev/null
+++ b/ext/mbstring/mbstring_arginfo.h
@@ -0,0 +1,297 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_internal_encoding, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_input, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_http_output arginfo_mb_internal_encoding
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_order, 0, 0, 0)
+ ZEND_ARG_INFO(0, encoding)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substitute_character, 0, 0, 0)
+ ZEND_ARG_INFO(0, substchar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_parse_str, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_INFO(1, result)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_output_handler, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contents, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_str_split, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, split_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strlen, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strpos, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrpos, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_stripos arginfo_mb_strpos
+
+#define arginfo_mb_strripos arginfo_mb_strpos
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strstr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, part, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_strrchr arginfo_mb_strstr
+
+#define arginfo_mb_stristr arginfo_mb_strstr
+
+#define arginfo_mb_strrichr arginfo_mb_strstr
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substr_count, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_strcut arginfo_mb_substr
+
+#define arginfo_mb_strwidth arginfo_mb_strlen
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strimwidth, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, trimmarker, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_encoding, 0, 0, 2)
+ ZEND_ARG_INFO(0, str)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_INFO(0, from)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_case, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, sourcestring, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strtoupper, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, sourcestring, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_strtolower arginfo_mb_strtoupper
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_encoding, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_INFO(0, encoding_list)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_list_encodings, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_encoding_aliases arginfo_mb_preferred_mime_name
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_mimeheader, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, transfer, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, linefeed, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, indent, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_decode_mimeheader, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_kana, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_variables, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_INFO(0, from)
+ ZEND_ARG_INFO(1, var)
+ ZEND_ARG_VARIADIC_INFO(1, vars)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_numericentity, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, convmap, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_hex, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_decode_numericentity, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, convmap, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_send_mail, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_INFO(0, additional_headers)
+ ZEND_ARG_TYPE_INFO(0, additional_parameters, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_get_info arginfo_mb_http_input
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_check_encoding, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, var)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_scrub arginfo_mb_strlen
+
+#define arginfo_mb_ord arginfo_mb_strlen
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_chr, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, cp, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_encoding, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_INFO(1, registers)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_eregi arginfo_mb_ereg
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_replace, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, replacement, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_eregi_replace arginfo_mb_ereg_replace
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_replace_callback, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_split, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_match, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_ereg_search_pos arginfo_mb_ereg_search
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_ereg_search_regs arginfo_mb_ereg_search
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_search_init, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_getregs, 0, 0, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_search_getpos, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_search_setpos, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, position, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_regex_set_options, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 366aad23cf..45f84e69f1 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.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, |
@@ -889,17 +887,17 @@ static int _php_mb_onig_search(regex_t* reg, const OnigUChar* str, const OnigUCh
/* {{{ _php_mb_regex_ereg_exec */
static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
- zval *arg_pattern, *array = NULL;
- char *string;
- size_t string_len;
+ zval *array = NULL;
+ char *arg_pattern, *string;
+ size_t arg_pattern_len, string_len;
php_mb_regex_t *re;
OnigRegion *regs = NULL;
int i, match_len, beg, end;
OnigOptionType options;
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|z", &arg_pattern, &string, &string_len, &array) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &arg_pattern, &arg_pattern_len, &string, &string_len, &array) == FAILURE) {
+ return;
}
if (array != NULL) {
@@ -922,25 +920,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
options |= ONIG_OPTION_IGNORECASE;
}
- /* compile the regular expression from the supplied regex */
- if (Z_TYPE_P(arg_pattern) != IS_STRING) {
- /* we convert numbers to integers and treat them as a string */
- if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) {
- convert_to_long_ex(arg_pattern); /* get rid of decimal places */
- }
- if (!try_convert_to_string(arg_pattern)) {
- return;
- }
- /* don't bother doing an extended regex with just a number */
- }
-
- if (Z_STRLEN_P(arg_pattern) == 0) {
+ if (arg_pattern_len == 0) {
php_error_docref(NULL, E_WARNING, "empty pattern");
RETVAL_FALSE;
goto out;
}
- re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax));
+ re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), MBREX(regex_default_syntax));
if (re == NULL) {
RETVAL_FALSE;
goto out;
@@ -1005,8 +991,6 @@ PHP_FUNCTION(mb_eregi)
/* {{{ _php_mb_regex_ereg_replace_exec */
static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOptionType options, int is_callable)
{
- zval *arg_pattern_zval;
-
char *arg_pattern;
size_t arg_pattern_len;
@@ -1029,7 +1013,6 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
OnigUChar *pos;
OnigUChar *string_lim;
char *description = NULL;
- char pat_buf[6];
const mbfl_encoding *enc;
@@ -1048,20 +1031,20 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
size_t option_str_len = 0;
if (!is_callable) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zss|s",
- &arg_pattern_zval,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|s",
+ &arg_pattern, &arg_pattern_len,
&replace, &replace_len,
&string, &string_len,
&option_str, &option_str_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zfs|s",
- &arg_pattern_zval,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sfs|s",
+ &arg_pattern, &arg_pattern_len,
&arg_replace_fci, &arg_replace_fci_cache,
&string, &string_len,
&option_str, &option_str_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
}
@@ -1081,28 +1064,10 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
}
}
if (eval && !is_callable) {
- php_error_docref(NULL, E_DEPRECATED, "The 'e' option is deprecated, use mb_ereg_replace_callback instead");
- }
- if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) {
- arg_pattern = Z_STRVAL_P(arg_pattern_zval);
- arg_pattern_len = Z_STRLEN_P(arg_pattern_zval);
- } else {
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string patterns will be interpreted as strings in the future. "
- "Use an explicit chr() call to preserve the current behavior");
-
- /* FIXME: this code is not multibyte aware! */
- convert_to_long_ex(arg_pattern_zval);
- pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval);
- pat_buf[1] = '\0';
- pat_buf[2] = '\0';
- pat_buf[3] = '\0';
- pat_buf[4] = '\0';
- pat_buf[5] = '\0';
-
- arg_pattern = pat_buf;
- arg_pattern_len = 1;
+ php_error_docref(NULL, E_WARNING, "The 'e' option is no longer supported, use mb_ereg_replace_callback instead");
+ RETURN_FALSE;
}
+
/* create regex pattern buffer */
re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), syntax);
if (re == NULL) {
@@ -1286,7 +1251,7 @@ PHP_FUNCTION(mb_split)
zend_long count = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (count > 0) {
@@ -1377,7 +1342,7 @@ PHP_FUNCTION(mb_ereg_match)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s",
&arg_pattern, &arg_pattern_len, &string, &string_len,
&option_str, &option_str_len)==FAILURE) {
- RETURN_FALSE;
+ return;
}
if (option_str != NULL) {
@@ -1620,6 +1585,10 @@ PHP_FUNCTION(mb_ereg_search_getregs)
size_t n, i, len, beg, end;
OnigUChar *str;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
if (MBREX(search_regs) != NULL && Z_TYPE(MBREX(search_str)) == IS_STRING) {
array_init(return_value);
@@ -1654,6 +1623,10 @@ PHP_FUNCTION(mb_ereg_search_getregs)
Get search start position */
PHP_FUNCTION(mb_ereg_search_getpos)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETVAL_LONG(MBREX(search_pos));
}
/* }}} */
@@ -1710,7 +1683,7 @@ PHP_FUNCTION(mb_regex_set_options)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s",
&string, &string_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (string != NULL) {
opt = 0;
diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h
index 497458e603..fd7661371d 100644
--- a/ext/mbstring/php_mbregex.h
+++ b/ext/mbstring/php_mbregex.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, |
@@ -41,21 +39,7 @@
PHP_FE(mb_ereg_search_init, arginfo_mb_ereg_search_init) \
PHP_FE(mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \
PHP_FE(mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \
- PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) \
- PHP_DEP_FALIAS(mbregex_encoding, mb_regex_encoding, arginfo_mb_regex_encoding) \
- PHP_DEP_FALIAS(mbereg, mb_ereg, arginfo_mb_ereg) \
- PHP_DEP_FALIAS(mberegi, mb_eregi, arginfo_mb_eregi) \
- PHP_DEP_FALIAS(mbereg_replace, mb_ereg_replace, arginfo_mb_ereg_replace) \
- PHP_DEP_FALIAS(mberegi_replace, mb_eregi_replace, arginfo_mb_eregi_replace) \
- PHP_DEP_FALIAS(mbsplit, mb_split, arginfo_mb_split) \
- PHP_DEP_FALIAS(mbereg_match, mb_ereg_match, arginfo_mb_ereg_match) \
- PHP_DEP_FALIAS(mbereg_search, mb_ereg_search, arginfo_mb_ereg_search) \
- PHP_DEP_FALIAS(mbereg_search_pos, mb_ereg_search_pos, arginfo_mb_ereg_search_pos) \
- PHP_DEP_FALIAS(mbereg_search_regs, mb_ereg_search_regs, arginfo_mb_ereg_search_regs) \
- PHP_DEP_FALIAS(mbereg_search_init, mb_ereg_search_init, arginfo_mb_ereg_search_init) \
- PHP_DEP_FALIAS(mbereg_search_getregs, mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \
- PHP_DEP_FALIAS(mbereg_search_getpos, mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \
- PHP_DEP_FALIAS(mbereg_search_setpos, mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos)
+ PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos)
/* }}} */
#define PHP_MBREGEX_MAXCACHE 50
diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c
index 664f760fc3..df16f20955 100644
--- a/ext/mbstring/php_unicode.c
+++ b/ext/mbstring/php_unicode.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/ext/mbstring/php_unicode.h b/ext/mbstring/php_unicode.h
index 54a43e32d0..2cd6dd9539 100644
--- a/ext/mbstring/php_unicode.h
+++ b/ext/mbstring/php_unicode.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/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt
deleted file mode 100644
index 1f62f08fd8..0000000000
--- a/ext/mbstring/tests/bug20087.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Bug #20087 (Assertion failure)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-$testmoo = "blah blah";
-var_dump(mb_parse_str("testmoo"));
-var_dump($testmoo);
-var_dump(mb_parse_str("test=moo"));
-var_dump($test);
-?>
---EXPECTF--
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-bool(true)
-string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-bool(true)
-string(3) "moo"
diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt
deleted file mode 100644
index 6da3dd6bbe..0000000000
--- a/ext/mbstring/tests/bug43301.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Bug #43301 (mb_ereg*_replace() crashes when replacement string is invalid PHP expression and 'e' option is used)
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-if (!function_exists('mb_ereg')) die('skip mbregex support not available');
-?>
---FILE--
-<?php
-
-$ptr = 'hello';
-
-$txt = <<<doc
-hello, I have got a cr*sh on you
-doc;
-
-echo mb_ereg_replace($ptr,'$1',$txt,'e');
-
-?>
---EXPECTF--
-Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug43301.php on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in %sbug43301.php(%d) : mbregex replace:1
-Stack trace:
-#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e')
-#1 {main}
-
-Next Error: Failed evaluating code:
-$1 in %sbug43301.php:%d
-Stack trace:
-#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e')
-#1 {main}
- thrown in %sbug43301.php on line %d
diff --git a/ext/mbstring/tests/bug43841.phpt b/ext/mbstring/tests/bug43841.phpt
index 01ae2a7525..ab52eb51c9 100644
--- a/ext/mbstring/tests/bug43841.phpt
+++ b/ext/mbstring/tests/bug43841.phpt
@@ -46,7 +46,7 @@ Warning: mb_strrpos(): Offset is greater than the length of haystack string in %
bool(false)
strrpos:
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Offset is -24 --
@@ -61,7 +61,7 @@ Warning: mb_strrpos(): Offset is greater than the length of haystack string in %
bool(false)
strrpos:
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Offset is -13 --
diff --git a/ext/mbstring/tests/bug45923.phpt b/ext/mbstring/tests/bug45923.phpt
index eace49678c..6fc8e1db09 100644
--- a/ext/mbstring/tests/bug45923.phpt
+++ b/ext/mbstring/tests/bug45923.phpt
@@ -149,7 +149,7 @@ bool(false)
bool(false)
> Offset: 12
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
> Offset: -1
int(8)
@@ -159,7 +159,7 @@ int(8)
int(4)
> Offset: -20
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
------- mb_strrpos -----------
@@ -203,7 +203,7 @@ bool(false)
bool(false)
> Offset: 12
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
> Offset: -1
int(8)
@@ -213,7 +213,7 @@ int(8)
int(4)
> Offset: -20
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
------- mb_strripos -----------
diff --git a/ext/mbstring/tests/bug48697.phpt b/ext/mbstring/tests/bug48697.phpt
index 93644a5f05..77d1c7a710 100644
--- a/ext/mbstring/tests/bug48697.phpt
+++ b/ext/mbstring/tests/bug48697.phpt
@@ -2,8 +2,6 @@
Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str()
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-error_reporting=E_ALL & ~E_DEPRECATED
--FILE--
<?php
ini_set('mbstring.internal_encoding', 'ISO-8859-15');
@@ -11,14 +9,15 @@ ini_set('mbstring.encoding_translation', true);
var_dump(mb_internal_encoding());
mb_internal_encoding('UTF-8');
var_dump(mb_internal_encoding());
-parse_str('a=b');
+parse_str('a=b', $ary);
var_dump(mb_internal_encoding());
mb_internal_encoding('UTF-8');
var_dump(mb_internal_encoding());
-parse_str('a=b');
+parse_str('a=b', $ary);
var_dump(mb_internal_encoding());
?>
---EXPECT--
+--EXPECTF--
+Deprecated: ini_set(): Use of mbstring.internal_encoding is deprecated in %s on line %d
string(11) "ISO-8859-15"
string(5) "UTF-8"
string(5) "UTF-8"
diff --git a/ext/mbstring/tests/bug52931.phpt b/ext/mbstring/tests/bug52931.phpt
deleted file mode 100644
index e7d7b6dda4..0000000000
--- a/ext/mbstring/tests/bug52931.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #52931 (strripos not overloaded with function overloading enabled)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-mbstring.func_overload = 7
---FILE--
-<?php
-
-$string = '<body>Umlauttest öüä</body>';
-
-var_dump(strlen($string));
-var_dump(mb_strlen($string));
-
-var_dump(strripos($string, '</body>'));
-var_dump(mb_strripos($string, '</body>'));
-
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-int(27)
-int(27)
-int(20)
-int(20)
diff --git a/ext/mbstring/tests/bug72164.phpt b/ext/mbstring/tests/bug72164.phpt
index 018754e335..f90fe89938 100644
--- a/ext/mbstring/tests/bug72164.phpt
+++ b/ext/mbstring/tests/bug72164.phpt
@@ -14,5 +14,5 @@ $var8 = mb_ereg_replace($var2,$var3,$var3,$var0);
var_dump($var8);
?>
--EXPECTF--
-Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug72164.php on line %d
-string(0) ""
+Warning: mb_ereg_replace(): The 'e' option is no longer supported, use mb_ereg_replace_callback instead in %s on line %d
+bool(false)
diff --git a/ext/mbstring/tests/bug72994.phpt b/ext/mbstring/tests/bug72994.phpt
deleted file mode 100644
index c9d2c9acf2..0000000000
--- a/ext/mbstring/tests/bug72994.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #72994 (mbc_to_code() out of bounds read)
---SKIPIF--
-<?php
-if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
-if (!function_exists('mb_ereg_replace')) die('skip mb_ereg_replace() not available');
-?>
---FILE--
-<?php
-$var1 = mb_ereg_replace($var-232338951,NULL,NULL,NULL);
-var_dump($var1);
-?>
-===DONE===
---EXPECTF--
-Notice: Undefined variable: var in %s on line %d
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/bug73646.phpt b/ext/mbstring/tests/bug73646.phpt
index 7ac824d69c..ea57017f11 100644
--- a/ext/mbstring/tests/bug73646.phpt
+++ b/ext/mbstring/tests/bug73646.phpt
@@ -7,10 +7,7 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
?>
--FILE--
<?php
-
-$v1=str_repeat("#", -1);
-var_dump(mb_ereg_search_init($v1));
+var_dump(mb_ereg_search_init(NULL));
?>
---EXPECTF--
-Warning: str_repeat(): Second argument has to be greater than or equal to 0 in %sbug73646.php on line %d
+--EXPECT--
bool(true)
diff --git a/ext/mbstring/tests/mb_convert_encoding.phpt b/ext/mbstring/tests/mb_convert_encoding.phpt
index f2fda35124..ac5d0d32a6 100644
--- a/ext/mbstring/tests/mb_convert_encoding.phpt
+++ b/ext/mbstring/tests/mb_convert_encoding.phpt
@@ -99,11 +99,6 @@ $s = $euc_jp;
$s = mb_convert_encoding($s, 'BAD');
print("BAD: $s\n"); // BAD
-$s = $euc_jp;
-$s = mb_convert_encoding($s);
-print("MP: $s\n"); // Missing parameter
-
-
?>
--EXPECTF--
== BASIC TEST ==
@@ -129,6 +124,3 @@ EUC-JP:
Warning: mb_convert_encoding(): Unknown encoding "BAD" in %s on line %d
BAD:
-
-Warning: mb_convert_encoding() expects at least 2 parameters, 1 given in %s on line %d
-MP:
diff --git a/ext/mbstring/tests/mb_decode_numericentity.phpt b/ext/mbstring/tests/mb_decode_numericentity.phpt
index 6008ef9a9b..5a29144c44 100644
--- a/ext/mbstring/tests/mb_decode_numericentity.phpt
+++ b/ext/mbstring/tests/mb_decode_numericentity.phpt
@@ -14,8 +14,20 @@ $convmap = array(0x0, 0x2FFFF, 0, 0xFFFF);
echo mb_decode_numericentity($str1, $convmap, "UTF-8")."\n";
echo mb_decode_numericentity($str2, $convmap, "UTF-8")."\n";
echo mb_decode_numericentity($str3, $convmap, "UTF-8")."\n";
+
+$convmap = [];
+echo mb_decode_numericentity('f&ouml;o', $convmap, "UTF-8")."\n";
+
+$convmap = array(0x0, 0x2FFFF, 0); // 3 elements
+try {
+ echo mb_decode_numericentity($str3, $convmap, "UTF-8")."\n";
+} catch (ValueError $ex) {
+ echo $ex->getMessage()."\n";
+}
?>
--EXPECT--
¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖ×ØÙÚÛÜÃÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
ƒΑΒΓΔΕΖΗΘΙΚΛΜÎΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπÏςστυφχψωϑϒϖ•…′″‾â„℘ℑℜ™ℵâ†â†‘→↓↔↵â‡â‡‘⇒⇓⇔∀∂∃∅∇∈∉∋âˆâˆ‘−∗√âˆâˆžâˆ âˆ§âˆ¨âˆ©âˆªâˆ«âˆ´âˆ¼â‰…≈≠≡≤≥⊂⊃⊄⊆⊇⊕⊗⊥⋅⌈⌉⌊⌋〈〉◊♠♣♥♦
aŒbœcŠdše€fg
+f&ouml;o
+count($convmap) must be a multiple of 4
diff --git a/ext/mbstring/tests/mb_detect_encoding.phpt b/ext/mbstring/tests/mb_detect_encoding.phpt
index 0c8015d86d..9a8f51281b 100644
--- a/ext/mbstring/tests/mb_detect_encoding.phpt
+++ b/ext/mbstring/tests/mb_detect_encoding.phpt
@@ -87,11 +87,6 @@ $s = $euc_jp;
$s = mb_detect_encoding($s, 'BAD');
print("BAD: $s\n"); // BAD
-$s = $euc_jp;
-$s = mb_detect_encoding();
-print("MP: $s\n"); // Missing parameter
-
-
?>
--EXPECTF--
== BASIC TEST ==
@@ -113,6 +108,3 @@ EUC-JP: EUC-JP
Warning: mb_detect_encoding(): Illegal argument in %s on line %d
BAD: EUC-JP
-
-Warning: mb_detect_encoding() expects at least 1 parameter, 0 given in %s on line %d
-MP:
diff --git a/ext/mbstring/tests/mb_encode_numericentity.phpt b/ext/mbstring/tests/mb_encode_numericentity.phpt
index 51ad6c22a1..3f14bfd48b 100644
--- a/ext/mbstring/tests/mb_encode_numericentity.phpt
+++ b/ext/mbstring/tests/mb_encode_numericentity.phpt
@@ -15,8 +15,20 @@ echo mb_encode_numericentity($str2, $convmap, "UTF-8")."\n";
$convmap = array(0xFF, 0x2FFFF, 0, 0xFFFF);
echo mb_encode_numericentity('aŒbœcŠdše€fg', $convmap, "UTF-8")."\n";
+
+$convmap = [];
+echo mb_encode_numericentity('föo', $convmap, "UTF-8")."\n";
+
+$convmap = array(0xFF, 0x2FFFF, 0); // 3 elements
+try {
+ echo mb_encode_numericentity('aŒbœcŠdše€fg', $convmap, "UTF-8")."\n";
+} catch (ValueError $ex) {
+ echo $ex->getMessage()."\n";
+}
?>
--EXPECT--
&#161;&#162;&#163;&#164;&#165;&#166;&#167;&#168;&#169;&#170;&#171;&#172;&#173;&#174;&#175;&#176;&#177;&#178;&#179;&#180;&#181;&#182;&#183;&#184;&#185;&#186;&#187;&#188;&#189;&#190;&#191;&#192;&#193;&#194;&#195;&#196;&#197;&#198;&#199;&#200;&#201;&#202;&#203;&#204;&#205;&#206;&#207;&#208;&#209;&#210;&#211;&#212;&#213;&#214;&#215;&#216;&#217;&#218;&#219;&#220;&#221;&#222;&#223;&#224;&#225;&#226;&#227;&#228;&#229;&#230;&#231;&#232;&#233;&#234;&#235;&#236;&#237;&#238;&#239;&#240;&#241;&#242;&#243;&#244;&#245;&#246;&#247;&#248;&#249;&#250;&#251;&#252;&#253;&#254;&#255;
&#402;&#913;&#914;&#915;&#916;&#917;&#918;&#919;&#920;&#921;&#922;&#923;&#924;&#925;&#926;&#927;&#928;&#929;&#931;&#932;&#933;&#934;&#935;&#936;&#937;&#945;&#946;&#947;&#948;&#949;&#950;&#951;&#952;&#953;&#954;&#955;&#956;&#957;&#958;&#959;&#960;&#961;&#962;&#963;&#964;&#965;&#966;&#967;&#968;&#969;&#977;&#978;&#982;&#8226;&#8230;&#8242;&#8243;&#8254;&#8260;&#8472;&#8465;&#8476;&#8482;&#8501;&#8592;&#8593;&#8594;&#8595;&#8596;&#8629;&#8656;&#8657;&#8658;&#8659;&#8660;&#8704;&#8706;&#8707;&#8709;&#8711;&#8712;&#8713;&#8715;&#8719;&#8721;&#8722;&#8727;&#8730;&#8733;&#8734;&#8736;&#8743;&#8744;&#8745;&#8746;&#8747;&#8756;&#8764;&#8773;&#8776;&#8800;&#8801;&#8804;&#8805;&#8834;&#8835;&#8836;&#8838;&#8839;&#8853;&#8855;&#8869;&#8901;&#8968;&#8969;&#8970;&#8971;&#9001;&#9002;&#9674;&#9824;&#9827;&#9829;&#9830;
a&#338;b&#339;c&#352;d&#353;e&#8364;fg
+föo
+count($convmap) must be a multiple of 4
diff --git a/ext/mbstring/tests/mb_encoding_aliases.phpt b/ext/mbstring/tests/mb_encoding_aliases.phpt
index 8bc0453350..798bdeb5ca 100644
--- a/ext/mbstring/tests/mb_encoding_aliases.phpt
+++ b/ext/mbstring/tests/mb_encoding_aliases.phpt
@@ -4,7 +4,6 @@ mb_encoding_aliases()
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
-mb_encoding_aliases();
$list = mb_encoding_aliases("ASCII");
sort($list);
var_dump($list);
@@ -13,7 +12,6 @@ var_dump(mb_encoding_aliases("8bit"));
var_dump(mb_encoding_aliases("BAD"));
?>
--EXPECTF--
-Warning: mb_encoding_aliases() expects exactly 1 parameter, 0 given in %s on line 2
array(11) {
[0]=>
string(14) "ANSI_X3.4-1968"
diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt
index 59ef788a77..05b3486545 100644
--- a/ext/mbstring/tests/mb_ereg1.phpt
+++ b/ext/mbstring/tests/mb_ereg1.phpt
@@ -14,7 +14,11 @@ $a = array(
);
foreach ($a as $args) {
- var_dump(mb_ereg($args[0], $args[1], $args[2]));
+ try {
+ var_dump(mb_ereg($args[0], $args[1], $args[2]));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump($args);
}
?>
@@ -42,9 +46,7 @@ array(3) {
array(0) {
}
}
-
-Notice: Array to string conversion in %s on line %d
-bool(false)
+mb_ereg() expects parameter 1 to be string, array given
array(3) {
[0]=>
array(0) {
@@ -52,12 +54,9 @@ array(3) {
[1]=>
int(1)
[2]=>
- array(0) {
- }
+ &string(0) ""
}
-
-Warning: mb_ereg() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
+mb_ereg() expects parameter 2 to be string, array given
array(3) {
[0]=>
int(1)
@@ -65,7 +64,7 @@ array(3) {
array(0) {
}
[2]=>
- string(0) ""
+ &string(0) ""
}
bool(false)
array(3) {
diff --git a/ext/mbstring/tests/mb_ereg2.phpt b/ext/mbstring/tests/mb_ereg2.phpt
index 30e857eed7..22e3cd36c5 100644
--- a/ext/mbstring/tests/mb_ereg2.phpt
+++ b/ext/mbstring/tests/mb_ereg2.phpt
@@ -15,12 +15,9 @@ var_dump($a, $b, $c);
mb_eregi($a, $b, $c);
var_dump($a, $b, $c);
-mb_ereg_search_init($a, $b, $c);
-var_dump($a, $b, $c);
-
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(-1)
int(-1)
array(1) {
@@ -33,12 +30,4 @@ array(1) {
[0]=>
string(2) "-1"
}
-
-Warning: mb_ereg_search_init() expects parameter 3 to be string, array given in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
Done
diff --git a/ext/mbstring/tests/mb_ereg3.phpt b/ext/mbstring/tests/mb_ereg3.phpt
deleted file mode 100644
index c591563444..0000000000
--- a/ext/mbstring/tests/mb_ereg3.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-mb_ereg() returning matches
---SKIPIF--
-<?php
-if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
-if (!function_exists("mb_ereg")) print "skip mb_ereg() not available";
-?>
---FILE--
-<?php
-
-// Note: This test is identical to mb_ereg2.phpt, but using deprecated mbereg_* aliases.
-// Deleted it once the deprecated aliases have been removed.
-
-$a = -1; $b = -1; $c = -1;
-mbereg($a, $b, $c);
-var_dump($a, $b, $c);
-
-mberegi($a, $b, $c);
-var_dump($a, $b, $c);
-
-mbereg_search_init($a, $b, $c);
-var_dump($a, $b, $c);
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function mbereg() is deprecated in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
-
-Deprecated: Function mberegi() is deprecated in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
-
-Deprecated: Function mbereg_search_init() is deprecated in %s on line %d
-
-Warning: mbereg_search_init() expects parameter 3 to be string, array given in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
-Done
diff --git a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
index 4c6e177b3e..c61e47723d 100644
--- a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
+++ b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
@@ -96,87 +96,53 @@ foreach($inputs as $input) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing mb_ereg_replace() : usage variations ***
-- Iteration 1 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 2 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 3 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 4 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
-bool(false)
+string(10) "string_val"
-- Iteration 5 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 6 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
-bool(false)
+string(10) "string_val"
-- Iteration 7 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 8 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 9 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 10 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 11 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 12 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 13 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 14 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 15 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 16 --
string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
@@ -194,17 +160,11 @@ string(10) "string_val"
string(10) "string_val"
-- Iteration 21 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 22 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 23 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
Done
diff --git a/ext/mbstring/tests/mb_ereg_variation1.phpt b/ext/mbstring/tests/mb_ereg_variation1.phpt
deleted file mode 100644
index 60baf8743e..0000000000
--- a/ext/mbstring/tests/mb_ereg_variation1.phpt
+++ /dev/null
@@ -1,178 +0,0 @@
---TEST--
-Test mb_ereg() function : usage variations - pass different data types to $pattern argument
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
-?>
---FILE--
-<?php
-/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
- * Description: Regular expression match for multibyte string
- * Source code: ext/mbstring/php_mbregex.c
- */
-
-/*
- * Pass different data types to $pattern argument
- */
-
-echo "*** Testing mb_ereg() : usage variations ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$string = 'string value';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $pattern argument
-$inputs = array(
-
-// int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
-// float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
-// boolean data
-/*10*/ true,
- TRUE,
-
-// string data
-/*12*/ "string",
- 'string',
- $heredoc,
-
-// object data
-/*15*/ new classA(),
-
-// resource variable
-/*16*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of mb_ereg()
-$iterator = 1;
-foreach($inputs as $input) {
- if (@is_array($regs)){
- $regs = null;
- }
- echo "\n-- Iteration $iterator --\n";
- var_dump( mb_ereg($input, $string, $regs) );
- var_dump($regs);
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECT--
-*** Testing mb_ereg() : usage variations ***
-
--- Iteration 1 --
-bool(false)
-array(0) {
-}
-
--- Iteration 2 --
-bool(false)
-array(0) {
-}
-
--- Iteration 3 --
-bool(false)
-array(0) {
-}
-
--- Iteration 4 --
-bool(false)
-array(0) {
-}
-
--- Iteration 5 --
-bool(false)
-array(0) {
-}
-
--- Iteration 6 --
-bool(false)
-array(0) {
-}
-
--- Iteration 7 --
-bool(false)
-array(0) {
-}
-
--- Iteration 8 --
-bool(false)
-array(0) {
-}
-
--- Iteration 9 --
-bool(false)
-array(0) {
-}
-
--- Iteration 10 --
-bool(false)
-array(0) {
-}
-
--- Iteration 11 --
-bool(false)
-array(0) {
-}
-
--- Iteration 12 --
-int(6)
-array(1) {
- [0]=>
- string(6) "string"
-}
-
--- Iteration 13 --
-int(6)
-array(1) {
- [0]=>
- string(6) "string"
-}
-
--- Iteration 14 --
-bool(false)
-array(0) {
-}
-
--- Iteration 15 --
-bool(false)
-array(0) {
-}
-
--- Iteration 16 --
-bool(false)
-array(0) {
-}
-Done
diff --git a/ext/mbstring/tests/mb_get_info.phpt b/ext/mbstring/tests/mb_get_info.phpt
index 5b9c0c0aef..4b08b9943f 100644
--- a/ext/mbstring/tests/mb_get_info.phpt
+++ b/ext/mbstring/tests/mb_get_info.phpt
@@ -9,7 +9,6 @@ mbstring.internal_encoding=UTF-8
mbstring.http_input=ISO-8859-1
mbstring.http_output=ISO-8859-15
mbstring.http_output_conv_mimetypes=abc
-mbstring.func_overload=2
mbstring.detect_order=UTF-8,ISO-8859-15,ISO-8859-1,ASCII
mbstring.substitute_character=123
mbstring.strict_detection=1
@@ -24,8 +23,7 @@ foreach (array_keys($result) as $key) {
}
?>
--EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-array(15) {
+array(13) {
["internal_encoding"]=>
string(5) "UTF-8"
["http_input"]=>
@@ -34,35 +32,6 @@ array(15) {
string(11) "ISO-8859-15"
["http_output_conv_mimetypes"]=>
string(3) "abc"
- ["func_overload"]=>
- int(2)
- ["func_overload_list"]=>
- array(12) {
- ["strlen"]=>
- string(9) "mb_strlen"
- ["strpos"]=>
- string(9) "mb_strpos"
- ["strrpos"]=>
- string(10) "mb_strrpos"
- ["stripos"]=>
- string(10) "mb_stripos"
- ["strripos"]=>
- string(11) "mb_strripos"
- ["strstr"]=>
- string(9) "mb_strstr"
- ["strrchr"]=>
- string(10) "mb_strrchr"
- ["stristr"]=>
- string(10) "mb_stristr"
- ["substr"]=>
- string(9) "mb_substr"
- ["strtolower"]=>
- string(13) "mb_strtolower"
- ["strtoupper"]=>
- string(13) "mb_strtoupper"
- ["substr_count"]=>
- string(15) "mb_substr_count"
- }
["mail_charset"]=>
string(11) "ISO-2022-KR"
["mail_header_encoding"]=>
@@ -99,60 +68,6 @@ string(11) "ISO-8859-15"
string(11) "ISO-8859-15"
string(3) "abc"
string(3) "abc"
-int(2)
-int(2)
-array(12) {
- ["strlen"]=>
- string(9) "mb_strlen"
- ["strpos"]=>
- string(9) "mb_strpos"
- ["strrpos"]=>
- string(10) "mb_strrpos"
- ["stripos"]=>
- string(10) "mb_stripos"
- ["strripos"]=>
- string(11) "mb_strripos"
- ["strstr"]=>
- string(9) "mb_strstr"
- ["strrchr"]=>
- string(10) "mb_strrchr"
- ["stristr"]=>
- string(10) "mb_stristr"
- ["substr"]=>
- string(9) "mb_substr"
- ["strtolower"]=>
- string(13) "mb_strtolower"
- ["strtoupper"]=>
- string(13) "mb_strtoupper"
- ["substr_count"]=>
- string(15) "mb_substr_count"
-}
-array(12) {
- ["strlen"]=>
- string(9) "mb_strlen"
- ["strpos"]=>
- string(9) "mb_strpos"
- ["strrpos"]=>
- string(10) "mb_strrpos"
- ["stripos"]=>
- string(10) "mb_stripos"
- ["strripos"]=>
- string(11) "mb_strripos"
- ["strstr"]=>
- string(9) "mb_strstr"
- ["strrchr"]=>
- string(10) "mb_strrchr"
- ["stristr"]=>
- string(10) "mb_stristr"
- ["substr"]=>
- string(9) "mb_substr"
- ["strtolower"]=>
- string(13) "mb_strtolower"
- ["strtoupper"]=>
- string(13) "mb_strtoupper"
- ["substr_count"]=>
- string(15) "mb_substr_count"
-}
string(11) "ISO-2022-KR"
string(11) "ISO-2022-KR"
string(6) "BASE64"
diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt
index b62734f02d..60581576b6 100644
--- a/ext/mbstring/tests/mb_http_output.phpt
+++ b/ext/mbstring/tests/mb_http_output.phpt
@@ -47,16 +47,6 @@ $r = mb_http_output('BAD_NAME');
$enc = mb_http_output();
print "$enc\n";
-$r = mb_http_output($t_ary);
-($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-$r = mb_http_output($t_obj);
-($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
?>
--EXPECTF--
OK_ASCII_SET
@@ -74,11 +64,3 @@ EUC-JP
Warning: mb_http_output(): Unknown encoding "BAD_NAME" in %s on line %d
OK_BAD_SET
EUC-JP
-
-Warning: mb_http_output() expects parameter 1 to be string, array given in %s on line %d
-OK_BAD_ARY_SET
-EUC-JP
-
-Warning: mb_http_output() expects parameter 1 to be string, object given in %s on line %d
-OK_BAD_OBJ_SET
-EUC-JP
diff --git a/ext/mbstring/tests/mb_internal_encoding.phpt b/ext/mbstring/tests/mb_internal_encoding.phpt
index 50b696e1bd..9a0191237d 100644
--- a/ext/mbstring/tests/mb_internal_encoding.phpt
+++ b/ext/mbstring/tests/mb_internal_encoding.phpt
@@ -35,16 +35,6 @@ $r = mb_internal_encoding('BAD');
$enc = mb_internal_encoding();
print "$enc\n";
-$r = mb_internal_encoding($t_ary);
-($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-$r = mb_internal_encoding($t_obj);
-($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
?>
--EXPECTF--
OK_EUC-JP_SET
@@ -58,11 +48,3 @@ ASCII
Warning: mb_internal_encoding(): Unknown encoding "BAD" in %s on line %d
OK_BAD_SET
ASCII
-
-Warning: mb_internal_encoding() expects parameter 1 to be string, array given in %s on line %d
-OK_BAD_ARY_SET
-ASCII
-
-Warning: mb_internal_encoding() expects parameter 1 to be string, object given in %s on line %d
-OK_BAD_OBJ_SET
-ASCII
diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt
index 8580ac52c5..ab504f918f 100644
--- a/ext/mbstring/tests/mb_parse_str.phpt
+++ b/ext/mbstring/tests/mb_parse_str.phpt
@@ -18,9 +18,6 @@ function test($query) {
var_dump($array);
var_dump($foo);
var_dump($bar);
- mb_parse_str($query);
- var_dump($foo);
- var_dump($bar);
}
foreach ($queries as $query) {
test($query);
@@ -35,10 +32,6 @@ array(2) {
}
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(3) "abc"
-string(3) "def"
array(2) {
["+foo"]=>
string(3) "def"
@@ -47,10 +40,6 @@ array(2) {
}
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(0) ""
-string(0) ""
array(2) {
["foo"]=>
array(3) {
@@ -69,17 +58,3 @@ array(2) {
}
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-array(3) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
-}
-array(1) {
- [0]=>
- string(3) "jkl"
-}
diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt
index e1871bf596..bad388ee90 100644
--- a/ext/mbstring/tests/mb_parse_str02.phpt
+++ b/ext/mbstring/tests/mb_parse_str02.phpt
@@ -20,10 +20,6 @@ function test($query) {
var_dump($foo);
var_dump($bar);
var_dump($fubar);
- mb_parse_str($query);
- var_dump($foo);
- var_dump($bar);
- var_dump($fubar);
}
foreach ($queries as $query) {
test($query);
@@ -41,11 +37,6 @@ array(3) {
string(0) ""
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(3) "abc"
-string(3) "def"
-string(3) "ghi"
array(3) {
["+foo"]=>
string(3) "def"
@@ -57,11 +48,6 @@ array(3) {
string(0) ""
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(0) ""
-string(0) ""
-string(0) ""
array(3) {
["foo"]=>
array(4) {
@@ -88,23 +74,3 @@ array(3) {
string(0) ""
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-array(4) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
- [3]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(1) "="
-}
diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt
index d2476658da..9e9cd4080b 100644
--- a/ext/mbstring/tests/mb_split.phpt
+++ b/ext/mbstring/tests/mb_split.phpt
@@ -5,8 +5,6 @@ mb_split()
extension_loaded('mbstring') or die('skip mbstring not available');
function_exists('mb_split') or die("skip mb_split() is not available in this build");
?>
---INI--
-mbstring.func_overload=0
--FILE--
<?php
mb_regex_set_options( '' );
diff --git a/ext/mbstring/tests/mb_str_unknown_encoding.phpt b/ext/mbstring/tests/mb_str_unknown_encoding.phpt
index 393b0b55b1..1cba531941 100644
--- a/ext/mbstring/tests/mb_str_unknown_encoding.phpt
+++ b/ext/mbstring/tests/mb_str_unknown_encoding.phpt
@@ -11,7 +11,7 @@ mb_chr(1, 'UTF-0');
mb_convert_case('coudenys', MB_CASE_UPPER, 'UTF-0');
mb_convert_encoding('coudenys', 'UTF-8', 'UTF-0');
mb_convert_kana('coudenys', 'KV', 'UTF-0');
-mb_decode_numericentity('coudenys', 'KV', 'UTF-0');
+mb_decode_numericentity('coudenys', [], 'UTF-0');
mb_ord('coudenys', 'UTF-0');
mb_strcut('coudenys', 0, 4, 'UTF-0');
mb_strimwidth('coudenys', 0, 4, '', 'UTF-0');
diff --git a/ext/mbstring/tests/mb_stripos.phpt b/ext/mbstring/tests/mb_stripos.phpt
index 9da6456992..067c3f2826 100644
--- a/ext/mbstring/tests/mb_stripos.phpt
+++ b/ext/mbstring/tests/mb_stripos.phpt
@@ -125,18 +125,6 @@ $r = mb_stripos($euc_jp, '´Ú¹ñ¸ì');
$r = mb_stripos($euc_jp, "\n");
($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-// Invalid Parameters
-echo "== INVALID PARAMETER TEST ==\n";
-
-$r = mb_stripos($euc_jp,'','EUC-JP');
-($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n");
-$r = mb_stripos($euc_jp, $t_ary, 'EUC-JP');
-($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n");
-$r = mb_stripos($euc_jp, $t_obj, 'EUC-JP');
-($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n");
-$r = mb_stripos($euc_jp, $t_obj, 'BAD_ENCODING');
-($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n");
?>
==DONE==
--EXPECTF--
@@ -213,17 +201,4 @@ OK_NEWLINE
0
OK_STR
OK_NEWLINE
-== INVALID PARAMETER TEST ==
-
-Warning: mb_stripos() expects parameter 3 to be int, string given in %s on line %d
-OK_NULL
-
-Warning: mb_stripos() expects parameter 2 to be string, array given in %s on line %d
-OK_ARRAY
-
-Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d
-OK_OBJECT
-
-Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d
-OK_BAD_ENCODING
==DONE==
diff --git a/ext/mbstring/tests/mb_strlen.phpt b/ext/mbstring/tests/mb_strlen.phpt
index ee71106937..fa546b2c59 100644
--- a/ext/mbstring/tests/mb_strlen.phpt
+++ b/ext/mbstring/tests/mb_strlen.phpt
@@ -2,8 +2,6 @@
mb_strlen()
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-mbstring.func_overload=0
--FILE--
<?php
// TODO: Add more encodings
@@ -55,14 +53,6 @@ print strlen($utf8) . "\n";
// Wrong Parameters
echo "== WRONG PARAMETERS ==\n";
-// Array
-// Note: PHP Warning, strlen() expects parameter 1 to be string, array given
-$r = strlen($t_ary);
-echo $r."\n";
-// Object
-// Note: PHP Warning, strlen() expects parameter 1 to be string, object given
-$r = strlen($t_obj);
-echo $r."\n";
// Wrong encoding
mb_internal_encoding('EUC-JP');
$r = mb_strlen($euc_jp, 'BAD_NAME');
@@ -88,10 +78,4 @@ echo $r."\n";
101
== WRONG PARAMETERS ==
-Warning: strlen() expects parameter 1 to be string, array given in %s on line %d
-
-
-Warning: strlen() expects parameter 1 to be string, object given in %s on line %d
-
-
Warning: mb_strlen(): Unknown encoding "BAD_NAME" in %s on line %d
diff --git a/ext/mbstring/tests/mb_strpos.phpt b/ext/mbstring/tests/mb_strpos.phpt
index 9bca0ba390..c86b77e7de 100644
--- a/ext/mbstring/tests/mb_strpos.phpt
+++ b/ext/mbstring/tests/mb_strpos.phpt
@@ -125,18 +125,6 @@ $r = mb_strpos($euc_jp, '´Ú¹ñ¸ì');
$r = mb_strpos($euc_jp, "\n");
($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-// Invalid Parameters
-echo "== INVALID PARAMETER TEST ==\n";
-
-$r = mb_strpos($euc_jp,'','EUC-JP');
-($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n");
-$r = mb_strpos($euc_jp, $t_ary, 'EUC-JP');
-($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n");
-$r = mb_strpos($euc_jp, $t_obj, 'EUC-JP');
-($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n");
-$r = mb_strpos($euc_jp, $t_obj, 'BAD_ENCODING');
-($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n");
?>
==DONE==
--EXPECTF--
@@ -213,17 +201,4 @@ OK_NEWLINE
0
OK_STR
OK_NEWLINE
-== INVALID PARAMETER TEST ==
-
-Warning: mb_strpos() expects parameter 3 to be int, string given in %s on line %d
-OK_NULL
-
-Warning: mb_strpos() expects parameter 2 to be string, array given in %s on line %d
-OK_ARRAY
-
-Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d
-OK_OBJECT
-
-Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d
-OK_BAD_ENCODING
==DONE==
diff --git a/ext/mbstring/tests/mb_substitute_character_variation1.phpt b/ext/mbstring/tests/mb_substitute_character_variation1.phpt
index f738876469..69912eca50 100644
--- a/ext/mbstring/tests/mb_substitute_character_variation1.phpt
+++ b/ext/mbstring/tests/mb_substitute_character_variation1.phpt
@@ -16,8 +16,8 @@ function_exists('mb_substitute_character') or die("skip mb_substitute_character(
echo "*** Testing mb_substitute_character() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/mbstring/tests/mb_substr.phpt b/ext/mbstring/tests/mb_substr.phpt
index 28b35ea910..ab4f7c17d6 100644
--- a/ext/mbstring/tests/mb_substr.phpt
+++ b/ext/mbstring/tests/mb_substr.phpt
@@ -4,7 +4,6 @@ mb_substr()
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
output_handler=
-mbstring.func_overload=0
--FILE--
<?php
// TODO: Add more encodings
diff --git a/ext/mbstring/tests/overload01.phpt b/ext/mbstring/tests/overload01.phpt
deleted file mode 100644
index 436608a89c..0000000000
--- a/ext/mbstring/tests/overload01.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Function overloading test 1
---SKIPIF--
-<?php
- extension_loaded('mbstring') or die('skip mbstring not available');
-?>
---INI--
-output_handler=
-mbstring.func_overload=7
-internal_encoding=EUC-JP
---FILE--
-<?php
-echo mb_internal_encoding()."\n";
-
-$ngchars = array('ǽ','ɽ','»½','¥½');
-$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
-var_dump(strlen($str));
-var_dump(mb_strlen($str));
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-EUC-JP
-int(33)
-int(33)
diff --git a/ext/mbstring/tests/overload02.phpt b/ext/mbstring/tests/overload02.phpt
deleted file mode 100644
index 2e4bbe856a..0000000000
--- a/ext/mbstring/tests/overload02.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Function overloading test 2
---SKIPIF--
-<?php
- extension_loaded('mbstring') or die('skip mbstring not available');
- if (!function_exists("mb_ereg_replace")) {
- die('skip mb_ereg_replace() function is not available.');
- }
-?>
---INI--
-output_handler=
-mbstring.func_overload=7
-internal_encoding=EUC-JP
---FILE--
-<?php
-echo mb_internal_encoding()."\n";
-
-$ngchars = array('ǽ','ɽ','»½','¥½');
-$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
-$converted_str = mb_convert_encoding($str, 'Shift_JIS');
-mb_regex_encoding('Shift_JIS');
-foreach($ngchars as $c) {
- $c = mb_convert_encoding($c, 'Shift_JIS');
- $replaced = mb_convert_encoding(str_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS');
- var_dump(strpos($replaced, '!!'));
-}
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-EUC-JP
-int(10)
-int(8)
-int(3)
-int(29)
diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4
index c78eb2bedc..4f011adf8d 100644
--- a/ext/mysqli/config.m4
+++ b/ext/mysqli/config.m4
@@ -49,7 +49,7 @@ elif test "$PHP_MYSQLI" != "no"; then
MYSQL_CONFIG=$PHP_MYSQLI
MYSQL_LIB_NAME='mysqlclient'
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
MYSQL_LIB_CFG='--libs_r'
MYSQL_LIB_NAME='mysqlclient_r'
else
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 612239527e..1fbc230e63 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.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, |
@@ -297,26 +295,16 @@ static int mysqli_write_na(mysqli_object *obj, zval *newval)
/* }}} */
/* {{{ mysqli_read_property */
-zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *mysqli_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- zval tmp_member;
zval *retval;
mysqli_object *obj;
mysqli_prop_handler *hnd = NULL;
- obj = Z_MYSQLI_P(object);
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
+ obj = php_mysqli_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
@@ -325,11 +313,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
@@ -337,35 +321,21 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl
/* }}} */
/* {{{ mysqli_write_property */
-zval *mysqli_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *mysqli_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval tmp_member;
mysqli_object *obj;
mysqli_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_MYSQLI_P(object);
+ obj = php_mysqli_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
hnd->write_func(obj, value);
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -384,20 +354,20 @@ void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysq
}
/* }}} */
-static int mysqli_object_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static int mysqli_object_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- mysqli_object *obj = Z_MYSQLI_P(object);
+ mysqli_object *obj = php_mysqli_fetch_object(object);
mysqli_prop_handler *p;
int ret = 0;
- if ((p = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member))) != NULL) {
+ if ((p = zend_hash_find_ptr(obj->prop_handler, name)) != NULL) {
switch (has_set_exists) {
case ZEND_PROPERTY_EXISTS:
ret = 1;
break;
case ZEND_PROPERTY_NOT_EMPTY: {
zval rv;
- zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
convert_to_boolean(value);
ret = Z_TYPE_P(value) == IS_TRUE ? 1 : 0;
@@ -406,7 +376,7 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
}
case ZEND_PROPERTY_ISSET: {
zval rv;
- zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
ret = Z_TYPE_P(value) != IS_NULL? 1 : 0;
zval_ptr_dtor(value);
@@ -417,27 +387,26 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
php_error_docref(NULL, E_WARNING, "Invalid value for has_set_exists");
}
} else {
- ret = zend_std_has_property(object, member, has_set_exists, cache_slot);
+ ret = zend_std_has_property(object, name, has_set_exists, cache_slot);
}
return ret;
} /* }}} */
-HashTable *mysqli_object_get_debug_info(zval *object, int *is_temp)
+HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp)
{
- mysqli_object *obj = Z_MYSQLI_P(object);
+ mysqli_object *obj = php_mysqli_fetch_object(object);
HashTable *retval, *props = obj->prop_handler;
mysqli_prop_handler *entry;
retval = zend_new_array(zend_hash_num_elements(props) + 1);
ZEND_HASH_FOREACH_PTR(props, entry) {
- zval rv, member;
+ zval rv;
zval *value;
- ZVAL_STR(&member, entry->name);
- value = mysqli_read_property(object, &member, BP_VAR_IS, 0, &rv);
+ value = mysqli_read_property(object, entry->name, BP_VAR_IS, 0, &rv);
if (value != &EG(uninitialized_zval)) {
- zend_hash_add(retval, Z_STR(member), value);
+ zend_hash_add(retval, entry->name, value);
}
} ZEND_HASH_FOREACH_END();
@@ -1226,7 +1195,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
if (into_object) {
zend_string *class_name = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|Sz", &mysql_result, mysqli_result_class_entry, &class_name, &ctor_params) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|Sa", &mysql_result, mysqli_result_class_entry, &class_name, &ctor_params) == FAILURE) {
return;
}
if (class_name == NULL) {
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index ffbb841c19..1e19fed52b 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.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, |
@@ -816,7 +814,7 @@ PHP_FUNCTION(mysqli_dump_debug_info)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_BOOL(!mysql_dump_debug_info(mysql->mysql))
+ RETURN_BOOL(!mysql_dump_debug_info(mysql->mysql));
}
/* }}} */
diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c
index 7df2eca11b..c0b3eb7d5a 100644
--- a/ext/mysqli/mysqli_driver.c
+++ b/ext/mysqli/mysqli_driver.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/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c
index 6ac5261e07..f93479328c 100644
--- a/ext/mysqli/mysqli_exception.c
+++ b/ext/mysqli/mysqli_exception.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/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
index 4869228ef2..506d74c4fa 100644
--- a/ext/mysqli/mysqli_fe.c
+++ b/ext/mysqli/mysqli_fe.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/ext/mysqli/mysqli_fe.h b/ext/mysqli/mysqli_fe.h
index c6e8293d1a..ab2974900d 100644
--- a/ext/mysqli/mysqli_fe.h
+++ b/ext/mysqli/mysqli_fe.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/ext/mysqli/mysqli_libmysql.h b/ext/mysqli/mysqli_libmysql.h
index 391fca9ff5..b6499e4c6e 100644
--- a/ext/mysqli/mysqli_libmysql.h
+++ b/ext/mysqli/mysqli_libmysql.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/ext/mysqli/mysqli_mysqlnd.h b/ext/mysqli/mysqli_mysqlnd.h
index 4c6872cf1a..48eae08258 100644
--- a/ext/mysqli/mysqli_mysqlnd.h
+++ b/ext/mysqli/mysqli_mysqlnd.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/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index ef20f98019..cf641fd7b8 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.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/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h
index 6448c7ce60..6d3db39038 100644
--- a/ext/mysqli/mysqli_priv.h
+++ b/ext/mysqli/mysqli_priv.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/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index eab1a0676c..f1f4fa2e36 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.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/ext/mysqli/mysqli_report.c b/ext/mysqli/mysqli_report.c
index 330e5a6f70..7a6ef5a0e8 100644
--- a/ext/mysqli/mysqli_report.c
+++ b/ext/mysqli/mysqli_report.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/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c
index caf19c34d1..3721edf5e3 100644
--- a/ext/mysqli/mysqli_result_iterator.c
+++ b/ext/mysqli/mysqli_result_iterator.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/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index 248d9a281f..dca0c5b726 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.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/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
index 64a979d3fd..e53c6a8169 100644
--- a/ext/mysqli/php_mysqli.h
+++ b/ext/mysqli/php_mysqli.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/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index 93fbc15e91..dfeebec3bf 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.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/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt
index f4b60ecd4f..a8977be02f 100644
--- a/ext/mysqli/tests/057.phpt
+++ b/ext/mysqli/tests/057.phpt
@@ -40,7 +40,6 @@ require_once('skipifconnectfailure.inc');
var_dump(mysqli_stmt_execute($stmt));
var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));
- var_dump(mysqli_stmt_reset($stmt));
$stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
mysqli_stmt_execute($stmt);
@@ -102,9 +101,6 @@ object(mysqli_stmt)#%d (%d) {
bool(true)
bool(false)
string(0) ""
-
-Warning: mysqli_stmt_reset() expects parameter 1 to be mysqli_stmt, bool given in %s on line %d
-NULL
Rows: 3
array(1) {
[0]=>
diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt
index 95c3bb3426..81a7f5b6de 100644
--- a/ext/mysqli/tests/mysqli_affected_rows.phpt
+++ b/ext/mysqli/tests/mysqli_affected_rows.phpt
@@ -10,18 +10,6 @@ mysqli_affected_rows()
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_affected_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_affected_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_affected_rows($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt
index ce470fce72..99bd7d29c5 100644
--- a/ext/mysqli/tests/mysqli_autocommit.phpt
+++ b/ext/mysqli/tests/mysqli_autocommit.phpt
@@ -19,18 +19,6 @@ mysqli_autocommit()
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_autocommit()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_autocommit($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_autocommit($link, $link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt
index e3c36a2286..ab945e4cb1 100644
--- a/ext/mysqli/tests/mysqli_begin_transaction.phpt
+++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt
@@ -17,31 +17,10 @@ if (!have_innodb($link))
<?php
require_once("connect.inc");
/* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_begin_transaction()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link)))
- printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt
index 7b9f23cf9e..bf1515e645 100644
--- a/ext/mysqli/tests/mysqli_change_user.phpt
+++ b/ext/mysqli/tests/mysqli_change_user.phpt
@@ -10,24 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_change_user()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_change_user($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_change_user($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_change_user($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_change_user($link, $link, $link, $link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt
index 90dd46fa73..4e7153e5b0 100644
--- a/ext/mysqli/tests/mysqli_character_set_name.phpt
+++ b/ext/mysqli/tests/mysqli_character_set_name.phpt
@@ -11,18 +11,6 @@ require_once('skipifconnectfailure.inc');
/* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_character_set_name()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_character_set_name($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_character_set_name($link, $link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
@@ -65,10 +53,6 @@ require_once('skipifconnectfailure.inc');
if (false !== ($tmp = @mysqli_character_set_name($link)))
printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- /* Make sure that the function alias exists */
- if (!is_null($tmp = @mysqli_character_set_name()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--EXPECT--
diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
index 5d303fd503..4b760ec5bb 100644
--- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
+++ b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
@@ -18,9 +18,6 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias]
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$mysqli->character_set_name($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$res = $mysqli->query('SELECT version() AS server_version'))
printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
$tmp = $res->fetch_assoc();
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
index 47beb1d79b..c341acf2b3 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
@@ -53,42 +53,42 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -111,42 +111,42 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -169,7 +169,7 @@ Number of Required Parameters: 1
Inspecting parameter 'mode' of method 'autocommit'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -192,14 +192,14 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'begin_transaction'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'name' of method 'begin_transaction'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -222,21 +222,21 @@ Number of Required Parameters: 3
Inspecting parameter 'user' of method 'change_user'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'password' of method 'change_user'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'database' of method 'change_user'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -291,14 +291,14 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'commit'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'name' of method 'commit'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -321,42 +321,42 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -379,7 +379,7 @@ Number of Required Parameters: 1
Inspecting parameter 'debug_options' of method 'debug'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -418,7 +418,7 @@ Number of Required Parameters: 1
Inspecting parameter 'string_to_escape' of method 'escape_string'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -537,7 +537,7 @@ Number of Required Parameters: 1
Inspecting parameter 'connection_id' of method 'kill'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -576,7 +576,7 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'multi_query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -615,14 +615,14 @@ Number of Required Parameters: 2
Inspecting parameter 'option' of method 'options'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'value' of method 'options'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -682,14 +682,14 @@ isDefaultValueAvailable: no
Inspecting parameter 'sec' of method 'poll'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'usec' of method 'poll'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -712,7 +712,7 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'prepare'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -735,14 +735,14 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'resultmode' of method 'query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -765,49 +765,49 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'flags' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -830,7 +830,7 @@ Number of Required Parameters: 1
Inspecting parameter 'string_to_escape' of method 'real_escape_string'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -853,7 +853,7 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'real_query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -892,7 +892,7 @@ Number of Required Parameters: 1
Inspecting parameter 'options' of method 'refresh'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -915,7 +915,7 @@ Number of Required Parameters: 1
Inspecting parameter 'name' of method 'release_savepoint'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -938,14 +938,14 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'rollback'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'name' of method 'rollback'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -968,7 +968,7 @@ Number of Required Parameters: 1
Inspecting parameter 'name' of method 'savepoint'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -991,7 +991,7 @@ Number of Required Parameters: 1
Inspecting parameter 'database' of method 'select_db'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1014,7 +1014,7 @@ Number of Required Parameters: 1
Inspecting parameter 'charset' of method 'set_charset'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1037,14 +1037,14 @@ Number of Required Parameters: 2
Inspecting parameter 'option' of method 'set_opt'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'value' of method 'set_opt'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1067,35 +1067,35 @@ Number of Required Parameters: 5
Inspecting parameter 'key' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'cert' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'certificate_authority' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'certificate_authority_path' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'cipher' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1150,7 +1150,7 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'store_result'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
index 7367a5cd7c..b8ab4a4af5 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
@@ -128,9 +128,6 @@ require_once('skipifconnectfailure.inc');
if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT)))
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($res = new mysqli_result($link, 'invalid')))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
$valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
do {
$mode = mt_rand(-1000, 1000);
@@ -146,12 +143,6 @@ require_once('skipifconnectfailure.inc');
printf("[009] Expecting warning because of invalid resultmode\n");
}
- if (!is_object($res = new mysqli_result('foo')))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = @new mysqli_result($link, MYSQLI_STORE_RESULT, 1)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
print "done!";
?>
--EXPECTF--
@@ -186,8 +177,4 @@ Access to undefined properties:
mysqli_result->unknown = ''
Constructor:
-
-Warning: mysqli_result::__construct() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: mysqli_result::__construct() expects parameter 1 to be mysqli, string given in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
index b3b7759ace..c130e27a6b 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
@@ -101,7 +101,7 @@ Number of Required Parameters: 1
Inspecting parameter 'offset' of method 'data_seek'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -124,7 +124,7 @@ Number of Required Parameters: 0
Inspecting parameter 'result_type' of method 'fetch_all'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -147,7 +147,7 @@ Number of Required Parameters: 0
Inspecting parameter 'result_type' of method 'fetch_array'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -202,7 +202,7 @@ Number of Required Parameters: 1
Inspecting parameter 'field_nr' of method 'fetch_field_direct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -241,7 +241,7 @@ Number of Required Parameters: 0
Inspecting parameter 'class_name' of method 'fetch_object'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -287,7 +287,7 @@ Number of Required Parameters: 1
Inspecting parameter 'field_nr' of method 'field_seek'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
index 8fc4583a4c..3e3301361d 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
@@ -123,16 +123,6 @@ printf("stmt->unknown = '%s'\n", @$stmt->unknown);
@$stmt->unknown = 13;
printf("stmt->unknown = '%s'\n", @$stmt->unknown);
-printf("\nPrepare using the constructor:\n");
-$stmt = new mysqli_stmt($link, 'SELECT id FROM test ORDER BY id');
-if (!$stmt->execute())
-printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
-$stmt->close();
-
-$obj = new stdClass();
-if (!is_object($stmt = new mysqli_stmt($link, $obj)))
-printf("[003] Expecting NULL got %s/%s\n", gettype($stmt), $stmt);
-
print "done!";
?>
--EXPECTF--
@@ -191,8 +181,4 @@ stmt->sqlstate = '00000'
Access to undefined properties:
stmt->unknown = ''
stmt->unknown = '13'
-
-Prepare using the constructor:
-
-Warning: mysqli_stmt::__construct() expects parameter 2 to be string, object given in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_close.phpt b/ext/mysqli/tests/mysqli_close.phpt
index a300fb8314..0110847334 100644
--- a/ext/mysqli/tests/mysqli_close.phpt
+++ b/ext/mysqli/tests/mysqli_close.phpt
@@ -10,23 +10,10 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_close($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- $tmp = @mysqli_close(NULL);
- if (NULL !== $tmp)
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
$tmp = mysqli_close($link);
if (true !== $tmp)
printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_close_oo.phpt b/ext/mysqli/tests/mysqli_close_oo.phpt
index 305d5edf88..be189ba232 100644
--- a/ext/mysqli/tests/mysqli_close_oo.phpt
+++ b/ext/mysqli/tests/mysqli_close_oo.phpt
@@ -17,9 +17,6 @@ require_once('skipifconnectfailure.inc');
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$mysqli->close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
$tmp = $mysqli->close();
if (true !== $tmp)
printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_commit.phpt b/ext/mysqli/tests/mysqli_commit.phpt
index 2fd3745d85..c2b46a7294 100644
--- a/ext/mysqli/tests/mysqli_commit.phpt
+++ b/ext/mysqli/tests/mysqli_commit.phpt
@@ -17,18 +17,6 @@ if (!have_innodb($link))
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_commit()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_commit($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_commit($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_connect.phpt b/ext/mysqli/tests/mysqli_connect.phpt
index 66cd94bd54..d5e4febbef 100644
--- a/ext/mysqli/tests/mysqli_connect.phpt
+++ b/ext/mysqli/tests/mysqli_connect.phpt
@@ -19,10 +19,6 @@ require_once('skipifconnectfailure.inc');
$exptype = ($anon_allow) ? "mysqli_object" : "false";
- $obj = new stdClass();
- if (!is_null($tmp = @mysqli_connect($obj)))
- printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
$tmp = @mysqli_connect($link);
if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_data_seek.phpt b/ext/mysqli/tests/mysqli_data_seek.phpt
index 9bc3b12f73..0859ee61d5 100644
--- a/ext/mysqli/tests/mysqli_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_data_seek.phpt
@@ -10,18 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_data_seek()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_data_seek($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_data_seek($link, $link)))
- printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_data_seek_oo.phpt b/ext/mysqli/tests/mysqli_data_seek_oo.phpt
index 7fb14f0956..2c4377d845 100644
--- a/ext/mysqli/tests/mysqli_data_seek_oo.phpt
+++ b/ext/mysqli/tests/mysqli_data_seek_oo.phpt
@@ -9,10 +9,6 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
require('table.inc');
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
@@ -26,15 +22,6 @@ require_once('skipifconnectfailure.inc');
if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @$res->data_seek()))
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @$res->data_seek($link)))
- printf("[005] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @$res->data_seek($link, $link)))
- printf("[006] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (true !== ($tmp = $res->data_seek(3)))
printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_debug.phpt b/ext/mysqli/tests/mysqli_debug.phpt
index aa455d7f6e..478dcf7d08 100644
--- a/ext/mysqli/tests/mysqli_debug.phpt
+++ b/ext/mysqli/tests/mysqli_debug.phpt
@@ -19,9 +19,6 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
<?php
require_once('connect.inc');
- if (NULL !== ($tmp = @mysqli_debug()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
// NOTE: documentation is not clear on this: function always return NULL or TRUE
if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_dump_debug_info.phpt b/ext/mysqli/tests/mysqli_dump_debug_info.phpt
index b3fbde7fd9..d9c894dfff 100644
--- a/ext/mysqli/tests/mysqli_dump_debug_info.phpt
+++ b/ext/mysqli/tests/mysqli_dump_debug_info.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_dump_debug_info()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_dump_debug_info($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
index a0b5365432..58eb63cb2b 100644
--- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
+++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
@@ -16,9 +16,6 @@ require_once('skipifconnectfailure.inc');
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = @$mysqli->dump_debug_info($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!is_bool($tmp = $mysqli->dump_debug_info()))
printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
gettype($tmp), $tmp,
diff --git a/ext/mysqli/tests/mysqli_errno.phpt b/ext/mysqli/tests/mysqli_errno.phpt
index 0a9c245341..f26a30e089 100644
--- a/ext/mysqli/tests/mysqli_errno.phpt
+++ b/ext/mysqli/tests/mysqli_errno.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_error.phpt b/ext/mysqli/tests/mysqli_error.phpt
index fd61f0f5d2..4154f45f1d 100644
--- a/ext/mysqli/tests/mysqli_error.phpt
+++ b/ext/mysqli/tests/mysqli_error.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_error_unicode.phpt b/ext/mysqli/tests/mysqli_error_unicode.phpt
index f4d8da9110..8127931882 100644
--- a/ext/mysqli/tests/mysqli_error_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_error_unicode.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt
index f9a7ee3770..9f18499454 100644
--- a/ext/mysqli/tests/mysqli_fetch_all.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all.phpt
@@ -12,15 +12,6 @@ if (!function_exists('mysqli_fetch_all'))
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_all()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_all($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt
index e9dd1602b5..775c6f20c4 100644
--- a/ext/mysqli/tests/mysqli_fetch_array.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array.phpt
@@ -9,14 +9,6 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_array()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_array($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_assoc.phpt
index 6b98b5f51c..3097eb2bc4 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc.phpt
@@ -10,17 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_assoc()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_assoc($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
index e4f6465176..db3457a4a0 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
@@ -24,9 +24,6 @@ require_once('skipifconnectfailure.inc');
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$res->fetch_assoc($link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt
index 684795a48e..5035cf70d2 100644
--- a/ext/mysqli/tests/mysqli_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field.phpt
@@ -10,15 +10,7 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_field()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_field($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
index be883ef625..5acc3b75d4 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
@@ -10,18 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_field_direct()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_field_direct($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_field_direct($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
index c240050e17..c1220c7832 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
@@ -10,13 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
$mysqli = new mysqli();
$res = @new mysqli_result($mysqli);
- if (!is_null($tmp = @$res->fetch_field_direct()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@@ -28,15 +23,6 @@ require_once('skipifconnectfailure.inc');
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
- if (!is_null($tmp = @$res->fetch_field_direct()))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @$res->fetch_field_direct($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @$res->fetch_field_direct($link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
var_dump($res->fetch_field_direct(-1));
var_dump($res->fetch_field_direct(0));
var_dump($res->fetch_field_direct(2));
diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
index 2293c9581a..35fdbb050e 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
@@ -10,23 +10,15 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
$mysqli = new mysqli();
$res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_field()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$res->fetch_field($link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
// Make sure that client, connection and result charsets are all the
// same. Not sure whether this is strictly necessary.
if (!$mysqli->set_charset('utf8'))
diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt
index c79555c3a1..6dee8108f9 100644
--- a/ext/mysqli/tests/mysqli_fetch_fields.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt
@@ -10,15 +10,7 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt
index 85921f800d..b407d91894 100644
--- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt
@@ -15,12 +15,6 @@ require_once('skipifconnectfailure.inc');
$host, $user, $db, $port, $socket);
}
- if (!is_null($tmp = @mysqli_fetch_lengths()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_lengths($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt
index 09ea19161a..3230162ce7 100644
--- a/ext/mysqli/tests/mysqli_fetch_object.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object.phpt
@@ -12,15 +12,6 @@ require_once('skipifconnectfailure.inc');
set_error_handler('handle_catchable_fatal');
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_object()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_object($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -145,14 +136,12 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
-[E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d
-[E_WARNING] mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in %s on line %d
Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 0 passed and exactly 2 expected
Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected
NULL
NULL
[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
bool(false)
-[0] Argument 3 passed to mysqli_fetch_object() must be of the type array, string given in %s on line %d
+[0] mysqli_fetch_object() expects parameter 3 to be array, string given in %s on line %d
Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
index d8c8cc70fd..a81cb7f80a 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
@@ -11,9 +11,6 @@ require_once('skipifconnectfailure.inc');
require_once("connect.inc");
set_error_handler('handle_catchable_fatal');
- $tmp = NULL;
- $link = NULL;
-
$mysqli = new mysqli();
$res = @new mysqli_result($mysqli);
if (false !== ($tmp = @$res->fetch_object()))
@@ -28,9 +25,6 @@ require_once('skipifconnectfailure.inc');
printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
- if (!is_null($tmp = @$res->fetch_object($link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
try {
if (!is_null($tmp = @$res->fetch_object($link, $link)))
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@@ -129,13 +123,12 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
-[E_WARNING] mysqli_result::__construct(): invalid object or resource mysql%s
-%s on line %d
+[E_WARNING] mysqli_result::__construct(): invalid object or resource mysqli
+ in %s on line %d
[E_WARNING] mysqli_result::fetch_object(): Couldn't fetch mysqli_result in %s on line %d
-[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
-[0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
-[0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
-[0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, null given in %s on line %d
+[0] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
+[0] mysqli_result::fetch_object() expects at most 2 parameters, 3 given in %s on line %d
+[0] mysqli_result::fetch_object() expects parameter 2 to be array, null given in %s on line %d
Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected
NULL
NULL
diff --git a/ext/mysqli/tests/mysqli_fetch_row.phpt b/ext/mysqli/tests/mysqli_fetch_row.phpt
index 7ca1b9a132..c16ca1da77 100644
--- a/ext/mysqli/tests/mysqli_fetch_row.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_row.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_row()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_row($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_field_count.phpt b/ext/mysqli/tests/mysqli_field_count.phpt
index d6581c6699..18fc3c9ec1 100644
--- a/ext/mysqli/tests/mysqli_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_field_count.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
var_dump(mysqli_field_count($link));
diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt
index c34cf3f647..3cd60c7ce9 100644
--- a/ext/mysqli/tests/mysqli_field_seek.phpt
+++ b/ext/mysqli/tests/mysqli_field_seek.phpt
@@ -56,15 +56,6 @@ require_once('skipifconnectfailure.inc');
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_field_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_field_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
// Make sure that client, connection and result charsets are all the
@@ -99,10 +90,6 @@ require_once('skipifconnectfailure.inc');
var_dump(mysqli_field_tell($res));
var_dump(mysqli_field_seek($res, 2));
var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, PHP_INT_MAX + 1));
-
- if (!is_null($tmp = @mysqli_field_seek($res, 0, "too many")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
mysqli_free_result($res);
@@ -217,9 +204,6 @@ int(2)
Warning: mysqli_field_seek(): Invalid field offset in %s on line %d
bool(false)
bool(false)
-
-Warning: mysqli_field_seek() expects parameter 2 to be int, float given in %s on line %d
-NULL
bool(true)
object(stdClass)#%d (13) {
["name"]=>
diff --git a/ext/mysqli/tests/mysqli_field_tell.phpt b/ext/mysqli/tests/mysqli_field_tell.phpt
index 9885c1d9d8..0b1d3bd0c1 100644
--- a/ext/mysqli/tests/mysqli_field_tell.phpt
+++ b/ext/mysqli/tests/mysqli_field_tell.phpt
@@ -10,31 +10,17 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_field_tell()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_field_tell($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek(1));
var_dump(mysqli_field_tell($res));
var_dump(mysqli_fetch_field($res));
var_dump(mysqli_fetch_field($res));
var_dump(mysqli_field_tell($res));
- if (!is_null($tmp = @mysqli_field_tell($res, 'too many arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-
var_dump(mysqli_field_seek($res, 2));
var_dump(mysqli_field_tell($res));
@@ -60,9 +46,6 @@ require_once('skipifconnectfailure.inc');
?>
--EXPECTF--
int(0)
-
-Warning: mysqli_field_seek() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(0)
object(stdClass)#%d (13) {
["name"]=>
diff --git a/ext/mysqli/tests/mysqli_free_result.phpt b/ext/mysqli/tests/mysqli_free_result.phpt
index 6cd7778319..be377a8817 100644
--- a/ext/mysqli/tests/mysqli_free_result.phpt
+++ b/ext/mysqli/tests/mysqli_free_result.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -33,7 +24,7 @@ require_once('skipifconnectfailure.inc');
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
print "c\n";
- var_dump($res = mysqli_store_result($link));
+ var_dump(mysqli_store_result($link));
var_dump(mysqli_error($link));
print "[005]\n";
var_dump(mysqli_free_result($res));
@@ -42,7 +33,7 @@ require_once('skipifconnectfailure.inc');
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
print "d\n";
- var_dump($res = mysqli_use_result($link));
+ var_dump(mysqli_use_result($link));
var_dump(mysqli_error($link));
print "[007]\n";
var_dump(mysqli_free_result($res));
@@ -63,16 +54,12 @@ Warning: mysqli_free_result(): Couldn't fetch mysqli_result in %s on line %d
bool(false)
c
bool(false)
-%s(0) ""
+string(0) ""
[005]
-
-Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d
NULL
d
bool(false)
-%s(0) ""
+string(0) ""
[007]
-
-Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d
NULL
done!
diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt
index 537809dd70..cd7cfb3ae4 100644
--- a/ext/mysqli/tests/mysqli_get_charset.phpt
+++ b/ext/mysqli/tests/mysqli_get_charset.phpt
@@ -12,18 +12,6 @@ if (!function_exists('mysqli_get_charset'))
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_get_charset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_charset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt
index 07ef78f296..6df6e2bee7 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt
@@ -81,10 +81,6 @@ mysqli.allow_local_infile=1
}
- $tmp = $link = null;
- if (!is_null($tmp = @mysqli_get_client_stats($link)))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require_once("connect.inc");
if (!is_array($info = mysqli_get_client_stats()) || empty($info))
diff --git a/ext/mysqli/tests/mysqli_get_connection_stats.phpt b/ext/mysqli/tests/mysqli_get_connection_stats.phpt
index 80875a44e6..45d09b1baf 100644
--- a/ext/mysqli/tests/mysqli_get_connection_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_connection_stats.phpt
@@ -14,13 +14,6 @@ if (!function_exists('mysqli_get_connection_stats')) {
?>
--FILE--
<?php
- $tmp = $link = null;
- if (!is_null($tmp = @mysqli_get_connection_stats()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_connection_stats($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require("table.inc");
if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
diff --git a/ext/mysqli/tests/mysqli_get_host_info.phpt b/ext/mysqli/tests/mysqli_get_host_info.phpt
index ada57f7d9f..534765808b 100644
--- a/ext/mysqli/tests/mysqli_get_host_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_host_info.phpt
@@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_host_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_host_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require "table.inc";
if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info))
printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
diff --git a/ext/mysqli/tests/mysqli_get_proto_info.phpt b/ext/mysqli/tests/mysqli_get_proto_info.phpt
index b24ab11fbd..c46fe30379 100644
--- a/ext/mysqli/tests/mysqli_get_proto_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_proto_info.phpt
@@ -10,19 +10,10 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_proto_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_proto_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require "table.inc";
if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1))
printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--EXPECT--
diff --git a/ext/mysqli/tests/mysqli_get_server_info.phpt b/ext/mysqli/tests/mysqli_get_server_info.phpt
index 3ea1b4a70d..25278528a6 100644
--- a/ext/mysqli/tests/mysqli_get_server_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_server_info.phpt
@@ -10,19 +10,10 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_server_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_server_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require "table.inc";
if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--CLEAN--
diff --git a/ext/mysqli/tests/mysqli_get_server_version.phpt b/ext/mysqli/tests/mysqli_get_server_version.phpt
index ddbf4e73bb..6589e335b4 100644
--- a/ext/mysqli/tests/mysqli_get_server_version.phpt
+++ b/ext/mysqli/tests/mysqli_get_server_version.phpt
@@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_server_version()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_server_version(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require "table.inc";
/* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
/* < 30000 = pre 3.2.3, very unlikely! */
diff --git a/ext/mysqli/tests/mysqli_info.phpt b/ext/mysqli/tests/mysqli_info.phpt
index 56ee2cce05..b3a090b6e8 100644
--- a/ext/mysqli/tests/mysqli_info.phpt
+++ b/ext/mysqli/tests/mysqli_info.phpt
@@ -12,12 +12,6 @@ mysqli.allow_local_infile=1
<?php
require_once("connect.inc");
- if (!is_null($tmp = @mysqli_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require "table.inc";
if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt
index 7d4c0e085c..383ed087b7 100644
--- a/ext/mysqli/tests/mysqli_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_insert_id.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_insert_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_insert_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (0 !== ($tmp = mysqli_insert_id($link)))
diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt
index 8b4e36afd4..f4af490a5b 100644
--- a/ext/mysqli/tests/mysqli_kill.phpt
+++ b/ext/mysqli/tests/mysqli_kill.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_kill()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_kill($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
// Zend will cast the NULL to 0
diff --git a/ext/mysqli/tests/mysqli_max_links.phpt b/ext/mysqli/tests/mysqli_max_links.phpt
index f3469e20e6..8586cb9276 100644
--- a/ext/mysqli/tests/mysqli_max_links.phpt
+++ b/ext/mysqli/tests/mysqli_max_links.phpt
@@ -25,14 +25,6 @@ mysqli.max_links=1
$i, mysqli_connect_errno(), mysqli_connect_error(),
mysqli_errno($links[$i]), mysqli_error($links[$i]));
- for ($i = 1; $i <= 5; $i++) {
- if ($res = mysqli_query($links[$i], 'SELECT id FROM test LIMIT 1')) {
- printf("[%03d] Can run query on link %d\n", 5 + $i, $i);
- mysqli_free_result($res);
- }
- mysqli_close($links[$i]);
- }
-
mysqli_close($link);
print "done!";
?>
@@ -53,24 +45,4 @@ Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt
index 7f0a1f748b..b9a971c24e 100644
--- a/ext/mysqli/tests/mysqli_more_results.phpt
+++ b/ext/mysqli/tests/mysqli_more_results.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_more_results()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_more_results($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
print "[004]\n";
diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt
index 05f564313d..57235c2b17 100644
--- a/ext/mysqli/tests/mysqli_multi_query.phpt
+++ b/ext/mysqli/tests/mysqli_multi_query.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_multi_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_multi_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (false !== ($tmp = mysqli_multi_query($link, "")))
diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt
index 6760cbbadc..b37d9949fa 100644
--- a/ext/mysqli/tests/mysqli_next_result.phpt
+++ b/ext/mysqli/tests/mysqli_next_result.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_next_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_next_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (false !== ($tmp = mysqli_next_result($link)))
diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt
index f891b309c2..1f33b4d2d9 100644
--- a/ext/mysqli/tests/mysqli_num_fields.phpt
+++ b/ext/mysqli/tests/mysqli_num_fields.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_num_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_num_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) {
diff --git a/ext/mysqli/tests/mysqli_num_rows.phpt b/ext/mysqli/tests/mysqli_num_rows.phpt
index c6e646e4c3..15d3f90257 100644
--- a/ext/mysqli/tests/mysqli_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_num_rows.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) {
@@ -28,16 +19,17 @@ require_once('skipifconnectfailure.inc');
return;
}
- if ($expected !== ($tmp = mysqli_num_rows($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
-
- mysqli_free_result($res);
+ if (!is_bool($res)) {
+ if ($expected !== ($tmp = mysqli_num_rows($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
- if ($test_free && (false !== ($tmp = mysqli_num_rows($res))))
- printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+ mysqli_free_result($res);
+ if ($test_free && (false !== ($tmp = mysqli_num_rows($res))))
+ printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+ }
}
func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
@@ -78,10 +70,6 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in %s on line %d
-
-Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d
-
Warning: mysqli_num_rows(): Couldn't fetch mysqli_result in %s on line %d
run_tests.php don't fool me with your 'ungreedy' expression '.+?'!
diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt
index 6d5247943b..7b920b4f4c 100644
--- a/ext/mysqli/tests/mysqli_options.phpt
+++ b/ext/mysqli/tests/mysqli_options.phpt
@@ -27,30 +27,12 @@ require_once('skipifconnectfailure.inc');
if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'))
$valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE');
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_options()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
$link = mysqli_init();
/* set it twice, checking if memory for the previous one is correctly freed */
mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8");
mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1");
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
// print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
@@ -120,7 +102,7 @@ bool(true)
%s(23) "MYSQLI_OPT_LOCAL_INFILE"
bool(true)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
%s(19) "MYSQLI_INIT_COMMAND"
bool(true)
%s(25) "MYSQLI_READ_DEFAULT_GROUP"
diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt
index 6ddb29efef..93deeebfa3 100644
--- a/ext/mysqli/tests/mysqli_ping.phpt
+++ b/ext/mysqli/tests/mysqli_ping.phpt
@@ -10,17 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_ping()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (!is_null($tmp = @mysqli_ping($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
var_dump(mysqli_ping($link));
// provoke an error to check if mysqli_ping resets it
diff --git a/ext/mysqli/tests/mysqli_poll.phpt b/ext/mysqli/tests/mysqli_poll.phpt
index b9c66381f9..f6d99c8e13 100644
--- a/ext/mysqli/tests/mysqli_poll.phpt
+++ b/ext/mysqli/tests/mysqli_poll.phpt
@@ -25,29 +25,6 @@ if (!$IS_MYSQLND)
if (!$link = get_connection())
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (NULL !== ($tmp = @mysqli_poll()))
- printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link);
- if (NULL !== ($tmp = @mysqli_poll($l)))
- printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $n = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $n)))
- printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $n = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $n, $n)))
- printf("[005] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $e = NULL; $r = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, -1)))
- printf("[007] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $l = array($link); $e = NULL; $r = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, 0, -1)))
- printf("[008] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
$read = $error = $reject = array($link);
if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1))))
printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
diff --git a/ext/mysqli/tests/mysqli_prepare.phpt b/ext/mysqli/tests/mysqli_prepare.phpt
index 0c3bedf5b5..c6400e0b17 100644
--- a/ext/mysqli/tests/mysqli_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_prepare.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (false !== ($tmp = @mysqli_prepare($link, false)))
@@ -105,15 +96,8 @@ require_once('skipifconnectfailure.inc');
var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2'));
mysqli_stmt_close($stmt);
-
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo')))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
mysqli_close($link);
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test')))
- printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--CLEAN--
diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt
index 08145cddcf..a9502a83e4 100644
--- a/ext/mysqli/tests/mysqli_query.phpt
+++ b/ext/mysqli/tests/mysqli_query.phpt
@@ -10,23 +10,11 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (false !== ($tmp = @mysqli_query($link, '')))
printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL')))
printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt
index 819a849d94..f167b4373a 100644
--- a/ext/mysqli/tests/mysqli_query_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_query_unicode.phpt
@@ -16,23 +16,11 @@ mysqli_close($link);
<?php
include_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require_once('table.inc');
if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8")))
printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS колона", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел')))
printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt
index 1316d1a981..b12b3650d1 100644
--- a/ext/mysqli/tests/mysqli_real_connect.phpt
+++ b/ext/mysqli/tests/mysqli_real_connect.phpt
@@ -12,34 +12,7 @@ mysqli.allow_local_infile=1
<?php
include("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_real_connect($link)))
- printf("[001a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link)))
- printf("[001b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link)))
- printf("[001c] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link)))
- printf("[001d] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link)))
- printf("[001e] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link)))
- printf("[001f] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link)))
- printf("[001g] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
// ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]]
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link, $link)))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = mysqli_init())
printf("[002] mysqli_init() failed\n");
diff --git a/ext/mysqli/tests/mysqli_real_escape_string.phpt b/ext/mysqli/tests/mysqli_real_escape_string.phpt
index 05588cac63..57ab99eb89 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string.phpt
@@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_real_escape_string()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
printf("[004] Expecting \\\\, got %s\n", $tmp);
@@ -47,10 +35,6 @@ require_once('skipifconnectfailure.inc');
if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- /* Make sure that the function alias exists */
- if (NULL !== ($tmp = @mysqli_escape_string()))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--EXPECTF--
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
index b3465ad2b1..3db0ecce62 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
@@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_real_escape_string()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (NULL !== ($tmp =@mysqli_real_escape_string($link, "фуу", "бар")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар')))
printf("[004] Expecting фу\\\\бар, got %s\n", $tmp);
diff --git a/ext/mysqli/tests/mysqli_real_query.phpt b/ext/mysqli/tests/mysqli_real_query.phpt
index 9b99435d42..4515810310 100644
--- a/ext/mysqli/tests/mysqli_real_query.phpt
+++ b/ext/mysqli/tests/mysqli_real_query.phpt
@@ -9,20 +9,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_real_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_real_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (NULL !== ($tmp = @mysqli_real_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL')))
printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_reap_async_query.phpt b/ext/mysqli/tests/mysqli_reap_async_query.phpt
index b43b6b2478..5f13c2bbd9 100644
--- a/ext/mysqli/tests/mysqli_reap_async_query.phpt
+++ b/ext/mysqli/tests/mysqli_reap_async_query.phpt
@@ -25,16 +25,6 @@ if (!$IS_MYSQLND)
if (!$link = get_connection())
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (NULL !== ($tmp = @mysqli_reap_async_query()))
- printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link);
- if (NULL !== ($tmp = @mysqli_reap_async_query($l)))
- printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
-
- if (NULL !== ($tmp = @mysqli_reap_async_query($link, $link)))
- printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
-
function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
diff --git a/ext/mysqli/tests/mysqli_release_savepoint.phpt b/ext/mysqli/tests/mysqli_release_savepoint.phpt
index e6417288d4..44a2bebb35 100644
--- a/ext/mysqli/tests/mysqli_release_savepoint.phpt
+++ b/ext/mysqli/tests/mysqli_release_savepoint.phpt
@@ -20,23 +20,10 @@ if (!have_innodb($link))
$tmp = NULL;
$link = NULL;
- if (!is_null($tmp = @mysqli_release_savepoint()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_release_savepoint($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- $name = array();
- if (!is_null($tmp = @mysqli_release_savepoint($link, $name)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_release_savepoint($link, 'foo', $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (false !== ($tmp = mysqli_release_savepoint($link, '')))
printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_report.phpt b/ext/mysqli/tests/mysqli_report.phpt
index 889fda5fbd..6215e6508c 100644
--- a/ext/mysqli/tests/mysqli_report.phpt
+++ b/ext/mysqli/tests/mysqli_report.phpt
@@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_report()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (true !== ($tmp = mysqli_report(-1)))
printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_rollback.phpt b/ext/mysqli/tests/mysqli_rollback.phpt
index 3a15ebbb79..e46ffbc296 100644
--- a/ext/mysqli/tests/mysqli_rollback.phpt
+++ b/ext/mysqli/tests/mysqli_rollback.phpt
@@ -17,22 +17,10 @@ mysqli_rollback()
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_rollback()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_rollback($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_rollback($link, 'foo')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (true !== ($tmp = mysqli_autocommit($link, false)))
printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_savepoint.phpt b/ext/mysqli/tests/mysqli_savepoint.phpt
index 866d96aa98..038d9c73c0 100644
--- a/ext/mysqli/tests/mysqli_savepoint.phpt
+++ b/ext/mysqli/tests/mysqli_savepoint.phpt
@@ -17,26 +17,11 @@ if (!have_innodb($link))
<?php
require_once("connect.inc");
/* {{{ proto bool mysqli_savepoint(object link, string name) */
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_savepoint()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_savepoint($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- $name = array();
- if (!is_null($tmp = @mysqli_savepoint($link, $name)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_savepoint($link, 'foo', $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (false !== ($tmp = mysqli_savepoint($link, '')))
printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt
index 041b7fbb22..e023866c17 100644
--- a/ext/mysqli/tests/mysqli_select_db.phpt
+++ b/ext/mysqli/tests/mysqli_select_db.phpt
@@ -11,22 +11,10 @@ require_once('skipifconnectfailure.inc');
require_once("connect.inc");
require_once("table.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_select_db()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_select_db($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_select_db($link, $db, "foo")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
/* does not make too much sense, unless we have access to at least one more database than $db */
if (!mysqli_select_db($link, $db))
printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt
index df90333867..33ebb8347b 100644
--- a/ext/mysqli/tests/mysqli_set_charset.phpt
+++ b/ext/mysqli/tests/mysqli_set_charset.phpt
@@ -48,18 +48,6 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_set_charset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
diff --git a/ext/mysqli/tests/mysqli_set_opt.phpt b/ext/mysqli/tests/mysqli_set_opt.phpt
index 757b8490b7..6769d2c530 100644
--- a/ext/mysqli/tests/mysqli_set_opt.phpt
+++ b/ext/mysqli/tests/mysqli_set_opt.phpt
@@ -10,26 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_set_opt()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_opt($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
$link = mysqli_init();
- if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_opt($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
// print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
diff --git a/ext/mysqli/tests/mysqli_sqlstate.phpt b/ext/mysqli/tests/mysqli_sqlstate.phpt
index b36291872e..55dd115403 100644
--- a/ext/mysqli/tests/mysqli_sqlstate.phpt
+++ b/ext/mysqli/tests/mysqli_sqlstate.phpt
@@ -10,19 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_sqlstate()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_sqlstate($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- var_dump(@mysqli_sqlstate($link, "foo"));
-
var_dump(mysqli_sqlstate($link));
mysqli_query($link, "SELECT unknown_column FROM test");
var_dump(mysqli_sqlstate($link));
@@ -40,7 +29,6 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
-NULL
%s(5) "00000"
%s(5) "42S22"
%s(5) "00000"
diff --git a/ext/mysqli/tests/mysqli_ssl_set.phpt b/ext/mysqli/tests/mysqli_ssl_set.phpt
index 8463cc58b8..4f28350ef5 100644
--- a/ext/mysqli/tests/mysqli_ssl_set.phpt
+++ b/ext/mysqli/tests/mysqli_ssl_set.phpt
@@ -12,27 +12,6 @@ if (!function_exists('mysqli_ssl_set'))
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_ssl_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_ssl_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_ssl_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
/*
This function always returns TRUE value.
diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt
index 2507a4c8f8..71f7af5a54 100644
--- a/ext/mysqli/tests/mysqli_stat.phpt
+++ b/ext/mysqli/tests/mysqli_stat.phpt
@@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stat()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stat($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (!is_null($tmp = @mysqli_stat($link, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link));
diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
index 1e08f0dec3..cfe5d53516 100644
--- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_affected_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_affected_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
index 92937a15ce..f3634a7621 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
@@ -10,23 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_attr_get()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_get($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
$valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
if (mysqli_get_client_version() > 50003)
$valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
index b3d60380cb..6e5710a0fc 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
@@ -8,22 +8,7 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_attr_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+require_once("connect.inc");
require('table.inc');
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
index d2d825438e..027460fc5f 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
@@ -19,18 +19,6 @@ require_once('skipifconnectfailure.inc');
*/
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_bind_param()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_param($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_param($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
$stmt = mysqli_stmt_init($link);
@@ -379,10 +367,6 @@ require_once('skipifconnectfailure.inc');
mysqli_stmt_close($stmt);
mysqli_close($link);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_bind_param()))
- printf("[021] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--CLEAN--
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
index dcd05e5f68..c166d91c48 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
@@ -9,25 +9,12 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_bind_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
$stmt = mysqli_stmt_init($link);
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_null($tmp = mysqli_stmt_bind_result($stmt)))
- printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
mysqli_stmt_close($stmt);
$stmt = mysqli_stmt_init($link);
@@ -295,11 +282,6 @@ require_once('skipifconnectfailure.inc');
if (mysqli_get_server_version($link) >= 50600)
func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34");
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_bind_result()))
- printf("[3000] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
$stmt = mysqli_stmt_init($link);
if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')"))
printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
@@ -318,8 +300,6 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_bind_result() expects at least 2 parameters, 1 given in %s on line %d
-
Warning: mysqli_stmt_bind_result(): invalid object or resource mysqli_stmt
in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt
index 6ea64e815a..dfeab7075d 100644
--- a/ext/mysqli/tests/mysqli_stmt_close.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_close.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
index f9224eef62..23ecea0be3 100644
--- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_data_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_data_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_errno.phpt b/ext/mysqli/tests/mysqli_stmt_errno.phpt
index d98a98b87a..39760e3003 100644
--- a/ext/mysqli/tests/mysqli_stmt_errno.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_errno.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_error.phpt b/ext/mysqli/tests/mysqli_stmt_error.phpt
index ad8efef602..49e03c8aee 100644
--- a/ext/mysqli/tests/mysqli_stmt_error.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_error.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_execute.phpt b/ext/mysqli/tests/mysqli_stmt_execute.phpt
index d97111a6fd..fd0fd3c628 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute.phpt
@@ -16,15 +16,6 @@ if (mysqli_get_server_version($link) <= 40100) {
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_execute()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_execute($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch.phpt b/ext/mysqli/tests/mysqli_stmt_fetch.phpt
index 4b41c9213d..25a1f52eb1 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch.phpt
@@ -15,15 +15,6 @@ require_once('skipifconnectfailure.inc');
*/
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_fetch($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
@@ -78,11 +69,6 @@ require_once('skipifconnectfailure.inc');
mysqli_close($link);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--CLEAN--
diff --git a/ext/mysqli/tests/mysqli_stmt_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_field_count.phpt
index 847fe04a3b..2fa8a8ac80 100644
--- a/ext/mysqli/tests/mysqli_stmt_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_field_count.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
$stmt = mysqli_stmt_init($link);
diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt
index 292905ab63..9d28d8a116 100644
--- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt
@@ -15,15 +15,6 @@ require_once('skipifconnectfailure.inc');
*/
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt
index e8f2843920..594e112cac 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt
@@ -18,15 +18,6 @@ if (!function_exists('mysqli_stmt_get_result'))
*/
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_get_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_get_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
index 00ed7adee4..ab261bd82b 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
@@ -17,23 +17,11 @@ if (!function_exists('mysqli_stmt_get_result'))
*/
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_get_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_get_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_get_result($stmt, "foo")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1"))
printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
index 51198523c9..c63a91487b 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
@@ -67,9 +67,6 @@ if (!function_exists('mysqli_stmt_get_result'))
if (false !== ($tmp = $res->data_seek($res->num_rows + 1)))
printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = $res->data_seek(PHP_INT_MAX + 1)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
for ($i = 0; $i < 100; $i++) {
/* intentionally out of range! */
$pos = mt_rand(-1, 4);
@@ -118,8 +115,6 @@ if (!function_exists('mysqli_stmt_get_result'))
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_result::data_seek() expects parameter 1 to be int, float given in %s on line %d
-
Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d
Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
index 1ebe6d051f..958a278554 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
@@ -26,15 +26,6 @@ mysqli_query($link, "DROP TABLE IF EXISTS test");
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_get_warnings()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_get_warnings($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_init.phpt b/ext/mysqli/tests/mysqli_stmt_init.phpt
index b82a855dd2..c16f708fe6 100644
--- a/ext/mysqli/tests/mysqli_stmt_init.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_init.phpt
@@ -15,15 +15,6 @@ require_once('skipifconnectfailure.inc');
*/
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_init()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_init($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!is_object($stmt = mysqli_stmt_init($link)))
@@ -34,9 +25,6 @@ require_once('skipifconnectfailure.inc');
mysqli_stmt_close($stmt);
- if (NULL !== ($tmp = mysqli_stmt_init($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
mysqli_close($link);
if (false !== ($tmp = mysqli_stmt_init($link)))
@@ -52,7 +40,5 @@ require_once('skipifconnectfailure.inc');
Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt
in %s on line %d
-Warning: mysqli_stmt_init() expects parameter 1 to be mysqli, object given in %s on line %d
-
Warning: mysqli_stmt_init(): Couldn't fetch mysqli in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
index e3ef9a25ec..fedf305650 100644
--- a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
@@ -10,16 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_insert_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt = @new mysqli_stmt($link);
- if (!is_null($tmp = @mysqli_insert_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
$stmt = mysqli_stmt_init($link);
diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
index 5355b3deb7..f798e22f71 100644
--- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_param_count.phpt b/ext/mysqli/tests/mysqli_stmt_param_count.phpt
index e847d165f6..4176de60c5 100644
--- a/ext/mysqli/tests/mysqli_stmt_param_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_param_count.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_param_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_param_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
@@ -53,11 +44,6 @@ require_once('skipifconnectfailure.inc');
mysqli_close($link);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_param_count()))
- printf("[041] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
print "done!";
?>
--CLEAN--
diff --git a/ext/mysqli/tests/mysqli_stmt_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_prepare.phpt
index d0e38075d9..52c7597ef6 100644
--- a/ext/mysqli/tests/mysqli_stmt_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_prepare.phpt
@@ -16,23 +16,11 @@ require_once('skipifconnectfailure.inc');
// fetch tests, because the fetch tests would have to call prepare/execute etc.
// anyway.
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_stmt_prepare($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (false !== ($tmp = mysqli_stmt_prepare($stmt, '')))
printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
diff --git a/ext/mysqli/tests/mysqli_stmt_reset.phpt b/ext/mysqli/tests/mysqli_stmt_reset.phpt
index b7ec4e3ed7..339b885b72 100644
--- a/ext/mysqli/tests/mysqli_stmt_reset.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_reset.phpt
@@ -16,15 +16,6 @@ require_once('skipifconnectfailure.inc');
// fetch tests, because the fetch tests would have to call prepare/execute etc.
// anyway.
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_reset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_reset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
index 8f4e13ef39..adb7f6f726 100644
--- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_result_metadata()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_result_metadata($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
@@ -85,11 +76,6 @@ require_once('skipifconnectfailure.inc');
if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_result_metadata()))
- printf("[018] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
mysqli_close($link);
print "done!";
?>
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
index 1fc2745511..b42e393503 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
@@ -10,23 +10,11 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_send_long_data()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_send_long_data($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$stmt = mysqli_stmt_init($link))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -80,10 +68,6 @@ require_once('skipifconnectfailure.inc');
printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n",
gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob)))
- printf("[013] Expecting NULL, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob)))
printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
@@ -115,14 +99,6 @@ require_once('skipifconnectfailure.inc');
if ($blob != $row['label'])
printf("[021] Blob value has not been stored properly!\n");
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
- printf("[022] Expecting NULL, got %s/%s\n");
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_send_long_data()))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
mysqli_close($link);
print "done!";
?>
diff --git a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
index 1784106162..2740195931 100644
--- a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
@@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_sqlstate()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_sqlstate($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_sqlstate($link, '')))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$stmt = mysqli_stmt_init($link))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_stmt_store_result.phpt b/ext/mysqli/tests/mysqli_stmt_store_result.phpt
index 89b8ed3bf8..a6634e56f9 100644
--- a/ext/mysqli/tests/mysqli_stmt_store_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_store_result.phpt
@@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_store_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_store_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (false !== ($tmp = @mysqli_stmt_store_result(new mysqli_stmt())))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$stmt = mysqli_stmt_init($link))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt
index b87d147e38..5ee8a14f6b 100644
--- a/ext/mysqli/tests/mysqli_store_result.phpt
+++ b/ext/mysqli/tests/mysqli_store_result.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_store_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_store_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
diff --git a/ext/mysqli/tests/mysqli_thread_id.phpt b/ext/mysqli/tests/mysqli_thread_id.phpt
index 4a71d60f41..f8e286b54c 100644
--- a/ext/mysqli/tests/mysqli_thread_id.phpt
+++ b/ext/mysqli/tests/mysqli_thread_id.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_thread_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_thread_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
diff --git a/ext/mysqli/tests/mysqli_use_result.phpt b/ext/mysqli/tests/mysqli_use_result.phpt
index 190cafa5d5..650a130c89 100644
--- a/ext/mysqli/tests/mysqli_use_result.phpt
+++ b/ext/mysqli/tests/mysqli_use_result.phpt
@@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_use_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_use_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
diff --git a/ext/mysqli/tests/mysqli_warning_count.phpt b/ext/mysqli/tests/mysqli_warning_count.phpt
index 9d59f26e52..5e6a2e2381 100644
--- a/ext/mysqli/tests/mysqli_warning_count.phpt
+++ b/ext/mysqli/tests/mysqli_warning_count.phpt
@@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_warning_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_warning_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
require('table.inc');
- if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
diff --git a/ext/mysqlnd/mysql_float_to_double.h b/ext/mysqlnd/mysql_float_to_double.h
index 0690a4c498..2d4d4809cd 100644
--- a/ext/mysqlnd/mysql_float_to_double.h
+++ b/ext/mysqlnd/mysql_float_to_double.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/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h
index 77cbce93ae..b914afed6a 100644
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.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/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c
index e4fe274901..5beb3707cb 100644
--- a/ext/mysqlnd/mysqlnd_alloc.c
+++ b/ext/mysqlnd/mysqlnd_alloc.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/ext/mysqlnd/mysqlnd_alloc.h b/ext/mysqlnd/mysqlnd_alloc.h
index 5764063df7..8ef00e00e4 100644
--- a/ext/mysqlnd/mysqlnd_alloc.h
+++ b/ext/mysqlnd/mysqlnd_alloc.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/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c
index b08420f268..f3ea22b0ca 100644
--- a/ext/mysqlnd/mysqlnd_auth.c
+++ b/ext/mysqlnd/mysqlnd_auth.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/ext/mysqlnd/mysqlnd_auth.h b/ext/mysqlnd/mysqlnd_auth.h
index e667375476..03c074eadf 100644
--- a/ext/mysqlnd/mysqlnd_auth.h
+++ b/ext/mysqlnd/mysqlnd_auth.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/ext/mysqlnd/mysqlnd_block_alloc.c b/ext/mysqlnd/mysqlnd_block_alloc.c
index cb785238c7..a1b83308de 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.c
+++ b/ext/mysqlnd/mysqlnd_block_alloc.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/ext/mysqlnd/mysqlnd_block_alloc.h b/ext/mysqlnd/mysqlnd_block_alloc.h
index 1adf8997c0..4336da6289 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.h
+++ b/ext/mysqlnd/mysqlnd_block_alloc.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/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c
index 729cdcd11f..48bef05e49 100644
--- a/ext/mysqlnd/mysqlnd_charset.c
+++ b/ext/mysqlnd/mysqlnd_charset.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/ext/mysqlnd/mysqlnd_charset.h b/ext/mysqlnd/mysqlnd_charset.h
index a87891c67c..8736ab7201 100644
--- a/ext/mysqlnd/mysqlnd_charset.h
+++ b/ext/mysqlnd/mysqlnd_charset.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/ext/mysqlnd/mysqlnd_commands.c b/ext/mysqlnd/mysqlnd_commands.c
index 76a67f8f8f..953c3a2fcd 100644
--- a/ext/mysqlnd/mysqlnd_commands.c
+++ b/ext/mysqlnd/mysqlnd_commands.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/ext/mysqlnd/mysqlnd_commands.h b/ext/mysqlnd/mysqlnd_commands.h
index f043910dcb..ec844f99f3 100644
--- a/ext/mysqlnd/mysqlnd_commands.h
+++ b/ext/mysqlnd/mysqlnd_commands.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/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c
index 9154731be5..5f4fe32f36 100644
--- a/ext/mysqlnd/mysqlnd_connection.c
+++ b/ext/mysqlnd/mysqlnd_connection.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/ext/mysqlnd/mysqlnd_connection.h b/ext/mysqlnd/mysqlnd_connection.h
index 5887327b35..795ec3c5ea 100644
--- a/ext/mysqlnd/mysqlnd_connection.h
+++ b/ext/mysqlnd/mysqlnd_connection.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/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index b76fd4a2e5..8aa307e58f 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.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/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h
index 32dc7316a7..49d2f8426a 100644
--- a/ext/mysqlnd/mysqlnd_debug.h
+++ b/ext/mysqlnd/mysqlnd_debug.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/ext/mysqlnd/mysqlnd_driver.c b/ext/mysqlnd/mysqlnd_driver.c
index c1da994f41..6ca1441bb6 100644
--- a/ext/mysqlnd/mysqlnd_driver.c
+++ b/ext/mysqlnd/mysqlnd_driver.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/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h
index 8eaf68214e..955eccac0e 100644
--- a/ext/mysqlnd/mysqlnd_enum_n_def.h
+++ b/ext/mysqlnd/mysqlnd_enum_n_def.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/ext/mysqlnd/mysqlnd_ext_plugin.c b/ext/mysqlnd/mysqlnd_ext_plugin.c
index c2884b4f30..58a4ee767e 100644
--- a/ext/mysqlnd/mysqlnd_ext_plugin.c
+++ b/ext/mysqlnd/mysqlnd_ext_plugin.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/ext/mysqlnd/mysqlnd_ext_plugin.h b/ext/mysqlnd/mysqlnd_ext_plugin.h
index 1d4d96364f..713eb1f44f 100644
--- a/ext/mysqlnd/mysqlnd_ext_plugin.h
+++ b/ext/mysqlnd/mysqlnd_ext_plugin.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/ext/mysqlnd/mysqlnd_libmysql_compat.h b/ext/mysqlnd/mysqlnd_libmysql_compat.h
index 93f7254a7c..df4b96eec3 100644
--- a/ext/mysqlnd/mysqlnd_libmysql_compat.h
+++ b/ext/mysqlnd/mysqlnd_libmysql_compat.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/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c
index 5362f1c7dd..6cd100ab74 100644
--- a/ext/mysqlnd/mysqlnd_loaddata.c
+++ b/ext/mysqlnd/mysqlnd_loaddata.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/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index f886b6e005..a48cb47326 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.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/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c
index 1d19dba7e2..25ba2669e1 100644
--- a/ext/mysqlnd/mysqlnd_plugin.c
+++ b/ext/mysqlnd/mysqlnd_plugin.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/ext/mysqlnd/mysqlnd_plugin.h b/ext/mysqlnd/mysqlnd_plugin.h
index 863bb5a476..005088f742 100644
--- a/ext/mysqlnd/mysqlnd_plugin.h
+++ b/ext/mysqlnd/mysqlnd_plugin.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/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index eeec53c8d1..d0b97eb16e 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.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/ext/mysqlnd/mysqlnd_protocol_frame_codec.c b/ext/mysqlnd/mysqlnd_protocol_frame_codec.c
index 038a1eb6ad..cdea2a007f 100644
--- a/ext/mysqlnd/mysqlnd_protocol_frame_codec.c
+++ b/ext/mysqlnd/mysqlnd_protocol_frame_codec.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/ext/mysqlnd/mysqlnd_protocol_frame_codec.h b/ext/mysqlnd/mysqlnd_protocol_frame_codec.h
index abd65da708..8ba317f0e2 100644
--- a/ext/mysqlnd/mysqlnd_protocol_frame_codec.h
+++ b/ext/mysqlnd/mysqlnd_protocol_frame_codec.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/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index 5207c1b506..01096d10d5 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.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/ext/mysqlnd/mysqlnd_ps.h b/ext/mysqlnd/mysqlnd_ps.h
index fbc3d51fb7..0d4f7f8068 100644
--- a/ext/mysqlnd/mysqlnd_ps.h
+++ b/ext/mysqlnd/mysqlnd_ps.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/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c
index 12edd9a284..279e7ba01e 100644
--- a/ext/mysqlnd/mysqlnd_ps_codec.c
+++ b/ext/mysqlnd/mysqlnd_ps_codec.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/ext/mysqlnd/mysqlnd_read_buffer.c b/ext/mysqlnd/mysqlnd_read_buffer.c
index 5efb9fec1f..d2ff02e7ca 100644
--- a/ext/mysqlnd/mysqlnd_read_buffer.c
+++ b/ext/mysqlnd/mysqlnd_read_buffer.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/ext/mysqlnd/mysqlnd_read_buffer.h b/ext/mysqlnd/mysqlnd_read_buffer.h
index d033d7b06d..7d90653c8f 100644
--- a/ext/mysqlnd/mysqlnd_read_buffer.h
+++ b/ext/mysqlnd/mysqlnd_read_buffer.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/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index ba85ef819f..ad37744c87 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.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/ext/mysqlnd/mysqlnd_result.h b/ext/mysqlnd/mysqlnd_result.h
index 9df70271bc..14f894ccba 100644
--- a/ext/mysqlnd/mysqlnd_result.h
+++ b/ext/mysqlnd/mysqlnd_result.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/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c
index 9a8b8d72ee..b9e4129add 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.c
+++ b/ext/mysqlnd/mysqlnd_result_meta.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/ext/mysqlnd/mysqlnd_result_meta.h b/ext/mysqlnd/mysqlnd_result_meta.h
index f35b6c890e..b0a1fe23b1 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.h
+++ b/ext/mysqlnd/mysqlnd_result_meta.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/ext/mysqlnd/mysqlnd_reverse_api.c b/ext/mysqlnd/mysqlnd_reverse_api.c
index 25175e9b03..580dc12ce8 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.c
+++ b/ext/mysqlnd/mysqlnd_reverse_api.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/ext/mysqlnd/mysqlnd_reverse_api.h b/ext/mysqlnd/mysqlnd_reverse_api.h
index 3311086bfa..49579f9562 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.h
+++ b/ext/mysqlnd/mysqlnd_reverse_api.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/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c
index 2058441254..0a34ebc81c 100644
--- a/ext/mysqlnd/mysqlnd_statistics.c
+++ b/ext/mysqlnd/mysqlnd_statistics.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/ext/mysqlnd/mysqlnd_statistics.h b/ext/mysqlnd/mysqlnd_statistics.h
index 5626fbffe6..0a6310d716 100644
--- a/ext/mysqlnd/mysqlnd_statistics.h
+++ b/ext/mysqlnd/mysqlnd_statistics.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/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h
index 9880d1643d..4867b3f6cd 100644
--- a/ext/mysqlnd/mysqlnd_structs.h
+++ b/ext/mysqlnd/mysqlnd_structs.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/ext/mysqlnd/mysqlnd_vio.c b/ext/mysqlnd/mysqlnd_vio.c
index a5685e6707..2788c8cdde 100644
--- a/ext/mysqlnd/mysqlnd_vio.c
+++ b/ext/mysqlnd/mysqlnd_vio.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/ext/mysqlnd/mysqlnd_vio.h b/ext/mysqlnd/mysqlnd_vio.h
index 93038bd8bb..7c71aaa01e 100644
--- a/ext/mysqlnd/mysqlnd_vio.h
+++ b/ext/mysqlnd/mysqlnd_vio.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/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index d0f1312f55..4f52c442c3 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.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/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h
index 4b63e76a35..72453dcc30 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.h
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.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/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index 276d8968cd..c3ed9ca8f2 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.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/ext/mysqlnd/php_mysqlnd.h b/ext/mysqlnd/php_mysqlnd.h
index f202d038bb..1fc0c1130b 100644
--- a/ext/mysqlnd/php_mysqlnd.h
+++ b/ext/mysqlnd/php_mysqlnd.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/ext/oci8/oci8.c b/ext/oci8/oci8.c
index a3364be7e6..b3b28a4016 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.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/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index a89b5abe2c..faf608b2c1 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.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/ext/oci8/oci8_failover.c b/ext/oci8/oci8_failover.c
index 9c606749a6..7854defdbc 100644
--- a/ext/oci8/oci8_failover.c
+++ b/ext/oci8/oci8_failover.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/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index ae05c08a28..4182a898c6 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.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/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 5a31618713..2c5598673f 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.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/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index fa6e97e47f..7155e610b3 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.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/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 061c2c7ae7..4eb3ebeb47 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.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/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 8d1e326815..8790da3a16 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.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/ext/odbc/odbc.stub.php b/ext/odbc/odbc.stub.php
new file mode 100644
index 0000000000..835ea10674
--- /dev/null
+++ b/ext/odbc/odbc.stub.php
@@ -0,0 +1,231 @@
+<?php
+
+function odbc_close_all(): void {}
+
+/** @param resource $result_id */
+function odbc_binmode($result_id, int $mode): bool {}
+
+/** @param resource $result_id */
+function odbc_longreadlen($result_id, int $length): bool {}
+
+/**
+ * @param resource $result_id
+ * @return resource|false
+ */
+function odbc_prepare($connection_id, string $query) {}
+
+/** @param resource $result_id */
+function odbc_execute($result_id, array $parameters_array = UNKNOWN): bool {}
+
+/**
+ * @param resource $result_id
+ * @return string|false
+ */
+function odbc_cursor($result_id) {}
+
+#ifdef HAVE_SQLDATASOURCES
+/**
+ * @param resource $connection_id
+ * @return array|false
+ */
+function odbc_data_source($connection_id, int $fetch_type) {}
+#endif
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_exec($connection_id, string $query, int $flags = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_do($connection_id, string $query, int $flags = UNKNOWN) {}
+
+#ifdef PHP_ODBC_HAVE_FETCH_HASH
+/**
+ * @param resource $result
+ * @return stdClass|false
+ */
+function odbc_fetch_object($result, int $rownumber = -1) {}
+
+/**
+ * @param resource $result
+ * @return array|false
+ */
+function odbc_fetch_array($result, int $rownumber = -1) {}
+#endif
+
+/**
+ * @param resource $result_id
+ * @return int|false
+ */
+function odbc_fetch_into($result_id, &$result_array, int $rownumber = 0) {}
+
+/** @param resource $result_id */
+function odbc_fetch_row($result_id, int $row_number = UNKNOWN): bool {}
+
+/**
+ * @param resource $result_id
+ * @param string|int $field
+ * @return string|bool|null
+ */
+function odbc_result($result_id, $field) {}
+
+/**
+ * @param resource $result_id
+ * @return int|false
+ */
+function odbc_result_all($result_id, string $format = '') {}
+
+/** @param resource $result_id */
+function odbc_free_result($result_id): bool {}
+
+/** @return resource|false */
+function odbc_connect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
+
+/** @return resource|false */
+function odbc_pconnect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
+
+/** @param resource $connection_id */
+function odbc_close($connection_id): void {}
+
+/** @param resource $result_id */
+function odbc_num_rows($result_id): int {}
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
+/** @param resource $result_id */
+function odbc_next_result($result_id): bool {}
+#endif
+
+/** @param resource $result_id */
+function odbc_num_fields($result_id): int {}
+
+/**
+ * @param resource $result_id
+ * @return string|false
+ */
+function odbc_field_name($result_id, int $field_number) {}
+
+/**
+ * @param resource $result_id
+ * @return string|false
+ */
+function odbc_field_type($result_id, int $field_number) {}
+
+/**
+ * @param resource $result_id
+ * @return int|false
+ */
+function odbc_field_len($result_id, int $field_number) {}
+
+/**
+ * @param resource $result_id
+ * @return int|false
+ */
+function odbc_field_precision($result_id, int $field_number) {}
+
+/**
+ * @param resource $result_id
+ * @return int|false
+ */
+function odbc_field_scale($result_id, int $field_number) {}
+
+/**
+ * @param resource $result_id
+ * @return int|false
+ */
+function odbc_field_num($result_id, string $field_name) {}
+
+/**
+ * @param resource $connection_id
+ * @return int|bool
+ */
+function odbc_autocommit($connection_id, int $onoff = 0) {}
+
+/** @param resource $connection_id */
+function odbc_commit($connection_id): bool {}
+
+/** @param resource $connection_id */
+function odbc_rollback($connection_id): bool {}
+
+/** @param resource $connection_id */
+function odbc_error($connection_id = UNKNOWN): string {}
+
+/** @param resource $connection_id */
+function odbc_errormsg($connection_id = UNKNOWN): string {}
+
+/** @param resource $conn_id */
+function odbc_setoption($conn_id, int $which, int $option, int $value): bool {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_tables($connection_id, ?string $qualfier = null, string $owner = UNKNOWN, string $name = UNKNOWN, string $table_types = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_columns($connection_id, ?string $qualifier = null, string $owner = UNKNOWN, string $table_name = UNKNOWN, string $column_name = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_gettypeinfo($connection_id, int $data_type = 0) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_primarykeys($connection_id, ?string $qualifier, string $owner, string $table) {}
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_procedurecolumns($connection_id, ?string $qualifier = null, string $owner = UNKNOWN, string $proc = UNKNOWN, string $column = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_procedures($connection_id, ?string $qualifier = null, string $owner = UNKNOWN, string $name = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_foreignkeys($connection_id, ?string $pk_qualifier, string $pk_owner, string $pk_table, string $fk_qualifier, string $fk_owner, string $fk_table) {}
+#endif
+
+/**
+ * @see https://bugs.php.net/bug.php?id=78470
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_specialcolumns($connection_id, int $type, ?string $qualifier, string $owner, string $table, int $scope) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_statistics($connection_id, ?string $qualfier, string $owner, string $name, int $unique, int $accuracy) {}
+
+#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_tableprivileges($connection_id, ?string $qualifier, string $owner, string $name) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_columnprivileges($connection_id, ?string $catalog, string $schema, string $table, string $column) {}
+#endif
diff --git a/ext/odbc/odbc_arginfo.h b/ext/odbc/odbc_arginfo.h
new file mode 100644
index 0000000000..cac9518e84
--- /dev/null
+++ b/ext/odbc/odbc_arginfo.h
@@ -0,0 +1,242 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_binmode, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_longreadlen, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_prepare, 0, 0, 2)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_execute, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, parameters_array, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_cursor, 0, 0, 1)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SQLDATASOURCES)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_data_source, 0, 0, 2)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, fetch_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_exec, 0, 0, 2)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_do arginfo_odbc_exec
+
+#if defined(PHP_ODBC_HAVE_FETCH_HASH)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_object, 0, 0, 1)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_TYPE_INFO(0, rownumber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_ODBC_HAVE_FETCH_HASH)
+#define arginfo_odbc_fetch_array arginfo_odbc_fetch_object
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_into, 0, 0, 2)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_INFO(1, result_array)
+ ZEND_ARG_TYPE_INFO(0, rownumber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_fetch_row, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, row_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_result, 0, 0, 2)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_INFO(0, field)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_result_all, 0, 0, 1)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_free_result, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_connect, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, user, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cursor_option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_pconnect arginfo_odbc_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, connection_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_num_rows, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_next_result, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_odbc_num_fields arginfo_odbc_num_rows
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_name, 0, 0, 2)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, field_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_field_type arginfo_odbc_field_name
+
+#define arginfo_odbc_field_len arginfo_odbc_field_name
+
+#define arginfo_odbc_field_precision arginfo_odbc_field_name
+
+#define arginfo_odbc_field_scale arginfo_odbc_field_name
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_num, 0, 0, 2)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, field_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_autocommit, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, onoff, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_commit, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, connection_id)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_rollback arginfo_odbc_commit
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_error, 0, 0, IS_STRING, 0)
+ ZEND_ARG_INFO(0, connection_id)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_errormsg arginfo_odbc_error
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_setoption, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, conn_id)
+ ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tables, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualfier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table_types, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columns, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_gettypeinfo, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, data_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_primarykeys, 0, 0, 4)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, proc, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedures, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_foreignkeys, 0, 0, 7)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, pk_qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, pk_owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pk_table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, fk_qualifier, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, fk_owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, fk_table, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_specialcolumns, 0, 0, 6)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scope, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualfier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, unique, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, accuracy, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tableprivileges, 0, 0, 4)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columnprivileges, 0, 0, 5)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 19fce8d0fd..071b36c817 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.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, |
@@ -34,6 +32,7 @@
#include "php_odbc.h"
#include "php_odbc_includes.h"
#include "php_globals.h"
+#include "odbc_arginfo.h"
#if HAVE_UODBC
@@ -64,261 +63,6 @@ static int le_result, le_conn, le_pconn;
#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0))
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_odbc_close_all, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_binmode, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_longreadlen, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_prepare, 0, 0, 2)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, query)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_execute, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, parameters_array)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_cursor, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SQLDATASOURCES
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_data_source, 0, 0, 2)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, fetch_type)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_exec, 0, 0, 2)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, query)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_ODBC_HAVE_FETCH_HASH
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_object, 0, 0, 1)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(0, rownumber)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_array, 0, 0, 1)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(0, rownumber)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_into, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(1, result_array)
- ZEND_ARG_INFO(0, rownumber)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_row, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, row_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_result, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_result_all, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_free_result, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_connect, 0, 0, 3)
- ZEND_ARG_INFO(0, dsn)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, cursor_option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_pconnect, 0, 0, 3)
- ZEND_ARG_INFO(0, dsn)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, cursor_option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_close, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_num_rows, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_next_result, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_num_fields, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_name, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_type, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_len, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_scale, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_num, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_autocommit, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, onoff)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_commit, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_rollback, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_error, 0, 0, 0)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_errormsg, 0, 0, 0)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_setoption, 0, 0, 4)
- ZEND_ARG_INFO(0, conn_id)
- ZEND_ARG_INFO(0, which)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tables, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, table_types)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columns, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, table_name)
- ZEND_ARG_INFO(0, column_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_gettypeinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, data_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_primarykeys, 0, 0, 4)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, table)
-ZEND_END_ARG_INFO()
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, proc)
- ZEND_ARG_INFO(0, column)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedures, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_foreignkeys, 0, 0, 7)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, pk_qualifier)
- ZEND_ARG_INFO(0, pk_owner)
- ZEND_ARG_INFO(0, pk_table)
- ZEND_ARG_INFO(0, fk_qualifier)
- ZEND_ARG_INFO(0, fk_owner)
- ZEND_ARG_INFO(0, fk_table)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_specialcolumns, 0, 0, 7)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, scope)
- ZEND_ARG_INFO(0, nullable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, unique)
- ZEND_ARG_INFO(0, accuracy)
-ZEND_END_ARG_INFO()
-
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tableprivileges, 0, 0, 4)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columnprivileges, 0, 0, 5)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, catalog)
- ZEND_ARG_INFO(0, schema)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, column)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
/* {{{ odbc_functions[]
*/
static const zend_function_entry odbc_functions[] = {
@@ -375,8 +119,8 @@ static const zend_function_entry odbc_functions[] = {
PHP_FE(odbc_procedures, arginfo_odbc_procedures)
PHP_FE(odbc_procedurecolumns, arginfo_odbc_procedurecolumns)
#endif
- PHP_FALIAS(odbc_do, odbc_exec, arginfo_odbc_exec)
- PHP_FALIAS(odbc_field_precision, odbc_field_len, arginfo_odbc_field_len)
+ PHP_FALIAS(odbc_do, odbc_exec, arginfo_odbc_do)
+ PHP_FALIAS(odbc_field_precision, odbc_field_len, arginfo_odbc_field_precision)
PHP_FE_END
};
/* }}} */
@@ -921,7 +665,7 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (mode) {
@@ -1059,7 +803,7 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
rc = SQLTransact(conn->henv, conn->hdbc, (SQLUSMALLINT)((type)?SQL_COMMIT:SQL_ROLLBACK));
@@ -1106,7 +850,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -1201,7 +945,7 @@ PHP_FUNCTION(odbc_prepare)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -1308,7 +1052,7 @@ PHP_FUNCTION(odbc_execute)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* XXX check for already bound parameters*/
@@ -1514,7 +1258,7 @@ PHP_FUNCTION(odbc_cursor)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&len);
@@ -1580,7 +1324,7 @@ PHP_FUNCTION(odbc_data_source)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(zv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
/* now we have the "connection" lets call the DataSource object */
@@ -1638,7 +1382,7 @@ PHP_FUNCTION(odbc_exec)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -1734,7 +1478,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
#endif
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -1886,7 +1630,7 @@ PHP_FUNCTION(odbc_fetch_into)
#endif /* HAVE_SQL_EXTENDED_FETCH */
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -1992,7 +1736,7 @@ PHP_FUNCTION(solid_fetch_prev)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
php_error_docref(NULL, E_WARNING, "No tuples available at this result index");
@@ -2034,7 +1778,7 @@ PHP_FUNCTION(odbc_fetch_row)
rownum = pv_row;
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -2100,7 +1844,7 @@ PHP_FUNCTION(odbc_result)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((result->numcols == 0)) {
@@ -2279,7 +2023,7 @@ PHP_FUNCTION(odbc_result_all)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -2396,7 +2140,7 @@ PHP_FUNCTION(odbc_free_result)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->values) {
@@ -2695,7 +2439,7 @@ PHP_FUNCTION(odbc_close)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
if (Z_RES_P(pv_conn)->type == le_pconn) {
@@ -2732,7 +2476,7 @@ PHP_FUNCTION(odbc_num_rows)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
SQLRowCount(result->stmt, &rows);
@@ -2754,7 +2498,7 @@ PHP_FUNCTION(odbc_next_result)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->values) {
@@ -2805,7 +2549,7 @@ PHP_FUNCTION(odbc_num_fields)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(result->numcols);
@@ -2825,7 +2569,7 @@ PHP_FUNCTION(odbc_field_name)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -2862,7 +2606,7 @@ PHP_FUNCTION(odbc_field_type)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -2881,7 +2625,7 @@ PHP_FUNCTION(odbc_field_type)
}
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
- RETURN_STRING(tmp)
+ RETURN_STRING(tmp);
}
/* }}} */
@@ -2915,7 +2659,7 @@ PHP_FUNCTION(odbc_field_num)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (result->numcols == 0) {
@@ -2952,7 +2696,7 @@ PHP_FUNCTION(odbc_autocommit)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
if (ZEND_NUM_ARGS() > 1) {
@@ -3004,7 +2748,7 @@ static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (ZEND_NUM_ARGS() == 1) {
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_handle), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
if (mode == 0) {
ret = conn->laststate;
@@ -3062,7 +2806,7 @@ PHP_FUNCTION(odbc_setoption)
switch (pv_which) {
case 1: /* SQLSetConnectOption */
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_handle), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
if (conn->persistent) {
@@ -3077,7 +2821,7 @@ PHP_FUNCTION(odbc_setoption)
break;
case 2: /* SQLSetStmtOption */
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_handle), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ return;
}
rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val);
@@ -3118,7 +2862,7 @@ PHP_FUNCTION(odbc_tables)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3187,7 +2931,7 @@ PHP_FUNCTION(odbc_columns)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3259,7 +3003,7 @@ PHP_FUNCTION(odbc_columnprivileges)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3337,7 +3081,7 @@ PHP_FUNCTION(odbc_foreignkeys)
#endif
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3405,7 +3149,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
data_type = (SQLSMALLINT) pv_data_type;
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3464,7 +3208,7 @@ PHP_FUNCTION(odbc_primarykeys)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3532,7 +3276,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3601,7 +3345,7 @@ PHP_FUNCTION(odbc_procedures)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3671,7 +3415,7 @@ PHP_FUNCTION(odbc_specialcolumns)
nullable = (SQLUSMALLINT) vnullable;
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3742,7 +3486,7 @@ PHP_FUNCTION(odbc_statistics)
reserved = (SQLUSMALLINT) vreserved;
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3807,7 +3551,7 @@ PHP_FUNCTION(odbc_tableprivileges)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ return;
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
index 351b31ea40..500c784de2 100644
--- a/ext/odbc/php_odbc.h
+++ b/ext/odbc/php_odbc.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/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h
index 858a28af68..5e2e83e7b2 100644
--- a/ext/odbc/php_odbc_includes.h
+++ b/ext/odbc/php_odbc_includes.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/ext/odbc/tests/bug78473.phpt b/ext/odbc/tests/bug78473.phpt
index fd73b6cc07..c595d51fad 100644
--- a/ext/odbc/tests/bug78473.phpt
+++ b/ext/odbc/tests/bug78473.phpt
@@ -6,9 +6,13 @@ if (!extension_loaded('odbc')) die('skip odbc extension not available');
?>
--FILE--
<?php
-odbc_close(STDIN);
+try {
+ odbc_close(STDIN);
+} catch (TypeError $err) {
+ echo $err->getMessage(), PHP_EOL;
+}
var_dump(STDIN);
?>
--EXPECTF--
-Warning: odbc_close(): supplied resource is not a valid ODBC-Link resource in %s on line %d
+odbc_close(): supplied resource is not a valid ODBC-Link resource
resource(%d) of type (stream)
diff --git a/ext/odbc/tests/odbc_data_source_001.phpt b/ext/odbc/tests/odbc_data_source_001.phpt
index 8f5767315a..fedbbc1b02 100644
--- a/ext/odbc/tests/odbc_data_source_001.phpt
+++ b/ext/odbc/tests/odbc_data_source_001.phpt
@@ -15,16 +15,12 @@ include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
var_dump(odbc_data_source($conn, NULL));
-var_dump(odbc_data_source($conn, ''));
var_dump(odbc_data_source($conn, SQL_FETCH_FIRST));
?>
--EXPECTF--
Warning: odbc_data_source(): Invalid fetch type (0) in %s on line %d
bool(false)
-
-Warning: odbc_data_source() expects parameter 2 to be int, string given in %s on line %d
-NULL
array(%d) {
%a
}
diff --git a/ext/odbc/tests/odbc_free_result_001.phpt b/ext/odbc/tests/odbc_free_result_001.phpt
index cdc421117d..223b3f0a4c 100644
--- a/ext/odbc/tests/odbc_free_result_001.phpt
+++ b/ext/odbc/tests/odbc_free_result_001.phpt
@@ -22,10 +22,21 @@ $res = odbc_exec($conn, 'SELECT * FROM FOO');
var_dump(odbc_fetch_row($res));
var_dump(odbc_result($res, 'test'));
var_dump(odbc_free_result($res));
-var_dump(odbc_free_result($conn));
-var_dump(odbc_free_result(NULL));
-var_dump(odbc_fetch_row($res));
-var_dump(odbc_result($res, 'test'));
+try {
+ var_dump(odbc_free_result($conn));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(odbc_fetch_row($res));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(odbc_result($res, 'test'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
odbc_exec($conn, 'DROP TABLE FOO');
@@ -36,15 +47,6 @@ odbc_exec($conn, 'DROP DATABASE odbcTEST');
bool(true)
string(1) "1"
bool(true)
-
-Warning: odbc_free_result(): supplied resource is not a valid ODBC result resource in %s on line %d
-bool(false)
-
-Warning: odbc_free_result() expects parameter 1 to be resource, null given in %s on line %d
-NULL
-
-Warning: odbc_fetch_row(): supplied resource is not a valid ODBC result resource in %s on line %d
-bool(false)
-
-Warning: odbc_result(): supplied resource is not a valid ODBC result resource in %s on line %d
-bool(false)
+odbc_free_result(): supplied resource is not a valid ODBC result resource
+odbc_fetch_row(): supplied resource is not a valid ODBC result resource
+odbc_result(): supplied resource is not a valid ODBC result resource
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 3327ec86df..b4cd2407ba 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -33,27 +33,9 @@
/* Checks if a constant (like "true") may be replaced by its value */
int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy)
{
- zend_constant *c;
- char *lookup_name;
- int retval = 1;
- ALLOCA_FLAG(use_heap);
-
- if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) {
- lookup_name = do_alloca(ZSTR_LEN(name) + 1, use_heap);
- memcpy(lookup_name, ZSTR_VAL(name), ZSTR_LEN(name) + 1);
- zend_str_tolower(lookup_name, ZSTR_LEN(name));
-
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, ZSTR_LEN(name))) != NULL) {
- if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CT_SUBST) || (ZEND_CONSTANT_FLAGS(c) & CONST_CS)) {
- retval = 0;
- }
- } else {
- retval = 0;
- }
- free_alloca(lookup_name, use_heap);
- }
-
- if (retval) {
+ zval *zv;
+ zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
+ if (c) {
if ((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)
&& (!(ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE)
|| !(CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE))) {
@@ -61,23 +43,23 @@ int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int
if (copy) {
Z_TRY_ADDREF_P(result);
}
+ return 1;
} else {
- retval = 0;
+ return 0;
}
}
- return retval;
+ /* Special constants null/true/false can always be substituted. */
+ zv = zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name));
+ if (zv) {
+ ZVAL_COPY_VALUE(result, zv);
+ return 1;
+ }
+ return 0;
}
-/* CFG back references management */
-
-#define DEL_SOURCE(from, to)
-#define ADD_SOURCE(from, to)
-
/* Data dependencies macros */
-#define VAR_NUM_EX(op) VAR_NUM((op).var)
-
#define VAR_SOURCE(op) Tsource[VAR_NUM(op.var)]
#define SET_VAR_SOURCE(opline) Tsource[VAR_NUM(opline->result.var)] = opline
@@ -86,15 +68,6 @@ static void strip_leading_nops(zend_op_array *op_array, zend_basic_block *b)
zend_op *opcodes = op_array->opcodes;
do {
- /* check if NOP breaks incorrect smart branch */
- if (b->len == 2
- && (opcodes[b->start + 1].opcode == ZEND_JMPZ
- || opcodes[b->start + 1].opcode == ZEND_JMPNZ)
- && (opcodes[b->start + 1].op1_type & (IS_CV|IS_CONST))
- && b->start > 0
- && zend_is_smart_branch(opcodes + b->start - 1)) {
- break;
- }
b->start++;
b->len--;
} while (b->len > 0 && opcodes[b->start].opcode == ZEND_NOP);
@@ -125,14 +98,6 @@ static void strip_nops(zend_op_array *op_array, zend_basic_block *b)
}
j++;
}
- if (i + 1 < b->start + b->len
- && (op_array->opcodes[i+1].opcode == ZEND_JMPZ
- || op_array->opcodes[i+1].opcode == ZEND_JMPNZ)
- && op_array->opcodes[i+1].op1_type & (IS_CV|IS_CONST)
- && zend_is_smart_branch(op_array->opcodes + j - 1)) {
- /* don't remove NOP, that splits incorrect smart branch */
- j++;
- }
i++;
}
b->len = j - b->start;
@@ -203,52 +168,6 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
literal_dtor(&ZEND_OP1_LITERAL(src));
MAKE_NOP(src);
++(*opt_count);
- switch (opline->opcode) {
- case ZEND_JMPZ:
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- MAKE_NOP(opline);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
- } else {
- opline->opcode = ZEND_JMP;
- COPY_NODE(opline->op1, opline->op2);
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
- }
- break;
- case ZEND_JMPNZ:
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- opline->opcode = ZEND_JMP;
- COPY_NODE(opline->op1, opline->op2);
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
- } else {
- MAKE_NOP(opline);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
- }
- break;
- case ZEND_JMPZNZ:
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- zend_op *target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = block->successors[1];
- } else {
- zend_op *target_opline = ZEND_OP2_JMP_ADDR(opline);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
- DEL_SOURCE(block, block->successors[0]);
- }
- block->successors_count = 1;
- opline->op1_type = IS_UNUSED;
- opline->extended_value = 0;
- opline->opcode = ZEND_JMP;
- break;
- default:
- break;
- }
} else {
zval_ptr_dtor_nogc(&c);
}
@@ -278,64 +197,55 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
}
}
- if (opline->opcode == ZEND_ECHO) {
- if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
- src = VAR_SOURCE(opline->op1);
- if (src &&
- src->opcode == ZEND_CAST &&
- src->extended_value == IS_STRING) {
- /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
- VAR_SOURCE(opline->op1) = NULL;
- COPY_NODE(opline->op1, src->op1);
- MAKE_NOP(src);
- ++(*opt_count);
- }
- }
-
- if (opline->op1_type == IS_CONST) {
- if (last_op && last_op->opcode == ZEND_ECHO &&
- last_op->op1_type == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_DOUBLE &&
- Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_DOUBLE) {
- /* compress consecutive ECHO's.
- * Float to string conversion may be affected by current
- * locale setting.
- */
- int l, old_len;
-
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP1_LITERAL(opline));
- }
- if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
- convert_to_string(&ZEND_OP1_LITERAL(last_op));
+ switch (opline->opcode) {
+ case ZEND_ECHO:
+ if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ src = VAR_SOURCE(opline->op1);
+ if (src &&
+ src->opcode == ZEND_CAST &&
+ src->extended_value == IS_STRING) {
+ /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
}
- old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
- l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
- if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
- zend_string *tmp = zend_string_alloc(l, 0);
- memcpy(ZSTR_VAL(tmp), Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
- Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
- } else {
- Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_extend(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
+ } else if (opline->op1_type == IS_CONST &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_DOUBLE) {
+ if (last_op == opline - 1) {
+ /* compress consecutive ECHO's.
+ * Float to string conversion may be affected by current
+ * locale setting.
+ */
+ int l, old_len;
+
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP1_LITERAL(opline));
+ }
+ if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
+ convert_to_string(&ZEND_OP1_LITERAL(last_op));
+ }
+ old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
+ l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
+ if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
+ zend_string *tmp = zend_string_alloc(l, 0);
+ memcpy(ZSTR_VAL(tmp), Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
+ Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
+ } else {
+ Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_extend(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
+ }
+ Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX;
+ memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
+ Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_STR(&ZEND_OP1_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op))));
+ ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
+ MAKE_NOP(last_op);
+ ++(*opt_count);
}
- Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX;
- memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
- Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
- zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
- ZVAL_STR(&ZEND_OP1_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op))));
- ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
- MAKE_NOP(last_op);
- ++(*opt_count);
+ last_op = opline;
}
- last_op = opline;
- } else {
- last_op = NULL;
- }
- } else {
- last_op = NULL;
- }
-
- switch (opline->opcode) {
+ break;
case ZEND_FREE:
if (opline->op1_type == IS_TMP_VAR) {
@@ -592,6 +502,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
MAKE_NOP(opline);
++(*opt_count);
break;
+ case ZEND_ISSET_ISEMPTY_CV:
case ZEND_ISSET_ISEMPTY_VAR:
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
@@ -600,6 +511,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
case ZEND_TYPE_CHECK:
case ZEND_DEFINED:
case ZEND_IN_ARRAY:
+ case ZEND_ARRAY_KEY_EXISTS:
if (opline->opcode == ZEND_BOOL_NOT) {
break;
}
@@ -615,56 +527,135 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
case ZEND_JMPZ:
case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMPZNZ:
- optimize_jmpznz:
- if (opline->op1_type == IS_TMP_VAR &&
- (!zend_bitset_in(used_ext, VAR_NUM(opline->op1.var)) ||
- (opline->result_type == opline->op1_type &&
- opline->result.var == opline->op1.var))) {
- src = VAR_SOURCE(opline->op1);
- if (src) {
- if (src->opcode == ZEND_BOOL_NOT &&
- opline->opcode != ZEND_JMPZ_EX &&
- opline->opcode != ZEND_JMPNZ_EX) {
- VAR_SOURCE(opline->op1) = NULL;
- COPY_NODE(opline->op1, src->op1);
- if (opline->opcode == ZEND_JMPZ) {
+ while (1) {
+ if (opline->op1_type == IS_CONST) {
+ ++(*opt_count);
+ block->successors_count = 1;
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline)) ==
+ (opline->opcode == ZEND_JMPZ)) {
+
+ MAKE_NOP(opline);
+ block->successors[0] = block->successors[1];
+ block->len--;
+ cfg->blocks[block->successors[0]].flags |= ZEND_BB_FOLLOW;
+ break;
+ } else {
+ zend_basic_block *next = cfg->blocks + block->successors[1];
+
+ next->flags &= ~ZEND_BB_FOLLOW;
+ if (!(next->flags & (ZEND_BB_TARGET|ZEND_BB_PROTECTED))) {
+ next->flags &= ~ZEND_BB_REACHABLE;
+ }
+ opline->opcode = ZEND_JMP;
+ COPY_NODE(opline->op1, opline->op2);
+ break;
+ }
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ !zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
+ src = VAR_SOURCE(opline->op1);
+ if (src) {
+ if (src->opcode == ZEND_BOOL_NOT) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
/* T = BOOL_NOT(X) + JMPZ(T) -> NOP, JMPNZ(X) */
- opline->opcode = ZEND_JMPNZ;
- } else if (opline->opcode == ZEND_JMPNZ) {
- /* T = BOOL_NOT(X) + JMPNZ(T) -> NOP, JMPZ(X) */
- opline->opcode = ZEND_JMPZ;
-#if 0
- } else if (opline->opcode == ZEND_JMPZ_EX) {
- /* T = BOOL_NOT(X) + JMPZ_EX(T) -> NOP, JMPNZ_EX(X) */
- opline->opcode = ZEND_JMPNZ_EX;
- } else if (opline->opcode == ZEND_JMPNZ_EX) {
- /* T = BOOL_NOT(X) + JMPNZ_EX(T) -> NOP, JMPZ_EX(X) */
- opline->opcode = ZEND_JMPZ;
-#endif
- } else {
+ opline->opcode = INV_COND(opline->opcode);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ } else if (src->opcode == ZEND_BOOL ||
+ src->opcode == ZEND_QM_ASSIGN) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ }
+ }
+ }
+ break;
+ }
+ break;
+
+ case ZEND_JMPZNZ:
+ while (1) {
+ if (opline->op1_type == IS_CONST) {
+ ++(*opt_count);
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
+ zend_op *target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
+ block->successors[0] = block->successors[1];
+ } else {
+ zend_op *target_opline = ZEND_OP2_JMP_ADDR(opline);
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
+ }
+ block->successors_count = 1;
+ opline->op1_type = IS_UNUSED;
+ opline->extended_value = 0;
+ opline->opcode = ZEND_JMP;
+ break;
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ !zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
+ src = VAR_SOURCE(opline->op1);
+ if (src) {
+ if (src->opcode == ZEND_BOOL_NOT) {
/* T = BOOL_NOT(X) + JMPZNZ(T,L1,L2) -> NOP, JMPZNZ(X,L2,L1) */
uint32_t tmp;
- ZEND_ASSERT(opline->opcode == ZEND_JMPZNZ);
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
tmp = block->successors[0];
block->successors[0] = block->successors[1];
block->successors[1] = tmp;
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ } else if (src->opcode == ZEND_BOOL ||
+ src->opcode == ZEND_QM_ASSIGN) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
}
- MAKE_NOP(src);
- ++(*opt_count);
- goto optimize_jmpznz;
- } else if (src->opcode == ZEND_BOOL ||
- src->opcode == ZEND_QM_ASSIGN) {
- VAR_SOURCE(opline->op1) = NULL;
- COPY_NODE(opline->op1, src->op1);
- MAKE_NOP(src);
+ }
+ }
+ break;
+ }
+ break;
+
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ while (1) {
+ if (opline->op1_type == IS_CONST) {
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline)) ==
+ (opline->opcode == ZEND_JMPZ_EX)) {
+
++(*opt_count);
- goto optimize_jmpznz;
+ opline->opcode = ZEND_QM_ASSIGN;
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_BOOL(&ZEND_OP1_LITERAL(opline), opline->opcode == ZEND_JMPZ_EX);
+ opline->op2.num = 0;
+ block->successors_count = 1;
+ block->successors[0] = block->successors[1];
+ cfg->blocks[block->successors[0]].flags |= ZEND_BB_FOLLOW;
+ break;
+ }
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ (!zend_bitset_in(used_ext, VAR_NUM(opline->op1.var)) ||
+ opline->result.var == opline->op1.var)) {
+ src = VAR_SOURCE(opline->op1);
+ if (src) {
+ if (src->opcode == ZEND_BOOL ||
+ src->opcode == ZEND_QM_ASSIGN) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ }
}
}
+ break;
}
break;
@@ -894,6 +885,23 @@ optimize_const_unary_op:
/* strip T = QM_ASSIGN(T) */
MAKE_NOP(opline);
++(*opt_count);
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ opline->result_type == IS_TMP_VAR &&
+ !zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
+ /* T1 = ..., T2 = QM_ASSIGN(T1) to T2 = ..., NOP */
+ src = VAR_SOURCE(opline->op1);
+ if (src &&
+ src->opcode != ZEND_COPY_TMP &&
+ src->opcode != ZEND_ADD_ARRAY_ELEMENT &&
+ src->opcode != ZEND_ADD_ARRAY_UNPACK &&
+ (src->opcode != ZEND_DECLARE_LAMBDA_FUNCTION ||
+ src == opline -1)) {
+ src->result.var = opline->result.var;
+ VAR_SOURCE(opline->op1) = NULL;
+ VAR_SOURCE(opline->result) = src;
+ MAKE_NOP(opline);
+ ++(*opt_count);
+ }
}
break;
}
@@ -1089,11 +1097,84 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
}
}
-static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_array, zend_cfg *cfg, zend_uchar *same_t, uint32_t *opt_count)
+static zend_always_inline zend_basic_block *get_target_block(const zend_cfg *cfg, zend_basic_block *block, int n, uint32_t *opt_count)
+{
+ int b;
+ zend_basic_block *target_block = cfg->blocks + block->successors[n];
+
+ if (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED)) {
+ do {
+ b = target_block->successors[0];
+ target_block = cfg->blocks + b;
+ } while (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED));
+ block->successors[n] = b;
+ ++(*opt_count);
+ }
+ return target_block;
+}
+
+static zend_always_inline zend_basic_block *get_follow_block(const zend_cfg *cfg, zend_basic_block *block, int n, uint32_t *opt_count)
+{
+ int b;
+ zend_basic_block *target_block = cfg->blocks + block->successors[n];
+
+ if (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED)) {
+ do {
+ b = target_block->successors[0];
+ target_block = cfg->blocks + b;
+ } while (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED));
+ block->successors[n] = b;
+ ++(*opt_count);
+ }
+ return target_block;
+}
+
+static zend_always_inline zend_basic_block *get_next_block(const zend_cfg *cfg, zend_basic_block *block)
+{
+ zend_basic_block *next_block = block + 1;
+ zend_basic_block *end = cfg->blocks + cfg->blocks_count;
+
+ while (1) {
+ if (next_block == end) {
+ return NULL;
+ } else if (next_block->flags & ZEND_BB_REACHABLE) {
+ break;
+ }
+ next_block++;
+ }
+ while (next_block->len == 0 && !(next_block->flags & ZEND_BB_PROTECTED)) {
+ next_block = cfg->blocks + next_block->successors[0];
+ }
+ return next_block;
+}
+
+
+/* we use "jmp_hitlist" to avoid infinity loops during jmp optimization */
+static zend_always_inline int in_hitlist(int target, int *jmp_hitlist, int jmp_hitlist_count)
+{
+ int i;
+
+ for (i = 0; i < jmp_hitlist_count; i++) {
+ if (jmp_hitlist[i] == target) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#define CHECK_LOOP(target) \
+ if (EXPECTED(!in_hitlist(target, jmp_hitlist, jmp_hitlist_count))) { \
+ jmp_hitlist[jmp_hitlist_count++] = target; \
+ } else { \
+ break; \
+ }
+
+static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_array, const zend_cfg *cfg, int *jmp_hitlist, uint32_t *opt_count)
{
/* last_op is the last opcode of the current block */
- zend_basic_block *blocks = cfg->blocks;
- zend_op *last_op;
+ zend_basic_block *target_block, *follow_block, *next_block;
+ zend_op *last_op, *target;
+ int next, jmp_hitlist_count;
if (block->len == 0) {
return;
@@ -1102,35 +1183,32 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
last_op = op_array->opcodes + block->start + block->len - 1;
switch (last_op->opcode) {
case ZEND_JMP:
- {
- zend_basic_block *target_block = blocks + block->successors[0];
- zend_op *target = op_array->opcodes + target_block->start;
- int next = (block - blocks) + 1;
-
- while (next < cfg->blocks_count && !(blocks[next].flags & ZEND_BB_REACHABLE)) {
- /* find used one */
- next++;
- }
+ jmp_hitlist_count = 0;
- /* JMP(next) -> NOP */
- if (block->successors[0] == next) {
- MAKE_NOP(last_op);
- ++(*opt_count);
- block->len--;
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+ if (target->opcode == ZEND_JMP) {
+ /* JMP L, L: JMP L1 -> JMP L1 */
+ next = target_block->successors[0];
+ } else {
break;
}
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ }
- if (target->opcode == ZEND_JMP &&
- block->successors[0] != target_block->successors[0] &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMP L, L: JMP L1 -> JMP L1 */
- *last_op = *target;
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMPZNZ &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
+ next_block = get_next_block(cfg, block);
+ if (target_block == next_block) {
+ /* JMP(next) -> NOP */
+ MAKE_NOP(last_op);
+ ++(*opt_count);
+ block->len--;
+ } else if (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+ if (target->opcode == ZEND_JMPZNZ) {
/* JMP L, L: JMPZNZ L1,L2 -> JMPZNZ L1,L2 */
*last_op = *target;
if (last_op->op1_type == IS_CONST) {
@@ -1138,15 +1216,14 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(last_op));
last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv);
}
- DEL_SOURCE(block, block->successors[0]);
block->successors_count = 2;
block->successors[0] = target_block->successors[0];
block->successors[1] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ADD_SOURCE(block, block->successors[1]);
++(*opt_count);
+ goto optimize_jmpznz;
} else if ((target->opcode == ZEND_RETURN ||
target->opcode == ZEND_RETURN_BY_REF ||
+ target->opcode == ZEND_GENERATOR_RETURN ||
target->opcode == ZEND_EXIT) &&
!(op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
/* JMP L, L: RETURN to immediate RETURN */
@@ -1156,96 +1233,68 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(last_op));
last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv);
}
- DEL_SOURCE(block, block->successors[0]);
block->successors_count = 0;
++(*opt_count);
-#if 0
- /* Temporarily disabled - see bug #0025274 */
- } else if (0&& block->op1_to != block &&
- block->op1_to != blocks &&
- op_array->last_try_catch == 0 &&
- target->opcode != ZEND_FREE) {
- /* Block Reordering (saves one JMP on each "for" loop iteration)
- * It is disabled for some cases (ZEND_FREE)
- * which may break register allocation.
- */
- zend_bool can_reorder = 0;
- zend_block_source *cs = block->op1_to->sources;
-
- /* the "target" block doesn't had any followed block */
- while(cs) {
- if (cs->from->follow_to == block->op1_to) {
- can_reorder = 0;
- break;
- }
- cs = cs->next;
- }
- if (can_reorder) {
- next = block->op1_to;
- /* the "target" block is not followed by current "block" */
- while (next->follow_to != NULL) {
- if (next->follow_to == block) {
- can_reorder = 0;
- break;
- }
- next = next->follow_to;
- }
- if (can_reorder) {
- zend_basic_block *prev = blocks;
+ }
+ }
+ break;
- while (prev->next != block->op1_to) {
- prev = prev->next;
- }
- prev->next = next->next;
- next->next = block->next;
- block->next = block->op1_to;
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ jmp_hitlist_count = 0;
- block->follow_to = block->op1_to;
- block->op1_to = NULL;
- MAKE_NOP(last_op);
- block->len--;
- if(block->len == 0) {
- /* this block is nothing but NOP now */
- delete_code_block(block, ctx);
- }
- break;
- }
- }
-#endif
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+
+ if (target->opcode == ZEND_JMP) {
+ /* JMP_SET(X, L), L: JMP(L2) -> JMP_SET(X, L2) */
+ next = target_block->successors[0];
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ } else {
+ break;
}
+ target_block = get_target_block(cfg, block, 0, opt_count);
}
break;
case ZEND_JMPZ:
case ZEND_JMPNZ:
- /* constant conditional JMPs */
- if (last_op->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
+ jmp_hitlist_count = 0;
- if (last_op->opcode == ZEND_JMPZ) {
- should_jmp = !should_jmp;
- }
- literal_dtor(&ZEND_OP1_LITERAL(last_op));
- last_op->op1_type = IS_UNUSED;
- if (should_jmp) {
- /* JMPNZ(true) -> JMP */
- last_op->opcode = ZEND_JMP;
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZ(X, L), L: JMP(L2) -> JMPZ(X, L2) */
+ next = target_block->successors[0];
+ } else if (target->opcode == last_op->opcode &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZ(X, L), L: JMPZ(X, L2) -> JMPZ(X, L2) */
+ next = target_block->successors[0];
+ } else if (target->opcode == INV_COND(last_op->opcode) &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZ(X, L), L: JMPNZ(X, L2) -> JMPZ(X, L+1) */
+ next = target_block->successors[1];
+ } else if (target->opcode == ZEND_JMPZNZ &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZ(X, L), L: JMPZNZ(X, L2, L3) -> JMPZ(X, L2) */
+ next = target_block->successors[last_op->opcode == ZEND_JMPNZ];
} else {
- /* JMPNZ(false) -> NOP */
- MAKE_NOP(last_op);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
+ break;
}
+ CHECK_LOOP(next);
+ block->successors[0] = next;
++(*opt_count);
- break;
+ target_block = get_target_block(cfg, block, 0, opt_count);
}
- if (block->successors[0] == block->successors[1]) {
+ follow_block = get_follow_block(cfg, block, 1, opt_count);
+ if (target_block == follow_block) {
/* L: JMP[N]Z(X, L+1) -> NOP or FREE(X) */
-
if (last_op->op1_type == IS_CV) {
last_op->opcode = ZEND_CHECK_VAR;
last_op->op2.num = 0;
@@ -1254,122 +1303,55 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
last_op->op2.num = 0;
} else {
MAKE_NOP(last_op);
+ block->len--;
}
block->successors_count = 1;
++(*opt_count);
- break;
- }
+ } else if (follow_block->len == 1) {
+ target = op_array->opcodes + follow_block->start;
+ if (target->opcode == ZEND_JMP) {
+ if (block->successors[0] == follow_block->successors[0]) {
+ /* JMPZ(X,L1), JMP(L1) -> NOP, JMP(L1) */
+ if (last_op->op1_type == IS_CV) {
+ last_op->opcode = ZEND_CHECK_VAR;
+ last_op->op2.num = 0;
+ } else if (last_op->op1_type & (IS_VAR|IS_TMP_VAR)) {
+ last_op->opcode = ZEND_FREE;
+ last_op->op2.num = 0;
+ } else {
+ MAKE_NOP(last_op);
+ block->len--;
+ }
+ block->successors_count = 1;
+ ++(*opt_count);
+ break;
+ } else if (!(follow_block->flags & (ZEND_BB_TARGET | ZEND_BB_PROTECTED))) {
+ next_block = get_next_block(cfg, follow_block);
- if (1) {
- zend_uchar same_type = last_op->op1_type;
- uint32_t same_var = VAR_NUM_EX(last_op->op1);
- zend_op *target;
- zend_op *target_end;
- zend_basic_block *target_block = blocks + block->successors[0];
+ if (target_block == next_block) {
+ /* JMPZ(X,L1) JMP(L2) L1: -> JMPNZ(X,L2) NOP*/
-next_target:
- target = op_array->opcodes + target_block->start;
- target_end = target + target_block->len;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
+ last_op->opcode = INV_COND(last_op->opcode);
- /* next block is only NOP's */
- if (target == target_end) {
- target_block = blocks + target_block->successors[0];
- ++(*opt_count);
- goto next_target;
- } else if (target->opcode == INV_COND(last_op->opcode) &&
- /* JMPZ(X, L), L: JMPNZ(X, L2) -> JMPZ(X, L+1) */
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)
- ) {
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == INV_COND_EX(last_op->opcode) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: T = JMPNZ_EX(X, L2) -> T = JMPZ_EX(X, L+1) */
- last_op->opcode += 3;
- COPY_NODE(last_op->result, target->result);
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == last_op->opcode &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: JMPZ(X, L2) -> JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: JMP(L2) -> JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMPZNZ &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: JMPZNZ(X, L2, L3) -> JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- if (last_op->opcode == ZEND_JMPZ) {
- block->successors[0] = target_block->successors[0];
- } else {
- block->successors[0] = target_block->successors[1];
- }
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- }
- }
+ block->successors[0] = follow_block->successors[0];
+ block->successors[1] = next_block - cfg->blocks;
- if (last_op->opcode == ZEND_JMPZ || last_op->opcode == ZEND_JMPNZ) {
- zend_op *target;
- zend_op *target_end;
- zend_basic_block *target_block;
+ follow_block->flags &= ~ZEND_BB_REACHABLE;
+ MAKE_NOP(target);
+ follow_block->len = 0;
- while (1) {
- target_block = blocks + block->successors[1];
- target = op_array->opcodes + target_block->start;
- target_end = op_array->opcodes + target_block->start + 1;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
+ next_block->flags |= ZEND_BB_FOLLOW;
- /* next block is only NOP's */
- if (target == target_end && !(target_block->flags & ZEND_BB_PROTECTED)) {
- DEL_SOURCE(block, block->successors[1]);
- block->successors[1] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[1]);
- ++(*opt_count);
- } else {
- break;
+ break;
+ }
}
- }
- /* JMPZ(X,L1), JMP(L2) -> JMPZNZ(X,L1,L2) */
- if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- DEL_SOURCE(block, block->successors[1]);
+
+ /* JMPZ(X,L1), JMP(L2) -> JMPZNZ(X,L1,L2) */
if (last_op->opcode == ZEND_JMPZ) {
- block->successors[1] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[1]);
+ block->successors[1] = follow_block->successors[0];
} else {
block->successors[1] = block->successors[0];
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
+ block->successors[0] = follow_block->successors[0];
}
last_op->opcode = ZEND_JMPZNZ;
++(*opt_count);
@@ -1379,212 +1361,153 @@ next_target:
case ZEND_JMPNZ_EX:
case ZEND_JMPZ_EX:
- /* constant conditional JMPs */
- if (last_op->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
-
- if (last_op->opcode == ZEND_JMPZ_EX) {
- should_jmp = !should_jmp;
- }
- if (!should_jmp) {
- /* T = JMPZ_EX(true,L) -> T = QM_ASSIGN(true)
- * T = JMPNZ_EX(false,L) -> T = QM_ASSIGN(false)
- */
- last_op->opcode = ZEND_QM_ASSIGN;
- SET_UNUSED(last_op->op2);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
- ++(*opt_count);
- }
- break;
- }
-
- if (1) {
- zend_op *target, *target_end;
- zend_basic_block *target_block;
- int var_num = op_array->last_var + op_array->T;
+ jmp_hitlist_count = 0;
- if (var_num <= 0) {
- return;
- }
- memset(same_t, 0, var_num);
- same_t[VAR_NUM_EX(last_op->op1)] |= last_op->op1_type;
- same_t[VAR_NUM_EX(last_op->result)] |= last_op->result_type;
- target_block = blocks + block->successors[0];
-next_target_ex:
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
target = op_array->opcodes + target_block->start;
- target_end = target + target_block->len;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
- /* next block is only NOP's */
- if (target == target_end) {
- target_block = blocks + target_block->successors[0];
- ++(*opt_count);
- goto next_target_ex;
+
+ if (target->opcode == ZEND_JMP) {
+ /* T = JMPZ_EX(X, L), L: JMP(L2) -> T = JMPZ(X, L2) */
+ next = target_block->successors[0];
} else if (target->opcode == last_op->opcode-3 &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
/* T = JMPZ_EX(X, L1), L1: JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == INV_EX_COND(last_op->opcode) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L1), L1: JMPNZ({X|T1}, L2) -> T = JMPZ_EX(X, L1+1) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == INV_EX_COND_EX(last_op->opcode) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- (same_t[VAR_NUM_EX(target->result)] & target->result_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L1), L1: T = JMPNZ_EX(T, L2) -> T = JMPZ_EX(X, L1+1) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
+ next = target_block->successors[0];
} else if (target->opcode == last_op->opcode &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- (same_t[VAR_NUM_EX(target->result)] & target->result_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L1), L1: T = JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L), L: JMP(L2) -> T = JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
+ target->result.var == last_op->result.var &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* T = JMPZ_EX(X, L1), L1: T = JMPZ_EX({X|T}, L2) -> T = JMPZ_EX(X, L2) */
+ next = target_block->successors[0];
} else if (target->opcode == ZEND_JMPZNZ &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
/* T = JMPZ_EX(X, L), L: JMPZNZ({X|T}, L2, L3) -> T = JMPZ_EX(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- if (last_op->opcode == ZEND_JMPZ_EX) {
- block->successors[0] = target_block->successors[0];
- } else {
- block->successors[0] = target_block->successors[1];
- }
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
+ next = target_block->successors[last_op->opcode == ZEND_JMPNZ_EX];
+ } else if (target->opcode == INV_EX_COND(last_op->opcode) &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* T = JMPZ_EX(X, L1), L1: JMPNZ({X|T1}, L2) -> T = JMPZ_EX(X, L1+1) */
+ next = target_block->successors[1];
+ } else if (target->opcode == INV_EX_COND_EX(last_op->opcode) &&
+ target->result.var == last_op->result.var &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* T = JMPZ_EX(X, L1), L1: T = JMPNZ_EX({X|T}, L2) -> T = JMPZ_EX(X, L1+1) */
+ next = target_block->successors[1];
+ } else if (target->opcode == ZEND_BOOL &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* convert Y = JMPZ_EX(X,L1), L1: Z = BOOL(Y) to
+ Z = JMPZ_EX(X,L1+1) */
+
+ /* NOTE: This optimization pattern is not safe, but works, */
+ /* because result of JMPZ_EX instruction */
+ /* is not used on the following path and */
+ /* should be used once on the branch path. */
+ /* */
+ /* The pattern works well only if jums processed in */
+ /* direct order, otherwise it breakes JMPZ_EX */
+ /* sequences too early. */
+ last_op->result.var = target->result.var;
+ next = target_block->successors[0];
+ } else {
+ break;
}
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ }
+
+ follow_block = get_follow_block(cfg, block, 1, opt_count);
+ if (target_block == follow_block) {
+ /* L: T = JMP[N]Z_EX(X, L+1) -> T = BOOL(X) */
+ last_op->opcode = ZEND_BOOL;
+ last_op->op2.num = 0;
+ block->successors_count = 1;
+ ++(*opt_count);
+ break;
}
break;
case ZEND_JMPZNZ: {
- int next = (block - blocks) + 1;
+optimize_jmpznz:
+ jmp_hitlist_count = 0;
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
- while (next < cfg->blocks_count && !(blocks[next].flags & ZEND_BB_REACHABLE)) {
- /* find first accessed one */
- next++;
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
+ next = target_block->successors[0];
+ } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ next = target_block->successors[0];
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ next = target_block->successors[1];
+ } else {
+ break;
+ }
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ target_block = get_target_block(cfg, block, 0, opt_count);
}
- if (last_op->op1_type == IS_CONST) {
- if (!zend_is_true(&ZEND_OP1_LITERAL(last_op))) {
- /* JMPZNZ(false,L1,L2) -> JMP(L1) */
- literal_dtor(&ZEND_OP1_LITERAL(last_op));
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
+ jmp_hitlist_count = 0;
+ follow_block = get_target_block(cfg, block, 1, opt_count);
+ while (follow_block->len == 1) {
+ target = op_array->opcodes + follow_block->start;
+
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
+ next = follow_block->successors[0];
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ next = follow_block->successors[0];
+ } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ next = target_block->successors[1];
} else {
- /* JMPZNZ(true,L1,L2) -> JMP(L2) */
- literal_dtor(&ZEND_OP1_LITERAL(last_op));
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
+ break;
}
+ CHECK_LOOP(next);
+ block->successors[1] = next;
++(*opt_count);
- } else if (block->successors[0] == block->successors[1]) {
- /* both goto the same one - it's JMP */
- if (!(last_op->op1_type & (IS_VAR|IS_TMP_VAR))) {
- /* JMPZNZ(?,L,L) -> JMP(L) */
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- block->successors_count = 1;
- ++(*opt_count);
- }
- } else if (block->successors[0] == next) {
+ follow_block = get_target_block(cfg, block, 1, opt_count);
+ }
+
+ next_block = get_next_block(cfg, block);
+ if (target_block == follow_block &&
+ !(last_op->op1_type & (IS_VAR|IS_TMP_VAR))) {
+ /* JMPZNZ(?,L,L) -> JMP(L) */
+ last_op->opcode = ZEND_JMP;
+ SET_UNUSED(last_op->op1);
+ SET_UNUSED(last_op->op2);
+ last_op->extended_value = 0;
+ block->successors_count = 1;
+ ++(*opt_count);
+ } else if (target_block == next_block) {
/* jumping to next on Z - can follow to it and jump only on NZ */
/* JMPZNZ(X,L1,L2) L1: -> JMPNZ(X,L2) */
+ int tmp = block->successors[0];
last_op->opcode = ZEND_JMPNZ;
block->successors[0] = block->successors[1];
- block->successors[1] = next;
+ block->successors[1] = tmp;
++(*opt_count);
- /* no need to add source */
- } else if (block->successors[1] == next) {
+ } else if (follow_block == next_block) {
/* jumping to next on NZ - can follow to it and jump only on Z */
/* JMPZNZ(X,L1,L2) L2: -> JMPZ(X,L1) */
last_op->opcode = ZEND_JMPZ;
++(*opt_count);
- /* no need to add source */
- }
-
- if (last_op->opcode == ZEND_JMPZNZ) {
- zend_uchar same_type = last_op->op1_type;
- zend_uchar same_var = VAR_NUM_EX(last_op->op1);
- zend_op *target;
- zend_op *target_end;
- zend_basic_block *target_block = blocks + block->successors[0];
-
-next_target_znz:
- target = op_array->opcodes + target_block->start;
- target_end = target + target_block->len;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
- /* next block is only NOP's */
- if (target == target_end) {
- target_block = blocks + target_block->successors[0];
- ++(*opt_count);
- goto next_target_znz;
- } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMPNZ &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- }
}
break;
}
@@ -1747,6 +1670,8 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
case ZEND_POST_DEC:
case ZEND_POST_INC_OBJ:
case ZEND_POST_DEC_OBJ:
+ case ZEND_POST_INC_STATIC_PROP:
+ case ZEND_POST_DEC_STATIC_PROP:
opline->opcode -= 2;
opline->result_type = IS_UNUSED;
break;
@@ -1884,8 +1809,8 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
zend_bitset usage;
void *checkpoint;
zend_op **Tsource;
- zend_uchar *same_t;
uint32_t opt_count;
+ int *jmp_hitlist;
/* Build CFG */
checkpoint = zend_arena_checkpoint(ctx->arena);
@@ -1905,8 +1830,8 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
bitset_len = zend_bitset_len(op_array->last_var + op_array->T);
Tsource = zend_arena_calloc(&ctx->arena, op_array->last_var + op_array->T, sizeof(zend_op *));
- same_t = zend_arena_alloc(&ctx->arena, op_array->last_var + op_array->T);
usage = zend_arena_alloc(&ctx->arena, bitset_len * ZEND_BITSET_ELM_SIZE);
+ jmp_hitlist = zend_arena_alloc(&ctx->arena, cfg.blocks_count * sizeof(int));
blocks = cfg.blocks;
end = blocks + cfg.blocks_count;
@@ -1938,10 +1863,12 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
}
+ opt_count = 0;
+
/* Jump optimization for each block */
for (b = blocks; b < end; b++) {
if (b->flags & ZEND_BB_REACHABLE) {
- zend_jmp_optimization(b, op_array, &cfg, same_t, &opt_count);
+ zend_jmp_optimization(b, op_array, &cfg, jmp_hitlist, &opt_count);
}
}
@@ -1956,8 +1883,6 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
}
- zend_bitset_clear(usage, bitset_len);
- zend_t_usage(&cfg, op_array, usage, ctx);
assemble_code_blocks(&cfg, op_array, ctx);
if (ctx->debug_level & ZEND_DUMP_AFTER_BLOCK_PASS) {
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index f754dbaa44..0a99ac4140 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -168,13 +168,13 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
LITERAL_INFO(opline->op1.constant, LITERAL_CLASS, 2);
break;
case ZEND_DEFINED:
- LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 2);
+ LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 1);
break;
case ZEND_FETCH_CONSTANT:
- if ((opline->op1.num & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
- LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 5);
- } else {
+ if (opline->op1.num & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 3);
+ } else {
+ LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 2);
}
break;
case ZEND_FETCH_CLASS_CONSTANT:
@@ -503,15 +503,10 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
}
switch (opline->opcode) {
case ZEND_RECV_INIT:
- if (class_name_type_hint(op_array, opline->op1.num)) {
- opline->extended_value = cache_size;
- cache_size += sizeof(void *);
- }
- break;
case ZEND_RECV:
case ZEND_RECV_VARIADIC:
if (class_name_type_hint(op_array, opline->op1.num)) {
- opline->op2.num = cache_size;
+ opline->extended_value = cache_size;
cache_size += sizeof(void *);
}
break;
diff --git a/ext/opcache/Optimizer/dce.c b/ext/opcache/Optimizer/dce.c
index 8370bdc779..2992bb60b3 100644
--- a/ext/opcache/Optimizer/dce.c
+++ b/ext/opcache/Optimizer/dce.c
@@ -241,6 +241,8 @@ static inline zend_bool may_have_side_effects(
}
}
return 0;
+ case ZEND_CHECK_VAR:
+ return (OP1_INFO() & MAY_BE_UNDEF) != 0;
default:
/* For everything we didn't handle, assume a side-effect */
return 1;
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c
index 5401c9df6a..d753c54a00 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -125,33 +125,6 @@ int zend_dfa_analyze_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx,
return SUCCESS;
}
-static zend_bool is_smart_branch_inhibiting_nop(
- zend_op_array *op_array, uint32_t target, uint32_t current,
- zend_basic_block *b, zend_basic_block *blocks_end)
-{
- uint32_t next;
- /* Target points one past the last non-nop instruction. Make sure there is one. */
- if (target == 0) {
- return 0;
- }
-
- /* Find the next instruction, skipping unreachable or empty blocks. */
- next = current + 1;
- if (next >= b->start + b->len) {
- do {
- b++;
- if (b == blocks_end) {
- return 0;
- }
- } while (!(b->flags & ZEND_BB_REACHABLE) || b->len == 0);
- next = b->start;
- }
-
- return (op_array->opcodes[next].opcode == ZEND_JMPZ ||
- op_array->opcodes[next].opcode == ZEND_JMPNZ) &&
- zend_is_smart_branch(op_array->opcodes + target - 1);
-}
-
static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_optimizer_ctx *ctx)
{
zend_basic_block *blocks = ssa->cfg.blocks;
@@ -199,8 +172,7 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_op
old_end = b->start + b->len;
while (i < old_end) {
shiftlist[i] = i - target;
- if (EXPECTED(op_array->opcodes[i].opcode != ZEND_NOP) ||
- is_smart_branch_inhibiting_nop(op_array, target, i, b, blocks_end)) {
+ if (EXPECTED(op_array->opcodes[i].opcode != ZEND_NOP)) {
if (i != target) {
op_array->opcodes[target] = op_array->opcodes[i];
ssa->ops[target] = ssa->ops[i];
@@ -312,6 +284,8 @@ static inline zend_bool can_elide_return_type_check(
zend_ssa_var_info *use_info = &ssa->var_info[ssa_op->op1_use];
zend_ssa_var_info *def_info = &ssa->var_info[ssa_op->op1_def];
+ /* TODO: It would be better to rewrite this without using def_info,
+ * which may not be an exact representation of the type. */
if (use_info->type & MAY_BE_REF) {
return 0;
}
@@ -322,7 +296,8 @@ static inline zend_bool can_elide_return_type_check(
}
/* These types are not represented exactly */
- if (ZEND_TYPE_CODE(info->type) == IS_CALLABLE || ZEND_TYPE_CODE(info->type) == IS_ITERABLE) {
+ if (ZEND_TYPE_IS_MASK(info->type)
+ && (ZEND_TYPE_MASK(info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))) {
return 0;
}
@@ -481,6 +456,24 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
MAKE_NOP(send_array);
removed_ops++;
+ op_num = call_info->caller_call_opline - op_array->opcodes;
+ ssa_op = ssa->ops + op_num;
+ if (ssa_op->result_def >= 0) {
+ int var = ssa_op->result_def;
+ int use = ssa->vars[var].use_chain;
+
+ if (ssa->vars[var].phi_use_chain == NULL) {
+ if (ssa->ops[use].op1_use == var
+ && ssa->ops[use].op1_use_chain == -1) {
+ call_info->caller_call_opline->result_type = IS_TMP_VAR;
+ op_array->opcodes[use].op1_type = IS_TMP_VAR;
+ } else if (ssa->ops[use].op2_use == var
+ && ssa->ops[use].op2_use_chain == -1) {
+ call_info->caller_call_opline->result_type = IS_TMP_VAR;
+ op_array->opcodes[use].op2_type = IS_TMP_VAR;
+ }
+ }
+ }
}
}
}
@@ -530,8 +523,7 @@ static void compress_block(zend_op_array *op_array, zend_basic_block *block)
while (block->len > 0) {
zend_op *opline = &op_array->opcodes[block->start + block->len - 1];
- if (opline->opcode == ZEND_NOP
- && (block->len == 1 || !zend_is_smart_branch(opline - 1))) {
+ if (opline->opcode == ZEND_NOP) {
block->len--;
} else {
break;
@@ -1165,8 +1157,64 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
/* Update opcodes */
op_array->opcodes[op_2].result_type = opline->op1_type;
op_array->opcodes[op_2].result.var = opline->op1.var;
+
MAKE_NOP(opline);
remove_nops = 1;
+
+ if (op_array->opcodes[op_2].opcode == ZEND_SUB
+ && op_array->opcodes[op_2].op1_type == op_array->opcodes[op_2].result_type
+ && op_array->opcodes[op_2].op1.var == op_array->opcodes[op_2].result.var
+ && op_array->opcodes[op_2].op2_type == IS_CONST
+ && Z_TYPE_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == IS_LONG
+ && Z_LVAL_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == 1
+ && ssa->ops[op_2].op1_use >= 0
+ && !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+
+ op_array->opcodes[op_2].opcode = ZEND_PRE_DEC;
+ SET_UNUSED(op_array->opcodes[op_2].op2);
+ SET_UNUSED(op_array->opcodes[op_2].result);
+
+ ssa->ops[op_2].result_def = -1;
+ ssa->ops[op_2].op1_def = v;
+
+ } else if (op_array->opcodes[op_2].opcode == ZEND_ADD
+ && op_array->opcodes[op_2].op1_type == op_array->opcodes[op_2].result_type
+ && op_array->opcodes[op_2].op1.var == op_array->opcodes[op_2].result.var
+ && op_array->opcodes[op_2].op2_type == IS_CONST
+ && Z_TYPE_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == IS_LONG
+ && Z_LVAL_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == 1
+ && ssa->ops[op_2].op1_use >= 0
+ && !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+
+ op_array->opcodes[op_2].opcode = ZEND_PRE_INC;
+ SET_UNUSED(op_array->opcodes[op_2].op2);
+ SET_UNUSED(op_array->opcodes[op_2].result);
+
+ ssa->ops[op_2].result_def = -1;
+ ssa->ops[op_2].op1_def = v;
+
+ } else if (op_array->opcodes[op_2].opcode == ZEND_ADD
+ && op_array->opcodes[op_2].op2_type == op_array->opcodes[op_2].result_type
+ && op_array->opcodes[op_2].op2.var == op_array->opcodes[op_2].result.var
+ && op_array->opcodes[op_2].op1_type == IS_CONST
+ && Z_TYPE_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op1.constant)) == IS_LONG
+ && Z_LVAL_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op1.constant)) == 1
+ && ssa->ops[op_2].op2_use >= 0
+ && !(ssa->var_info[ssa->ops[op_2].op2_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+
+ op_array->opcodes[op_2].opcode = ZEND_PRE_INC;
+ op_array->opcodes[op_2].op1_type = op_array->opcodes[op_2].op2_type;
+ op_array->opcodes[op_2].op1.var = op_array->opcodes[op_2].op2.var;
+ SET_UNUSED(op_array->opcodes[op_2].op2);
+ SET_UNUSED(op_array->opcodes[op_2].result);
+
+ ssa->ops[op_2].result_def = -1;
+ ssa->ops[op_2].op1_def = v;
+ ssa->ops[op_2].op1_use = ssa->ops[op_2].op2_use;
+ ssa->ops[op_2].op1_use_chain = ssa->ops[op_2].op2_use_chain;
+ ssa->ops[op_2].op2_use = -1;
+ ssa->ops[op_2].op2_use_chain = -1;
+ }
}
} else if (opline->op2_type == IS_CONST
|| ((opline->op2_type & (IS_TMP_VAR|IS_VAR|IS_CV))
diff --git a/ext/opcache/Optimizer/escape_analysis.c b/ext/opcache/Optimizer/escape_analysis.c
index c561bec9dc..a13f69cdf0 100644
--- a/ext/opcache/Optimizer/escape_analysis.c
+++ b/ext/opcache/Optimizer/escape_analysis.c
@@ -176,7 +176,7 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
case ZEND_NEW:
/* objects with destructors should escape */
if (opline->op1_type == IS_CONST) {
- zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)+1));
+ zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
uint32_t forbidden_flags = ZEND_ACC_INHERITED
/* These flags will always cause an exception */
| ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
@@ -191,7 +191,7 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
break;
case ZEND_QM_ASSIGN:
if (opline->op1_type == IS_CONST
- && Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)) == IS_ARRAY) {
+ && Z_TYPE_P(CRT_CONSTANT(opline->op1)) == IS_ARRAY) {
return 1;
}
if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_ARRAY)) {
@@ -208,7 +208,7 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
switch (opline->opcode) {
case ZEND_ASSIGN:
if (opline->op2_type == IS_CONST
- && Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)) == IS_ARRAY) {
+ && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_ARRAY) {
return 1;
}
if (opline->op2_type == IS_CV && (OP2_INFO() & MAY_BE_ARRAY)) {
@@ -245,7 +245,7 @@ static int is_local_def(zend_op_array *op_array, zend_ssa *ssa, int def, int var
case ZEND_NEW:
/* objects with destructors should escape */
if (opline->op1_type == IS_CONST) {
- zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)+1));
+ zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
if (ce && !ce->create_object && !ce->constructor &&
!ce->destructor && !ce->__get && !ce->__set &&
!(ce->ce_flags & ZEND_ACC_INHERITED)) {
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c
index ae707a2409..ea2b904a0f 100644
--- a/ext/opcache/Optimizer/optimize_func_calls.c
+++ b/ext/opcache/Optimizer/optimize_func_calls.c
@@ -126,7 +126,7 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
i = fcall->extended_value;
do {
- if (Z_TYPE_P(RT_CONSTANT(&func->op_array.opcodes[i], func->op_array.opcodes[i].op2)) == IS_CONSTANT_AST) {
+ if (Z_TYPE_P(CRT_CONSTANT_EX(&func->op_array, &func->op_array.opcodes[i], func->op_array.opcodes[i].op2)) == IS_CONSTANT_AST) {
return;
}
i++;
@@ -136,7 +136,7 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
if (RETURN_VALUE_USED(opline)) {
zval zv;
- ZVAL_COPY(&zv, RT_CONSTANT(ret_opline, ret_opline->op1));
+ ZVAL_COPY(&zv, CRT_CONSTANT_EX(&func->op_array, ret_opline, ret_opline->op1));
opline->opcode = ZEND_QM_ASSIGN;
opline->op1_type = IS_CONST;
opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
@@ -173,7 +173,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_INIT_FCALL:
case ZEND_NEW:
call_stack[call].func = zend_optimizer_get_called_func(
- ctx->script, op_array, opline, 0);
+ ctx->script, op_array, opline);
call_stack[call].try_inline = opline->opcode != ZEND_NEW;
/* break missing intentionally */
case ZEND_INIT_DYNAMIC_CALL:
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1.c
index 8ae1d34fc0..2e9e547175 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1.c
@@ -19,10 +19,11 @@
+----------------------------------------------------------------------+
*/
-/* pass 1
- * - substitute persistent constants (true, false, null, etc)
- * - perform compile-time evaluation of constant binary and unary operations
- * - convert CAST(IS_BOOL,x) into BOOL(x)
+/* pass 1 (Simple local optimizations)
+ * - persistent constant substitution (true, false, null, etc)
+ * - constant casting (ADD expects numbers, CONCAT strings, etc)
+ * - constant expression evaluation
+ * - optimize constant conditional JMPs
* - pre-evaluate constant function calls
* - eliminate FETCH $GLOBALS followed by FETCH_DIM/UNSET_DIM/ISSET_ISEMPTY_DIM
*/
@@ -37,7 +38,6 @@
void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
{
- int i = 0;
zend_op *opline = op_array->opcodes;
zend_op *end = opline + op_array->last;
zend_bool collect_constants = (ZEND_OPTIMIZER_PASS_15 & ctx->optimization_level)?
@@ -49,21 +49,80 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_SUB:
case ZEND_MUL:
case ZEND_DIV:
- case ZEND_MOD:
case ZEND_POW:
+ if (opline->op1_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP1_LITERAL(opline));
+ }
+ }
+ }
+ if (opline->op2_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ if (opline->op1_type == IS_CONST) {
+ goto constant_binary_op;
+ }
+ }
+ break;
+
+ case ZEND_MOD:
case ZEND_SL:
case ZEND_SR:
+ if (opline->op1_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP1_LITERAL(opline));
+ }
+ }
+ }
+ if (opline->op2_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ if (opline->op1_type == IS_CONST) {
+ goto constant_binary_op;
+ }
+ }
+ break;
+
case ZEND_CONCAT:
case ZEND_FAST_CONCAT:
+ if (opline->op1_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP1_LITERAL(opline));
+ }
+ }
+ if (opline->op2_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP2_LITERAL(opline));
+ }
+ if (opline->op1_type == IS_CONST) {
+ goto constant_binary_op;
+ }
+ }
+ break;
+
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
case ZEND_IS_EQUAL:
case ZEND_IS_NOT_EQUAL:
case ZEND_IS_SMALLER:
case ZEND_IS_SMALLER_OR_EQUAL:
case ZEND_IS_IDENTICAL:
case ZEND_IS_NOT_IDENTICAL:
- case ZEND_BW_OR:
- case ZEND_BW_AND:
- case ZEND_BW_XOR:
case ZEND_BOOL_XOR:
case ZEND_SPACESHIP:
case ZEND_CASE:
@@ -72,6 +131,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
/* binary operation with constant operands */
zval result;
+constant_binary_op:
if (zend_optimizer_eval_binary_op(&result, opline->opcode, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline)) == SUCCESS) {
literal_dtor(&ZEND_OP1_LITERAL(opline));
literal_dtor(&ZEND_OP2_LITERAL(opline));
@@ -86,6 +146,37 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
break;
+ case ZEND_ASSIGN_OP:
+ if (opline->op2_type == IS_CONST) {
+ if (opline->extended_value == ZEND_ADD
+ || opline->extended_value == ZEND_SUB
+ || opline->extended_value == ZEND_MUL
+ || opline->extended_value == ZEND_DIV
+ || opline->extended_value == ZEND_POW) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ } else if (opline->extended_value == ZEND_MOD
+ || opline->extended_value == ZEND_SL
+ || opline->extended_value == ZEND_SR) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ } else if (opline->extended_value == ZEND_CONCAT) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ }
+ break;
+
case ZEND_CAST:
if (opline->op1_type == IS_CONST) {
/* cast of constant operand */
@@ -103,12 +194,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
}
}
-
- if (opline->extended_value == _IS_BOOL) {
- /* T = CAST(X, IS_BOOL) => T = BOOL(X) */
- opline->opcode = ZEND_BOOL;
- opline->extended_value = 0;
- }
break;
case ZEND_BW_NOT:
@@ -559,6 +644,71 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
break;
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ /* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C)
+ in case we know it wouldn't jump */
+ if (opline->op1_type == IS_CONST) {
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
+ if (opline->opcode == ZEND_JMPZ_EX) {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_TRUE(&ZEND_OP1_LITERAL(opline));
+ opline->op2.num = 0;
+ break;
+ }
+ } else {
+ if (opline->opcode == ZEND_JMPNZ_EX) {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_FALSE(&ZEND_OP1_LITERAL(opline));
+ opline->op2.num = 0;
+ break;
+ }
+ }
+ }
+ collect_constants = 0;
+ break;
+
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ if (opline->op1_type == IS_CONST) {
+ int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
+
+ if (opline->opcode == ZEND_JMPZ) {
+ should_jmp = !should_jmp;
+ }
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ opline->op1_type = IS_UNUSED;
+ if (should_jmp) {
+ opline->opcode = ZEND_JMP;
+ COPY_NODE(opline->op1, opline->op2);
+ opline->op2.num = 0;
+ } else {
+ MAKE_NOP(opline);
+ break;
+ }
+ }
+ collect_constants = 0;
+ break;
+
+ case ZEND_JMPZNZ:
+ if (opline->op1_type == IS_CONST) {
+ zend_op *target_opline;
+
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
+ target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value); /* JMPNZ */
+ } else {
+ target_opline = ZEND_OP2_JMP_ADDR(opline); /* JMPZ */
+ }
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
+ opline->op1_type = IS_UNUSED;
+ opline->opcode = ZEND_JMP;
+ }
+ collect_constants = 0;
+ break;
+
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
case ZEND_GENERATOR_RETURN:
@@ -568,11 +718,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_FAST_CALL:
case ZEND_FAST_RET:
case ZEND_JMP:
- case ZEND_JMPZNZ:
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
case ZEND_FE_RESET_R:
case ZEND_FE_RESET_RW:
case ZEND_FE_FETCH_R:
@@ -584,6 +729,5 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
}
opline++;
- i++;
}
}
diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c
deleted file mode 100644
index 01e118e7e3..0000000000
--- a/ext/opcache/Optimizer/pass2.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend OPcache |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@php.net> |
- | Zeev Suraski <zeev@php.net> |
- | Stanislav Malyshev <stas@zend.com> |
- | Dmitry Stogov <dmitry@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* pass 2:
- * - convert non-numeric constants to numeric constants in numeric operators
- * - optimize constant conditional JMPs
- */
-
-#include "php.h"
-#include "Optimizer/zend_optimizer.h"
-#include "Optimizer/zend_optimizer_internal.h"
-#include "zend_API.h"
-#include "zend_constants.h"
-#include "zend_execute.h"
-#include "zend_vm.h"
-
-void zend_optimizer_pass2(zend_op_array *op_array)
-{
- zend_op *opline;
- zend_op *end = op_array->opcodes + op_array->last;
-
- opline = op_array->opcodes;
- while (opline < end) {
- switch (opline->opcode) {
- case ZEND_ADD:
- case ZEND_SUB:
- case ZEND_MUL:
- case ZEND_DIV:
- case ZEND_POW:
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0)) {
- convert_scalar_to_number(&ZEND_OP1_LITERAL(opline));
- }
- }
- }
- if (opline->op2_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
- convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
- }
- }
- }
- break;
-
- case ZEND_MOD:
- case ZEND_SL:
- case ZEND_SR:
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (!(Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING
- && !is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0))) {
- convert_to_long(&ZEND_OP1_LITERAL(opline));
- }
- }
- }
- if (opline->op2_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
- && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
- convert_to_long(&ZEND_OP2_LITERAL(opline));
- }
- }
- }
- break;
-
- case ZEND_CONCAT:
- case ZEND_FAST_CONCAT:
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP1_LITERAL(opline));
- }
- }
- if (opline->op2_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP2_LITERAL(opline));
- }
- }
- break;
-
- case ZEND_ASSIGN_OP:
- if (opline->op2_type == IS_CONST) {
- if (opline->extended_value == ZEND_ADD
- || opline->extended_value == ZEND_SUB
- || opline->extended_value == ZEND_MUL
- || opline->extended_value == ZEND_DIV
- || opline->extended_value == ZEND_POW) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
- convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
- }
- }
- } else if (opline->extended_value == ZEND_MOD
- || opline->extended_value == ZEND_SL
- || opline->extended_value == ZEND_SR) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
- && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
- convert_to_long(&ZEND_OP2_LITERAL(opline));
- }
- }
- } else if (opline->extended_value == ZEND_CONCAT) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP2_LITERAL(opline));
- }
- }
- }
- break;
-
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- /* convert Ti = JMPZ_EX(Ti, L) to JMPZ(Ti, L) */
-#if 0
- /* Disabled unsafe pattern: in conjunction with
- * ZEND_VM_SMART_BRANCH() this may improperly eliminate
- * assignment to Ti.
- */
- if (opline->op1_type == IS_TMP_VAR &&
- opline->result_type == IS_TMP_VAR &&
- opline->op1.var == opline->result.var) {
- opline->opcode -= 3;
- SET_UNUSED(opline->result);
- } else
-#endif
- /* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C)
- in case we know it wouldn't jump */
- if (opline->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
- if (opline->opcode == ZEND_JMPZ_EX) {
- should_jmp = !should_jmp;
- }
- if (!should_jmp) {
- opline->opcode = ZEND_QM_ASSIGN;
- SET_UNUSED(opline->op2);
- }
- }
- break;
-
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- if (opline->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
-
- if (opline->opcode == ZEND_JMPZ) {
- should_jmp = !should_jmp;
- }
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- opline->op1_type = IS_UNUSED;
- if (should_jmp) {
- opline->opcode = ZEND_JMP;
- COPY_NODE(opline->op1, opline->op2);
- } else {
- MAKE_NOP(opline);
- }
- break;
- }
- if ((opline + 1)->opcode == ZEND_JMP) {
- /* JMPZ(X, L1), JMP(L2) => JMPZNZ(X, L1, L2) */
- /* JMPNZ(X, L1), JMP(L2) => JMPZNZ(X, L2, L1) */
- if (ZEND_OP2_JMP_ADDR(opline) == ZEND_OP1_JMP_ADDR(opline + 1)) {
- /* JMPZ(X, L1), JMP(L1) => NOP, JMP(L1) */
- if (opline->op1_type == IS_CV) {
- opline->opcode = ZEND_CHECK_VAR;
- opline->op2.num = 0;
- } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
- opline->opcode = ZEND_FREE;
- opline->op2.num = 0;
- } else {
- MAKE_NOP(opline);
- }
- } else {
- if (opline->opcode == ZEND_JMPZ) {
- opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, ZEND_OP1_JMP_ADDR(opline + 1));
- } else {
- opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, ZEND_OP2_JMP_ADDR(opline));
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(opline + 1));
- }
- opline->opcode = ZEND_JMPZNZ;
- }
- }
- break;
-
- case ZEND_JMPZNZ:
- if (opline->op1_type == IS_CONST) {
- zend_op *target_opline;
-
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value); /* JMPNZ */
- } else {
- target_opline = ZEND_OP2_JMP_ADDR(opline); /* JMPZ */
- }
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
- opline->op1_type = IS_UNUSED;
- opline->opcode = ZEND_JMP;
- }
- break;
- }
- opline++;
- }
-}
diff --git a/ext/opcache/Optimizer/pass3.c b/ext/opcache/Optimizer/pass3.c
index 5bbb2b0854..a4abe2f8d3 100644
--- a/ext/opcache/Optimizer/pass3.c
+++ b/ext/opcache/Optimizer/pass3.c
@@ -19,10 +19,8 @@
+----------------------------------------------------------------------+
*/
-/* pass 3:
- * - optimize $i = $i+expr to $i+=expr
+/* pass 3: (Jump optimization)
* - optimize series of JMPs
- * - change $i++ to ++$i where possible
*/
#include "php.h"
@@ -34,388 +32,325 @@
#include "zend_vm.h"
/* we use "jmp_hitlist" to avoid infinity loops during jmp optimization */
-#define CHECK_JMP(target, label) \
- for (i=0; i<jmp_hitlist_count; i++) { \
- if (jmp_hitlist[i] == ZEND_OP1_JMP_ADDR(target)) { \
- goto label; \
- } \
- } \
- jmp_hitlist[jmp_hitlist_count++] = ZEND_OP1_JMP_ADDR(target);
+static zend_always_inline int in_hitlist(zend_op *target, zend_op **jmp_hitlist, int jmp_hitlist_count)
+{
+ int i;
-#define CHECK_JMP2(target, label) \
- for (i=0; i<jmp_hitlist_count; i++) { \
- if (jmp_hitlist[i] == ZEND_OP2_JMP_ADDR(target)) { \
- goto label; \
- } \
- } \
- jmp_hitlist[jmp_hitlist_count++] = ZEND_OP2_JMP_ADDR(target);
+ for (i = 0; i < jmp_hitlist_count; i++) {
+ if (jmp_hitlist[i] == target) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#define CHECK_LOOP(target) \
+ if (EXPECTED(!in_hitlist(target, jmp_hitlist, jmp_hitlist_count))) { \
+ jmp_hitlist[jmp_hitlist_count++] = target; \
+ } else { \
+ break; \
+ }
void zend_optimizer_pass3(zend_op_array *op_array, zend_optimizer_ctx *ctx)
{
zend_op *opline;
- zend_op *end = op_array->opcodes + op_array->last;
+ zend_op *end;
+ zend_op *target;
zend_op **jmp_hitlist;
int jmp_hitlist_count;
- int i;
- uint32_t opline_num = 0;
ALLOCA_FLAG(use_heap);
jmp_hitlist = (zend_op**)do_alloca(sizeof(zend_op*)*op_array->last, use_heap);
opline = op_array->opcodes;
+ end = opline + op_array->last;
while (opline < end) {
- jmp_hitlist_count = 0;
switch (opline->opcode) {
- case ZEND_ADD:
- case ZEND_SUB:
- case ZEND_MUL:
- case ZEND_DIV:
- case ZEND_MOD:
- case ZEND_POW:
- case ZEND_CONCAT:
- case ZEND_SL:
- case ZEND_SR:
- case ZEND_BW_OR:
- case ZEND_BW_AND:
- case ZEND_BW_XOR:
- {
- zend_op *next_opline = opline + 1;
-
- while (next_opline < end && next_opline->opcode == ZEND_NOP) {
- ++next_opline;
- }
+ case ZEND_JMP:
+ jmp_hitlist_count = 0;
- if (next_opline >= end || next_opline->opcode != ZEND_ASSIGN) {
+ target = ZEND_OP1_JMP_ADDR(opline);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* convert JMP L1 ... L1: JMP L2 to JMP L2 .. L1: JMP L2 */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
break;
}
-
- /* change $i=expr+$i to $i=$i+expr so that the following optimization
- * works on it. Only do this if we are ignoring operator overloading,
- * as operand order might be significant otherwise. */
- if ((ctx->optimization_level & ZEND_OPTIMIZER_IGNORE_OVERLOADING)
- && (opline->op2_type & (IS_VAR | IS_CV))
- && opline->op2.var == next_opline->op1.var &&
- (opline->opcode == ZEND_ADD ||
- opline->opcode == ZEND_MUL ||
- opline->opcode == ZEND_BW_OR ||
- opline->opcode == ZEND_BW_AND ||
- opline->opcode == ZEND_BW_XOR)) {
- zend_uchar tmp_type = opline->op1_type;
- znode_op tmp = opline->op1;
-
- if (opline->opcode != ZEND_ADD
- || (opline->op1_type == IS_CONST
- && Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_ARRAY)) {
- /* protection from array add: $a = array + $a is not commutative! */
- COPY_NODE(opline->op1, opline->op2);
- COPY_NODE(opline->op2, tmp);
- }
- }
-
- if (ZEND_IS_BINARY_ASSIGN_OP_OPCODE(opline->opcode)
- && (opline->op1_type & (IS_VAR | IS_CV))
- && opline->op1.var == next_opline->op1.var
- && opline->op1_type == next_opline->op1_type) {
- opline->extended_value = opline->opcode;
- opline->opcode = ZEND_ASSIGN_OP;
- COPY_NODE(opline->result, next_opline->result);
- MAKE_NOP(next_opline);
- opline++;
- opline_num++;
- }
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target);
}
- break;
- case ZEND_JMP:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
-
- /* convert L: JMP L+1 to NOP */
- if (ZEND_OP1_JMP_ADDR(opline) == opline + 1) {
+ if (target == opline + 1) {
+ /* convert L: JMP L+1 to NOP */
MAKE_NOP(opline);
- goto done_jmp_optimization;
- }
-
- /* convert JMP L1 ... L1: JMP L2 to JMP L2 .. L1: JMP L2 */
- while (ZEND_OP1_JMP_ADDR(opline) < end
- && ZEND_OP1_JMP_ADDR(opline)->opcode == ZEND_JMP) {
- zend_op *target = ZEND_OP1_JMP_ADDR(opline);
- CHECK_JMP(target, done_jmp_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, ZEND_OP1_JMP_ADDR(target));
+ } else if (target->opcode == ZEND_JMPZNZ) {
+ /* JMP L, L: JMPZNZ L1,L2 -> JMPZNZ L1,L2 */
+ *opline = *target;
+ if (opline->op1_type == IS_CONST) {
+ zval zv;
+ ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(opline));
+ opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
+ }
+ goto optimize_jmpznz;
+ } else if ((target->opcode == ZEND_RETURN ||
+ target->opcode == ZEND_RETURN_BY_REF ||
+ target->opcode == ZEND_GENERATOR_RETURN ||
+ target->opcode == ZEND_EXIT) &&
+ !(op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
+ /* JMP L, L: RETURN to immediate RETURN */
+ *opline = *target;
+ if (opline->op1_type == IS_CONST) {
+ zval zv;
+ ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(opline));
+ opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
+ }
+ } else if (opline > op_array->opcodes &&
+ ((opline-1)->opcode == ZEND_JMPZ ||
+ (opline-1)->opcode == ZEND_JMPNZ)) {
+ if (ZEND_OP2_JMP_ADDR(opline-1) == target) {
+ /* JMPZ(X,L1), JMP(L1) -> NOP, JMP(L1) */
+ if ((opline-1)->op1_type == IS_CV) {
+ (opline-1)->opcode = ZEND_CHECK_VAR;
+ (opline-1)->op2.num = 0;
+ } else if ((opline-1)->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ (opline-1)->opcode = ZEND_FREE;
+ (opline-1)->op2.num = 0;
+ } else {
+ MAKE_NOP(opline-1);
+ }
+ } else {
+ /* JMPZ(X,L1), JMP(L2) -> JMPZNZ(X,L1,L2) */
+ if ((opline-1)->opcode == ZEND_JMPZ) {
+ (opline-1)->extended_value = ZEND_OPLINE_TO_OFFSET((opline-1), target);
+ } else {
+ (opline-1)->extended_value = ZEND_OPLINE_TO_OFFSET((opline-1), ZEND_OP2_JMP_ADDR(opline-1));
+ ZEND_SET_OP_JMP_ADDR((opline-1), (opline-1)->op2, target);
+ }
+ (opline-1)->opcode = ZEND_JMPZNZ;
+ }
}
break;
case ZEND_JMP_SET:
case ZEND_COALESCE:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
+ jmp_hitlist_count = 0;
- while (ZEND_OP2_JMP_ADDR(opline) < end) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
if (target->opcode == ZEND_JMP) {
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(target));
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
} else {
break;
}
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
}
break;
+
case ZEND_JMPZ:
case ZEND_JMPNZ:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
-
- while (ZEND_OP2_JMP_ADDR(opline) < end) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
+ jmp_hitlist_count = 0;
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
if (target->opcode == ZEND_JMP) {
/* plain JMP */
/* JMPZ(X,L1), L1: JMP(L2) => JMPZ(X,L2), L1: JMP(L2) */
- CHECK_JMP(target, done_jmp_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(target));
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
} else if (target->opcode == opline->opcode &&
SAME_VAR(opline->op1, target->op1)) {
/* same opcode and same var as this opcode */
/* JMPZ(X,L1), L1: JMPZ(X,L2) => JMPZ(X,L2), L1: JMPZ(X,L2) */
- CHECK_JMP2(target, done_jmp_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- } else if (target->opcode == opline->opcode + 3 &&
- SAME_VAR(opline->op1, target->op1)) {
- /* convert JMPZ(X,L1), L1: T JMPZ_EX(X,L2) to
- T = JMPZ_EX(X, L2) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- opline->opcode += 3;
- COPY_NODE(opline->result, target->result);
- break;
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
} else if (target->opcode == INV_COND(opline->opcode) &&
SAME_VAR(opline->op1, target->op1)) {
/* convert JMPZ(X,L1), L1: JMPNZ(X,L2) to
JMPZ(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == INV_COND_EX(opline->opcode) &&
+ target = target + 1;
+ } else if (target->opcode == ZEND_JMPZNZ &&
SAME_VAR(opline->op1, target->op1)) {
- /* convert JMPZ(X,L1), L1: T = JMPNZ_EX(X,L2) to
- T = JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- opline->opcode += 3;
- COPY_NODE(opline->result, target->result);
- break;
+ target = (opline->opcode == ZEND_JMPZ) ?
+ ZEND_OP2_JMP_ADDR(target) :
+ ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
} else {
break;
}
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
+ }
+
+ /* convert L: JMPZ L+1 to NOP */
+ if (target == opline + 1) {
+ if (opline->op1_type == IS_CV) {
+ opline->opcode = ZEND_CHECK_VAR;
+ opline->op2.num = 0;
+ } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ opline->opcode = ZEND_FREE;
+ opline->op2.num = 0;
+ } else {
+ MAKE_NOP(opline);
+ }
}
break;
case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX: {
- zend_uchar T_type = opline->result_type;
- znode_op T = opline->result;
+ case ZEND_JMPNZ_EX:
+ jmp_hitlist_count = 0;
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* plain JMP */
+ /* JMPZ_EX(X,L1), L1: JMP(L2) => JMPZ_EX(X,L2), L1: JMP(L2) */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == opline->opcode-3 &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: JMPZ(T,L2) to
+ JMPZ_EX(X,L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == opline->opcode &&
+ target->result.var == opline->result.var &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: T=JMPZ_EX(T,L2) to
+ JMPZ_EX(X,L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPZNZ &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* Check for JMPZNZ with same cond variable */
+ target = (opline->opcode == ZEND_JMPZ_EX) ?
+ ZEND_OP2_JMP_ADDR(target) :
+ ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
+ CHECK_LOOP(target);
+ } else if (target->opcode == INV_EX_COND(opline->opcode) &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: JMPNZ(T,L2) to
+ JMPZ_EX(X,L1+1) */
+ target = target + 1;
+ } else if (target->opcode == INV_EX_COND_EX(opline->opcode) &&
+ target->result.var == opline->result.var &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: T=JMPNZ_EX(T,L2) to
+ JMPZ_EX(X,L1+1) */
+ target = target + 1;
+ } else if (target->opcode == ZEND_BOOL &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert Y = JMPZ_EX(X,L1), L1: Z = BOOL(Y) to
+ Z = JMPZ_EX(X,L1+1) */
+
+ /* NOTE: This optimization pattern is not safe, but works, */
+ /* because result of JMPZ_EX instruction */
+ /* is not used on the following path and */
+ /* should be used once on the branch path. */
+ /* */
+ /* The pattern works well only if jums processed in */
+ /* direct order, otherwise it breakes JMPZ_EX */
+ /* sequences too early. */
+ opline->result.var = target->result.var;
+ target = target + 1;
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
break;
}
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
+ }
- /* convert L: T = JMPZ_EX X,L+1 to T = BOOL(X) */
- /* convert L: T = JMPZ_EX T,L+1 to NOP */
- if (ZEND_OP2_JMP_ADDR(opline) == opline + 1) {
- if (opline->op1.var == opline->result.var) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_BOOL;
- SET_UNUSED(opline->op2);
- }
- goto done_jmp_optimization;
- }
-
- while (ZEND_OP2_JMP_ADDR(opline) < end) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
-
- if (target->opcode == opline->opcode-3 &&
- SAME_VAR(target->op1, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: JMPZ(T,L2) to
- JMPZ_EX(X,L2) */
- CHECK_JMP2(target, continue_jmp_ex_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- } else if (target->opcode == opline->opcode &&
- SAME_VAR(target->op1, T) &&
- SAME_VAR(target->result, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: T=JMPZ_EX(T,L2) to
- JMPZ_EX(X,L2) */
- CHECK_JMP2(target, continue_jmp_ex_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- } else if (target->opcode == ZEND_JMPZNZ &&
- SAME_VAR(target->op1, T)) {
- /* Check for JMPZNZ with same cond variable */
- zend_op *new_target;
-
- CHECK_JMP2(target, continue_jmp_ex_optimization);
- if (opline->opcode == ZEND_JMPZ_EX) {
- new_target = ZEND_OP2_JMP_ADDR(target);
- } else {
- /* JMPNZ_EX */
- new_target = ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
- }
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, new_target);
- } else if ((target->opcode == INV_EX_COND_EX(opline->opcode) ||
- target->opcode == INV_EX_COND(opline->opcode)) &&
- SAME_VAR(opline->op1, target->op1)) {
- /* convert JMPZ_EX(X,L1), L1: JMPNZ_EX(X,L2) to
- JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == INV_EX_COND(opline->opcode) &&
- SAME_VAR(target->op1, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: JMPNZ(T,L2) to
- JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == INV_EX_COND_EX(opline->opcode) &&
- SAME_VAR(target->op1, T) &&
- SAME_VAR(target->result, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: T=JMPNZ_EX(T,L2) to
- JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == ZEND_BOOL &&
- SAME_VAR(opline->result, target->op1)) {
- /* convert Y = JMPZ_EX(X,L1), L1: Z = BOOL(Y) to
- Z = JMPZ_EX(X,L1+1) */
- opline->result.var = target->result.var;
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else {
- break;
- }
- } /* while */
-continue_jmp_ex_optimization:
- break;
-#if 0
- /* If Ti = JMPZ_EX(X, L) and Ti is not used, convert to JMPZ(X, L) */
- {
- zend_op *op;
- for(op = opline+1; op<end; op++) {
- if(op->result_type == IS_TMP_VAR &&
- op->result.var == opline->result.var) {
- break; /* can pass to part 2 */
- }
-
- if(op->opcode == ZEND_JMP ||
- op->opcode == ZEND_JMPZ ||
- op->opcode == ZEND_JMPZ_EX ||
- op->opcode == ZEND_JMPNZ ||
- op->opcode == ZEND_JMPNZ_EX ||
- op->opcode == ZEND_JMPZNZ ||
- op->opcode == ZEND_CASE ||
- op->opcode == ZEND_RETURN ||
- op->opcode == ZEND_RETURN_BY_REF ||
- op->opcode == ZEND_FAST_RET ||
- op->opcode == ZEND_FE_FETCH_R ||
- op->opcode == ZEND_FE_FETCH_RW ||
- op->opcode == ZEND_EXIT) {
- break;
- }
-
- if(op->op1_type == IS_TMP_VAR &&
- op->op1.var == opline->result.var) {
- goto done_jmp_optimization;
- }
-
- if(op->op2_type == IS_TMP_VAR &&
- op->op2.var == opline->result.var) {
- goto done_jmp_optimization;
- }
- } /* for */
-
- for(op = &op_array->opcodes[opline->op2.opline_num]; op<end; op++) {
-
- if(op->result_type == IS_TMP_VAR &&
- op->result.var == opline->result.var) {
- break; /* can pass to optimization */
- }
-
- if(op->opcode == ZEND_JMP ||
- op->opcode == ZEND_JMPZ ||
- op->opcode == ZEND_JMPZ_EX ||
- op->opcode == ZEND_JMPNZ ||
- op->opcode == ZEND_JMPNZ_EX ||
- op->opcode == ZEND_JMPZNZ ||
- op->opcode == ZEND_CASE ||
- op->opcode == ZEND_RETURN ||
- op->opcode == ZEND_RETURN_BY_REF ||
- op->opcode == ZEND_FAST_RET ||
- op->opcode == ZEND_FE_FETCH_R ||
- op->opcode == ZEND_FE_FETCH_RW ||
- op->opcode == ZEND_EXIT) {
- break;
- }
-
- if(op->op1_type == IS_TMP_VAR &&
- op->op1.var == opline->result.var) {
- goto done_jmp_optimization;
- }
-
- if(op->op2_type == IS_TMP_VAR &&
- op->op2.var == opline->result.var) {
- goto done_jmp_optimization;
- }
- }
-
- opline->opcode = opline->opcode-3; /* JMP_EX -> JMP */
- SET_UNUSED(opline->result);
- break;
- }
-#endif
+ /* convert L: T = JMPZ_EX X,L+1 to T = BOOL(X) */
+ if (target == opline + 1) {
+ opline->opcode = ZEND_BOOL;
+ opline->op2.num = 0;
}
break;
case ZEND_JMPZNZ:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
-
- /* JMPZNZ(X,L1,L2), L1: JMP(L3) => JMPZNZ(X,L3,L2), L1: JMP(L3) */
- while (ZEND_OP2_JMP_ADDR(opline) < end
- && ZEND_OP2_JMP_ADDR(opline)->opcode == ZEND_JMP) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
- CHECK_JMP(target, continue_jmpznz_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(target));
- }
-continue_jmpznz_optimization:
- /* JMPZNZ(X,L1,L2), L2: JMP(L3) => JMPZNZ(X,L1,L3), L2: JMP(L3) */
- while (ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) < end
- && ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value)->opcode == ZEND_JMP) {
- zend_op *target = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
- CHECK_JMP(target, done_jmp_optimization);
- opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, ZEND_OP1_JMP_ADDR(target));
+optimize_jmpznz:
+ jmp_hitlist_count = 0;
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X,L1,L2), L1: JMP(L3) => JMPZNZ(X,L3,L2), L1: JMP(L3) */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ target = target + 1;
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
+ break;
+ }
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
}
- break;
-
- case ZEND_POST_INC_OBJ:
- case ZEND_POST_DEC_OBJ:
- case ZEND_POST_INC:
- case ZEND_POST_DEC: {
- /* POST_INC, FREE => PRE_INC */
- zend_op *next_op = opline + 1;
- if (next_op >= end) {
+ jmp_hitlist_count = 0;
+ target = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X,L1,L2), L2: JMP(L3) => JMPZNZ(X,L1,L3), L2: JMP(L3) */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ target = target + 1;
+ } else if (target->opcode == ZEND_JMPZNZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ target = ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
break;
}
- if (next_op->opcode == ZEND_FREE &&
- next_op->op1.var == opline->result.var) {
- MAKE_NOP(next_op);
- opline->opcode -= 2;
- opline->result_type = IS_UNUSED;
- }
+ opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, target);
+ }
+
+ if (ZEND_OP2_JMP_ADDR(opline) == target &&
+ !(opline->op1_type & (IS_VAR|IS_TMP_VAR))) {
+ /* JMPZNZ(?,L,L) -> JMP(L) */
+ opline->opcode = ZEND_JMP;
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target);
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
+ opline->extended_value = 0;
}
+ /* Don't convert JMPZNZ back to JMPZ/JMPNZ, because the
+ following JMP is not removed yet. */
break;
}
-done_jmp_optimization:
opline++;
- opline_num++;
}
free_alloca(jmp_hitlist, use_heap);
}
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 6f8de3d43f..57ae48b021 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -740,13 +740,12 @@ static inline int ct_eval_in_array(zval *result, uint32_t extended_value, zval *
res = zend_hash_exists(ht, ZSTR_EMPTY_ALLOC());
} else {
zend_string *key;
- zval key_tmp, result_tmp;
+ zval key_tmp;
res = 0;
ZEND_HASH_FOREACH_STR_KEY(ht, key) {
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) {
res = 1;
break;
}
@@ -892,8 +891,7 @@ static inline int ct_eval_func_call(
} else if (zend_string_equals_literal(name, "strpos")) {
if (Z_TYPE_P(args[0]) != IS_STRING
|| Z_TYPE_P(args[1]) != IS_STRING
- || !Z_STRLEN_P(args[1])
- || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) {
+ || !Z_STRLEN_P(args[1])) {
return FAILURE;
}
/* pass */
@@ -972,8 +970,7 @@ static inline int ct_eval_func_call(
/* pass */
} else if (zend_string_equals_literal(name, "substr")) {
if (Z_TYPE_P(args[0]) != IS_STRING
- || Z_TYPE_P(args[1]) != IS_LONG
- || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) {
+ || Z_TYPE_P(args[1]) != IS_LONG) {
return FAILURE;
}
/* pass */
@@ -1017,8 +1014,7 @@ static inline int ct_eval_func_call(
} else if (zend_string_equals_literal(name, "substr")) {
if (Z_TYPE_P(args[0]) != IS_STRING
|| Z_TYPE_P(args[1]) != IS_LONG
- || Z_TYPE_P(args[2]) != IS_LONG
- || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) {
+ || Z_TYPE_P(args[2]) != IS_LONG) {
return FAILURE;
}
/* pass */
diff --git a/ext/opcache/Optimizer/ssa_integrity.c b/ext/opcache/Optimizer/ssa_integrity.c
index ede40be59a..4f042cae74 100644
--- a/ext/opcache/Optimizer/ssa_integrity.c
+++ b/ext/opcache/Optimizer/ssa_integrity.c
@@ -87,7 +87,7 @@ static inline zend_bool is_in_successors(zend_basic_block *block, int check) {
}
static inline zend_bool is_var_type(zend_uchar type) {
- return type == IS_CV || type == IS_VAR || type == IS_TMP_VAR;
+ return (type & (IS_CV|IS_VAR|IS_TMP_VAR)) != 0;
}
#define FAIL(...) do { \
diff --git a/ext/opcache/Optimizer/zend_call_graph.c b/ext/opcache/Optimizer/zend_call_graph.c
index 8d677c1b86..28b20d10b8 100644
--- a/ext/opcache/Optimizer/zend_call_graph.c
+++ b/ext/opcache/Optimizer/zend_call_graph.c
@@ -103,7 +103,7 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
case ZEND_INIT_STATIC_METHOD_CALL:
call_stack[call] = call_info;
func = zend_optimizer_get_called_func(
- script, op_array, opline, (build_flags & ZEND_RT_CONSTANTS) != 0);
+ script, op_array, opline);
if (func) {
call_info = zend_arena_calloc(arena, 1, sizeof(zend_call_info) + (sizeof(zend_send_arg_info) * ((int)opline->extended_value - 1)));
call_info->caller_op_array = op_array;
@@ -250,10 +250,8 @@ static void zend_sort_op_arrays(zend_call_graph *call_graph)
// TODO: perform topological sort of cyclic call graph
}
-int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_call_graph *call_graph) /* {{{ */
+int zend_build_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph) /* {{{ */
{
- int i;
-
call_graph->op_arrays_count = 0;
if (zend_foreach_op_array(call_graph, script, zend_op_array_calc) != SUCCESS) {
return FAILURE;
@@ -264,13 +262,20 @@ int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t buil
if (zend_foreach_op_array(call_graph, script, zend_op_array_collect) != SUCCESS) {
return FAILURE;
}
+
+ return SUCCESS;
+}
+/* }}} */
+
+void zend_analyze_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph) /* {{{ */
+{
+ int i;
+
for (i = 0; i < call_graph->op_arrays_count; i++) {
- zend_analyze_calls(arena, script, build_flags, call_graph->op_arrays[i], call_graph->func_infos + i);
+ zend_analyze_calls(arena, script, 0, call_graph->op_arrays[i], call_graph->func_infos + i);
}
zend_analyze_recursion(call_graph);
zend_sort_op_arrays(call_graph);
-
- return SUCCESS;
}
/* }}} */
diff --git a/ext/opcache/Optimizer/zend_call_graph.h b/ext/opcache/Optimizer/zend_call_graph.h
index 033c675b63..8d2b866fd0 100644
--- a/ext/opcache/Optimizer/zend_call_graph.h
+++ b/ext/opcache/Optimizer/zend_call_graph.h
@@ -69,7 +69,8 @@ typedef struct _zend_call_graph {
BEGIN_EXTERN_C()
-int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_call_graph *call_graph);
+int zend_build_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph);
+void zend_analyze_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph);
zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info *info, zend_op_array *op_array);
int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_op_array *op_array, zend_func_info *func_info);
diff --git a/ext/opcache/Optimizer/zend_cfg.h b/ext/opcache/Optimizer/zend_cfg.h
index 7d6ef25eee..ec7a10462c 100644
--- a/ext/opcache/Optimizer/zend_cfg.h
+++ b/ext/opcache/Optimizer/zend_cfg.h
@@ -92,7 +92,6 @@ typedef struct _zend_cfg {
} zend_cfg;
/* Build Flags */
-#define ZEND_RT_CONSTANTS (1U<<31)
#define ZEND_CFG_STACKLESS (1<<30)
#define ZEND_SSA_DEBUG_LIVENESS (1<<29)
#define ZEND_SSA_DEBUG_PHI_PLACEMENT (1<<28)
@@ -102,15 +101,15 @@ typedef struct _zend_cfg {
#define ZEND_CALL_TREE (1<<23)
#define ZEND_SSA_USE_CV_RESULTS (1<<22)
-#define CRT_CONSTANT_EX(op_array, opline, node, rt_constants) \
- ((rt_constants) ? \
+#define CRT_CONSTANT_EX(op_array, opline, node) \
+ (((op_array)->fn_flags & ZEND_ACC_DONE_PASS_TWO) ? \
RT_CONSTANT(opline, (node)) \
: \
CT_CONSTANT_EX(op_array, (node).constant) \
)
#define CRT_CONSTANT(node) \
- CRT_CONSTANT_EX(op_array, opline, node, (build_flags & ZEND_RT_CONSTANTS))
+ CRT_CONSTANT_EX(op_array, opline, node)
#define RETURN_VALUE_USED(opline) \
((opline)->result_type != IS_UNUSED)
diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c
index e995b673b7..3bb76fb05c 100644
--- a/ext/opcache/Optimizer/zend_dfg.c
+++ b/ext/opcache/Optimizer/zend_dfg.c
@@ -123,10 +123,6 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg
case ZEND_FETCH_DIM_RW:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_OBJ_W:
- case ZEND_FETCH_OBJ_RW:
- case ZEND_FETCH_OBJ_FUNC_ARG:
- case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_LIST_W:
case ZEND_VERIFY_RETURN_TYPE:
case ZEND_PRE_INC_OBJ:
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c
index d6ef63415a..68b3d4a99f 100644
--- a/ext/opcache/Optimizer/zend_dump.c
+++ b/ext/opcache/Optimizer/zend_dump.c
@@ -127,11 +127,8 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla
} else if (ZEND_VM_OP_CONSTRUCTOR == (flags & ZEND_VM_OP_MASK)) {
fprintf(stderr, " CONSTRUCTOR");
} else if (ZEND_VM_OP_CONST_FETCH == (flags & ZEND_VM_OP_MASK)) {
- if (op.num & IS_CONSTANT_UNQUALIFIED) {
- fprintf(stderr, " (unqualified)");
- }
- if (op.num & IS_CONSTANT_IN_NAMESPACE) {
- fprintf(stderr, " (in-namespace)");
+ if (op.num & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
+ fprintf(stderr, " (unqualified-in-namespace)");
}
}
}
@@ -142,7 +139,7 @@ void zend_dump_var(const zend_op_array *op_array, zend_uchar var_type, int var_n
fprintf(stderr, "CV%d($%s)", var_num, op_array->vars[var_num]->val);
} else if (var_type == IS_VAR) {
fprintf(stderr, "V%d", var_num);
- } else if (var_type == IS_TMP_VAR) {
+ } else if ((var_type & (IS_VAR|IS_TMP_VAR)) == IS_TMP_VAR) {
fprintf(stderr, "T%d", var_num);
} else {
fprintf(stderr, "X%d", var_num);
@@ -314,10 +311,6 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
fprintf(stderr, "resource");
}
}
- if (info & MAY_BE_ERROR) {
- if (first) first = 0; else fprintf(stderr, ", ");
- fprintf(stderr, "error");
- }
//TODO: this is useful only for JIT???
if (info & MAY_BE_IN_REG) {
if (first) first = 0; else fprintf(stderr, ", ");
@@ -581,20 +574,18 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
fprintf(stderr, " (ref)");
}
}
- if ((ZEND_VM_EXT_DIM_OBJ_WRITE|ZEND_VM_EXT_FETCH_REF) & flags) {
+ if ((ZEND_VM_EXT_DIM_WRITE|ZEND_VM_EXT_FETCH_REF) & flags) {
uint32_t obj_flags = opline->extended_value & ZEND_FETCH_OBJ_FLAGS;
if (obj_flags == ZEND_FETCH_REF) {
fprintf(stderr, " (ref)");
} else if (obj_flags == ZEND_FETCH_DIM_WRITE) {
fprintf(stderr, " (dim write)");
- } else if (obj_flags == ZEND_FETCH_OBJ_WRITE) {
- fprintf(stderr, " (obj write)");
}
}
}
if (opline->op1_type == IS_CONST) {
- zend_dump_const(CRT_CONSTANT_EX(op_array, opline, opline->op1, (dump_flags & ZEND_DUMP_RT_CONSTANTS)));
+ zend_dump_const(CRT_CONSTANT(opline->op1));
} else if (opline->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
int ssa_var_num = ssa->ops[opline - op_array->opcodes].op1_use;
@@ -630,7 +621,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
}
if (opline->op2_type == IS_CONST) {
- zval *op = CRT_CONSTANT_EX(op_array, opline, opline->op2, (dump_flags & ZEND_DUMP_RT_CONSTANTS));
+ zval *op = CRT_CONSTANT(opline->op2);
if (opline->opcode == ZEND_SWITCH_LONG || opline->opcode == ZEND_SWITCH_STRING) {
HashTable *jumptable = Z_ARRVAL_P(op);
zend_string *key;
@@ -696,7 +687,13 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
}
}
if (opline->result_type == IS_CONST) {
- zend_dump_const(CRT_CONSTANT_EX(op_array, opline, opline->result, (dump_flags & ZEND_DUMP_RT_CONSTANTS)));
+ zend_dump_const(CRT_CONSTANT(opline->result));
+#if 0
+ } else if (opline->result_type & IS_SMART_BRANCH_JMPZ) {
+ fprintf(stderr, " jmpz");
+ } else if (opline->result_type & IS_SMART_BRANCH_JMPNZ) {
+ fprintf(stderr, " jmpnz");
+#endif
} else if (ssa && ssa->ops && ssa->ops[opline - op_array->opcodes].result_use >= 0) {
if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
@@ -729,6 +726,9 @@ static void zend_dump_block_info(const zend_cfg *cfg, int n, uint32_t dump_flags
if (b->flags & ZEND_BB_START) {
fprintf(stderr, " start");
}
+ if (b->flags & ZEND_BB_RECV_ENTRY) {
+ fprintf(stderr, " recv");
+ }
if (b->flags & ZEND_BB_FOLLOW) {
fprintf(stderr, " follow");
}
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index d9ff58e75e..96fe6594f9 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -39,66 +39,19 @@ typedef struct _func_info_t {
info_func_t info_func;
} func_info_t;
-/* MSVC defines its own IN macro, undefine it here */
-#undef IN
-
#define F0(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | (info)), NULL}
+ {name, sizeof(name)-1, (info), NULL}
#define F1(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_RC1 | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_RC1 | (info)), NULL}
#define FN(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
#define FR(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_REF | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_REF | (info)), NULL}
#define FX(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | (info)), NULL}
-#define I0(name, info) \
- {name, sizeof(name)-1, (info), NULL}
-#define I1(name, info) \
- {name, sizeof(name)-1, (MAY_BE_RC1 | (info)), NULL}
-#define IN(name, info) \
- {name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | (info)), NULL}
#define FC(name, callback) \
{name, sizeof(name)-1, 0, callback}
-static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
- uint32_t tmp = 0;
- if (call_info->arg_info[0].opline) {
- uint32_t arg_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
-
- if (arg_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_LONG;
- }
- if (arg_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- } else {
- tmp |= MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else if (call_info->num_args != -1) {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL;
- } else {
- return MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
- }
-}
-
-static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
- return MAY_BE_RC1 | MAY_BE_STRING;
- } else if (call_info->num_args != -1) {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL;
- } else {
- return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_STRING | MAY_BE_NULL;
- }
-}
-
static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa)
{
if (call_info->num_args == 2 || call_info->num_args == 3) {
@@ -106,7 +59,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
uint32_t t1 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
uint32_t t2 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline);
uint32_t t3 = 0;
- uint32_t tmp = FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG;
+ uint32_t tmp = MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG;
if (call_info->num_args == 3) {
t3 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[2].opline);
@@ -127,87 +80,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
return tmp;
} else {
/* may warning, and return FALSE */
- return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING;
- }
-}
-
-static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
- return MAY_BE_FALSE | MAY_BE_TRUE;
- } else {
- return MAY_BE_FALSE | MAY_BE_TRUE | FUNC_MAY_WARN;
- }
-}
-
-static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 2) {
-
- uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
- uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline);
- uint32_t tmp = 0;
-
- if ((arg1_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) &&
- (arg2_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT))) {
- tmp |= MAY_BE_LONG;
- }
- if ((arg1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
- (arg2_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL | MAY_BE_LONG;
- }
-}
-
-static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 3) {
- uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
- uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline);
- uint32_t arg3_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[2].opline);
- uint32_t tmp = 0;
-
- if ((arg1_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) &&
- (arg2_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) &&
- (arg3_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT))) {
- tmp |= MAY_BE_LONG | MAY_BE_FALSE;
- }
- if ((arg1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
- (arg2_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
- (arg3_info & (MAY_BE_STRING|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT))) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL | MAY_BE_LONG;
- }
-}
-
-static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
-
- uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
- uint32_t tmp = 0;
-
- if (arg1_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_FALSE | MAY_BE_TRUE;
- }
- if (arg1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE;
+ return MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING;
}
}
@@ -215,191 +88,158 @@ static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *s
static const func_info_t func_infos[] = {
/* zend */
- I1("zend_version", MAY_BE_STRING),
- I0("gc_collect_cycles", MAY_BE_LONG),
- I0("gc_enabled", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("gc_enable", MAY_BE_NULL),
- F0("gc_disable", MAY_BE_NULL),
- F0("func_num_args", MAY_BE_LONG),
+ F1("zend_version", MAY_BE_STRING),
FN("func_get_arg", UNKNOWN_INFO),
F1("func_get_args", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
- FC("strlen", zend_strlen_info),
- FC("strcmp", zend_l_ss_info),
- FC("strncmp", zend_lb_ssn_info),
- FC("strcasecmp", zend_l_ss_info),
- FC("strncasecmp", zend_lb_ssn_info),
- F1("each", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_KEY_ANY),
- F0("error_reporting", MAY_BE_NULL | MAY_BE_LONG),
- F0("define", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_NULL), // TODO: inline
- FC("defined", zend_b_s_info), // TODO: inline
+ F0("strncmp", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("strncasecmp", MAY_BE_FALSE | MAY_BE_LONG),
FN("get_class", MAY_BE_FALSE | MAY_BE_STRING),
FN("get_called_class", MAY_BE_FALSE | MAY_BE_STRING),
- FN("get_parent_class", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_NULL),
- F0("is_subclass_of", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline
- F0("is_a", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline
- F1("get_class_vars", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("get_object_vars", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("get_mangled_object_vars", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- F1("get_class_methods", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("method_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("property_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("class_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("interface_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("trait_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FC("function_exists", zend_b_s_info), // TODO: inline
- F0("class_alias", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("get_included_files", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("trigger_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("user_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ FN("get_parent_class", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("get_class_vars", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ FN("get_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ FN("get_mangled_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ F1("get_class_methods", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_included_files", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
FN("set_error_handler", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
- I0("restore_error_handler", MAY_BE_TRUE),
- I0("restore_exception_handler", MAY_BE_TRUE),
- I1("get_declared_traits", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- I1("get_declared_classes", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- I1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("get_defined_functions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
- I1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("create_function", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("get_resource_type", MAY_BE_NULL | MAY_BE_STRING),
- F1("get_defined_constants", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY),
- F0("debug_print_backtrace", MAY_BE_NULL),
- F1("debug_backtrace", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
- F1("get_loaded_extensions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- FC("extension_loaded", zend_b_s_info),
- F1("get_extension_funcs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F0("restore_error_handler", MAY_BE_TRUE),
+ F0("restore_exception_handler", MAY_BE_TRUE),
+ F1("get_declared_traits", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_declared_classes", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_defined_functions", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ F1("get_resource_type", MAY_BE_STRING),
+ F1("get_defined_constants", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY),
+ F1("debug_backtrace", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
+ F1("get_loaded_extensions", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_extension_funcs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
/* ext/standard */
FN("constant", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING | MAY_BE_RESOURCE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- F1("bin2hex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hex2bin", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("bin2hex", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("hex2bin", MAY_BE_FALSE | MAY_BE_STRING),
F0("sleep", MAY_BE_FALSE | MAY_BE_LONG),
F0("usleep", MAY_BE_NULL | MAY_BE_FALSE),
#if HAVE_NANOSLEEP
- F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
- F0("time_sleep_until", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("time_nanosleep", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
+ F0("time_sleep_until", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
#if HAVE_STRPTIME
- F1("strptime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("strptime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
#endif
F0("flush", MAY_BE_NULL),
- F1("wordwrap", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("htmlspecialchars", MAY_BE_NULL | MAY_BE_STRING),
- F1("htmlentities", MAY_BE_NULL | MAY_BE_STRING),
- FN("html_entity_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("htmlspecialchars_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("get_html_translation_table", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F1("sha1", MAY_BE_NULL | MAY_BE_STRING),
- F1("sha1_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("md5", MAY_BE_NULL | MAY_BE_STRING),
- F1("md5_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("crc32", MAY_BE_NULL | MAY_BE_LONG),
- F1("iptcparse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F1("iptcembed", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("getimagesize", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("getimagesizefromstring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("image_type_to_mime_type", MAY_BE_NULL | MAY_BE_STRING),
+ F1("wordwrap", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("htmlspecialchars", MAY_BE_STRING),
+ F1("htmlentities", MAY_BE_STRING),
+ FN("html_entity_decode", MAY_BE_FALSE | MAY_BE_STRING),
+ FN("htmlspecialchars_decode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("get_html_translation_table", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F1("sha1", MAY_BE_STRING),
+ F1("sha1_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("md5", MAY_BE_STRING),
+ F1("md5_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("iptcparse", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("iptcembed", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("getimagesize", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("getimagesizefromstring", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("image_type_to_mime_type", MAY_BE_STRING),
F1("image_type_to_extension", MAY_BE_FALSE | MAY_BE_STRING),
- F0("phpinfo", MAY_BE_NULL | MAY_BE_TRUE),
- F1("phpversion", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("phpcredits", MAY_BE_NULL | MAY_BE_TRUE),
- I1("php_sapi_name", MAY_BE_FALSE | MAY_BE_STRING),
- F1("php_uname", MAY_BE_NULL | MAY_BE_STRING),
- I1("php_ini_scanned_files", MAY_BE_FALSE | MAY_BE_STRING),
- I1("php_ini_loaded_file", MAY_BE_FALSE | MAY_BE_STRING),
- F0("strnatcmp", MAY_BE_NULL | MAY_BE_LONG),
- F0("strnatcasecmp", MAY_BE_NULL | MAY_BE_LONG),
- F0("substr_count", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strspn", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strcspn", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("strtok", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("strtoupper", MAY_BE_NULL | MAY_BE_STRING),
- FN("strtolower", MAY_BE_NULL | MAY_BE_STRING),
- F0("strpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("stripos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strrpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strripos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("strrev", MAY_BE_NULL | MAY_BE_STRING),
- F1("hebrev", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hebrevc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("nl2br", MAY_BE_NULL | MAY_BE_STRING),
- F1("basename", MAY_BE_NULL | MAY_BE_STRING),
+ F0("phpinfo", MAY_BE_TRUE),
+ F1("phpversion", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("phpcredits", MAY_BE_TRUE),
+ F1("php_sapi_name", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("php_uname", MAY_BE_STRING),
+ F1("php_ini_scanned_files", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("php_ini_loaded_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("substr_count", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("strspn", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("strcspn", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("strtok", MAY_BE_FALSE | MAY_BE_STRING),
+ FN("strtoupper", MAY_BE_STRING),
+ FN("strtolower", MAY_BE_STRING),
+ F0("strpos", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("stripos", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("strrpos", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("strripos", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("strrev", MAY_BE_STRING),
+ F1("hebrev", MAY_BE_STRING),
+ F1("hebrevc", MAY_BE_STRING),
+ FN("nl2br", MAY_BE_STRING),
+ F1("basename", MAY_BE_STRING),
F1("dirname", MAY_BE_NULL | MAY_BE_STRING),
- F1("pathinfo", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F1("stripslashes", MAY_BE_NULL | MAY_BE_STRING),
- F1("stripcslashes", MAY_BE_NULL | MAY_BE_STRING),
- F1("strstr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("stristr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("strrchr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("str_shuffle", MAY_BE_NULL | MAY_BE_STRING),
- F1("str_word_count", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("str_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("pathinfo", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F1("stripslashes", MAY_BE_STRING),
+ F1("stripcslashes", MAY_BE_STRING),
+ F1("strstr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("stristr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("strrchr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("str_shuffle", MAY_BE_STRING),
+ F1("str_word_count", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("str_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING),
F0("substr_compare", MAY_BE_FALSE | MAY_BE_LONG),
- F0("strcoll", MAY_BE_NULL | MAY_BE_LONG),
#ifdef HAVE_STRFMON
- F1("money_format", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("money_format", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- FN("substr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("substr_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
- F1("quotemeta", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("ucfirst", MAY_BE_NULL | MAY_BE_STRING),
- FN("lcfirst", MAY_BE_NULL | MAY_BE_STRING),
- F1("ucwords", MAY_BE_NULL | MAY_BE_STRING),
- FN("strtr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("addslashes", MAY_BE_NULL | MAY_BE_STRING),
- F1("addcslashes", MAY_BE_NULL | MAY_BE_STRING),
- FN("rtrim", MAY_BE_NULL | MAY_BE_STRING),
- FN("str_replace", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
- FN("str_ireplace", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
+ FN("substr", MAY_BE_FALSE | MAY_BE_STRING),
+ FN("substr_replace", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
+ F1("quotemeta", MAY_BE_STRING),
+ FN("ucfirst", MAY_BE_STRING),
+ FN("lcfirst", MAY_BE_STRING),
+ F1("ucwords", MAY_BE_STRING),
+ FN("strtr", MAY_BE_FALSE | MAY_BE_STRING),
+ FN("addslashes", MAY_BE_STRING),
+ F1("addcslashes", MAY_BE_STRING),
+ FN("rtrim", MAY_BE_STRING),
+ FN("chop", MAY_BE_STRING),
+ FN("str_replace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
+ FN("str_ireplace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
F1("str_repeat", MAY_BE_NULL | MAY_BE_STRING),
- F1("count_chars", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("chunk_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("trim", MAY_BE_NULL | MAY_BE_STRING),
- FN("ltrim", MAY_BE_NULL | MAY_BE_STRING),
- F1("strip_tags", MAY_BE_NULL | MAY_BE_STRING),
- F0("similar_text", MAY_BE_NULL | MAY_BE_LONG),
- F1("explode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- FN("implode", MAY_BE_NULL | MAY_BE_STRING),
- FN("join", MAY_BE_NULL | MAY_BE_STRING),
- FN("setlocale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("count_chars", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("chunk_split", MAY_BE_FALSE | MAY_BE_STRING),
+ FN("trim", MAY_BE_STRING),
+ FN("ltrim", MAY_BE_STRING),
+ F1("strip_tags", MAY_BE_STRING),
+ F1("explode", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ FN("implode", MAY_BE_STRING),
+ FN("join", MAY_BE_STRING),
+ FN("setlocale", MAY_BE_FALSE | MAY_BE_STRING),
F1("localeconv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if HAVE_NL_LANGINFO
- F1("nl_langinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("nl_langinfo", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- F1("soundex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("levenshtein", MAY_BE_NULL | MAY_BE_LONG),
- F1("chr", MAY_BE_NULL | MAY_BE_STRING),
- F0("ord", MAY_BE_NULL | MAY_BE_LONG),
- F0("parse_str", MAY_BE_NULL),
+ F1("soundex", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("levenshtein", MAY_BE_LONG),
+ F1("chr", MAY_BE_STRING),
F1("str_getcsv", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("str_pad", MAY_BE_NULL | MAY_BE_STRING),
- F1("chop", MAY_BE_NULL | MAY_BE_STRING),
- F1("strchr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("strchr", MAY_BE_FALSE | MAY_BE_STRING),
F1("sprintf", MAY_BE_FALSE | MAY_BE_STRING),
F0("printf", MAY_BE_FALSE | MAY_BE_LONG),
F0("vprintf", MAY_BE_FALSE | MAY_BE_LONG),
F1("vsprintf", MAY_BE_FALSE | MAY_BE_STRING),
- F0("fprintf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("vfprintf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F0("fprintf", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("vfprintf", MAY_BE_FALSE | MAY_BE_LONG),
F1("sscanf", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
F1("fscanf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
- F1("parse_url", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG),
- F1("urlencode", MAY_BE_NULL | MAY_BE_STRING),
- F1("urldecode", MAY_BE_NULL | MAY_BE_STRING),
- F1("rawurlencode", MAY_BE_NULL | MAY_BE_STRING),
- F1("rawurldecode", MAY_BE_NULL | MAY_BE_STRING),
+ F1("parse_url", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG),
+ F1("urlencode", MAY_BE_STRING),
+ F1("urldecode", MAY_BE_STRING),
+ F1("rawurlencode", MAY_BE_STRING),
+ F1("rawurldecode", MAY_BE_STRING),
F1("http_build_query", MAY_BE_FALSE | MAY_BE_STRING),
#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
- F1("readlink", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("linkinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("symlink", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("link", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("readlink", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("linkinfo", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("symlink", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("link", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
F0("unlink", MAY_BE_FALSE | MAY_BE_TRUE),
F1("exec", MAY_BE_FALSE | MAY_BE_STRING),
F1("system", MAY_BE_FALSE | MAY_BE_STRING),
- F1("escapeshellcmd", MAY_BE_NULL | MAY_BE_STRING),
- F1("escapeshellarg", MAY_BE_NULL | MAY_BE_STRING),
+ F1("escapeshellcmd", MAY_BE_STRING),
+ F1("escapeshellarg", MAY_BE_STRING),
F1("passthru", MAY_BE_NULL | MAY_BE_FALSE),
F1("shell_exec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
@@ -418,111 +258,89 @@ static const func_info_t func_infos[] = {
F0("getrandmax", MAY_BE_NULL | MAY_BE_LONG),
F0("mt_rand", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("mt_srand", MAY_BE_NULL),
- I0("mt_getrandmax", MAY_BE_LONG),
+ F0("mt_getrandmax", MAY_BE_LONG),
#if HAVE_GETSERVBYNAME
- F0("getservbyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F0("getservbyname", MAY_BE_FALSE | MAY_BE_LONG),
#endif
#if HAVE_GETSERVBYPORT
- F1("getservbyport", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("getservbyport", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#if HAVE_GETPROTOBYNAME
- F0("getprotobyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F0("getprotobyname", MAY_BE_FALSE | MAY_BE_LONG),
#endif
#if HAVE_GETPROTOBYNUMBER
- F1("getprotobynumber", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("getprotobynumber", MAY_BE_FALSE | MAY_BE_STRING),
#endif
F0("getmyuid", MAY_BE_FALSE | MAY_BE_LONG),
F0("getmygid", MAY_BE_FALSE | MAY_BE_LONG),
F0("getmypid", MAY_BE_FALSE | MAY_BE_LONG),
F0("getmyinode", MAY_BE_FALSE | MAY_BE_LONG),
- F0("getlastmod", MAY_BE_FALSE | MAY_BE_LONG),
- F1("base64_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("base64_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("password_hash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("password_get_info", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("password_needs_rehash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("base64_encode", MAY_BE_STRING),
+ F1("password_hash", MAY_BE_NULL | MAY_BE_STRING),
+ F1("password_get_info", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F0("password_needs_rehash", MAY_BE_FALSE | MAY_BE_TRUE),
F0("password_verify", MAY_BE_FALSE | MAY_BE_TRUE),
F1("convert_uuencode", MAY_BE_FALSE | MAY_BE_STRING),
F1("convert_uudecode", MAY_BE_FALSE | MAY_BE_STRING),
- F0("abs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("ceil", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("floor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("round", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("sin", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("cos", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("tan", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("asin", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("acos", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("atan", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("atanh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("atan2", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("sinh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("cosh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("tanh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("asinh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("acosh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("expm1", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("log1p", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("pi", MAY_BE_DOUBLE),
- F0("is_finite", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_nan", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_infinite", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("pow", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("exp", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("log", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("log10", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("sqrt", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("hypot", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("deg2rad", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("rad2deg", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("bindec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("hexdec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("octdec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F1("decbin", MAY_BE_NULL | MAY_BE_STRING),
- F1("decoct", MAY_BE_NULL | MAY_BE_STRING),
- FC("dechex", zend_dechex_info),
- F1("base_convert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("number_format", MAY_BE_NULL | MAY_BE_STRING),
- F0("fmod", MAY_BE_NULL | MAY_BE_DOUBLE),
+ F0("abs", MAY_BE_LONG | MAY_BE_DOUBLE),
+ F0("ceil", MAY_BE_DOUBLE),
+ F0("floor", MAY_BE_DOUBLE),
+ F0("round", MAY_BE_FALSE | MAY_BE_DOUBLE),
+ F0("expm1", MAY_BE_DOUBLE),
+ F0("log1p", MAY_BE_DOUBLE),
+ F1("pow", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT),
+ F0("exp", MAY_BE_DOUBLE),
+ F0("log", MAY_BE_FALSE | MAY_BE_DOUBLE),
+ F0("log10", MAY_BE_DOUBLE),
+ F0("sqrt", MAY_BE_DOUBLE),
+ F0("hypot", MAY_BE_DOUBLE),
+ F0("deg2rad", MAY_BE_DOUBLE),
+ F0("rad2deg", MAY_BE_DOUBLE),
+ F0("bindec", MAY_BE_LONG | MAY_BE_DOUBLE),
+ F0("hexdec", MAY_BE_LONG | MAY_BE_DOUBLE),
+ F0("octdec", MAY_BE_LONG | MAY_BE_DOUBLE),
+ F1("decbin", MAY_BE_STRING),
+ F1("decoct", MAY_BE_STRING),
+ F1("dechex", MAY_BE_STRING),
+ F1("base_convert", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("number_format", MAY_BE_STRING),
+ F0("fmod", MAY_BE_DOUBLE),
#ifdef HAVE_INET_NTOP
F1("inet_ntop", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#ifdef HAVE_INET_PTON
F1("inet_pton", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- F0("ip2long", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("long2ip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F0("ip2long", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("long2ip", MAY_BE_FALSE | MAY_BE_STRING),
F1("getenv", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
#ifdef HAVE_PUTENV
- F0("putenv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("putenv", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
F1("getopt", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#ifdef HAVE_GETLOADAVG
F1("sys_getloadavg", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
#endif
#ifdef HAVE_GETTIMEOFDAY
- F1("microtime", MAY_BE_NULL | MAY_BE_DOUBLE | MAY_BE_STRING),
- F1("gettimeofday", MAY_BE_NULL | MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
+ F1("microtime", MAY_BE_DOUBLE | MAY_BE_STRING),
+ F1("gettimeofday", MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
#endif
#ifdef HAVE_GETRUSAGE
- F1("getrusage", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
+ F1("getrusage", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
#endif
#ifdef HAVE_GETTIMEOFDAY
- F1("uniqid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("uniqid", MAY_BE_STRING),
#endif
- F1("quoted_printable_decode", MAY_BE_NULL | MAY_BE_STRING),
- F1("quoted_printable_encode", MAY_BE_NULL | MAY_BE_STRING),
- F1("convert_cyr_string", MAY_BE_NULL | MAY_BE_STRING),
- I1("get_current_user", MAY_BE_STRING),
- F0("set_time_limit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("header_register_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("get_cfg_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- I0("magic_quotes_runtime", MAY_BE_FALSE),
- I0("set_magic_quotes_runtime", MAY_BE_FALSE),
- I0("get_magic_quotes_gpc", MAY_BE_FALSE),
- I0("get_magic_quotes_runtime", MAY_BE_FALSE),
- F0("error_log", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("quoted_printable_decode", MAY_BE_STRING),
+ F1("quoted_printable_encode", MAY_BE_STRING),
+ F1("convert_cyr_string", MAY_BE_STRING),
+ F1("get_current_user", MAY_BE_STRING),
+ F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F0("get_magic_quotes_gpc", MAY_BE_FALSE),
+ F0("get_magic_quotes_runtime", MAY_BE_FALSE),
+ F0("error_log", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
FN("call_user_func", UNKNOWN_INFO),
FN("call_user_func_array", UNKNOWN_INFO),
FN("call_user_method", UNKNOWN_INFO),
@@ -543,73 +361,50 @@ static const func_info_t func_infos[] = {
F1("highlight_file", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("show_source", MAY_BE_FALSE | MAY_BE_STRING),
F1("highlight_string", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("php_strip_whitespace", MAY_BE_FALSE | MAY_BE_STRING),
- FN("ini_get", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("ini_get_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- FN("ini_set", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("php_strip_whitespace", MAY_BE_STRING),
+ FN("ini_get", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ini_get_all", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ FN("ini_set", MAY_BE_FALSE | MAY_BE_STRING),
F1("ini_alter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F0("ini_restore", MAY_BE_NULL),
- I1("get_include_path", MAY_BE_FALSE | MAY_BE_STRING),
- F1("set_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("get_include_path", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("set_include_path", MAY_BE_FALSE | MAY_BE_STRING),
F0("restore_include_path", MAY_BE_NULL),
- F0("setcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("setrawcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("header", MAY_BE_NULL),
- F0("header_remove", MAY_BE_NULL),
- F0("headers_sent", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("headers_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F0("http_response_code", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("connection_aborted", MAY_BE_LONG),
F0("connection_status", MAY_BE_LONG),
- F0("ignore_user_abort", MAY_BE_NULL | MAY_BE_LONG),
+ F0("ignore_user_abort", MAY_BE_LONG),
F1("parse_ini_file", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("parse_ini_string", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if ZEND_DEBUG
F1("config_get_hash", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#endif
- F0("is_uploaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("move_uploaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("gethostbyaddr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gethostbyname", MAY_BE_NULL | MAY_BE_STRING),
- F1("gethostbynamel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F0("move_uploaded_file", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("gethostbyaddr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gethostbyname", MAY_BE_STRING),
+ F1("gethostbynamel", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
#ifdef HAVE_GETHOSTNAME
F1("gethostname", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
- F0("dns_check_record", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("checkdnsrr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("dns_check_record", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("checkdnsrr", MAY_BE_FALSE | MAY_BE_TRUE),
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
- F0("dns_get_mx", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("getmxrr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("dns_get_record", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
+ F0("dns_get_mx", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("getmxrr", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("dns_get_record", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
# endif
#endif
- F0("intval", MAY_BE_NULL | MAY_BE_LONG),
- F0("floatval", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("doubleval", MAY_BE_NULL | MAY_BE_DOUBLE),
- FN("strval", MAY_BE_NULL | MAY_BE_STRING),
- F0("boolval", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FN("gettype", MAY_BE_NULL | MAY_BE_STRING),
- F0("settype", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FC("is_null", zend_is_type_info),
- F0("is_resource", MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline with support for closed resources
- FC("is_bool", zend_is_type_info),
- FC("is_long", zend_is_type_info),
- FC("is_float", zend_is_type_info),
- FC("is_int", zend_is_type_info),
- FC("is_integer", zend_is_type_info),
- FC("is_double", zend_is_type_info),
- FC("is_real", zend_is_type_info),
- F0("is_numeric", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FC("is_string", zend_is_type_info),
- FC("is_array", zend_is_type_info),
- F0("is_object", MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline with support for incomplete class
- F0("is_scalar", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_callable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_countable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_iterable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("intval", MAY_BE_LONG),
+ F0("floatval", MAY_BE_DOUBLE),
+ F0("doubleval", MAY_BE_DOUBLE),
+ FN("strval", MAY_BE_STRING),
+ F0("boolval", MAY_BE_FALSE | MAY_BE_TRUE),
+ FN("gettype", MAY_BE_STRING),
+ F0("settype", MAY_BE_FALSE | MAY_BE_TRUE),
F0("pclose", MAY_BE_FALSE | MAY_BE_LONG),
- F1("popen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("popen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F0("readfile", MAY_BE_FALSE | MAY_BE_LONG),
F0("rewind", MAY_BE_FALSE | MAY_BE_TRUE),
F0("rmdir", MAY_BE_FALSE | MAY_BE_TRUE),
@@ -618,7 +413,6 @@ static const func_info_t func_infos[] = {
F0("feof", MAY_BE_FALSE | MAY_BE_TRUE),
F1("fgetc", MAY_BE_FALSE | MAY_BE_STRING),
F1("fgets", MAY_BE_FALSE | MAY_BE_STRING),
- F1("fgetss", MAY_BE_FALSE | MAY_BE_STRING),
F1("fread", MAY_BE_FALSE | MAY_BE_STRING),
F1("fopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F0("fpassthru", MAY_BE_FALSE | MAY_BE_LONG),
@@ -631,13 +425,13 @@ static const func_info_t func_infos[] = {
F0("fputs", MAY_BE_FALSE | MAY_BE_LONG),
F0("mkdir", MAY_BE_FALSE | MAY_BE_TRUE),
F0("rename", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("tempnam", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F0("copy", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("tempnam", MAY_BE_FALSE | MAY_BE_STRING),
F1("tmpfile", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("file_get_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("file_put_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_select", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F1("file", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("file_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("file_put_contents", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("stream_select", MAY_BE_FALSE | MAY_BE_LONG),
F1("stream_context_create", MAY_BE_FALSE | MAY_BE_RESOURCE),
F0("stream_context_set_params", MAY_BE_FALSE | MAY_BE_TRUE),
F1("stream_context_get_params", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
@@ -665,44 +459,40 @@ static const func_info_t func_infos[] = {
F1("stream_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
F0("stream_supports_lock", MAY_BE_FALSE | MAY_BE_TRUE),
F1("fgetcsv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
- F0("fputcsv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("flock", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("get_meta_tags", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F0("fputcsv", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("flock", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("get_meta_tags", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F0("stream_set_read_buffer", MAY_BE_FALSE | MAY_BE_LONG),
F0("stream_set_write_buffer", MAY_BE_FALSE | MAY_BE_LONG),
F0("set_file_buffer", MAY_BE_FALSE | MAY_BE_LONG),
F0("stream_set_chunk_size", MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_set_blocking", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("socket_set_blocking", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("stream_get_meta_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F0("stream_set_blocking", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("socket_set_blocking", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("stream_get_meta_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("stream_get_line", MAY_BE_FALSE | MAY_BE_STRING),
- F0("stream_wrapper_register", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("stream_register_wrapper", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("stream_wrapper_unregister", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("stream_wrapper_restore", MAY_BE_FALSE | MAY_BE_TRUE),
F1("stream_get_wrappers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("stream_get_transports", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("stream_resolve_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING),
F0("stream_is_local", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("get_headers", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("get_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
- F0("stream_set_timeout", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("socket_set_timeout", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("stream_set_timeout", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("socket_set_timeout", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
- F1("socket_get_status", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("socket_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
#if HAVE_REALPATH || defined(ZTS)
- F1("realpath", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("realpath", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#ifdef HAVE_FNMATCH
- F0("fnmatch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("fnmatch", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
F1("fsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pfsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pack", MAY_BE_FALSE | MAY_BE_STRING),
- F1("unpack", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
+ F1("unpack", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("get_browser", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_OBJECT | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F1("crypt", MAY_BE_NULL | MAY_BE_STRING),
- FN("opendir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("crypt", MAY_BE_STRING),
+ FN("opendir", MAY_BE_FALSE | MAY_BE_RESOURCE),
F0("closedir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("chdir", MAY_BE_FALSE | MAY_BE_TRUE),
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
@@ -710,86 +500,54 @@ static const func_info_t func_infos[] = {
#endif
F1("getcwd", MAY_BE_FALSE | MAY_BE_STRING),
F0("rewinddir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("readdir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("dir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("scandir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("readdir", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("dir", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("scandir", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
#ifdef HAVE_GLOB
- F1("glob", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("glob", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
#endif
- F0("fileatime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filectime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filegroup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("fileinode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filemtime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("fileowner", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("fileperms", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filesize", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("filetype", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("file_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_writable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_writeable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_readable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_executable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_dir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_link", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("stat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("lstat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("chown", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("chgrp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("fileatime", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("filectime", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("filegroup", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("fileinode", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("filemtime", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("fileowner", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("fileperms", MAY_BE_FALSE | MAY_BE_LONG),
+ F0("filesize", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("filetype", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("file_exists", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("stat", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("lstat", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F0("chown", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("chgrp", MAY_BE_FALSE | MAY_BE_TRUE),
#if HAVE_LCHOWN
- F0("lchown", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("lchown", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
#if HAVE_LCHOWN
- F0("lchgrp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("lchgrp", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
- F0("chmod", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("chmod", MAY_BE_FALSE | MAY_BE_TRUE),
#if HAVE_UTIME
- F0("touch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("touch", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
F0("clearstatcache", MAY_BE_NULL),
- F0("disk_total_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("disk_free_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("diskfreespace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- I0("realpath_cache_size", MAY_BE_LONG),
- I1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("mail", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ezmlm_hash", MAY_BE_NULL | MAY_BE_LONG),
+ F0("disk_total_space", MAY_BE_FALSE | MAY_BE_DOUBLE),
+ F0("disk_free_space", MAY_BE_FALSE | MAY_BE_DOUBLE),
+ F0("diskfreespace", MAY_BE_FALSE | MAY_BE_DOUBLE),
+ F0("realpath_cache_size", MAY_BE_LONG),
+ F1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F0("mail", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("ezmlm_hash", MAY_BE_LONG),
#ifdef HAVE_SYSLOG_H
- F0("openlog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("syslog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("closelog", MAY_BE_TRUE),
#endif
- F0("lcg_value", MAY_BE_DOUBLE),
- F1("metaphone", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ob_start", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_clean", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_end_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_end_clean", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("ob_get_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("ob_get_clean", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ob_get_length", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("ob_get_level", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("ob_get_status", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- FN("ob_get_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ob_implicit_flush", MAY_BE_NULL),
- F1("ob_list_handlers", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("ksort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("krsort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("natsort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("natcasesort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("asort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("arsort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("sort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("rsort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("usort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("uasort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("uksort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("shuffle", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("array_walk", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("array_walk_recursive", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("count", MAY_BE_NULL | MAY_BE_LONG),
+ F1("metaphone", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ob_get_flush", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ob_get_clean", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("ob_get_length", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("ob_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ FN("ob_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ob_list_handlers", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
FN("end", UNKNOWN_INFO),
FN("prev", UNKNOWN_INFO),
FN("next", UNKNOWN_INFO),
@@ -798,129 +556,111 @@ static const func_info_t func_infos[] = {
FN("key", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
FN("min", UNKNOWN_INFO),
FN("max", UNKNOWN_INFO),
- F0("in_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
FN("array_search", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
- F0("extract", MAY_BE_NULL | MAY_BE_LONG),
- F1("compact", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_fill", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
- F1("array_fill_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("compact", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_fill", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
+ F1("array_fill_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
FC("range", zend_range_info),
- F0("array_multisort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("array_push", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
FN("array_pop", UNKNOWN_INFO),
FN("array_shift", UNKNOWN_INFO),
- F0("array_unshift", MAY_BE_NULL | MAY_BE_LONG),
- F1("array_splice", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_slice", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_merge", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_merge_recursive", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_replace", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_replace_recursive", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- FN("array_values", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_count_values", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
- F1("array_column", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_reverse", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_splice", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_slice", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_merge", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_merge_recursive", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_replace", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_replace_recursive", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ FN("array_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_count_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
+ F1("array_column", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_reverse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_reduce", UNKNOWN_INFO),
- FN("array_pad", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_flip", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("array_change_key_case", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_pad", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_flip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("array_change_key_case", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_rand", UNKNOWN_INFO),
- FN("array_unique", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_key", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_ukey", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_uintersect", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_uintersect_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_uintersect_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_diff", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_key", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_ukey", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_udiff", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_udiff_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_udiff_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F0("array_sum", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("array_product", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE),
- F1("array_filter", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_map", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_chunk", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_combine", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F0("array_key_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ FN("array_unique", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_key", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_ukey", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_uintersect", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_uintersect_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_uintersect_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_diff", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_key", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_ukey", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_udiff", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_udiff_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_udiff_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F0("array_sum", MAY_BE_LONG | MAY_BE_DOUBLE),
+ F0("array_product", MAY_BE_LONG | MAY_BE_DOUBLE),
+ F1("array_filter", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_map", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
FN("array_key_first", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
FN("array_key_last", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
F1("pos", UNKNOWN_INFO),
- F0("sizeof", MAY_BE_NULL | MAY_BE_LONG),
- F0("key_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("assert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("assert_options", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
F0("version_compare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG),
-#if HAVE_FTOK
- F0("ftok", MAY_BE_NULL | MAY_BE_LONG),
-#endif
- F1("str_rot13", MAY_BE_NULL | MAY_BE_STRING),
- I1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("str_rot13", MAY_BE_STRING),
+ F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F0("stream_filter_register", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
F1("stream_bucket_prepend", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("stream_bucket_append", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("stream_bucket_new", MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("output_add_rewrite_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("output_reset_rewrite_vars", MAY_BE_FALSE),
- I1("sys_get_temp_dir", MAY_BE_STRING),
+ F1("sys_get_temp_dir", MAY_BE_STRING),
/* ext/date */
F0("strtotime", MAY_BE_FALSE | MAY_BE_LONG),
- F1("date", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("date", MAY_BE_STRING),
F0("idate", MAY_BE_FALSE | MAY_BE_LONG),
- F1("gmdate", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gmdate", MAY_BE_STRING),
F0("mktime", MAY_BE_FALSE | MAY_BE_LONG),
F0("gmmktime", MAY_BE_FALSE | MAY_BE_LONG),
- F0("checkdate", MAY_BE_FALSE | MAY_BE_TRUE),
F1("strftime", MAY_BE_FALSE | MAY_BE_STRING),
F1("gmstrftime", MAY_BE_FALSE | MAY_BE_STRING),
- F0("time", MAY_BE_LONG),
- F1("localtime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
- F1("getdate", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("localtime", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
+ F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
F1("date_create", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_immutable", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_immutable_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("date_parse", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F1("date_parse_from_format", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("date_parse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("date_parse_from_format", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("date_get_last_errors", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_ARRAY),
- F1("date_format", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("date_format", MAY_BE_STRING),
FN("date_modify", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_add", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_sub", MAY_BE_FALSE | MAY_BE_OBJECT),
+ FN("date_add", MAY_BE_OBJECT),
+ FN("date_sub", MAY_BE_OBJECT),
F1("date_timezone_get", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_timezone_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("date_offset_get", MAY_BE_FALSE | MAY_BE_LONG),
- F1("date_diff", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_time_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_date_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_isodate_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_timestamp_set", MAY_BE_FALSE | MAY_BE_OBJECT),
+ FN("date_timezone_set", MAY_BE_OBJECT),
+ F1("date_diff", MAY_BE_OBJECT),
+ FN("date_time_set", MAY_BE_OBJECT),
+ FN("date_date_set", MAY_BE_OBJECT),
+ FN("date_isodate_set", MAY_BE_OBJECT),
+ FN("date_timestamp_set", MAY_BE_OBJECT),
F0("date_timestamp_get", MAY_BE_FALSE | MAY_BE_LONG),
F1("timezone_open", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("timezone_name_get", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("timezone_name_get", MAY_BE_STRING),
F1("timezone_name_from_abbr", MAY_BE_FALSE | MAY_BE_STRING),
- F0("timezone_offset_get", MAY_BE_FALSE | MAY_BE_LONG),
F1("timezone_transitions_get", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("timezone_location_get", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING),
F1("timezone_identifiers_list", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("timezone_abbreviations_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("timezone_version_get", MAY_BE_STRING),
F1("date_interval_create_from_date_string", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("date_interval_format", MAY_BE_FALSE | MAY_BE_STRING),
- F0("date_default_timezone_set", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("date_interval_format", MAY_BE_STRING),
F1("date_default_timezone_get", MAY_BE_STRING),
F1("date_sunrise", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING),
F1("date_sunset", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING),
- F1("date_sun_info", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG),
+ F1("date_sun_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG),
/* ext/preg */
F0("preg_match", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
@@ -929,15 +669,14 @@ static const func_info_t func_infos[] = {
FN("preg_replace_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
F1("preg_filter", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
F1("preg_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- FN("preg_quote", MAY_BE_NULL | MAY_BE_STRING),
+ FN("preg_quote", MAY_BE_STRING),
F1("preg_grep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F0("preg_last_error", MAY_BE_NULL | MAY_BE_LONG),
/* ext/mysqli */
F1("mysqli_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("mysqli_close", MAY_BE_NULL | MAY_BE_TRUE),
- I1("mysqli_connect_error", MAY_BE_NULL | MAY_BE_STRING),
- I0("mysqli_connect_errno", MAY_BE_LONG),
+ F1("mysqli_connect_error", MAY_BE_NULL | MAY_BE_STRING),
+ F0("mysqli_connect_errno", MAY_BE_LONG),
F1("mysqli_get_client_stats", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F1("mysqli_error_list", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
F1("mysqli_get_links_stats", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
@@ -981,8 +720,8 @@ static const func_info_t func_infos[] = {
F0("mysqli_field_count", MAY_BE_NULL | MAY_BE_LONG),
F0("mysqli_field_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("mysqli_field_tell", MAY_BE_NULL | MAY_BE_LONG),
- I1("mysqli_get_client_info", MAY_BE_STRING),
- I0("mysqli_get_client_version", MAY_BE_LONG),
+ F1("mysqli_get_client_info", MAY_BE_STRING),
+ F0("mysqli_get_client_version", MAY_BE_LONG),
F1("mysqli_get_host_info", MAY_BE_NULL | MAY_BE_STRING),
F0("mysqli_get_proto_info", MAY_BE_NULL | MAY_BE_LONG),
F1("mysqli_get_server_info", MAY_BE_NULL | MAY_BE_STRING),
@@ -1030,7 +769,7 @@ static const func_info_t func_infos[] = {
F1("mysqli_stmt_sqlstate", MAY_BE_NULL | MAY_BE_STRING),
F1("mysqli_store_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("mysqli_thread_id", MAY_BE_NULL | MAY_BE_LONG),
- I0("mysqli_thread_safe", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("mysqli_thread_safe", MAY_BE_FALSE | MAY_BE_TRUE),
F1("mysqli_use_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("mysqli_warning_count", MAY_BE_NULL | MAY_BE_LONG),
@@ -1038,31 +777,19 @@ static const func_info_t func_infos[] = {
F1("curl_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("curl_copy_handle", MAY_BE_NULL | MAY_BE_RESOURCE),
F1("curl_version", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("curl_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("curl_setopt_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
FN("curl_exec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("curl_getinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- F1("curl_error", MAY_BE_NULL | MAY_BE_STRING),
- F0("curl_errno", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_close", MAY_BE_NULL),
+ F1("curl_error", MAY_BE_STRING),
F1("curl_strerror", MAY_BE_NULL | MAY_BE_STRING),
F1("curl_multi_strerror", MAY_BE_NULL | MAY_BE_STRING),
- F0("curl_reset", MAY_BE_NULL),
F1("curl_escape", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("curl_unescape", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("curl_pause", MAY_BE_NULL | MAY_BE_LONG),
F1("curl_multi_init", MAY_BE_RESOURCE),
- F0("curl_multi_add_handle", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_multi_remove_handle", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_multi_select", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_multi_exec", MAY_BE_NULL | MAY_BE_LONG),
FN("curl_multi_getcontent", MAY_BE_NULL | MAY_BE_STRING),
F1("curl_multi_info_read", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_RESOURCE),
F0("curl_multi_close", MAY_BE_NULL | MAY_BE_FALSE),
F0("curl_multi_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("curl_share_init", MAY_BE_RESOURCE),
- F0("curl_share_close", MAY_BE_NULL),
- F0("curl_share_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("curl_share_init", MAY_BE_RESOURCE),
F1("curl_file_create", MAY_BE_OBJECT),
/* ext/mbstring */
@@ -1094,7 +821,7 @@ static const func_info_t func_infos[] = {
F1("mb_strimwidth", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_convert_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("mb_detect_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- I1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_encoding_aliases", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_convert_kana", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_encode_mimeheader", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
@@ -1123,25 +850,9 @@ static const func_info_t func_infos[] = {
F0("mb_ereg_search_getpos", MAY_BE_LONG),
F0("mb_ereg_search_setpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("mbregex_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("mbereg", MAY_BE_FALSE | MAY_BE_LONG),
- F0("mberegi", MAY_BE_FALSE | MAY_BE_LONG),
- F1("mbereg_replace", MAY_BE_FALSE | MAY_BE_STRING),
- F1("mberegi_replace", MAY_BE_FALSE | MAY_BE_STRING),
- F1("mbsplit", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("mbereg_match", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("mbereg_search", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mbereg_search_pos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("mbereg_search_regs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
- F0("mbereg_search_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mbereg_search_getregs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
- F0("mbereg_search_getpos", MAY_BE_LONG),
- F0("mbereg_search_setpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-
/* ext/iconv */
F1("iconv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_get_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F0("iconv_set_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("iconv_strlen", MAY_BE_FALSE | MAY_BE_LONG),
F1("iconv_substr", MAY_BE_FALSE | MAY_BE_STRING),
F0("iconv_strpos", MAY_BE_FALSE | MAY_BE_LONG),
@@ -1153,47 +864,22 @@ static const func_info_t func_infos[] = {
/* ext/json */
F1("json_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("json_decode", MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- I0("json_last_error", MAY_BE_LONG),
- I1("json_last_error_msg", MAY_BE_STRING),
+ F1("json_last_error_msg", MAY_BE_STRING),
/* ext/xml */
- FN("xml_parser_create", MAY_BE_FALSE | MAY_BE_RESOURCE),
- FN("xml_parser_create_ns", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("xml_set_object", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_element_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_character_data_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_processing_instruction_handler",MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_default_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_unparsed_entity_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_notation_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_external_entity_ref_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_start_namespace_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_end_namespace_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_parse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_parse_into_struct", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_get_error_code", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ FN("xml_parser_create", MAY_BE_FALSE | MAY_BE_OBJECT),
+ FN("xml_parser_create_ns", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("xml_error_string", MAY_BE_NULL | MAY_BE_STRING),
- F0("xml_get_current_line_number", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_get_current_column_number", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_get_current_byte_index", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_parser_free", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_parser_set_option", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("xml_parser_get_option", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
- F1("utf8_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("utf8_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("utf8_encode", MAY_BE_STRING),
+ F1("utf8_decode", MAY_BE_STRING),
/* ext/zlib */
F0("readgzfile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("gzrewind", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("gzclose", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("gzeof", MAY_BE_FALSE | MAY_BE_TRUE),
F1("gzgetc", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzgets", MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzgetss", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzread", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzopen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("gzpassthru", MAY_BE_FALSE | MAY_BE_LONG),
- F0("gzseek", MAY_BE_FALSE | MAY_BE_LONG),
F0("gztell", MAY_BE_FALSE | MAY_BE_LONG),
F0("gzwrite", MAY_BE_FALSE | MAY_BE_LONG),
F0("gzputs", MAY_BE_FALSE | MAY_BE_LONG),
@@ -1206,21 +892,17 @@ static const func_info_t func_infos[] = {
F1("gzdecode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("zlib_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("zlib_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- I1("zlib_get_coding_type", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("zlib_get_coding_type", MAY_BE_FALSE | MAY_BE_STRING),
F1("ob_gzhandler", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/hash */
F1("hash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("hash_equals", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("hash_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("hash_hmac_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hkdf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("hash_update", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("hash_update_stream", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("hash_update_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("hash_final", MAY_BE_NULL | MAY_BE_STRING),
F1("hash_copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F1("hash_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
@@ -1228,7 +910,7 @@ static const func_info_t func_infos[] = {
F1("mhash_keygen_s2k", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F0("mhash_get_block_size", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F1("mhash_get_hash_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- I0("mhash_count", MAY_BE_LONG),
+ F0("mhash_count", MAY_BE_LONG),
F1("mhash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
/* ext/sodium */
@@ -1310,28 +992,17 @@ static const func_info_t func_infos[] = {
F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING),
/* ext/session */
- F0("session_set_cookie_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("session_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("session_module_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_set_save_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("session_save_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
FN("session_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_regenerate_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("session_create_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("session_cache_limiter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F0("session_cache_expire", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- I1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_start", MAY_BE_FALSE | MAY_BE_TRUE),
- I0("session_destroy", MAY_BE_FALSE | MAY_BE_TRUE),
- I0("session_unset", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
F0("session_gc", MAY_BE_FALSE | MAY_BE_LONG),
- F0("session_write_close", MAY_BE_FALSE | MAY_BE_TRUE),
F0("session_abort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_reset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_status", MAY_BE_NULL | MAY_BE_LONG),
- I0("session_register_shutdown", MAY_BE_NULL),
/* ext/pgsql */
F1("pg_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
@@ -1423,16 +1094,14 @@ static const func_info_t func_infos[] = {
F1("pg_select", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
/* ext/bcmath */
- F1("bcadd", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcsub", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcmul", MAY_BE_NULL | MAY_BE_STRING),
+ F1("bcadd", MAY_BE_STRING),
+ F1("bcsub", MAY_BE_STRING),
+ F1("bcmul", MAY_BE_STRING),
F1("bcdiv", MAY_BE_NULL | MAY_BE_STRING),
F1("bcmod", MAY_BE_NULL | MAY_BE_STRING),
F1("bcpowmod", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("bcpow", MAY_BE_NULL | MAY_BE_STRING),
+ F1("bcpow", MAY_BE_STRING),
F1("bcsqrt", MAY_BE_NULL | MAY_BE_STRING),
- F0("bccomp", MAY_BE_NULL | MAY_BE_LONG),
- F0("bcscale", MAY_BE_NULL | MAY_BE_LONG),
/* ext/exif */
F1("exif_tagname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
@@ -1446,7 +1115,7 @@ static const func_info_t func_infos[] = {
FN("filter_var", UNKNOWN_INFO),
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- I1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F0("filter_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
/* ext/gettext */
@@ -1466,23 +1135,8 @@ static const func_info_t func_infos[] = {
F1("bind_textdomain_codeset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
#endif
- /* ext/ctype */
- F0("ctype_alnum", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_alpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_cntrl", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_digit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_lower", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_graph", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_print", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_punct", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_upper", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_xdigit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-
/* ext/fileinfo */
F1("finfo_open", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("finfo_close", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("finfo_set_flags", MAY_BE_FALSE | MAY_BE_TRUE),
F1("finfo_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("finfo_buffer", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mime_content_type", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
@@ -1490,43 +1144,24 @@ static const func_info_t func_infos[] = {
/* ext/gd */
F1("gd_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE),
F0("imageloadfont", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagesetstyle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("imagecreatetruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imageistruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagetruecolortopalette", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagepalettetotruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolormatch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesetthickness", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledellipse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledarc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagealphablending", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesavealpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagelayereffect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("imagecolorallocatealpha", MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorresolvealpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorclosestalpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorexactalpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecopyresampled", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
#ifdef PHP_WIN32
F1("imagegrabwindow", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("imagegrabscreen", MAY_BE_FALSE | MAY_BE_RESOURCE),
#endif
F1("imagerotate", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagesettile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesetbrush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("imagecreate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- I0("imagetypes", MAY_BE_LONG),
F1("imagecreatefromstring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("imagecreatefromgif", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
#ifdef HAVE_GD_JPG
F1("imagecreatefromjpeg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagejpeg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("jpeg2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
#endif
#ifdef HAVE_GD_PNG
F1("imagecreatefrompng", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagepng", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("png2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
#endif
#ifdef HAVE_GD_WEBP
F1("imagecreatefromwebp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
@@ -1542,70 +1177,26 @@ static const func_info_t func_infos[] = {
F1("imagecreatefromgd2part", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
#if defined(HAVE_GD_BMP)
F1("imagecreatefrombmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagebmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
#endif
- F0("imagexbm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagegif", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagewbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagegd", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagegd2", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagedestroy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("imagecolorallocate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagepalettecopy", MAY_BE_NULL | MAY_BE_FALSE),
F0("imagecolorat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorclosest", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorclosesthwb", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolordeallocate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("imagecolorresolve", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorexact", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorset", MAY_BE_NULL | MAY_BE_FALSE),
F1("imagecolorsforindex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
- F0("imagegammacorrect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesetpixel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageline", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagedashedline", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagerectangle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledrectangle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagearc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageellipse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilltoborder", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefill", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolorstotal", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolortransparent", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imageinterlace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagepolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageopenpolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledpolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefontwidth", MAY_BE_NULL | MAY_BE_LONG),
- F0("imagefontheight", MAY_BE_NULL | MAY_BE_LONG),
- F0("imagechar", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecharup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagestring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagestringup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopymerge", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopymergegray", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopyresized", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesx", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagesy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagesetclip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("imagegetclip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imagegetclip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
F1("imageftbbox", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
F1("imagefttext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
F1("imagettfbbox", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
F1("imagettftext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F0("image2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageconvolution", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageflip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageantialias", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("imagecrop", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("imagecropauto", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("imagescale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("imageaffine", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("imageaffinematrixget", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
F1("imageaffinematrixconcat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
- F0("imagesetinterpolation", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("imageresolution", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
/* ext/spl */
@@ -1631,31 +1222,33 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
zval *zv;
- func_info_t *info;
+ zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2));
- zv = zend_hash_find_ex(&func_info, Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2, ssa->rt_constants)), 1);
+ zv = zend_hash_find_ex(&func_info, lcname, 1);
if (zv) {
- info = Z_PTR_P(zv);
+ func_info_t *info = Z_PTR_P(zv);
if (UNEXPECTED(zend_optimizer_is_disabled_func(info->name, info->name_len))) {
ret = MAY_BE_NULL;
} else if (info->info_func) {
ret = info->info_func(call_info, ssa);
- } else if (/*callee_func->common.arg_info && */
- callee_func->common.num_args == 0 &&
- callee_func->common.required_num_args == 0 &&
- !(callee_func->common.fn_flags & ZEND_ACC_VARIADIC)) {
- if (call_info->num_args == 0) {
- ret = info->info;
- } else {
- ret = FUNC_MAY_WARN | MAY_BE_NULL;
- }
} else {
ret = info->info;
}
-#if 0
+ return ret;
+ }
+
+ if (callee_func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ zend_class_entry *ce; // TODO: Use the CE.
+ ret = zend_fetch_arg_info_type(NULL, callee_func->common.arg_info - 1, &ce);
} else {
+#if 0
fprintf(stderr, "Unknown internal function '%s'\n", func->common.function_name);
#endif
+ ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF
+ | MAY_BE_RC1 | MAY_BE_RCN;
+ }
+ if (callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ ret |= MAY_BE_REF;
}
} else {
// FIXME: the order of functions matters!!!
@@ -1663,18 +1256,14 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
if (info) {
ret = info->return_info.type;
}
- }
- if (!ret) {
- ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
- if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
- ret |= FUNC_MAY_WARN;
- }
- if (callee_func->common.fn_flags & ZEND_ACC_GENERATOR) {
- ret = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_OBJECT;
- } else if (callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
- ret |= MAY_BE_REF;
- } else {
- ret |= MAY_BE_RC1 | MAY_BE_RCN;
+ if (!ret) {
+ ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF
+ | MAY_BE_RC1 | MAY_BE_RCN;
+ /* For generators RETURN_REFERENCE refers to the yielded values. */
+ if ((callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
+ && !(callee_func->common.fn_flags & ZEND_ACC_GENERATOR)) {
+ ret |= MAY_BE_REF;
+ }
}
}
return ret;
diff --git a/ext/opcache/Optimizer/zend_func_info.h b/ext/opcache/Optimizer/zend_func_info.h
index 7eeb363da5..0f4fcea092 100644
--- a/ext/opcache/Optimizer/zend_func_info.h
+++ b/ext/opcache/Optimizer/zend_func_info.h
@@ -34,11 +34,6 @@
#define ZEND_FUNC_HAS_EXTENDED_FCALL (1<<10)
#define ZEND_FUNC_HAS_EXTENDED_STMT (1<<11)
-/* The following flags are valid only for return values of internal functions
- * returned by zend_get_func_info()
- */
-#define FUNC_MAY_WARN (1<<30)
-
typedef struct _zend_func_info zend_func_info;
typedef struct _zend_call_info zend_call_info;
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index f89b133b92..51872dcc61 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -1419,18 +1419,22 @@ int zend_inference_calc_range(const zend_op_array *op_array, zend_ssa *ssa, int
return 1;
} else if (op_array->arg_info &&
opline->op1.num <= op_array->num_args) {
- if (ZEND_TYPE_CODE(op_array->arg_info[opline->op1.num-1].type) == IS_LONG) {
- tmp->underflow = 0;
- tmp->min = ZEND_LONG_MIN;
- tmp->max = ZEND_LONG_MAX;
- tmp->overflow = 0;
- return 1;
- } else if (ZEND_TYPE_CODE(op_array->arg_info[opline->op1.num-1].type) == _IS_BOOL) {
- tmp->underflow = 0;
- tmp->min = 0;
- tmp->max = 1;
- tmp->overflow = 0;
- return 1;
+ zend_type type = op_array->arg_info[opline->op1.num-1].type;
+ if (ZEND_TYPE_IS_MASK(type)) {
+ uint32_t mask = ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(type));
+ if (mask == MAY_BE_LONG) {
+ tmp->underflow = 0;
+ tmp->min = ZEND_LONG_MIN;
+ tmp->max = ZEND_LONG_MAX;
+ tmp->overflow = 0;
+ return 1;
+ } else if (mask == (MAY_BE_FALSE|MAY_BE_TRUE)) {
+ tmp->underflow = 0;
+ tmp->min = 0;
+ tmp->max = 1;
+ tmp->overflow = 0;
+ return 1;
+ }
}
}
}
@@ -1833,9 +1837,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
/* }}} */
static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
- if (alias == PHP_ERRORMSG_ALIAS) {
- return MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
- } else if (alias == HTTP_RESPONSE_HEADER_ALIAS) {
+ if (alias == HTTP_RESPONSE_HEADER_ALIAS) {
return MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN;
} else {
return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
@@ -2063,16 +2065,10 @@ uint32_t zend_array_element_type(uint32_t t1, int write, int insert)
}
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
tmp |= MAY_BE_NULL;
- if (t1 & MAY_BE_ERROR) {
- if (write) {
- tmp |= MAY_BE_ERROR;
- }
- }
}
if (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_NULL;
- if (write) {
- tmp |= MAY_BE_ERROR;
+ if (!write) {
+ tmp |= MAY_BE_NULL;
}
}
return tmp;
@@ -2234,25 +2230,26 @@ static inline zend_class_entry *get_class_entry(const zend_script *script, zend_
return NULL;
}
-static uint32_t zend_convert_type_code_to_may_be(zend_uchar type_code) {
- switch (type_code) {
- case IS_VOID:
- return MAY_BE_NULL;
- case IS_CALLABLE:
- return MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
- case IS_ITERABLE:
- return MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
- case IS_ARRAY:
- return MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
- case _IS_BOOL:
- return MAY_BE_TRUE|MAY_BE_FALSE;
- default:
- ZEND_ASSERT(type_code < IS_REFERENCE);
- return 1 << type_code;
+static uint32_t zend_convert_type_declaration_mask(uint32_t type_mask) {
+ if (type_mask & MAY_BE_VOID) {
+ type_mask &= ~MAY_BE_VOID;
+ type_mask |= MAY_BE_NULL;
+ }
+ if (type_mask & MAY_BE_CALLABLE) {
+ type_mask &= ~MAY_BE_CALLABLE;
+ type_mask |= MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
+ }
+ if (type_mask & MAY_BE_ITERABLE) {
+ type_mask &= ~MAY_BE_ITERABLE;
+ type_mask |= MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
+ }
+ if (type_mask & MAY_BE_ARRAY) {
+ type_mask |= MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
}
+ return type_mask;
}
-static uint32_t zend_fetch_arg_info(const zend_script *script, zend_arg_info *arg_info, zend_class_entry **pce)
+uint32_t zend_fetch_arg_info_type(const zend_script *script, zend_arg_info *arg_info, zend_class_entry **pce)
{
uint32_t tmp = 0;
@@ -2263,14 +2260,17 @@ static uint32_t zend_fetch_arg_info(const zend_script *script, zend_arg_info *ar
tmp |= MAY_BE_OBJECT;
*pce = get_class_entry(script, lcname);
zend_string_release_ex(lcname, 0);
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- tmp |= zend_convert_type_code_to_may_be(ZEND_TYPE_CODE(arg_info->type));
+ } else if (ZEND_TYPE_IS_MASK(arg_info->type)) {
+ tmp |= zend_convert_type_declaration_mask(ZEND_TYPE_MASK(arg_info->type));
} else {
tmp |= MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
}
if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
tmp |= MAY_BE_NULL;
}
+ if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ tmp |= MAY_BE_RC1 | MAY_BE_RCN;
+ }
return tmp;
}
@@ -2314,7 +2314,7 @@ static zend_property_info *zend_fetch_prop_info(const zend_op_array *op_array, z
}
if (ce) {
prop_info = lookup_prop_info(ce,
- Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)),
+ Z_STR_P(CRT_CONSTANT(opline->op2)),
op_array->scope);
if (prop_info && (prop_info->flags & ZEND_ACC_STATIC)) {
prop_info = NULL;
@@ -2345,12 +2345,12 @@ static zend_property_info *zend_fetch_static_prop_info(const zend_script *script
break;
}
} else if (opline->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op2);
ce = get_class_entry(script, Z_STR_P(zv + 1));
}
if (ce) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op1);
prop_info = lookup_prop_info(ce, Z_STR_P(zv), op_array->scope);
if (prop_info && !(prop_info->flags & ZEND_ACC_STATIC)) {
prop_info = NULL;
@@ -2365,7 +2365,7 @@ static uint32_t zend_fetch_prop_type(const zend_script *script, zend_property_in
if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
uint32_t type = ZEND_TYPE_IS_CLASS(prop_info->type)
? MAY_BE_OBJECT
- : zend_convert_type_code_to_may_be(ZEND_TYPE_CODE(prop_info->type));
+ : zend_convert_type_declaration_mask(ZEND_TYPE_MASK(prop_info->type));
if (ZEND_TYPE_ALLOW_NULL(prop_info->type)) {
type |= MAY_BE_NULL;
@@ -2419,8 +2419,8 @@ static int zend_update_type_info(const zend_op_array *op_array,
/* If one of the operands cannot have any type, this means the operand derives from
* unreachable code. Propagate the empty result early, so that that the following
* code may assume that operands have at least one type. */
- if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS|MAY_BE_ERROR))
- || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS|MAY_BE_ERROR))) {
+ if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))
+ || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))) {
tmp = 0;
if (ssa_ops[i].result_def >= 0) {
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
@@ -2711,9 +2711,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_LONG;
}
} else {
- if (t1 & MAY_BE_ERROR) {
- tmp |= MAY_BE_NULL;
- }
if (t1 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
if (opline->opcode == ZEND_PRE_INC) {
tmp |= MAY_BE_LONG;
@@ -2746,7 +2743,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) {
tmp |= MAY_BE_RC1|MAY_BE_RCN;
}
- tmp |= t1 & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_REF|MAY_BE_RCN);
+ tmp |= t1 & ~(MAY_BE_UNDEF|MAY_BE_REF|MAY_BE_RCN);
if (t1 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
}
@@ -2773,9 +2770,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_LONG;
}
} else {
- if (t1 & MAY_BE_ERROR) {
- tmp |= MAY_BE_NULL;
- }
if (t1 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
if (opline->opcode == ZEND_POST_INC) {
tmp |= MAY_BE_LONG;
@@ -2953,7 +2947,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (opline->op2_type == IS_VAR && opline->extended_value == ZEND_RETURNS_FUNCTION) {
tmp = (MAY_BE_REF | MAY_BE_RCN | MAY_BE_RC1 | t2) & ~MAY_BE_UNDEF;
} else {
- tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_RC1|MAY_BE_RCN);
+ tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_RC1|MAY_BE_RCN);
}
if (t2 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
@@ -2981,7 +2975,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION)) {
tmp = (MAY_BE_REF | MAY_BE_RCN | MAY_BE_RC1 | t2) & ~MAY_BE_UNDEF;
} else {
- tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_RC1|MAY_BE_RCN);
+ tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_RC1|MAY_BE_RCN);
}
if (t2 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
@@ -3102,16 +3096,9 @@ static int zend_update_type_info(const zend_op_array *op_array,
ce = NULL;
if (arg_info) {
- tmp = zend_fetch_arg_info(script, arg_info, &ce);
- if (opline->opcode == ZEND_RECV_INIT &&
- Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)) == IS_CONSTANT_AST) {
- /* The constant may resolve to NULL */
- tmp |= MAY_BE_NULL;
- }
+ tmp = zend_fetch_arg_info_type(script, arg_info, &ce);
if (arg_info->pass_by_reference) {
tmp |= MAY_BE_REF;
- } else if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_RC1|MAY_BE_RCN;
}
} else {
tmp = MAY_BE_REF|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
@@ -3149,7 +3136,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
}
case ZEND_DECLARE_ANON_CLASS:
UPDATE_SSA_TYPE(MAY_BE_CLASS, ssa_ops[i].result_def);
- if (script && (ce = zend_hash_find_ptr(&script->class_table, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)))) != NULL) {
+ if (script && (ce = zend_hash_find_ptr(&script->class_table, Z_STR_P(CRT_CONSTANT(opline->op1)))) != NULL) {
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
}
break;
@@ -3177,7 +3164,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
break;
}
} else if (opline->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op2);
if (Z_TYPE_P(zv) == IS_STRING) {
ce = get_class_entry(script, Z_STR_P(zv+1));
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
@@ -3191,7 +3178,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_NEW:
tmp = MAY_BE_RC1|MAY_BE_RCN|MAY_BE_OBJECT;
if (opline->op1_type == IS_CONST &&
- (ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)+1))) != NULL) {
+ (ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1))) != NULL) {
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
} else if ((t1 & MAY_BE_CLASS) && ssa_ops[i].op1_use >= 0 && ssa_var_info[ssa_ops[i].op1_use].ce) {
UPDATE_SSA_OBJ_TYPE(ssa_var_info[ssa_ops[i].op1_use].ce, ssa_var_info[ssa_ops[i].op1_use].is_instanceof, ssa_ops[i].result_def);
@@ -3362,6 +3349,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_LIST_R:
case ZEND_FETCH_LIST_W:
if (ssa_ops[i].op1_def >= 0) {
+ uint32_t key_type = 0;
tmp = t1 & ~(MAY_BE_RC1|MAY_BE_RCN);
if (opline->opcode == ZEND_FETCH_DIM_W ||
opline->opcode == ZEND_FETCH_DIM_RW ||
@@ -3383,20 +3371,20 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
}
if (opline->op2_type == IS_UNUSED) {
- tmp |= MAY_BE_ARRAY_KEY_LONG;
+ key_type |= MAY_BE_ARRAY_KEY_LONG;
} else {
if (t2 & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
- tmp |= MAY_BE_ARRAY_KEY_LONG;
+ key_type |= MAY_BE_ARRAY_KEY_LONG;
}
if (t2 & MAY_BE_STRING) {
- tmp |= MAY_BE_ARRAY_KEY_STRING;
+ key_type |= MAY_BE_ARRAY_KEY_STRING;
if (opline->op2_type != IS_CONST) {
// FIXME: numeric string
- tmp |= MAY_BE_ARRAY_KEY_LONG;
+ key_type |= MAY_BE_ARRAY_KEY_LONG;
}
}
if (t2 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
- tmp |= MAY_BE_ARRAY_KEY_STRING;
+ key_type |= MAY_BE_ARRAY_KEY_STRING;
}
}
} else if (opline->opcode == ZEND_FETCH_DIM_UNSET) {
@@ -3420,19 +3408,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_LIST_W:
case ZEND_ASSIGN_DIM:
case ZEND_ASSIGN_DIM_OP:
- tmp |= MAY_BE_ARRAY | MAY_BE_ARRAY_OF_ARRAY;
- break;
- case ZEND_FETCH_OBJ_W:
- case ZEND_FETCH_OBJ_RW:
- case ZEND_FETCH_OBJ_FUNC_ARG:
- case ZEND_ASSIGN_OBJ:
- case ZEND_ASSIGN_OBJ_OP:
- case ZEND_ASSIGN_OBJ_REF:
- case ZEND_PRE_INC_OBJ:
- case ZEND_PRE_DEC_OBJ:
- case ZEND_POST_INC_OBJ:
- case ZEND_POST_DEC_OBJ:
- tmp |= MAY_BE_ARRAY_OF_OBJECT;
+ tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_ARRAY;
break;
case ZEND_SEND_VAR_EX:
case ZEND_SEND_FUNC_ARG:
@@ -3447,7 +3423,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_VERIFY_RETURN_TYPE:
case ZEND_MAKE_REF:
case ZEND_FE_RESET_RW:
- tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
break;
case ZEND_PRE_INC:
case ZEND_PRE_DEC:
@@ -3455,11 +3431,24 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_POST_DEC:
if (tmp & MAY_BE_ARRAY_OF_LONG) {
/* may overflow */
- tmp |= MAY_BE_ARRAY_OF_DOUBLE;
+ tmp |= key_type | MAY_BE_ARRAY_OF_DOUBLE;
} else if (!(tmp & (MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_DOUBLE))) {
- tmp |= MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE;
+ tmp |= key_type | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE;
}
break;
+ case ZEND_FETCH_OBJ_W:
+ case ZEND_FETCH_OBJ_RW:
+ case ZEND_FETCH_OBJ_FUNC_ARG:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_OBJ_REF:
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ /* These will result in an error exception, unless the element
+ * is already an object. */
+ break;
case ZEND_SEND_VAR:
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
* behind, because it can't be converted to DIM_FETCH_R. */
@@ -3483,18 +3472,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
opline->opcode != ZEND_FETCH_LIST_R ? t1 : ((t1 & ~MAY_BE_STRING) | MAY_BE_NULL),
opline->result_type == IS_VAR,
opline->op2_type == IS_UNUSED);
- if (opline->opcode == ZEND_FETCH_DIM_W ||
- opline->opcode == ZEND_FETCH_DIM_RW ||
- opline->opcode == ZEND_FETCH_DIM_FUNC_ARG ||
- opline->opcode == ZEND_FETCH_LIST_W) {
- if (t1 & (MAY_BE_ERROR|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_ERROR;
- } else if (opline->op2_type == IS_UNUSED) {
- tmp |= MAY_BE_ERROR;
- } else if (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_ERROR;
- }
- } else if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
+ if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
tmp |= MAY_BE_NULL;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
@@ -3509,26 +3487,11 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_OBJ_FUNC_ARG:
- if (ssa_ops[i].op1_def >= 0) {
- tmp = t1;
- if (opline->opcode == ZEND_FETCH_OBJ_W ||
- opline->opcode == ZEND_FETCH_OBJ_RW ||
- opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG) {
- if (opline->opcode != ZEND_FETCH_DIM_FUNC_ARG) {
- if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
- tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
- tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
- }
- }
- }
- UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
- COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
- }
if (ssa_ops[i].result_def >= 0) {
tmp = zend_fetch_prop_type(script,
zend_fetch_prop_info(op_array, ssa, opline, i), &ce);
if (opline->result_type != IS_TMP_VAR) {
- tmp |= MAY_BE_REF | MAY_BE_ERROR;
+ tmp |= MAY_BE_REF;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
@@ -3545,7 +3508,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp = zend_fetch_prop_type(script,
zend_fetch_static_prop_info(script, op_array, ssa, opline), &ce);
if (opline->result_type != IS_TMP_VAR) {
- tmp |= MAY_BE_REF | MAY_BE_ERROR;
+ tmp |= MAY_BE_REF;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
@@ -3567,7 +3530,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (!call_info) {
goto unknown_opcode;
}
- tmp = zend_get_func_info(call_info, ssa) & ~FUNC_MAY_WARN;
+ tmp = zend_get_func_info(call_info, ssa);
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (call_info->callee_func->type == ZEND_USER_FUNCTION) {
func_info = ZEND_FUNC_INFO(&call_info->callee_func->op_array);
@@ -3615,11 +3578,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
ce = NULL;
} else {
zend_arg_info *ret_info = op_array->arg_info - 1;
-
- tmp = zend_fetch_arg_info(script, ret_info, &ce);
- if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_RC1 | MAY_BE_RCN;
- }
+ tmp = zend_fetch_arg_info_type(script, ret_info, &ce);
}
if (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV)) {
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
@@ -3886,7 +3845,7 @@ static zend_bool can_convert_to_double(
ZVAL_COPY_VALUE(&orig_op1, value);
ZVAL_DOUBLE(&dval_op1, (double) Z_LVAL_P(value));
} else if (opline->op1_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_DOUBLE) {
ZVAL_COPY_VALUE(&orig_op1, zv);
ZVAL_COPY_VALUE(&dval_op1, zv);
@@ -3899,7 +3858,7 @@ static zend_bool can_convert_to_double(
ZVAL_COPY_VALUE(&orig_op2, value);
ZVAL_DOUBLE(&dval_op2, (double) Z_LVAL_P(value));
} else if (opline->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op2);
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_DOUBLE) {
ZVAL_COPY_VALUE(&orig_op2, zv);
ZVAL_COPY_VALUE(&dval_op2, zv);
@@ -3987,7 +3946,7 @@ static int zend_type_narrowing(const zend_op_array *op_array, const zend_script
* doubles instead, in the hope that we'll narrow long|double to double. */
if (opline->opcode == ZEND_ASSIGN && opline->result_type == IS_UNUSED &&
opline->op1_type == IS_CV && opline->op2_type == IS_CONST) {
- zval *value = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *value = CRT_CONSTANT(opline->op2);
zend_bitset_clear(visited, bitset_len);
if (can_convert_to_double(op_array, ssa, v, value, visited)) {
@@ -4046,11 +4005,9 @@ void zend_init_func_return_info(const zend_op_array *op_array,
zend_arg_info *ret_info = op_array->arg_info - 1;
zend_ssa_range tmp_range = {0, 0, 0, 0};
- ret->type = zend_fetch_arg_info(script, ret_info, &ret->ce);
+ ret->type = zend_fetch_arg_info_type(script, ret_info, &ret->ce);
if (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
ret->type |= MAY_BE_REF;
- } else if (ret->type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- ret->type |= MAY_BE_RC1|MAY_BE_RCN;
}
ret->is_instanceof = (ret->ce) ? 1 : 0;
ret->range = tmp_range;
@@ -4141,7 +4098,7 @@ void zend_func_return_info(const zend_op_array *op_array,
}
if (opline->op1_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op1, info->ssa.rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(zv) == IS_NULL) {
if (tmp_has_range < 0) {
@@ -4363,7 +4320,7 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array)
free_alloca(worklist, use_heap);
}
-int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa)
+int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
{
uint32_t t1 = OP1_INFO();
uint32_t t2 = OP2_INFO();
@@ -4620,7 +4577,7 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
if (opline->op2_type == IS_CONST) {
prop_info = zend_hash_find_ptr(&ce->properties_info,
- Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)));
+ Z_STR_P(CRT_CONSTANT(opline->op2)));
if (prop_info && !(prop_info->flags & ZEND_ACC_PUBLIC)) {
return 1;
}
@@ -4650,7 +4607,7 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
case ZEND_COUNT:
return (t1 & MAY_BE_ANY) != MAY_BE_ARRAY;
case ZEND_RECV_INIT:
- if (Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)) == IS_CONSTANT_AST) {
+ if (Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_CONSTANT_AST) {
return 1;
}
if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
diff --git a/ext/opcache/Optimizer/zend_inference.h b/ext/opcache/Optimizer/zend_inference.h
index ec98fcbef9..f01f6cc786 100644
--- a/ext/opcache/Optimizer/zend_inference.h
+++ b/ext/opcache/Optimizer/zend_inference.h
@@ -26,11 +26,11 @@
/* Bitmask for type inference (zend_ssa_var_info.type) */
#include "zend_type_info.h"
-#define MAY_BE_IN_REG (1<<25) /* value allocated in CPU register */
+#define MAY_BE_IN_REG (1<<29) /* value allocated in CPU register */
//TODO: remome MAY_BE_RC1, MAY_BE_RCN???
-#define MAY_BE_RC1 (1<<27) /* may be non-reference with refcount == 1 */
-#define MAY_BE_RCN (1<<28) /* may be non-reference with refcount > 1 */
+#define MAY_BE_RC1 (1<<30) /* may be non-reference with refcount == 1 */
+#define MAY_BE_RCN (1u<<31) /* may be non-reference with refcount > 1 */
#define MAY_HAVE_DTOR \
(MAY_BE_OBJECT|MAY_BE_RESOURCE \
@@ -40,7 +40,7 @@
static zend_always_inline zend_bool _ssa_##opN##_has_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
return (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_TRUE || Z_TYPE_P(zv) == IS_FALSE || Z_TYPE_P(zv) == IS_NULL); \
} else { \
return (opline->opN##_type != IS_UNUSED && \
@@ -56,7 +56,7 @@
static zend_always_inline zend_long _ssa_##opN##_min_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return Z_LVAL_P(zv); \
} else if (Z_TYPE_P(zv) == IS_TRUE) { \
@@ -80,7 +80,7 @@
static zend_always_inline zend_long _ssa_##opN##_max_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return Z_LVAL_P(zv); \
} else if (Z_TYPE_P(zv) == IS_TRUE) { \
@@ -104,7 +104,7 @@
static zend_always_inline char _ssa_##opN##_range_underflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_TRUE || Z_TYPE_P(zv) == IS_FALSE || Z_TYPE_P(zv) == IS_NULL) { \
return 0; \
} \
@@ -122,7 +122,7 @@
static zend_always_inline char _ssa_##opN##_range_overflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_TRUE || Z_TYPE_P(zv) == IS_FALSE || Z_TYPE_P(zv) == IS_NULL) { \
return 0; \
} \
@@ -199,7 +199,7 @@ static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa
if (ssa->var_info && ssa_var_num >= 0) {
return ssa->var_info[ssa_var_num].type;
} else {
- return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ERROR;
+ return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
}
}
@@ -207,7 +207,7 @@ static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa
static zend_always_inline uint32_t _ssa_##opN##_info(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- return _const_op_type(CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants)); \
+ return _const_op_type(CRT_CONSTANT(opline->opN)); \
} else { \
return get_ssa_var_info(ssa, ssa->ops ? ssa->ops[opline - op_array->opcodes].opN##_use : -1); \
} \
@@ -263,6 +263,8 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array);
int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script, zend_ssa *ssa, zend_bitset worklist, zend_long optimization_level);
+uint32_t zend_fetch_arg_info_type(
+ const zend_script *script, zend_arg_info *arg_info, zend_class_entry **pce);
void zend_init_func_return_info(const zend_op_array *op_array,
const zend_script *script,
zend_ssa_var_info *ret);
@@ -272,7 +274,7 @@ void zend_func_return_info(const zend_op_array *op_array,
int widening,
zend_ssa_var_info *ret);
-int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa);
+int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
END_EXTERN_C()
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index a922d0f597..aa638032ca 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -32,10 +32,6 @@
#include "zend_inference.h"
#include "zend_dump.h"
-#ifndef HAVE_DFA_PASS
-# define HAVE_DFA_PASS 1
-#endif
-
static void zend_optimizer_zval_dtor_wrapper(zval *zvalue)
{
zval_ptr_dtor_nogc(zvalue);
@@ -657,8 +653,8 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
case ZEND_VERIFY_RETURN_TYPE: {
zend_arg_info *ret_info = op_array->arg_info - 1;
if (ZEND_TYPE_IS_CLASS(ret_info->type)
- || ZEND_TYPE_CODE(ret_info->type) == IS_CALLABLE
- || !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(val))
+ || (ZEND_TYPE_IS_MASK(ret_info->type)
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(val)))
|| (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
return 0;
}
@@ -777,9 +773,9 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_
}
static zend_class_entry *get_class_entry_from_op1(
- zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool rt_constants) {
+ zend_script *script, zend_op_array *op_array, zend_op *opline) {
if (opline->op1_type == IS_CONST) {
- zval *op1 = CRT_CONSTANT_EX(op_array, opline, opline->op1, rt_constants);
+ zval *op1 = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(op1) == IS_STRING) {
zend_string *class_name = Z_STR_P(op1 + 1);
zend_class_entry *ce;
@@ -804,13 +800,12 @@ static zend_class_entry *get_class_entry_from_op1(
}
zend_function *zend_optimizer_get_called_func(
- zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool rt_constants)
+ zend_script *script, zend_op_array *op_array, zend_op *opline)
{
-#define GET_OP(op) CRT_CONSTANT_EX(op_array, opline, opline->op, rt_constants)
switch (opline->opcode) {
case ZEND_INIT_FCALL:
{
- zend_string *function_name = Z_STR_P(GET_OP(op2));
+ zend_string *function_name = Z_STR_P(CRT_CONSTANT(opline->op2));
zend_function *func;
if (script && (func = zend_hash_find_ptr(&script->function_table, function_name)) != NULL) {
return func;
@@ -827,8 +822,8 @@ zend_function *zend_optimizer_get_called_func(
}
case ZEND_INIT_FCALL_BY_NAME:
case ZEND_INIT_NS_FCALL_BY_NAME:
- if (opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING) {
- zval *function_name = GET_OP(op2) + 1;
+ if (opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING) {
+ zval *function_name = CRT_CONSTANT(opline->op2) + 1;
zend_function *func;
if (script && (func = zend_hash_find_ptr(&script->function_table, Z_STR_P(function_name)))) {
return func;
@@ -844,11 +839,11 @@ zend_function *zend_optimizer_get_called_func(
}
break;
case ZEND_INIT_STATIC_METHOD_CALL:
- if (opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING) {
+ if (opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING) {
zend_class_entry *ce = get_class_entry_from_op1(
- script, op_array, opline, rt_constants);
+ script, op_array, opline);
if (ce) {
- zend_string *func_name = Z_STR_P(GET_OP(op2) + 1);
+ zend_string *func_name = Z_STR_P(CRT_CONSTANT(opline->op2) + 1);
zend_function *fbc = zend_hash_find_ptr(&ce->function_table, func_name);
if (fbc) {
zend_bool is_public = (fbc->common.fn_flags & ZEND_ACC_PUBLIC) != 0;
@@ -862,9 +857,9 @@ zend_function *zend_optimizer_get_called_func(
break;
case ZEND_INIT_METHOD_CALL:
if (opline->op1_type == IS_UNUSED
- && opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING
+ && opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING
&& op_array->scope && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)) {
- zend_string *method_name = Z_STR_P(GET_OP(op2) + 1);
+ zend_string *method_name = Z_STR_P(CRT_CONSTANT(opline->op2) + 1);
zend_function *fbc = zend_hash_find_ptr(
&op_array->scope->function_table, method_name);
if (fbc) {
@@ -881,7 +876,7 @@ zend_function *zend_optimizer_get_called_func(
case ZEND_NEW:
{
zend_class_entry *ce = get_class_entry_from_op1(
- script, op_array, opline, rt_constants);
+ script, op_array, opline);
if (ce && ce->type == ZEND_USER_CLASS) {
return ce->constructor;
}
@@ -889,7 +884,6 @@ zend_function *zend_optimizer_get_called_func(
}
}
return NULL;
-#undef GET_OP
}
uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args) {
@@ -897,14 +891,8 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args)
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "compact")) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
- } else if (zend_string_equals_literal(name, "parse_str") && num_args <= 1) {
- return ZEND_FUNC_INDIRECT_VAR_ACCESS;
- } else if (zend_string_equals_literal(name, "mb_parse_str") && num_args <= 1) {
- return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "get_defined_vars")) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
- } else if (zend_string_equals_literal(name, "assert")) {
- return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "func_num_args")) {
return ZEND_FUNC_VARARG;
} else if (zend_string_equals_literal(name, "func_get_arg")) {
@@ -940,12 +928,13 @@ static void zend_optimize(zend_op_array *op_array,
zend_dump_op_array(op_array, ZEND_DUMP_LIVE_RANGES, "before optimizer", NULL);
}
- /* pass 1
- * - substitute persistent constants (true, false, null, etc)
- * - perform compile-time evaluation of constant binary and unary operations
- * - optimize series of ADD_STRING and/or ADD_CHAR
- * - convert CAST(IS_BOOL,x) into BOOL(x)
- * - pre-evaluate constant function calls
+ /* pass 1 (Simple local optimizations)
+ * - persistent constant substitution (true, false, null, etc)
+ * - constant casting (ADD expects numbers, CONCAT strings, etc)
+ * - constant expression evaluation
+ * - optimize constant conditional JMPs
+ * - pre-evaluate constant function calls
+ * - eliminate FETCH $GLOBALS followed by FETCH_DIM/UNSET_DIM/ISSET_ISEMPTY_DIM
*/
if (ZEND_OPTIMIZER_PASS_1 & ctx->optimization_level) {
zend_optimizer_pass1(op_array, ctx);
@@ -954,21 +943,8 @@ static void zend_optimize(zend_op_array *op_array,
}
}
- /* pass 2:
- * - convert non-numeric constants to numeric constants in numeric operators
- * - optimize constant conditional JMPs
- */
- if (ZEND_OPTIMIZER_PASS_2 & ctx->optimization_level) {
- zend_optimizer_pass2(op_array);
- if (ctx->debug_level & ZEND_DUMP_AFTER_PASS_2) {
- zend_dump_op_array(op_array, 0, "after pass 2", NULL);
- }
- }
-
- /* pass 3:
- * - optimize $i = $i+expr to $i+=expr
+ /* pass 3: (Jump optimization)
* - optimize series of JMPs
- * - change $i++ to ++$i where possible
*/
if (ZEND_OPTIMIZER_PASS_3 & ctx->optimization_level) {
zend_optimizer_pass3(op_array, ctx);
@@ -997,7 +973,6 @@ static void zend_optimize(zend_op_array *op_array,
}
}
-#if HAVE_DFA_PASS
/* pass 6:
* - DFA optimization
*/
@@ -1008,7 +983,6 @@ static void zend_optimize(zend_op_array *op_array,
zend_dump_op_array(op_array, 0, "after pass 6", NULL);
}
}
-#endif
/* pass 9:
* - Optimize temp variables usage
@@ -1064,6 +1038,8 @@ static void zend_revert_pass_two(zend_op_array *op_array)
{
zend_op *opline, *end;
+ ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) != 0);
+
opline = op_array->opcodes;
end = opline + op_array->last;
while (opline < end) {
@@ -1073,6 +1049,8 @@ static void zend_revert_pass_two(zend_op_array *op_array)
if (opline->op2_type == IS_CONST) {
ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op2);
}
+ /* reset smart branch flags IS_SMART_BRANCH_JMP[N]Z */
+ opline->result_type &= (IS_TMP_VAR|IS_VAR|IS_CV|IS_CONST);
opline++;
}
#if !ZEND_USE_ABS_CONST_ADDR
@@ -1082,6 +1060,8 @@ static void zend_revert_pass_two(zend_op_array *op_array)
op_array->literals = literals;
}
#endif
+
+ op_array->fn_flags &= ~ZEND_ACC_DONE_PASS_TWO;
}
static void zend_redo_pass_two(zend_op_array *op_array)
@@ -1091,6 +1071,8 @@ static void zend_redo_pass_two(zend_op_array *op_array)
zend_op *old_opcodes = op_array->opcodes;
#endif
+ ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) == 0);
+
#if !ZEND_USE_ABS_CONST_ADDR
if (op_array->last_literal) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes,
@@ -1117,48 +1099,79 @@ static void zend_redo_pass_two(zend_op_array *op_array)
if (opline->op2_type == IS_CONST) {
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2);
}
+ /* fix jumps to point to new array */
+ switch (opline->opcode) {
#if ZEND_USE_ABS_JMP_ADDR && !ZEND_USE_ABS_CONST_ADDR
- if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
- /* fix jumps to point to new array */
- switch (opline->opcode) {
- case ZEND_JMP:
- case ZEND_FAST_CALL:
- opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
- break;
- case ZEND_JMPZNZ:
- /* relative extended_value don't have to be changed */
- /* break omitted intentionally */
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMP_SET:
- case ZEND_COALESCE:
- case ZEND_FE_RESET_R:
- case ZEND_FE_RESET_RW:
- case ZEND_ASSERT_CHECK:
+ case ZEND_JMP:
+ case ZEND_FAST_CALL:
+ opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
+ break;
+ case ZEND_JMPZNZ:
+ /* relative extended_value don't have to be changed */
+ /* break omitted intentionally */
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_ASSERT_CHECK:
+ opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ break;
+ case ZEND_CATCH:
+ if (!(opline->extended_value & ZEND_LAST_CATCH)) {
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
- break;
- case ZEND_CATCH:
- if (!(opline->extended_value & ZEND_LAST_CATCH)) {
- opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ }
+ break;
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ /* relative extended_value don't have to be changed */
+ break;
+#endif
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_CASE:
+ case ZEND_ISSET_ISEMPTY_CV:
+ case ZEND_ISSET_ISEMPTY_VAR:
+ case ZEND_ISSET_ISEMPTY_DIM_OBJ:
+ case ZEND_ISSET_ISEMPTY_PROP_OBJ:
+ case ZEND_ISSET_ISEMPTY_STATIC_PROP:
+ case ZEND_INSTANCEOF:
+ case ZEND_TYPE_CHECK:
+ case ZEND_DEFINED:
+ case ZEND_IN_ARRAY:
+ case ZEND_ARRAY_KEY_EXISTS:
+ if (opline->result_type & IS_TMP_VAR) {
+ /* reinitialize result_type of smart branch instructions */
+ if (opline + 1 < end) {
+ if ((opline+1)->opcode == ZEND_JMPZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPZ | IS_TMP_VAR;
+ } else if ((opline+1)->opcode == ZEND_JMPNZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPNZ | IS_TMP_VAR;
+ }
}
- break;
- case ZEND_FE_FETCH_R:
- case ZEND_FE_FETCH_RW:
- case ZEND_SWITCH_LONG:
- case ZEND_SWITCH_STRING:
- /* relative extended_value don't have to be changed */
- break;
- }
+ }
+ break;
}
-#endif
ZEND_VM_SET_OPCODE_HANDLER(opline);
opline++;
}
+
+ op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
}
-#if HAVE_DFA_PASS
static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
{
zend_op *opline, *end;
@@ -1166,6 +1179,8 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
zend_op *old_opcodes = op_array->opcodes;
#endif
+ ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) == 0);
+
#if !ZEND_USE_ABS_CONST_ADDR
if (op_array->last_literal) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes,
@@ -1203,47 +1218,78 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2);
}
- zend_vm_set_opcode_handler_ex(opline, op1_info, op2_info, res_info);
+ /* fix jumps to point to new array */
+ switch (opline->opcode) {
#if ZEND_USE_ABS_JMP_ADDR && !ZEND_USE_ABS_CONST_ADDR
- if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
- /* fix jumps to point to new array */
- switch (opline->opcode) {
- case ZEND_JMP:
- case ZEND_FAST_CALL:
- opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
- break;
- case ZEND_JMPZNZ:
- /* relative extended_value don't have to be changed */
- /* break omitted intentionally */
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMP_SET:
- case ZEND_COALESCE:
- case ZEND_FE_RESET_R:
- case ZEND_FE_RESET_RW:
- case ZEND_ASSERT_CHECK:
+ case ZEND_JMP:
+ case ZEND_FAST_CALL:
+ opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
+ break;
+ case ZEND_JMPZNZ:
+ /* relative extended_value don't have to be changed */
+ /* break omitted intentionally */
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_ASSERT_CHECK:
+ opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ break;
+ case ZEND_CATCH:
+ if (!(opline->extended_value & ZEND_LAST_CATCH)) {
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
- break;
- case ZEND_CATCH:
- if (!(opline->extended_value & ZEND_LAST_CATCH)) {
- opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ }
+ break;
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ /* relative extended_value don't have to be changed */
+ break;
+#endif
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_CASE:
+ case ZEND_ISSET_ISEMPTY_CV:
+ case ZEND_ISSET_ISEMPTY_VAR:
+ case ZEND_ISSET_ISEMPTY_DIM_OBJ:
+ case ZEND_ISSET_ISEMPTY_PROP_OBJ:
+ case ZEND_ISSET_ISEMPTY_STATIC_PROP:
+ case ZEND_INSTANCEOF:
+ case ZEND_TYPE_CHECK:
+ case ZEND_DEFINED:
+ case ZEND_IN_ARRAY:
+ case ZEND_ARRAY_KEY_EXISTS:
+ if (opline->result_type & IS_TMP_VAR) {
+ /* reinitialize result_type of smart branch instructions */
+ if (opline + 1 < end) {
+ if ((opline+1)->opcode == ZEND_JMPZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPZ | IS_TMP_VAR;
+ } else if ((opline+1)->opcode == ZEND_JMPNZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPNZ | IS_TMP_VAR;
+ }
}
- break;
- case ZEND_FE_FETCH_R:
- case ZEND_FE_FETCH_RW:
- case ZEND_SWITCH_LONG:
- case ZEND_SWITCH_STRING:
- /* relative extended_value don't have to be changed */
- break;
- }
+ }
+ break;
}
-#endif
+ zend_vm_set_opcode_handler_ex(opline, op1_info, op2_info, res_info);
opline++;
}
+
+ op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
}
-#endif
static void zend_optimize_op_array(zend_op_array *op_array,
zend_optimizer_ctx *ctx)
@@ -1258,12 +1304,6 @@ static void zend_optimize_op_array(zend_op_array *op_array,
zend_redo_pass_two(op_array);
if (op_array->live_range) {
-#if HAVE_DFA_PASS
- if ((ZEND_OPTIMIZER_PASS_6 & ctx->optimization_level) &&
- (ZEND_OPTIMIZER_PASS_7 & ctx->optimization_level)) {
- return;
- }
-#endif
zend_recalc_live_ranges(op_array, NULL);
}
}
@@ -1288,7 +1328,6 @@ static void zend_adjust_fcall_stack_size(zend_op_array *op_array, zend_optimizer
}
}
-#if HAVE_DFA_PASS
static void zend_adjust_fcall_stack_size_graph(zend_op_array *op_array)
{
zend_func_info *func_info = ZEND_FUNC_INFO(op_array);
@@ -1316,7 +1355,6 @@ static zend_bool needs_live_range(zend_op_array *op_array, zend_op *def_opline)
}
return 1;
}
-#endif
int zend_optimize_script(zend_script *script, zend_long optimization_level, zend_long debug_level)
{
@@ -1325,9 +1363,7 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
zend_op_array *op_array;
zend_string *name;
zend_optimizer_ctx ctx;
-#if HAVE_DFA_PASS
zend_call_graph call_graph;
-#endif
ctx.arena = zend_arena_create(64 * 1024);
ctx.script = script;
@@ -1335,38 +1371,20 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
ctx.optimization_level = optimization_level;
ctx.debug_level = debug_level;
- zend_optimize_op_array(&script->main_op_array, &ctx);
-
- ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
- zend_optimize_op_array(op_array, &ctx);
- } ZEND_HASH_FOREACH_END();
-
- ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
- if (ce->refcount > 1 && !zend_string_equals_ci(key, ce->name)) {
- continue;
- }
- ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
- if (op_array->scope == ce
- && op_array->type == ZEND_USER_FUNCTION
- && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
- zend_optimize_op_array(op_array, &ctx);
- }
- } ZEND_HASH_FOREACH_END();
- } ZEND_HASH_FOREACH_END();
-
-#if HAVE_DFA_PASS
if ((ZEND_OPTIMIZER_PASS_6 & optimization_level) &&
(ZEND_OPTIMIZER_PASS_7 & optimization_level) &&
- zend_build_call_graph(&ctx.arena, script, ZEND_RT_CONSTANTS, &call_graph) == SUCCESS) {
+ zend_build_call_graph(&ctx.arena, script, &call_graph) == SUCCESS) {
/* Optimize using call-graph */
- void *checkpoint = zend_arena_checkpoint(ctx.arena);
int i;
zend_func_info *func_info;
for (i = 0; i < call_graph.op_arrays_count; i++) {
zend_revert_pass_two(call_graph.op_arrays[i]);
+ zend_optimize(call_graph.op_arrays[i], &ctx);
}
+ zend_analyze_call_graph(&ctx.arena, script, &call_graph);
+
for (i = 0; i < call_graph.op_arrays_count; i++) {
func_info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
if (func_info) {
@@ -1445,16 +1463,11 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
for (i = 0; i < call_graph.op_arrays_count; i++) {
ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
}
-
- zend_arena_release(&ctx.arena, checkpoint);
- } else
-#endif
-
- if (ZEND_OPTIMIZER_PASS_12 & optimization_level) {
- zend_adjust_fcall_stack_size(&script->main_op_array, &ctx);
+ } else {
+ zend_optimize_op_array(&script->main_op_array, &ctx);
ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
- zend_adjust_fcall_stack_size(op_array, &ctx);
+ zend_optimize_op_array(op_array, &ctx);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
@@ -1465,10 +1478,31 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
if (op_array->scope == ce
&& op_array->type == ZEND_USER_FUNCTION
&& !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
- zend_adjust_fcall_stack_size(op_array, &ctx);
+ zend_optimize_op_array(op_array, &ctx);
}
} ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
+
+ if (ZEND_OPTIMIZER_PASS_12 & optimization_level) {
+ zend_adjust_fcall_stack_size(&script->main_op_array, &ctx);
+
+ ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
+ zend_adjust_fcall_stack_size(op_array, &ctx);
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
+ if (ce->refcount > 1 && !zend_string_equals_ci(key, ce->name)) {
+ continue;
+ }
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
+ if (op_array->scope == ce
+ && op_array->type == ZEND_USER_FUNCTION
+ && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
+ zend_adjust_fcall_stack_size(op_array, &ctx);
+ }
+ } ZEND_HASH_FOREACH_END();
+ } ZEND_HASH_FOREACH_END();
+ }
}
ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
@@ -1498,11 +1532,11 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
if ((debug_level & ZEND_DUMP_AFTER_OPTIMIZER) &&
(ZEND_OPTIMIZER_PASS_7 & optimization_level)) {
zend_dump_op_array(&script->main_op_array,
- ZEND_DUMP_RT_CONSTANTS | ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
+ ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
zend_dump_op_array(op_array,
- ZEND_DUMP_RT_CONSTANTS | ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
+ ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_PTR(&script->class_table, ce) {
@@ -1511,7 +1545,7 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
&& op_array->type == ZEND_USER_FUNCTION
&& !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
zend_dump_op_array(op_array,
- ZEND_DUMP_RT_CONSTANTS | ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
+ ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
}
} ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
diff --git a/ext/opcache/Optimizer/zend_optimizer.h b/ext/opcache/Optimizer/zend_optimizer.h
index 2841d018a5..04528d33e2 100644
--- a/ext/opcache/Optimizer/zend_optimizer.h
+++ b/ext/opcache/Optimizer/zend_optimizer.h
@@ -25,9 +25,9 @@
#include "zend.h"
#include "zend_compile.h"
-#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* CSE, STRING construction */
-#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* Constant conversion and jumps */
-#define ZEND_OPTIMIZER_PASS_3 (1<<2) /* ++, +=, series of jumps */
+#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* Simple local optimizations */
+#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* */
+#define ZEND_OPTIMIZER_PASS_3 (1<<2) /* Jump optimization */
#define ZEND_OPTIMIZER_PASS_4 (1<<3) /* INIT_FCALL_BY_NAME -> DO_FCALL */
#define ZEND_OPTIMIZER_PASS_5 (1<<4) /* CFG based optimization */
#define ZEND_OPTIMIZER_PASS_6 (1<<5) /* DFA based optimization */
diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h
index 9ab18f6398..43ac1ea07f 100644
--- a/ext/opcache/Optimizer/zend_optimizer_internal.h
+++ b/ext/opcache/Optimizer/zend_optimizer_internal.h
@@ -93,7 +93,6 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
zend_op *zend_optimizer_get_loop_var_def(const zend_op_array *op_array, zend_op *free_opline);
void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx);
-void zend_optimizer_pass2(zend_op_array *op_array);
void zend_optimizer_pass3(zend_op_array *op_array, zend_optimizer_ctx *ctx);
void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx);
void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx);
@@ -106,7 +105,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
void zend_optimizer_compact_vars(zend_op_array *op_array);
int zend_optimizer_is_disabled_func(const char *name, size_t len);
zend_function *zend_optimizer_get_called_func(
- zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool rt_constants);
+ zend_script *script, zend_op_array *op_array, zend_op *opline);
uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args);
void zend_optimizer_migrate_jump(zend_op_array *op_array, zend_op *new_opline, zend_op *opline);
void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_t *shiftlist);
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index 9d3b81ca83..99d577dd2c 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -192,14 +192,14 @@ static int find_adjusted_tmp_var(const zend_op_array *op_array, uint32_t build_f
}
} else if (op->opcode == ZEND_ADD) {
if (op->op1_type == IS_CV && op->op2_type == IS_CONST) {
- zv = CRT_CONSTANT_EX(op_array, op, op->op2, (build_flags & ZEND_RT_CONSTANTS));
+ zv = CRT_CONSTANT_EX(op_array, op, op->op2);
if (Z_TYPE_P(zv) == IS_LONG
&& Z_LVAL_P(zv) != ZEND_LONG_MIN) {
*adjustment = -Z_LVAL_P(zv);
return EX_VAR_TO_NUM(op->op1.var);
}
} else if (op->op2_type == IS_CV && op->op1_type == IS_CONST) {
- zv = CRT_CONSTANT_EX(op_array, op, op->op1, (build_flags & ZEND_RT_CONSTANTS));
+ zv = CRT_CONSTANT_EX(op_array, op, op->op1);
if (Z_TYPE_P(zv) == IS_LONG
&& Z_LVAL_P(zv) != ZEND_LONG_MIN) {
*adjustment = -Z_LVAL_P(zv);
@@ -208,7 +208,7 @@ static int find_adjusted_tmp_var(const zend_op_array *op_array, uint32_t build_f
}
} else if (op->opcode == ZEND_SUB) {
if (op->op1_type == IS_CV && op->op2_type == IS_CONST) {
- zv = CRT_CONSTANT_EX(op_array, op, op->op2, (build_flags & ZEND_RT_CONSTANTS));
+ zv = CRT_CONSTANT_EX(op_array, op, op->op2);
if (Z_TYPE_P(zv) == IS_LONG) {
*adjustment = Z_LVAL_P(zv);
return EX_VAR_TO_NUM(op->op1.var);
@@ -293,7 +293,7 @@ static void place_essa_pis(
} else if (var1 >= 0 && var2 < 0) {
zend_long add_val2 = 0;
if ((opline-1)->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2, (build_flags & ZEND_RT_CONSTANTS));
+ zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2);
if (Z_TYPE_P(zv) == IS_LONG) {
add_val2 = Z_LVAL_P(zv);
@@ -315,9 +315,9 @@ static void place_essa_pis(
} else if (var1 < 0 && var2 >= 0) {
zend_long add_val1 = 0;
if ((opline-1)->op1_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1, (build_flags & ZEND_RT_CONSTANTS));
+ zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1);
if (Z_TYPE_P(zv) == IS_LONG) {
- add_val1 = Z_LVAL_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1, (build_flags & ZEND_RT_CONSTANTS)));
+ add_val1 = Z_LVAL_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1));
} else if (Z_TYPE_P(zv) == IS_FALSE) {
add_val1 = 0;
} else if (Z_TYPE_P(zv) == IS_TRUE) {
@@ -463,10 +463,10 @@ static void place_essa_pis(
uint32_t type_mask;
if ((opline-1)->op1_type == IS_CV && (opline-1)->op2_type == IS_CONST) {
var = EX_VAR_TO_NUM((opline-1)->op1.var);
- val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2, (build_flags & ZEND_RT_CONSTANTS));
+ val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2);
} else if ((opline-1)->op1_type == IS_CONST && (opline-1)->op2_type == IS_CV) {
var = EX_VAR_TO_NUM((opline-1)->op2.var);
- val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1, (build_flags & ZEND_RT_CONSTANTS));
+ val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1);
} else {
continue;
}
@@ -497,7 +497,7 @@ static void place_essa_pis(
opline->op1.var == (opline-1)->result.var && (opline-1)->op1_type == IS_CV &&
(opline-1)->op2_type == IS_CONST) {
int var = EX_VAR_TO_NUM((opline-1)->op1.var);
- zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2, (build_flags & ZEND_RT_CONSTANTS)) + 1);
+ zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2) + 1);
zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL;
if (!ce) {
ce = zend_hash_find_ptr(CG(class_table), lcname);
@@ -742,10 +742,6 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
case ZEND_FETCH_DIM_RW:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_OBJ_W:
- case ZEND_FETCH_OBJ_RW:
- case ZEND_FETCH_OBJ_FUNC_ARG:
- case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_LIST_W:
if (opline->op1_type == IS_CV) {
ssa_ops[k].op1_def = ssa_vars_count;
@@ -885,7 +881,6 @@ int zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_
return FAILURE;
}
- ssa->rt_constants = (build_flags & ZEND_RT_CONSTANTS);
ssa_blocks = zend_arena_calloc(arena, blocks_count, sizeof(zend_ssa_block));
ssa->blocks = ssa_blocks;
@@ -1125,8 +1120,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
for (i = 0; i < op_array->last_var; i++) {
if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
ssa_vars[i].alias = SYMTABLE_ALIAS;
- } else if (zend_string_equals_literal(op_array->vars[i], "php_errormsg")) {
- ssa_vars[i].alias = PHP_ERRORMSG_ALIAS;
} else if (zend_string_equals_literal(op_array->vars[i], "http_response_header")) {
ssa_vars[i].alias = HTTP_RESPONSE_HEADER_ALIAS;
}
diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h
index a921a5bbe0..1987a47fc4 100644
--- a/ext/opcache/Optimizer/zend_ssa.h
+++ b/ext/opcache/Optimizer/zend_ssa.h
@@ -95,7 +95,6 @@ typedef struct _zend_ssa_op {
typedef enum _zend_ssa_alias_kind {
NO_ALIAS,
SYMTABLE_ALIAS,
- PHP_ERRORMSG_ALIAS,
HTTP_RESPONSE_HEADER_ALIAS
} zend_ssa_alias_kind;
@@ -132,12 +131,11 @@ typedef struct _zend_ssa_var_info {
typedef struct _zend_ssa {
zend_cfg cfg; /* control flow graph */
- int rt_constants; /* run-time or compile-time */
int vars_count; /* number of SSA variables */
+ int sccs; /* number of SCCs */
zend_ssa_block *blocks; /* array of SSA blocks */
zend_ssa_op *ops; /* array of SSA instructions */
zend_ssa_var *vars; /* use/def chain of SSA variables */
- int sccs; /* number of SCCs */
zend_ssa_var_info *var_info;
} zend_ssa;
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 704e1c38d9..12dd8aba7a 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -47,6 +47,10 @@
#include "ext/standard/md5.h"
#include "ext/hash/php_hash.h"
+#ifdef HAVE_JIT
+# include "jit/zend_jit.h"
+#endif
+
#ifndef ZEND_WIN32
#include <netdb.h>
#endif
@@ -86,19 +90,6 @@ typedef int gid_t;
#include <immintrin.h>
#endif
-#define SHM_PROTECT() \
- do { \
- if (ZCG(accel_directives).protect_memory) { \
- zend_accel_shared_protect(1); \
- } \
- } while (0)
-#define SHM_UNPROTECT() \
- do { \
- if (ZCG(accel_directives).protect_memory) { \
- zend_accel_shared_protect(0); \
- } \
- } while (0)
-
ZEND_EXTENSION();
#ifndef ZTS
@@ -2471,6 +2462,11 @@ int accel_activate(INIT_FUNC_ARGS)
ZCG(pcre_reseted) = 1;
}
+
+#ifdef HAVE_JIT
+ zend_jit_activate();
+#endif
+
if (ZCSG(preload_script)) {
preload_activate();
}
@@ -2478,6 +2474,13 @@ int accel_activate(INIT_FUNC_ARGS)
return SUCCESS;
}
+#ifdef HAVE_JIT
+void accel_deactivate(void)
+{
+ zend_jit_deactivate();
+}
+#endif
+
int accel_post_deactivate(void)
{
if (ZCG(cwd)) {
@@ -2905,12 +2908,46 @@ static int accel_post_startup(void)
}
}
+ /* Initialize zend_func_info_rid */
+ zend_optimizer_startup();
+
/********************************************/
/* End of non-SHM dependent initializations */
/********************************************/
file_cache_only = ZCG(accel_directives).file_cache_only;
if (!file_cache_only) {
- switch (zend_shared_alloc_startup(ZCG(accel_directives).memory_consumption)) {
+ size_t shm_size = ZCG(accel_directives).memory_consumption;
+#ifdef HAVE_JIT
+ size_t jit_size = 0;
+ zend_bool reattached = 0;
+
+ if (ZCG(accel_directives).jit &&
+ ZCG(accel_directives).jit_buffer_size) {
+ size_t page_size;
+
+# ifdef _WIN32
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ page_size = system_info.dwPageSize;
+# else
+ page_size = getpagesize();
+# endif
+ if (!page_size || (page_size & (page_size - 1))) {
+ zend_accel_error(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - can't get page size.");
+ abort();
+ }
+ jit_size = ZCG(accel_directives).jit_buffer_size;
+ jit_size = ZEND_MM_ALIGNED_SIZE_EX(jit_size, page_size);
+ shm_size += jit_size;
+ } else {
+ ZCG(accel_directives).jit = 0;
+ ZCG(accel_directives).jit_buffer_size = 0;
+ }
+
+ switch (zend_shared_alloc_startup(shm_size, jit_size)) {
+#else
+ switch (zend_shared_alloc_startup(shm_size, 0)) {
+#endif
case ALLOC_SUCCESS:
if (zend_accel_init_shm() == FAILURE) {
accel_startup_ok = 0;
@@ -2922,6 +2959,9 @@ static int accel_post_startup(void)
zend_accel_error(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - probably not enough shared memory.");
return SUCCESS;
case SUCCESSFULLY_REATTACHED:
+#ifdef HAVE_JIT
+ reattached = 1;
+#endif
zend_shared_alloc_lock();
accel_shared_globals = (zend_accel_shared_globals *) ZSMMG(app_shared_globals);
zend_interned_strings_set_request_storage_handlers(accel_new_interned_string_for_php, accel_init_interned_string_for_php);
@@ -2953,6 +2993,16 @@ static int accel_post_startup(void)
zend_accel_init_auto_globals();
zend_shared_alloc_lock();
+#ifdef HAVE_JIT
+ if (ZCG(accel_directives).jit &&
+ ZCG(accel_directives).jit_buffer_size &&
+ ZSMMG(reserved) &&
+ zend_jit_startup(ZCG(accel_directives).jit, ZSMMG(reserved), jit_size, reattached) == SUCCESS) {
+ ZCG(jit_enabled) = 1;
+ } else {
+ ZCG(jit_enabled) = 0;
+ }
+#endif
zend_shared_alloc_save_state();
zend_shared_alloc_unlock();
@@ -3036,6 +3086,10 @@ void accel_shutdown(void)
zend_ini_entry *ini_entry;
zend_bool _file_cache_only = 0;
+#ifdef HAVE_JIT
+ zend_jit_shutdown();
+#endif
+
zend_optimizer_shutdown();
zend_accel_blacklist_shutdown(&accel_blacklist);
@@ -4356,6 +4410,7 @@ static int accel_preload(const char *config)
#else
init_op_array(&script->script.main_op_array, ZEND_USER_FUNCTION, 2);
#endif
+ script->script.main_op_array.fn_flags |= ZEND_ACC_DONE_PASS_TWO;
script->script.main_op_array.last = 1;
script->script.main_op_array.last_literal = 1;
#if ZEND_USE_ABS_CONST_ADDR
@@ -4485,13 +4540,13 @@ static int accel_finish_startup(void)
int rc;
int orig_error_reporting;
- int (*orig_activate)(TSRMLS_D) = sapi_module.activate;
- int (*orig_deactivate)(TSRMLS_D) = sapi_module.deactivate;
- void (*orig_register_server_variables)(zval *track_vars_array TSRMLS_DC) = sapi_module.register_server_variables;
- int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) = sapi_module.header_handler;
- int (*orig_send_headers)(sapi_headers_struct *sapi_headers TSRMLS_DC) = sapi_module.send_headers;
- void (*orig_send_header)(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)= sapi_module.send_header;
- char *(*orig_getenv)(char *name, size_t name_len TSRMLS_DC) = sapi_module.getenv;
+ int (*orig_activate)() = sapi_module.activate;
+ int (*orig_deactivate)() = sapi_module.deactivate;
+ void (*orig_register_server_variables)(zval *track_vars_array) = sapi_module.register_server_variables;
+ int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers) = sapi_module.header_handler;
+ int (*orig_send_headers)(sapi_headers_struct *sapi_headers) = sapi_module.send_headers;
+ void (*orig_send_header)(sapi_header_struct *sapi_header, void *server_context)= sapi_module.send_header;
+ char *(*orig_getenv)(char *name, size_t name_len) = sapi_module.getenv;
size_t (*orig_ub_write)(const char *str, size_t str_length) = sapi_module.ub_write;
void (*orig_flush)(void *server_context) = sapi_module.flush;
uint32_t orig_compiler_options = CG(compiler_options);
@@ -4694,7 +4749,11 @@ ZEND_EXT_API zend_extension zend_extension_entry = {
accel_startup, /* startup */
NULL, /* shutdown */
NULL, /* per-script activation */
+#ifdef HAVE_JIT
+ accel_deactivate, /* per-script deactivation */
+#else
NULL, /* per-script deactivation */
+#endif
NULL, /* message handler */
NULL, /* op_array handler */
NULL, /* extended statement handler */
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index c2f95d7c41..bb884d9cc9 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -191,6 +191,12 @@ typedef struct _zend_accel_directives {
#ifdef ZEND_WIN32
char *cache_id;
#endif
+#ifdef HAVE_JIT
+ zend_long jit;
+ zend_long jit_buffer_size;
+ zend_long jit_debug;
+ zend_long jit_bisect_limit;
+#endif
} zend_accel_directives;
typedef struct _zend_accel_globals {
@@ -221,6 +227,9 @@ typedef struct _zend_accel_globals {
void *arena_mem;
zend_persistent_script *current_persistent_script;
zend_bool is_immutable_class;
+#ifdef HAVE_JIT
+ zend_bool jit_enabled;
+#endif
/* cache to save hash lookup on the same INCLUDE opcode */
const zend_op *cache_opline;
zend_persistent_script *cache_persistent_script;
@@ -321,4 +330,19 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type);
zend_string* ZEND_FASTCALL accel_new_interned_string(zend_string *str);
+/* memory write protection */
+#define SHM_PROTECT() \
+ do { \
+ if (ZCG(accel_directives).protect_memory) { \
+ zend_accel_shared_protect(1); \
+ } \
+ } while (0)
+
+#define SHM_UNPROTECT() \
+ do { \
+ if (ZCG(accel_directives).protect_memory) { \
+ zend_accel_shared_protect(0); \
+ } \
+ } while (0)
+
#endif /* ZEND_ACCELERATOR_H */
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index 6c40cafc1c..5e61575d48 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -11,6 +11,13 @@ PHP_ARG_ENABLE([huge-code-pages],
[yes],
[no])
+PHP_ARG_ENABLE([opcache-jit],
+ [whether to enable JIT],
+ [AS_HELP_STRING([--disable-opcache-jit],
+ [Disable JIT])],
+ [yes],
+ [no])
+
if test "$PHP_OPCACHE" != "no"; then
dnl Always build as shared extension
@@ -20,6 +27,67 @@ if test "$PHP_OPCACHE" != "no"; then
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
fi
+ if test "$PHP_OPCACHE_JIT" = "yes"; then
+ case $host_cpu in
+ x86*)
+ ;;
+ *)
+ AC_MSG_WARN([JIT not supported by host architecture])
+ PHP_OPCACHE_JIT=no
+ ;;
+ esac
+ fi
+
+ if test "$PHP_OPCACHE_JIT" = "yes"; then
+ AC_DEFINE(HAVE_JIT, 1, [Define to enable JIT])
+ ZEND_JIT_SRC="jit/zend_jit.c jit/zend_jit_vm_helpers.c"
+
+ dnl Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *"Mach-O 64-bit"*)
+ DASM_FLAGS="-D X64APPLE=1 -D X64=1"
+ ;;
+ *64-bit*)
+ DASM_FLAGS="-D X64=1"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+
+ if test "$enable_zts" = "yes"; then
+ DASM_FLAGS="$DASM_FLAGS -D ZTS=1"
+ fi
+
+ PHP_SUBST(DASM_FLAGS)
+
+ AC_MSG_CHECKING(for opagent in default path)
+ for i in /usr/local /usr; do
+ if test -r $i/include/opagent.h; then
+ OPAGENT_DIR=$i
+ AC_MSG_RESULT(found in $i)
+ break
+ fi
+ done
+ if test -z "$OPAGENT_DIR"; then
+ AC_MSG_RESULT(not found)
+ else
+ PHP_CHECK_LIBRARY(opagent, op_write_native_code,
+ [
+ AC_DEFINE(HAVE_OPROFILE,1,[ ])
+ PHP_ADD_INCLUDE($OPAGENT_DIR/include)
+ PHP_ADD_LIBRARY_WITH_PATH(opagent, $OPAGENT_DIR/$PHP_LIBDIR/oprofile, OPCACHE_SHARED_LIBADD)
+ PHP_SUBST(OPCACHE_SHARED_LIBADD)
+ ],[
+ AC_MSG_RESULT(not found)
+ ],[
+ -L$OPAGENT_DIR/$PHP_LIBDIR/oprofile
+ ])
+ fi
+
+ fi
+
AC_CHECK_FUNCS([mprotect])
AC_MSG_CHECKING(for sysvipc shared memory support)
@@ -234,8 +302,7 @@ int main() {
shared_alloc_mmap.c \
shared_alloc_posix.c \
Optimizer/zend_optimizer.c \
- Optimizer/pass1_5.c \
- Optimizer/pass2.c \
+ Optimizer/pass1.c \
Optimizer/pass3.c \
Optimizer/optimize_func_calls.c \
Optimizer/block_pass.c \
@@ -254,10 +321,16 @@ int main() {
Optimizer/dce.c \
Optimizer/escape_analysis.c \
Optimizer/compact_vars.c \
- Optimizer/zend_dump.c,
+ Optimizer/zend_dump.c \
+ $ZEND_JIT_SRC,
shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes)
PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
PHP_ADD_EXTENSION_DEP(opcache, pcre)
+
+ if test "$PHP_OPCACHE_JIT" = "yes"; then
+ PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1)
+ PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag)
+ fi
PHP_SUBST(OPCACHE_SHARED_LIBADD)
fi
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
index fba1b1bef1..7c67ccf0f6 100644
--- a/ext/opcache/config.w32
+++ b/ext/opcache/config.w32
@@ -1,9 +1,10 @@
ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes");
-/* var PHP_OPCACHE_PGO = false; */
if (PHP_OPCACHE != "no") {
+ ARG_ENABLE("opcache-jit", "whether to enable JIT", "yes");
+
ZEND_EXTENSION('opcache', "\
ZendAccelerator.c \
zend_accelerator_blacklist.c \
@@ -17,9 +18,29 @@ if (PHP_OPCACHE != "no") {
zend_shared_alloc.c \
shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
- ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1_5.c pass2.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c zend_cfg.c zend_dfg.c dfa_pass.c zend_ssa.c zend_inference.c zend_func_info.c zend_call_graph.c sccp.c scdf.c dce.c escape_analysis.c compact_vars.c zend_dump.c", "opcache", "OptimizerObj");
+ if (PHP_OPCACHE_JIT == "yes") {
+ if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
+ var dasm_flags = (X64 ? "-D X64=1" : "") + (X64 ? " -D X64WIN=1" : "") + " -D WIN=1";
+ if (PHP_ZTS == "yes") {
+ dasm_flags += " -D ZTS=1";
+ }
+ DEFINE("DASM_FLAGS", dasm_flags);
+
+ AC_DEFINE('HAVE_JIT', 1, 'Define to enable JIT');
+ /* XXX read this dynamically */
+ /*ADD_FLAG("CFLAGS_OPCACHE", "/D DASM_VERSION=10400");*/
+
+ ADD_MAKEFILE_FRAGMENT(configure_module_dirname + "\\jit\\Makefile.frag.w32");
+ ADD_SOURCES(configure_module_dirname + "\\jit", "zend_jit.c zend_jit_vm_helpers.c", "opcache", "opcache_jit");
+ } else {
+ WARNING("JIT not enabled, headers not found");
+ }
+ }
+
+ ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c zend_cfg.c zend_dfg.c dfa_pass.c zend_ssa.c zend_inference.c zend_func_info.c zend_call_graph.c zend_dump.c escape_analysis.c compact_vars.c dce.c sccp.c scdf.c", "opcache", "OptimizerObj");
ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname);
}
+
diff --git a/ext/opcache/jit/Makefile.frag b/ext/opcache/jit/Makefile.frag
new file mode 100644
index 0000000000..02e44c2654
--- /dev/null
+++ b/ext/opcache/jit/Makefile.frag
@@ -0,0 +1,17 @@
+
+$(builddir)/minilua: $(srcdir)/jit/dynasm/minilua.c
+ $(CC) $(srcdir)/jit/dynasm/minilua.c -lm -o $@
+
+$(builddir)/jit/zend_jit_x86.c: $(srcdir)/jit/zend_jit_x86.dasc $(srcdir)/jit/dynasm/*.lua $(builddir)/minilua
+ $(builddir)/minilua $(srcdir)/jit/dynasm/dynasm.lua $(DASM_FLAGS) -o $@ $(srcdir)/jit/zend_jit_x86.dasc
+
+$(builddir)/jit/zend_jit.lo: \
+ $(builddir)/jit/zend_jit_x86.c \
+ $(srcdir)/jit/zend_jit_helpers.c \
+ $(srcdir)/jit/zend_jit_disasm_x86.c \
+ $(srcdir)/jit/zend_jit_gdb.c \
+ $(srcdir)/jit/zend_jit_perf_dump.c \
+ $(srcdir)/jit/zend_jit_oprofile.c \
+ $(srcdir)/jit/zend_jit_vtune.c \
+ $(srcdir)/jit/zend_elf.c
+
diff --git a/ext/opcache/jit/Makefile.frag.w32 b/ext/opcache/jit/Makefile.frag.w32
new file mode 100644
index 0000000000..282f81bb74
--- /dev/null
+++ b/ext/opcache/jit/Makefile.frag.w32
@@ -0,0 +1,16 @@
+$(BUILD_DIR)\\minilua.exe: ext\opcache\jit\dynasm\minilua.c
+ @if exist $(BUILD_DIR)\\minilua.exe del $(BUILD_DIR)\\minilua.exe
+ $(PHP_CL) /Fo$(BUILD_DIR)\ /Fd$(BUILD_DIR)\ /Fp$(BUILD_DIR)\ /FR$(BUILD_DIR) /Fe$(BUILD_DIR)\minilua.exe ext\opcache\jit\dynasm\minilua.c
+
+ext\opcache\jit\zend_jit_x86.c: ext\opcache\jit\zend_jit_x86.dasc $(BUILD_DIR)\\minilua.exe
+ @if exist ext\opcache\jit\zend_jit_x86.c del ext\opcache\jit\zend_jit_x86.c
+ $(BUILD_DIR)\\minilua.exe ext/opcache/jit/dynasm/dynasm.lua $(DASM_FLAGS) -o $@ ext/opcache/jit/zend_jit_x86.dasc
+
+$(BUILD_DIR)\opcache_jit\zend_jit.obj: \
+ ext/opcache/jit/zend_jit_x86.c \
+ ext/opcache/jit/zend_jit_helpers.c \
+ ext/opcache/jit/zend_jit_disasm_x86.c \
+ ext/opcache/jit/zend_jit_gdb.c \
+ ext/opcache/jit/zend_jit_perf_dump.c \
+ ext/opcache/jit/zend_jit_oprofile.c \
+ ext/opcache/jit/zend_jit_vtune.c
diff --git a/ext/opcache/jit/dynasm/dasm_arm.h b/ext/opcache/jit/dynasm/dasm_arm.h
new file mode 100644
index 0000000000..0fa69ac06f
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm.h
@@ -0,0 +1,456 @@
+/*
+** DynASM ARM encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "arm"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC,
+ DASM_IMM, DASM_IMM12, DASM_IMM16, DASM_IMML8, DASM_IMML12, DASM_IMMV8,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+static int dasm_imm12(unsigned int n)
+{
+ int i;
+ for (i = 0; i < 16; i++, n = (n << 2) | (n >> 30))
+ if (n <= 255) return (int)(n + (i << 8));
+ return -1;
+}
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM:
+ case DASM_IMM16:
+#ifdef DASM_CHECKS
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+ if ((ins & 0x8000))
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ case DASM_IMMV8:
+ CK((n & 3) == 0, RANGE_I);
+ n >>= 2;
+ case DASM_IMML8:
+ case DASM_IMML12:
+ CK(n >= 0 ? ((n>>((ins>>5)&31)) == 0) :
+ (((-n)>>((ins>>5)&31)) == 0), RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM12:
+ CK(dasm_imm12((unsigned int)n) != -1, RANGE_I);
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMM12: case DASM_IMM16:
+ case DASM_IMML8: case DASM_IMML12: case DASM_IMMV8: pos++; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins&2047), !(ins&2048));
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) - 4;
+ patchrel:
+ if ((ins & 0x800) == 0) {
+ CK((n & 3) == 0 && ((n+0x02000000) >> 26) == 0, RANGE_REL);
+ cp[-1] |= ((n >> 2) & 0x00ffffff);
+ } else if ((ins & 0x1000)) {
+ CK((n & 3) == 0 && -256 <= n && n <= 256, RANGE_REL);
+ goto patchimml8;
+ } else if ((ins & 0x2000) == 0) {
+ CK((n & 3) == 0 && -4096 <= n && n <= 4096, RANGE_REL);
+ goto patchimml;
+ } else {
+ CK((n & 3) == 0 && -1020 <= n && n <= 1020, RANGE_REL);
+ n >>= 2;
+ goto patchimml;
+ }
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMM:
+ cp[-1] |= ((n>>((ins>>10)&31)) & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ case DASM_IMM12:
+ cp[-1] |= dasm_imm12((unsigned int)n);
+ break;
+ case DASM_IMM16:
+ cp[-1] |= ((n & 0xf000) << 4) | (n & 0x0fff);
+ break;
+ case DASM_IMML8: patchimml8:
+ cp[-1] |= n >= 0 ? (0x00800000 | (n & 0x0f) | ((n & 0xf0) << 4)) :
+ ((-n & 0x0f) | ((-n & 0xf0) << 4));
+ break;
+ case DASM_IMML12: case DASM_IMMV8: patchimml:
+ cp[-1] |= n >= 0 ? (0x00800000 | n) : (-n);
+ break;
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_arm.lua b/ext/opcache/jit/dynasm/dasm_arm.lua
new file mode 100644
index 0000000000..e2ed922a3c
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm.lua
@@ -0,0 +1,1125 @@
+------------------------------------------------------------------------------
+-- DynASM ARM module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+-- Module information:
+local _info = {
+ arch = "arm",
+ description = "DynASM ARM module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable, rawget = assert, setmetatable, rawget
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch, gsub = _s.match, _s.gmatch, _s.gsub
+local concat, sort, insert = table.concat, table.sort, table.insert
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local ror, tohex = bit.ror, bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMM12", "IMM16", "IMML8", "IMML12", "IMMV8",
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n <= 0x000fffff then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ if n <= 0x000fffff then
+ insert(actlist, pos+1, n)
+ n = map_action.ESC * 0x10000
+ end
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+
+-- Ext. register name -> int. name.
+local map_archdef = { sp = "r13", lr = "r14", pc = "r15", }
+
+-- Int. register name -> ext. name.
+local map_reg_rev = { r13 = "sp", r14 = "lr", r15 = "pc", }
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ return map_reg_rev[s] or s
+end
+
+local map_shift = { lsl = 0, lsr = 1, asr = 2, ror = 3, }
+
+local map_cond = {
+ eq = 0, ne = 1, cs = 2, cc = 3, mi = 4, pl = 5, vs = 6, vc = 7,
+ hi = 8, ls = 9, ge = 10, lt = 11, gt = 12, le = 13, al = 14,
+ hs = 2, lo = 3,
+}
+
+------------------------------------------------------------------------------
+
+-- Template strings for ARM instructions.
+local map_op = {
+ -- Basic data processing instructions.
+ and_3 = "e0000000DNPs",
+ eor_3 = "e0200000DNPs",
+ sub_3 = "e0400000DNPs",
+ rsb_3 = "e0600000DNPs",
+ add_3 = "e0800000DNPs",
+ adc_3 = "e0a00000DNPs",
+ sbc_3 = "e0c00000DNPs",
+ rsc_3 = "e0e00000DNPs",
+ tst_2 = "e1100000NP",
+ teq_2 = "e1300000NP",
+ cmp_2 = "e1500000NP",
+ cmn_2 = "e1700000NP",
+ orr_3 = "e1800000DNPs",
+ mov_2 = "e1a00000DPs",
+ bic_3 = "e1c00000DNPs",
+ mvn_2 = "e1e00000DPs",
+
+ and_4 = "e0000000DNMps",
+ eor_4 = "e0200000DNMps",
+ sub_4 = "e0400000DNMps",
+ rsb_4 = "e0600000DNMps",
+ add_4 = "e0800000DNMps",
+ adc_4 = "e0a00000DNMps",
+ sbc_4 = "e0c00000DNMps",
+ rsc_4 = "e0e00000DNMps",
+ tst_3 = "e1100000NMp",
+ teq_3 = "e1300000NMp",
+ cmp_3 = "e1500000NMp",
+ cmn_3 = "e1700000NMp",
+ orr_4 = "e1800000DNMps",
+ mov_3 = "e1a00000DMps",
+ bic_4 = "e1c00000DNMps",
+ mvn_3 = "e1e00000DMps",
+
+ lsl_3 = "e1a00000DMws",
+ lsr_3 = "e1a00020DMws",
+ asr_3 = "e1a00040DMws",
+ ror_3 = "e1a00060DMws",
+ rrx_2 = "e1a00060DMs",
+
+ -- Multiply and multiply-accumulate.
+ mul_3 = "e0000090NMSs",
+ mla_4 = "e0200090NMSDs",
+ umaal_4 = "e0400090DNMSs", -- v6
+ mls_4 = "e0600090DNMSs", -- v6T2
+ umull_4 = "e0800090DNMSs",
+ umlal_4 = "e0a00090DNMSs",
+ smull_4 = "e0c00090DNMSs",
+ smlal_4 = "e0e00090DNMSs",
+
+ -- Halfword multiply and multiply-accumulate.
+ smlabb_4 = "e1000080NMSD", -- v5TE
+ smlatb_4 = "e10000a0NMSD", -- v5TE
+ smlabt_4 = "e10000c0NMSD", -- v5TE
+ smlatt_4 = "e10000e0NMSD", -- v5TE
+ smlawb_4 = "e1200080NMSD", -- v5TE
+ smulwb_3 = "e12000a0NMS", -- v5TE
+ smlawt_4 = "e12000c0NMSD", -- v5TE
+ smulwt_3 = "e12000e0NMS", -- v5TE
+ smlalbb_4 = "e1400080NMSD", -- v5TE
+ smlaltb_4 = "e14000a0NMSD", -- v5TE
+ smlalbt_4 = "e14000c0NMSD", -- v5TE
+ smlaltt_4 = "e14000e0NMSD", -- v5TE
+ smulbb_3 = "e1600080NMS", -- v5TE
+ smultb_3 = "e16000a0NMS", -- v5TE
+ smulbt_3 = "e16000c0NMS", -- v5TE
+ smultt_3 = "e16000e0NMS", -- v5TE
+
+ -- Miscellaneous data processing instructions.
+ clz_2 = "e16f0f10DM", -- v5T
+ rev_2 = "e6bf0f30DM", -- v6
+ rev16_2 = "e6bf0fb0DM", -- v6
+ revsh_2 = "e6ff0fb0DM", -- v6
+ sel_3 = "e6800fb0DNM", -- v6
+ usad8_3 = "e780f010NMS", -- v6
+ usada8_4 = "e7800010NMSD", -- v6
+ rbit_2 = "e6ff0f30DM", -- v6T2
+ movw_2 = "e3000000DW", -- v6T2
+ movt_2 = "e3400000DW", -- v6T2
+ -- Note: the X encodes width-1, not width.
+ sbfx_4 = "e7a00050DMvX", -- v6T2
+ ubfx_4 = "e7e00050DMvX", -- v6T2
+ -- Note: the X encodes the msb field, not the width.
+ bfc_3 = "e7c0001fDvX", -- v6T2
+ bfi_4 = "e7c00010DMvX", -- v6T2
+
+ -- Packing and unpacking instructions.
+ pkhbt_3 = "e6800010DNM", pkhbt_4 = "e6800010DNMv", -- v6
+ pkhtb_3 = "e6800050DNM", pkhtb_4 = "e6800050DNMv", -- v6
+ sxtab_3 = "e6a00070DNM", sxtab_4 = "e6a00070DNMv", -- v6
+ sxtab16_3 = "e6800070DNM", sxtab16_4 = "e6800070DNMv", -- v6
+ sxtah_3 = "e6b00070DNM", sxtah_4 = "e6b00070DNMv", -- v6
+ sxtb_2 = "e6af0070DM", sxtb_3 = "e6af0070DMv", -- v6
+ sxtb16_2 = "e68f0070DM", sxtb16_3 = "e68f0070DMv", -- v6
+ sxth_2 = "e6bf0070DM", sxth_3 = "e6bf0070DMv", -- v6
+ uxtab_3 = "e6e00070DNM", uxtab_4 = "e6e00070DNMv", -- v6
+ uxtab16_3 = "e6c00070DNM", uxtab16_4 = "e6c00070DNMv", -- v6
+ uxtah_3 = "e6f00070DNM", uxtah_4 = "e6f00070DNMv", -- v6
+ uxtb_2 = "e6ef0070DM", uxtb_3 = "e6ef0070DMv", -- v6
+ uxtb16_2 = "e6cf0070DM", uxtb16_3 = "e6cf0070DMv", -- v6
+ uxth_2 = "e6ff0070DM", uxth_3 = "e6ff0070DMv", -- v6
+
+ -- Saturating instructions.
+ qadd_3 = "e1000050DMN", -- v5TE
+ qsub_3 = "e1200050DMN", -- v5TE
+ qdadd_3 = "e1400050DMN", -- v5TE
+ qdsub_3 = "e1600050DMN", -- v5TE
+ -- Note: the X for ssat* encodes sat_imm-1, not sat_imm.
+ ssat_3 = "e6a00010DXM", ssat_4 = "e6a00010DXMp", -- v6
+ usat_3 = "e6e00010DXM", usat_4 = "e6e00010DXMp", -- v6
+ ssat16_3 = "e6a00f30DXM", -- v6
+ usat16_3 = "e6e00f30DXM", -- v6
+
+ -- Parallel addition and subtraction.
+ sadd16_3 = "e6100f10DNM", -- v6
+ sasx_3 = "e6100f30DNM", -- v6
+ ssax_3 = "e6100f50DNM", -- v6
+ ssub16_3 = "e6100f70DNM", -- v6
+ sadd8_3 = "e6100f90DNM", -- v6
+ ssub8_3 = "e6100ff0DNM", -- v6
+ qadd16_3 = "e6200f10DNM", -- v6
+ qasx_3 = "e6200f30DNM", -- v6
+ qsax_3 = "e6200f50DNM", -- v6
+ qsub16_3 = "e6200f70DNM", -- v6
+ qadd8_3 = "e6200f90DNM", -- v6
+ qsub8_3 = "e6200ff0DNM", -- v6
+ shadd16_3 = "e6300f10DNM", -- v6
+ shasx_3 = "e6300f30DNM", -- v6
+ shsax_3 = "e6300f50DNM", -- v6
+ shsub16_3 = "e6300f70DNM", -- v6
+ shadd8_3 = "e6300f90DNM", -- v6
+ shsub8_3 = "e6300ff0DNM", -- v6
+ uadd16_3 = "e6500f10DNM", -- v6
+ uasx_3 = "e6500f30DNM", -- v6
+ usax_3 = "e6500f50DNM", -- v6
+ usub16_3 = "e6500f70DNM", -- v6
+ uadd8_3 = "e6500f90DNM", -- v6
+ usub8_3 = "e6500ff0DNM", -- v6
+ uqadd16_3 = "e6600f10DNM", -- v6
+ uqasx_3 = "e6600f30DNM", -- v6
+ uqsax_3 = "e6600f50DNM", -- v6
+ uqsub16_3 = "e6600f70DNM", -- v6
+ uqadd8_3 = "e6600f90DNM", -- v6
+ uqsub8_3 = "e6600ff0DNM", -- v6
+ uhadd16_3 = "e6700f10DNM", -- v6
+ uhasx_3 = "e6700f30DNM", -- v6
+ uhsax_3 = "e6700f50DNM", -- v6
+ uhsub16_3 = "e6700f70DNM", -- v6
+ uhadd8_3 = "e6700f90DNM", -- v6
+ uhsub8_3 = "e6700ff0DNM", -- v6
+
+ -- Load/store instructions.
+ str_2 = "e4000000DL", str_3 = "e4000000DL", str_4 = "e4000000DL",
+ strb_2 = "e4400000DL", strb_3 = "e4400000DL", strb_4 = "e4400000DL",
+ ldr_2 = "e4100000DL", ldr_3 = "e4100000DL", ldr_4 = "e4100000DL",
+ ldrb_2 = "e4500000DL", ldrb_3 = "e4500000DL", ldrb_4 = "e4500000DL",
+ strh_2 = "e00000b0DL", strh_3 = "e00000b0DL",
+ ldrh_2 = "e01000b0DL", ldrh_3 = "e01000b0DL",
+ ldrd_2 = "e00000d0DL", ldrd_3 = "e00000d0DL", -- v5TE
+ ldrsb_2 = "e01000d0DL", ldrsb_3 = "e01000d0DL",
+ strd_2 = "e00000f0DL", strd_3 = "e00000f0DL", -- v5TE
+ ldrsh_2 = "e01000f0DL", ldrsh_3 = "e01000f0DL",
+
+ ldm_2 = "e8900000oR", ldmia_2 = "e8900000oR", ldmfd_2 = "e8900000oR",
+ ldmda_2 = "e8100000oR", ldmfa_2 = "e8100000oR",
+ ldmdb_2 = "e9100000oR", ldmea_2 = "e9100000oR",
+ ldmib_2 = "e9900000oR", ldmed_2 = "e9900000oR",
+ stm_2 = "e8800000oR", stmia_2 = "e8800000oR", stmfd_2 = "e8800000oR",
+ stmda_2 = "e8000000oR", stmfa_2 = "e8000000oR",
+ stmdb_2 = "e9000000oR", stmea_2 = "e9000000oR",
+ stmib_2 = "e9800000oR", stmed_2 = "e9800000oR",
+ pop_1 = "e8bd0000R", push_1 = "e92d0000R",
+
+ -- Branch instructions.
+ b_1 = "ea000000B",
+ bl_1 = "eb000000B",
+ blx_1 = "e12fff30C",
+ bx_1 = "e12fff10M",
+
+ -- Miscellaneous instructions.
+ nop_0 = "e1a00000",
+ mrs_1 = "e10f0000D",
+ bkpt_1 = "e1200070K", -- v5T
+ svc_1 = "ef000000T", swi_1 = "ef000000T",
+ ud_0 = "e7f001f0",
+
+ -- VFP instructions.
+ ["vadd.f32_3"] = "ee300a00dnm",
+ ["vadd.f64_3"] = "ee300b00Gdnm",
+ ["vsub.f32_3"] = "ee300a40dnm",
+ ["vsub.f64_3"] = "ee300b40Gdnm",
+ ["vmul.f32_3"] = "ee200a00dnm",
+ ["vmul.f64_3"] = "ee200b00Gdnm",
+ ["vnmul.f32_3"] = "ee200a40dnm",
+ ["vnmul.f64_3"] = "ee200b40Gdnm",
+ ["vmla.f32_3"] = "ee000a00dnm",
+ ["vmla.f64_3"] = "ee000b00Gdnm",
+ ["vmls.f32_3"] = "ee000a40dnm",
+ ["vmls.f64_3"] = "ee000b40Gdnm",
+ ["vnmla.f32_3"] = "ee100a40dnm",
+ ["vnmla.f64_3"] = "ee100b40Gdnm",
+ ["vnmls.f32_3"] = "ee100a00dnm",
+ ["vnmls.f64_3"] = "ee100b00Gdnm",
+ ["vdiv.f32_3"] = "ee800a00dnm",
+ ["vdiv.f64_3"] = "ee800b00Gdnm",
+
+ ["vabs.f32_2"] = "eeb00ac0dm",
+ ["vabs.f64_2"] = "eeb00bc0Gdm",
+ ["vneg.f32_2"] = "eeb10a40dm",
+ ["vneg.f64_2"] = "eeb10b40Gdm",
+ ["vsqrt.f32_2"] = "eeb10ac0dm",
+ ["vsqrt.f64_2"] = "eeb10bc0Gdm",
+ ["vcmp.f32_2"] = "eeb40a40dm",
+ ["vcmp.f64_2"] = "eeb40b40Gdm",
+ ["vcmpe.f32_2"] = "eeb40ac0dm",
+ ["vcmpe.f64_2"] = "eeb40bc0Gdm",
+ ["vcmpz.f32_1"] = "eeb50a40d",
+ ["vcmpz.f64_1"] = "eeb50b40Gd",
+ ["vcmpze.f32_1"] = "eeb50ac0d",
+ ["vcmpze.f64_1"] = "eeb50bc0Gd",
+
+ vldr_2 = "ed100a00dl|ed100b00Gdl",
+ vstr_2 = "ed000a00dl|ed000b00Gdl",
+ vldm_2 = "ec900a00or",
+ vldmia_2 = "ec900a00or",
+ vldmdb_2 = "ed100a00or",
+ vpop_1 = "ecbd0a00r",
+ vstm_2 = "ec800a00or",
+ vstmia_2 = "ec800a00or",
+ vstmdb_2 = "ed000a00or",
+ vpush_1 = "ed2d0a00r",
+
+ ["vmov.f32_2"] = "eeb00a40dm|eeb00a00dY", -- #imm is VFPv3 only
+ ["vmov.f64_2"] = "eeb00b40Gdm|eeb00b00GdY", -- #imm is VFPv3 only
+ vmov_2 = "ee100a10Dn|ee000a10nD",
+ vmov_3 = "ec500a10DNm|ec400a10mDN|ec500b10GDNm|ec400b10GmDN",
+
+ vmrs_0 = "eef1fa10",
+ vmrs_1 = "eef10a10D",
+ vmsr_1 = "eee10a10D",
+
+ ["vcvt.s32.f32_2"] = "eebd0ac0dm",
+ ["vcvt.s32.f64_2"] = "eebd0bc0dGm",
+ ["vcvt.u32.f32_2"] = "eebc0ac0dm",
+ ["vcvt.u32.f64_2"] = "eebc0bc0dGm",
+ ["vcvtr.s32.f32_2"] = "eebd0a40dm",
+ ["vcvtr.s32.f64_2"] = "eebd0b40dGm",
+ ["vcvtr.u32.f32_2"] = "eebc0a40dm",
+ ["vcvtr.u32.f64_2"] = "eebc0b40dGm",
+ ["vcvt.f32.s32_2"] = "eeb80ac0dm",
+ ["vcvt.f64.s32_2"] = "eeb80bc0GdFm",
+ ["vcvt.f32.u32_2"] = "eeb80a40dm",
+ ["vcvt.f64.u32_2"] = "eeb80b40GdFm",
+ ["vcvt.f32.f64_2"] = "eeb70bc0dGm",
+ ["vcvt.f64.f32_2"] = "eeb70ac0GdFm",
+
+ -- VFPv4 only:
+ ["vfma.f32_3"] = "eea00a00dnm",
+ ["vfma.f64_3"] = "eea00b00Gdnm",
+ ["vfms.f32_3"] = "eea00a40dnm",
+ ["vfms.f64_3"] = "eea00b40Gdnm",
+ ["vfnma.f32_3"] = "ee900a40dnm",
+ ["vfnma.f64_3"] = "ee900b40Gdnm",
+ ["vfnms.f32_3"] = "ee900a00dnm",
+ ["vfnms.f64_3"] = "ee900b00Gdnm",
+
+ -- NYI: Advanced SIMD instructions.
+
+ -- NYI: I have no need for these instructions right now:
+ -- swp, swpb, strex, ldrex, strexd, ldrexd, strexb, ldrexb, strexh, ldrexh
+ -- msr, nopv6, yield, wfe, wfi, sev, dbg, bxj, smc, srs, rfe
+ -- cps, setend, pli, pld, pldw, clrex, dsb, dmb, isb
+ -- stc, ldc, mcr, mcr2, mrc, mrc2, mcrr, mcrr2, mrrc, mrrc2, cdp, cdp2
+}
+
+-- Add mnemonics for "s" variants.
+do
+ local t = {}
+ for k,v in pairs(map_op) do
+ if sub(v, -1) == "s" then
+ local v2 = sub(v, 1, 2)..char(byte(v, 3)+1)..sub(v, 4, -2)
+ t[sub(k, 1, -3).."s"..sub(k, -2)] = v2
+ end
+ end
+ for k,v in pairs(t) do
+ map_op[k] = v
+ end
+end
+
+------------------------------------------------------------------------------
+
+local function parse_gpr(expr)
+ local tname, ovreg = match(expr, "^([%w_]+):(r1?[0-9])$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local r = match(expr, "^r(1?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 15 then return r, tp end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_gpr_pm(expr)
+ local pm, expr2 = match(expr, "^([+-]?)(.*)$")
+ return parse_gpr(expr2), (pm == "-")
+end
+
+local function parse_vr(expr, tp)
+ local t, r = match(expr, "^([sd])([0-9]+)$")
+ if t == tp then
+ r = tonumber(r)
+ if r <= 31 then
+ if t == "s" then return shr(r, 1), band(r, 1) end
+ return band(r, 15), shr(r, 4)
+ end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_reglist(reglist)
+ reglist = match(reglist, "^{%s*([^}]*)}$")
+ if not reglist then werror("register list expected") end
+ local rr = 0
+ for p in gmatch(reglist..",", "%s*([^,]*),") do
+ local rbit = shl(1, parse_gpr(gsub(p, "%s+$", "")))
+ if band(rr, rbit) ~= 0 then
+ werror("duplicate register `"..p.."'")
+ end
+ rr = rr + rbit
+ end
+ return rr
+end
+
+local function parse_vrlist(reglist)
+ local ta, ra, tb, rb = match(reglist,
+ "^{%s*([sd])([0-9]+)%s*%-%s*([sd])([0-9]+)%s*}$")
+ ra, rb = tonumber(ra), tonumber(rb)
+ if ta and ta == tb and ra and rb and ra <= 31 and rb <= 31 and ra <= rb then
+ local nr = rb+1 - ra
+ if ta == "s" then
+ return shl(shr(ra,1),12)+shl(band(ra,1),22) + nr
+ else
+ return shl(band(ra,15),12)+shl(shr(ra,4),22) + nr*2 + 0x100
+ end
+ end
+ werror("register list expected")
+end
+
+local function parse_imm(imm, bits, shift, scale, signed)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = tonumber(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
+ return 0
+ end
+end
+
+local function parse_imm12(imm)
+ local n = tonumber(imm)
+ if n then
+ local m = band(n)
+ for i=0,-15,-1 do
+ if shr(m, 8) == 0 then return m + shl(band(i, 15), 8) end
+ m = ror(m, 2)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM12", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm16(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = tonumber(imm)
+ if n then
+ if shr(n, 16) == 0 then return band(n, 0x0fff) + shl(band(n, 0xf000), 4) end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM16", 32*16, imm)
+ return 0
+ end
+end
+
+local function parse_imm_load(imm, ext)
+ local n = tonumber(imm)
+ if n then
+ if ext then
+ if n >= -255 and n <= 255 then
+ local up = 0x00800000
+ if n < 0 then n = -n; up = 0 end
+ return shl(band(n, 0xf0), 4) + band(n, 0x0f) + up
+ end
+ else
+ if n >= -4095 and n <= 4095 then
+ if n >= 0 then return n+0x00800000 end
+ return -n
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction(ext and "IMML8" or "IMML12", 32768 + shl(ext and 8 or 12, 5), imm)
+ return 0
+ end
+end
+
+local function parse_shift(shift, gprok)
+ if shift == "rrx" then
+ return 3 * 32
+ else
+ local s, s2 = match(shift, "^(%S+)%s*(.*)$")
+ s = map_shift[s]
+ if not s then werror("expected shift operand") end
+ if sub(s2, 1, 1) == "#" then
+ return parse_imm(s2, 5, 7, 0, false) + shl(s, 5)
+ else
+ if not gprok then werror("expected immediate shift operand") end
+ return shl(parse_gpr(s2), 8) + shl(s, 5) + 16
+ end
+ end
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+local function parse_load(params, nparams, n, op)
+ local oplo = band(op, 255)
+ local ext, ldrd = (oplo ~= 0), (oplo == 208)
+ local d
+ if (ldrd or oplo == 240) then
+ d = band(shr(op, 12), 15)
+ if band(d, 1) ~= 0 then werror("odd destination register") end
+ end
+ local pn = params[n]
+ local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
+ local p2 = params[n+1]
+ if not p1 then
+ if not p2 then
+ if match(pn, "^[<>=%-]") or match(pn, "^extern%s+") then
+ local mode, n, s = parse_label(pn, false)
+ waction("REL_"..mode, n + (ext and 0x1800 or 0x0800), s, 1)
+ return op + 15 * 65536 + 0x01000000 + (ext and 0x00400000 or 0)
+ end
+ local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local d, tp = parse_gpr(reg)
+ if tp then
+ waction(ext and "IMML8" or "IMML12", 32768 + 32*(ext and 8 or 12),
+ format(tp.ctypefmt, tailr))
+ return op + shl(d, 16) + 0x01000000 + (ext and 0x00400000 or 0)
+ end
+ end
+ end
+ werror("expected address operand")
+ end
+ if wb == "!" then op = op + 0x00200000 end
+ if p2 then
+ if wb == "!" then werror("bad use of '!'") end
+ local p3 = params[n+2]
+ op = op + shl(parse_gpr(p1), 16)
+ local imm = match(p2, "^#(.*)$")
+ if imm then
+ local m = parse_imm_load(imm, ext)
+ if p3 then werror("too many parameters") end
+ op = op + m + (ext and 0x00400000 or 0)
+ else
+ local m, neg = parse_gpr_pm(p2)
+ if ldrd and (m == d or m-1 == d) then werror("register conflict") end
+ op = op + m + (neg and 0 or 0x00800000) + (ext and 0 or 0x02000000)
+ if p3 then op = op + parse_shift(p3) end
+ end
+ else
+ local p1a, p2 = match(p1, "^([^,%s]*)%s*(.*)$")
+ op = op + shl(parse_gpr(p1a), 16) + 0x01000000
+ if p2 ~= "" then
+ local imm = match(p2, "^,%s*#(.*)$")
+ if imm then
+ local m = parse_imm_load(imm, ext)
+ op = op + m + (ext and 0x00400000 or 0)
+ else
+ local p2a, p3 = match(p2, "^,%s*([^,%s]*)%s*,?%s*(.*)$")
+ local m, neg = parse_gpr_pm(p2a)
+ if ldrd and (m == d or m-1 == d) then werror("register conflict") end
+ op = op + m + (neg and 0 or 0x00800000) + (ext and 0 or 0x02000000)
+ if p3 ~= "" then
+ if ext then werror("too many parameters") end
+ op = op + parse_shift(p3)
+ end
+ end
+ else
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + (ext and 0x00c00000 or 0x00800000)
+ end
+ end
+ return op
+end
+
+local function parse_vload(q)
+ local reg, imm = match(q, "^%[%s*([^,%s]*)%s*(.*)%]$")
+ if reg then
+ local d = shl(parse_gpr(reg), 16)
+ if imm == "" then return d end
+ imm = match(imm, "^,%s*#(.*)$")
+ if imm then
+ local n = tonumber(imm)
+ if n then
+ if n >= -1020 and n <= 1020 and n%4 == 0 then
+ return d + (n >= 0 and n/4+0x00800000 or -n/4)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMMV8", 32768 + 32*8, imm)
+ return d
+ end
+ end
+ else
+ if match(q, "^[<>=%-]") or match(q, "^extern%s+") then
+ local mode, n, s = parse_label(q, false)
+ waction("REL_"..mode, n + 0x2800, s, 1)
+ return 15 * 65536
+ end
+ local reg, tailr = match(q, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local d, tp = parse_gpr(reg)
+ if tp then
+ waction("IMMV8", 32768 + 32*8, format(tp.ctypefmt, tailr))
+ return shl(d, 16)
+ end
+ end
+ end
+ werror("expected address operand")
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+local function parse_template(params, template, nparams, pos)
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n = 1
+ local vr = "s"
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ local q = params[n]
+ if p == "D" then
+ op = op + shl(parse_gpr(q), 12); n = n + 1
+ elseif p == "N" then
+ op = op + shl(parse_gpr(q), 16); n = n + 1
+ elseif p == "S" then
+ op = op + shl(parse_gpr(q), 8); n = n + 1
+ elseif p == "M" then
+ op = op + parse_gpr(q); n = n + 1
+ elseif p == "d" then
+ local r,h = parse_vr(q, vr); op = op+shl(r,12)+shl(h,22); n = n + 1
+ elseif p == "n" then
+ local r,h = parse_vr(q, vr); op = op+shl(r,16)+shl(h,7); n = n + 1
+ elseif p == "m" then
+ local r,h = parse_vr(q, vr); op = op+r+shl(h,5); n = n + 1
+ elseif p == "P" then
+ local imm = match(q, "^#(.*)$")
+ if imm then
+ op = op + parse_imm12(imm) + 0x02000000
+ else
+ op = op + parse_gpr(q)
+ end
+ n = n + 1
+ elseif p == "p" then
+ op = op + parse_shift(q, true); n = n + 1
+ elseif p == "L" then
+ op = parse_load(params, nparams, n, op)
+ elseif p == "l" then
+ op = op + parse_vload(q)
+ elseif p == "B" then
+ local mode, n, s = parse_label(q, false)
+ waction("REL_"..mode, n, s, 1)
+ elseif p == "C" then -- blx gpr vs. blx label.
+ if match(q, "^([%w_]+):(r1?[0-9])$") or match(q, "^r(1?[0-9])$") then
+ op = op + parse_gpr(q)
+ else
+ if op < 0xe0000000 then werror("unconditional instruction") end
+ local mode, n, s = parse_label(q, false)
+ waction("REL_"..mode, n, s, 1)
+ op = 0xfa000000
+ end
+ elseif p == "F" then
+ vr = "s"
+ elseif p == "G" then
+ vr = "d"
+ elseif p == "o" then
+ local r, wb = match(q, "^([^!]*)(!?)$")
+ op = op + shl(parse_gpr(r), 16) + (wb == "!" and 0x00200000 or 0)
+ n = n + 1
+ elseif p == "R" then
+ op = op + parse_reglist(q); n = n + 1
+ elseif p == "r" then
+ op = op + parse_vrlist(q); n = n + 1
+ elseif p == "W" then
+ op = op + parse_imm16(q); n = n + 1
+ elseif p == "v" then
+ op = op + parse_imm(q, 5, 7, 0, false); n = n + 1
+ elseif p == "w" then
+ local imm = match(q, "^#(.*)$")
+ if imm then
+ op = op + parse_imm(q, 5, 7, 0, false); n = n + 1
+ else
+ op = op + shl(parse_gpr(q), 8) + 16
+ end
+ elseif p == "X" then
+ op = op + parse_imm(q, 5, 16, 0, false); n = n + 1
+ elseif p == "Y" then
+ local imm = tonumber(match(q, "^#(.*)$")); n = n + 1
+ if not imm or shr(imm, 8) ~= 0 then
+ werror("bad immediate operand")
+ end
+ op = op + shl(band(imm, 0xf0), 12) + band(imm, 0x0f)
+ elseif p == "K" then
+ local imm = tonumber(match(q, "^#(.*)$")); n = n + 1
+ if not imm or shr(imm, 16) ~= 0 then
+ werror("bad immediate operand")
+ end
+ op = op + shl(band(imm, 0xfff0), 4) + band(imm, 0x000f)
+ elseif p == "T" then
+ op = op + parse_imm(q, 24, 0, 0, false); n = n + 1
+ elseif p == "s" then
+ -- Ignored.
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+map_op[".template__"] = function(params, template, nparams)
+ if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 3 positions.
+ if secpos+3 > maxsecpos then wflush() end
+ local pos = wpos()
+ local lpos, apos, spos = #actlist, #actargs, secpos
+
+ local ok, err
+ for t in gmatch(template, "[^|]+") do
+ ok, err = pcall(parse_template, params, t, nparams, pos)
+ if ok then return end
+ secpos = spos
+ actlist[lpos+1] = nil
+ actlist[lpos+2] = nil
+ actlist[lpos+3] = nil
+ actargs[apos+1] = nil
+ actargs[apos+2] = nil
+ actargs[apos+3] = nil
+ end
+ error(err, 0)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = function(t, k)
+ local v = map_coreop[k]
+ if v then return v end
+ local k1, cc, k2 = match(k, "^(.-)(..)([._].*)$")
+ local cv = map_cond[cc]
+ if cv then
+ local v = rawget(t, k1..k2)
+ if type(v) == "string" then
+ local scv = format("%x", cv)
+ return gsub(scv..sub(v, 2), "|e", "|"..scv)
+ end
+ end
+ end })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_arm64.h b/ext/opcache/jit/dynasm/dasm_arm64.h
new file mode 100644
index 0000000000..d64e60a3e6
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm64.h
@@ -0,0 +1,518 @@
+/*
+** DynASM ARM64 encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "arm64"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC,
+ DASM_IMM, DASM_IMM6, DASM_IMM12, DASM_IMM13W, DASM_IMM13X, DASM_IMML,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+static int dasm_imm12(unsigned int n)
+{
+ if ((n >> 12) == 0)
+ return n;
+ else if ((n & 0xff000fff) == 0)
+ return (n >> 12) | 0x1000;
+ else
+ return -1;
+}
+
+static int dasm_ffs(unsigned long long x)
+{
+ int n = -1;
+ while (x) { x >>= 1; n++; }
+ return n;
+}
+
+static int dasm_imm13(int lo, int hi)
+{
+ int inv = 0, w = 64, s = 0xfff, xa, xb;
+ unsigned long long n = (((unsigned long long)hi) << 32) | (unsigned int)lo;
+ unsigned long long m = 1ULL, a, b, c;
+ if (n & 1) { n = ~n; inv = 1; }
+ a = n & -n; b = (n+a)&-(n+a); c = (n+a-b)&-(n+a-b);
+ xa = dasm_ffs(a); xb = dasm_ffs(b);
+ if (c) {
+ w = dasm_ffs(c) - xa;
+ if (w == 32) m = 0x0000000100000001UL;
+ else if (w == 16) m = 0x0001000100010001UL;
+ else if (w == 8) m = 0x0101010101010101UL;
+ else if (w == 4) m = 0x1111111111111111UL;
+ else if (w == 2) m = 0x5555555555555555UL;
+ else return -1;
+ s = (-2*w & 0x3f) - 1;
+ } else if (!a) {
+ return -1;
+ } else if (xb == -1) {
+ xb = 64;
+ }
+ if ((b-a) * m != n) return -1;
+ if (inv) {
+ return ((w - xb) << 6) | (s+w+xa-xb);
+ } else {
+ return ((w - xa) << 6) | (s+xb-xa);
+ }
+ return -1;
+}
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM:
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+ n >>= ((ins>>10)&31);
+#ifdef DASM_CHECKS
+ if ((ins & 0x8000))
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ case DASM_IMM6:
+ CK((n >> 6) == 0, RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM12:
+ CK(dasm_imm12((unsigned int)n) != -1, RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM13W:
+ CK(dasm_imm13(n, n) != -1, RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM13X: {
+ int m = va_arg(ap, int);
+ CK(dasm_imm13(n, m) != -1, RANGE_I);
+ b[pos++] = n;
+ b[pos++] = m;
+ break;
+ }
+ case DASM_IMML: {
+#ifdef DASM_CHECKS
+ int scale = (p[-2] >> 30);
+ CK((!(n & ((1<<scale)-1)) && (unsigned int)(n>>scale) < 4096) ||
+ (unsigned int)(n+256) < 512, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMM6: case DASM_IMM12: case DASM_IMM13W:
+ case DASM_IMML: pos++; break;
+ case DASM_IMM13X: pos += 2; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins&2047), !(ins&2048));
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) + 4;
+ patchrel:
+ if (!(ins & 0xf800)) { /* B, BL */
+ CK((n & 3) == 0 && ((n+0x08000000) >> 28) == 0, RANGE_REL);
+ cp[-1] |= ((n >> 2) & 0x03ffffff);
+ } else if ((ins & 0x800)) { /* B.cond, CBZ, CBNZ, LDR* literal */
+ CK((n & 3) == 0 && ((n+0x00100000) >> 21) == 0, RANGE_REL);
+ cp[-1] |= ((n << 3) & 0x00ffffe0);
+ } else if ((ins & 0x3000) == 0x2000) { /* ADR */
+ CK(((n+0x00100000) >> 21) == 0, RANGE_REL);
+ cp[-1] |= ((n << 3) & 0x00ffffe0) | ((n & 3) << 29);
+ } else if ((ins & 0x3000) == 0x3000) { /* ADRP */
+ cp[-1] |= ((n >> 9) & 0x00ffffe0) | (((n >> 12) & 3) << 29);
+ } else if ((ins & 0x1000)) { /* TBZ, TBNZ */
+ CK((n & 3) == 0 && ((n+0x00008000) >> 16) == 0, RANGE_REL);
+ cp[-1] |= ((n << 3) & 0x0007ffe0);
+ }
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMM:
+ cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ case DASM_IMM6:
+ cp[-1] |= ((n&31) << 19) | ((n&32) << 26);
+ break;
+ case DASM_IMM12:
+ cp[-1] |= (dasm_imm12((unsigned int)n) << 10);
+ break;
+ case DASM_IMM13W:
+ cp[-1] |= (dasm_imm13(n, n) << 10);
+ break;
+ case DASM_IMM13X:
+ cp[-1] |= (dasm_imm13(n, *b++) << 10);
+ break;
+ case DASM_IMML: {
+ int scale = (p[-2] >> 30);
+ cp[-1] |= (!(n & ((1<<scale)-1)) && (unsigned int)(n>>scale) < 4096) ?
+ ((n << (10-scale)) | 0x01000000) : ((n & 511) << 12);
+ break;
+ }
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_arm64.lua b/ext/opcache/jit/dynasm/dasm_arm64.lua
new file mode 100644
index 0000000000..4a7d8dfeeb
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm64.lua
@@ -0,0 +1,1166 @@
+------------------------------------------------------------------------------
+-- DynASM ARM64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+-- Module information:
+local _info = {
+ arch = "arm",
+ description = "DynASM ARM64 module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable, rawget = assert, setmetatable, rawget
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch, gsub = _s.match, _s.gmatch, _s.gsub
+local concat, sort, insert = table.concat, table.sort, table.insert
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local ror, tohex = bit.ror, bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMM6", "IMM12", "IMM13W", "IMM13X", "IMML",
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n <= 0x000fffff then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ if n <= 0x000fffff then
+ insert(actlist, pos+1, n)
+ n = map_action.ESC * 0x10000
+ end
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+
+-- Ext. register name -> int. name.
+local map_archdef = { xzr = "@x31", wzr = "@w31", lr = "x30", }
+
+-- Int. register name -> ext. name.
+local map_reg_rev = { ["@x31"] = "xzr", ["@w31"] = "wzr", x30 = "lr", }
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ return map_reg_rev[s] or s
+end
+
+local map_shift = { lsl = 0, lsr = 1, asr = 2, }
+
+local map_extend = {
+ uxtb = 0, uxth = 1, uxtw = 2, uxtx = 3,
+ sxtb = 4, sxth = 5, sxtw = 6, sxtx = 7,
+}
+
+local map_cond = {
+ eq = 0, ne = 1, cs = 2, cc = 3, mi = 4, pl = 5, vs = 6, vc = 7,
+ hi = 8, ls = 9, ge = 10, lt = 11, gt = 12, le = 13, al = 14,
+ hs = 2, lo = 3,
+}
+
+------------------------------------------------------------------------------
+
+local parse_reg_type
+
+local function parse_reg(expr)
+ if not expr then werror("expected register name") end
+ local tname, ovreg = match(expr, "^([%w_]+):(@?%l%d+)$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local ok31, rt, r = match(expr, "^(@?)([xwqdshb])([123]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 30 or (r == 31 and ok31 ~= "" or (rt ~= "w" and rt ~= "x")) then
+ if not parse_reg_type then
+ parse_reg_type = rt
+ elseif parse_reg_type ~= rt then
+ werror("register size mismatch")
+ end
+ return r, tp
+ end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_reg_base(expr)
+ if expr == "sp" then return 0x3e0 end
+ local base, tp = parse_reg(expr)
+ if parse_reg_type ~= "x" then werror("bad register type") end
+ parse_reg_type = false
+ return shl(base, 5), tp
+end
+
+local parse_ctx = {}
+
+local loadenv = setfenv and function(s)
+ local code = loadstring(s, "")
+ if code then setfenv(code, parse_ctx) end
+ return code
+end or function(s)
+ return load(s, "", nil, parse_ctx)
+end
+
+-- Try to parse simple arithmetic, too, since some basic ops are aliases.
+local function parse_number(n)
+ local x = tonumber(n)
+ if x then return x end
+ local code = loadenv("return "..n)
+ if code then
+ local ok, y = pcall(code)
+ if ok then return y end
+ end
+ return nil
+end
+
+local function parse_imm(imm, bits, shift, scale, signed)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
+ return 0
+ end
+end
+
+local function parse_imm12(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ if shr(n, 12) == 0 then
+ return shl(n, 10)
+ elseif band(n, 0xff000fff) == 0 then
+ return shr(n, 2) + 0x00400000
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM12", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm13(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ local r64 = parse_reg_type == "x"
+ if n and n % 1 == 0 and n >= 0 and n <= 0xffffffff then
+ local inv = false
+ if band(n, 1) == 1 then n = bit.bnot(n); inv = true end
+ local t = {}
+ for i=1,32 do t[i] = band(n, 1); n = shr(n, 1) end
+ local b = table.concat(t)
+ b = b..(r64 and (inv and "1" or "0"):rep(32) or b)
+ local p0, p1, p0a, p1a = b:match("^(0+)(1+)(0*)(1*)")
+ if p0 then
+ local w = p1a == "" and (r64 and 64 or 32) or #p1+#p0a
+ if band(w, w-1) == 0 and b == b:sub(1, w):rep(64/w) then
+ local s = band(-2*w, 0x3f) - 1
+ if w == 64 then s = s + 0x1000 end
+ if inv then
+ return shl(w-#p1-#p0, 16) + shl(s+w-#p1, 10)
+ else
+ return shl(w-#p0, 16) + shl(s+#p1, 10)
+ end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif r64 then
+ waction("IMM13X", 0, format("(unsigned int)(%s)", imm))
+ actargs[#actargs+1] = format("(unsigned int)((unsigned long long)(%s)>>32)", imm)
+ return 0
+ else
+ waction("IMM13W", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm6(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ if n >= 0 and n <= 63 then
+ return shl(band(n, 0x1f), 19) + (n >= 32 and 0x80000000 or 0)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM6", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm_load(imm, scale)
+ local n = parse_number(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n and m >= 0 and m < 0x1000 then
+ return shl(m, 10) + 0x01000000 -- Scaled, unsigned 12 bit offset.
+ elseif n >= -256 and n < 256 then
+ return shl(band(n, 511), 12) -- Unscaled, signed 9 bit offset.
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMML", 0, imm)
+ return 0
+ end
+end
+
+local function parse_fpimm(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ local m, e = math.frexp(n)
+ local s, e2 = 0, band(e-2, 7)
+ if m < 0 then m = -m; s = 0x00100000 end
+ m = m*32-16
+ if m % 1 == 0 and m >= 0 and m <= 15 and sar(shl(e2, 29), 29)+2 == e then
+ return s + shl(e2, 17) + shl(m, 13)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ werror("NYI fpimm action")
+ end
+end
+
+local function parse_shift(expr)
+ local s, s2 = match(expr, "^(%S+)%s*(.*)$")
+ s = map_shift[s]
+ if not s then werror("expected shift operand") end
+ return parse_imm(s2, 6, 10, 0, false) + shl(s, 22)
+end
+
+local function parse_lslx16(expr)
+ local n = match(expr, "^lsl%s*#(%d+)$")
+ n = tonumber(n)
+ if not n then werror("expected shift operand") end
+ if band(n, parse_reg_type == "x" and 0xffffffcf or 0xffffffef) ~= 0 then
+ werror("bad shift amount")
+ end
+ return shl(n, 17)
+end
+
+local function parse_extend(expr)
+ local s, s2 = match(expr, "^(%S+)%s*(.*)$")
+ if s == "lsl" then
+ s = parse_reg_type == "x" and 3 or 2
+ else
+ s = map_extend[s]
+ end
+ if not s then werror("expected extend operand") end
+ return (s2 == "" and 0 or parse_imm(s2, 3, 10, 0, false)) + shl(s, 13)
+end
+
+local function parse_cond(expr, inv)
+ local c = map_cond[expr]
+ if not c then werror("expected condition operand") end
+ return shl(bit.bxor(c, inv), 12)
+end
+
+local function parse_load(params, nparams, n, op)
+ if params[n+2] then werror("too many operands") end
+ local pn, p2 = params[n], params[n+1]
+ local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
+ if not p1 then
+ if not p2 then
+ local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local base, tp = parse_reg_base(reg)
+ if tp then
+ waction("IMML", 0, format(tp.ctypefmt, tailr))
+ return op + base
+ end
+ end
+ end
+ werror("expected address operand")
+ end
+ local scale = shr(op, 30)
+ if p2 then
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + parse_reg_base(p1) + parse_imm(p2, 9, 12, 0, true) + 0x400
+ elseif wb == "!" then
+ local p1a, p2a = match(p1, "^([^,%s]*)%s*,%s*(.*)$")
+ if not p1a then werror("bad use of '!'") end
+ op = op + parse_reg_base(p1a) + parse_imm(p2a, 9, 12, 0, true) + 0xc00
+ else
+ local p1a, p2a = match(p1, "^([^,%s]*)%s*(.*)$")
+ op = op + parse_reg_base(p1a)
+ if p2a ~= "" then
+ local imm = match(p2a, "^,%s*#(.*)$")
+ if imm then
+ op = op + parse_imm_load(imm, scale)
+ else
+ local p2b, p3b, p3s = match(p2a, "^,%s*([^,%s]*)%s*,?%s*(%S*)%s*(.*)$")
+ op = op + shl(parse_reg(p2b), 16) + 0x00200800
+ if parse_reg_type ~= "x" and parse_reg_type ~= "w" then
+ werror("bad index register type")
+ end
+ if p3b == "" then
+ if parse_reg_type ~= "x" then werror("bad index register type") end
+ op = op + 0x6000
+ else
+ if p3s == "" or p3s == "#0" then
+ elseif p3s == "#"..scale then
+ op = op + 0x1000
+ else
+ werror("bad scale")
+ end
+ if parse_reg_type == "x" then
+ if p3b == "lsl" and p3s ~= "" then op = op + 0x6000
+ elseif p3b == "sxtx" then op = op + 0xe000
+ else
+ werror("bad extend/shift specifier")
+ end
+ else
+ if p3b == "uxtw" then op = op + 0x4000
+ elseif p3b == "sxtw" then op = op + 0xc000
+ else
+ werror("bad extend/shift specifier")
+ end
+ end
+ end
+ end
+ else
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + 0x01000000
+ end
+ end
+ return op
+end
+
+local function parse_load_pair(params, nparams, n, op)
+ if params[n+2] then werror("too many operands") end
+ local pn, p2 = params[n], params[n+1]
+ local scale = shr(op, 30) == 0 and 2 or 3
+ local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
+ if not p1 then
+ if not p2 then
+ local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local base, tp = parse_reg_base(reg)
+ if tp then
+ waction("IMM", 32768+7*32+15+scale*1024, format(tp.ctypefmt, tailr))
+ return op + base + 0x01000000
+ end
+ end
+ end
+ werror("expected address operand")
+ end
+ if p2 then
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + 0x00800000
+ else
+ local p1a, p2a = match(p1, "^([^,%s]*)%s*,%s*(.*)$")
+ if p1a then p1, p2 = p1a, p2a else p2 = "#0" end
+ op = op + (wb == "!" and 0x01800000 or 0x01000000)
+ end
+ return op + parse_reg_base(p1) + parse_imm(p2, 7, 15, scale, true)
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+local function branch_type(op)
+ if band(op, 0x7c000000) == 0x14000000 then return 0 -- B, BL
+ elseif shr(op, 24) == 0x54 or band(op, 0x7e000000) == 0x34000000 or
+ band(op, 0x3b000000) == 0x18000000 then
+ return 0x800 -- B.cond, CBZ, CBNZ, LDR* literal
+ elseif band(op, 0x7e000000) == 0x36000000 then return 0x1000 -- TBZ, TBNZ
+ elseif band(op, 0x9f000000) == 0x10000000 then return 0x2000 -- ADR
+ elseif band(op, 0x9f000000) == band(0x90000000) then return 0x3000 -- ADRP
+ else
+ assert(false, "unknown branch type")
+ end
+end
+
+------------------------------------------------------------------------------
+
+local map_op, op_template
+
+local function op_alias(opname, f)
+ return function(params, nparams)
+ if not params then return "-> "..opname:sub(1, -3) end
+ f(params, nparams)
+ op_template(params, map_op[opname], nparams)
+ end
+end
+
+local function alias_bfx(p)
+ p[4] = "#("..p[3]:sub(2)..")+("..p[4]:sub(2)..")-1"
+end
+
+local function alias_bfiz(p)
+ parse_reg(p[1])
+ if parse_reg_type == "w" then
+ p[3] = "#-("..p[3]:sub(2)..")%32"
+ p[4] = "#("..p[4]:sub(2)..")-1"
+ else
+ p[3] = "#-("..p[3]:sub(2)..")%64"
+ p[4] = "#("..p[4]:sub(2)..")-1"
+ end
+end
+
+local alias_lslimm = op_alias("ubfm_4", function(p)
+ parse_reg(p[1])
+ local sh = p[3]:sub(2)
+ if parse_reg_type == "w" then
+ p[3] = "#-("..sh..")%32"
+ p[4] = "#31-("..sh..")"
+ else
+ p[3] = "#-("..sh..")%64"
+ p[4] = "#63-("..sh..")"
+ end
+end)
+
+-- Template strings for ARM instructions.
+map_op = {
+ -- Basic data processing instructions.
+ add_3 = "0b000000DNMg|11000000pDpNIg|8b206000pDpNMx",
+ add_4 = "0b000000DNMSg|0b200000DNMXg|8b200000pDpNMXx|8b200000pDpNxMwX",
+ adds_3 = "2b000000DNMg|31000000DpNIg|ab206000DpNMx",
+ adds_4 = "2b000000DNMSg|2b200000DNMXg|ab200000DpNMXx|ab200000DpNxMwX",
+ cmn_2 = "2b00001fNMg|3100001fpNIg|ab20601fpNMx",
+ cmn_3 = "2b00001fNMSg|2b20001fNMXg|ab20001fpNMXx|ab20001fpNxMwX",
+
+ sub_3 = "4b000000DNMg|51000000pDpNIg|cb206000pDpNMx",
+ sub_4 = "4b000000DNMSg|4b200000DNMXg|cb200000pDpNMXx|cb200000pDpNxMwX",
+ subs_3 = "6b000000DNMg|71000000DpNIg|eb206000DpNMx",
+ subs_4 = "6b000000DNMSg|6b200000DNMXg|eb200000DpNMXx|eb200000DpNxMwX",
+ cmp_2 = "6b00001fNMg|7100001fpNIg|eb20601fpNMx",
+ cmp_3 = "6b00001fNMSg|6b20001fNMXg|eb20001fpNMXx|eb20001fpNxMwX",
+
+ neg_2 = "4b0003e0DMg",
+ neg_3 = "4b0003e0DMSg",
+ negs_2 = "6b0003e0DMg",
+ negs_3 = "6b0003e0DMSg",
+
+ adc_3 = "1a000000DNMg",
+ adcs_3 = "3a000000DNMg",
+ sbc_3 = "5a000000DNMg",
+ sbcs_3 = "7a000000DNMg",
+ ngc_2 = "5a0003e0DMg",
+ ngcs_2 = "7a0003e0DMg",
+
+ and_3 = "0a000000DNMg|12000000pDNig",
+ and_4 = "0a000000DNMSg",
+ orr_3 = "2a000000DNMg|32000000pDNig",
+ orr_4 = "2a000000DNMSg",
+ eor_3 = "4a000000DNMg|52000000pDNig",
+ eor_4 = "4a000000DNMSg",
+ ands_3 = "6a000000DNMg|72000000DNig",
+ ands_4 = "6a000000DNMSg",
+ tst_2 = "6a00001fNMg|7200001fNig",
+ tst_3 = "6a00001fNMSg",
+
+ bic_3 = "0a200000DNMg",
+ bic_4 = "0a200000DNMSg",
+ orn_3 = "2a200000DNMg",
+ orn_4 = "2a200000DNMSg",
+ eon_3 = "4a200000DNMg",
+ eon_4 = "4a200000DNMSg",
+ bics_3 = "6a200000DNMg",
+ bics_4 = "6a200000DNMSg",
+
+ movn_2 = "12800000DWg",
+ movn_3 = "12800000DWRg",
+ movz_2 = "52800000DWg",
+ movz_3 = "52800000DWRg",
+ movk_2 = "72800000DWg",
+ movk_3 = "72800000DWRg",
+
+ -- TODO: this doesn't cover all valid immediates for mov reg, #imm.
+ mov_2 = "2a0003e0DMg|52800000DW|320003e0pDig|11000000pDpNg",
+ mov_3 = "2a0003e0DMSg",
+ mvn_2 = "2a2003e0DMg",
+ mvn_3 = "2a2003e0DMSg",
+
+ adr_2 = "10000000DBx",
+ adrp_2 = "90000000DBx",
+
+ csel_4 = "1a800000DNMCg",
+ csinc_4 = "1a800400DNMCg",
+ csinv_4 = "5a800000DNMCg",
+ csneg_4 = "5a800400DNMCg",
+ cset_2 = "1a9f07e0Dcg",
+ csetm_2 = "5a9f03e0Dcg",
+ cinc_3 = "1a800400DNmcg",
+ cinv_3 = "5a800000DNmcg",
+ cneg_3 = "5a800400DNmcg",
+
+ ccmn_4 = "3a400000NMVCg|3a400800N5VCg",
+ ccmp_4 = "7a400000NMVCg|7a400800N5VCg",
+
+ madd_4 = "1b000000DNMAg",
+ msub_4 = "1b008000DNMAg",
+ mul_3 = "1b007c00DNMg",
+ mneg_3 = "1b00fc00DNMg",
+
+ smaddl_4 = "9b200000DxNMwAx",
+ smsubl_4 = "9b208000DxNMwAx",
+ smull_3 = "9b207c00DxNMw",
+ smnegl_3 = "9b20fc00DxNMw",
+ smulh_3 = "9b407c00DNMx",
+ umaddl_4 = "9ba00000DxNMwAx",
+ umsubl_4 = "9ba08000DxNMwAx",
+ umull_3 = "9ba07c00DxNMw",
+ umnegl_3 = "9ba0fc00DxNMw",
+ umulh_3 = "9bc07c00DNMx",
+
+ udiv_3 = "1ac00800DNMg",
+ sdiv_3 = "1ac00c00DNMg",
+
+ -- Bit operations.
+ sbfm_4 = "13000000DN12w|93400000DN12x",
+ bfm_4 = "33000000DN12w|b3400000DN12x",
+ ubfm_4 = "53000000DN12w|d3400000DN12x",
+ extr_4 = "13800000DNM2w|93c00000DNM2x",
+
+ sxtb_2 = "13001c00DNw|93401c00DNx",
+ sxth_2 = "13003c00DNw|93403c00DNx",
+ sxtw_2 = "93407c00DxNw",
+ uxtb_2 = "53001c00DNw",
+ uxth_2 = "53003c00DNw",
+
+ sbfx_4 = op_alias("sbfm_4", alias_bfx),
+ bfxil_4 = op_alias("bfm_4", alias_bfx),
+ ubfx_4 = op_alias("ubfm_4", alias_bfx),
+ sbfiz_4 = op_alias("sbfm_4", alias_bfiz),
+ bfi_4 = op_alias("bfm_4", alias_bfiz),
+ ubfiz_4 = op_alias("ubfm_4", alias_bfiz),
+
+ lsl_3 = function(params, nparams)
+ if params and params[3]:byte() == 35 then
+ return alias_lslimm(params, nparams)
+ else
+ return op_template(params, "1ac02000DNMg", nparams)
+ end
+ end,
+ lsr_3 = "1ac02400DNMg|53007c00DN1w|d340fc00DN1x",
+ asr_3 = "1ac02800DNMg|13007c00DN1w|9340fc00DN1x",
+ ror_3 = "1ac02c00DNMg|13800000DNm2w|93c00000DNm2x",
+
+ clz_2 = "5ac01000DNg",
+ cls_2 = "5ac01400DNg",
+ rbit_2 = "5ac00000DNg",
+ rev_2 = "5ac00800DNw|dac00c00DNx",
+ rev16_2 = "5ac00400DNg",
+ rev32_2 = "dac00800DNx",
+
+ -- Loads and stores.
+ ["strb_*"] = "38000000DwL",
+ ["ldrb_*"] = "38400000DwL",
+ ["ldrsb_*"] = "38c00000DwL|38800000DxL",
+ ["strh_*"] = "78000000DwL",
+ ["ldrh_*"] = "78400000DwL",
+ ["ldrsh_*"] = "78c00000DwL|78800000DxL",
+ ["str_*"] = "b8000000DwL|f8000000DxL|bc000000DsL|fc000000DdL",
+ ["ldr_*"] = "18000000DwB|58000000DxB|1c000000DsB|5c000000DdB|b8400000DwL|f8400000DxL|bc400000DsL|fc400000DdL",
+ ["ldrsw_*"] = "98000000DxB|b8800000DxL",
+ -- NOTE: ldur etc. are handled by ldr et al.
+
+ ["stp_*"] = "28000000DAwP|a8000000DAxP|2c000000DAsP|6c000000DAdP",
+ ["ldp_*"] = "28400000DAwP|a8400000DAxP|2c400000DAsP|6c400000DAdP",
+ ["ldpsw_*"] = "68400000DAxP",
+
+ -- Branches.
+ b_1 = "14000000B",
+ bl_1 = "94000000B",
+ blr_1 = "d63f0000Nx",
+ br_1 = "d61f0000Nx",
+ ret_0 = "d65f03c0",
+ ret_1 = "d65f0000Nx",
+ -- b.cond is added below.
+ cbz_2 = "34000000DBg",
+ cbnz_2 = "35000000DBg",
+ tbz_3 = "36000000DTBw|36000000DTBx",
+ tbnz_3 = "37000000DTBw|37000000DTBx",
+
+ -- Miscellaneous instructions.
+ -- TODO: hlt, hvc, smc, svc, eret, dcps[123], drps, mrs, msr
+ -- TODO: sys, sysl, ic, dc, at, tlbi
+ -- TODO: hint, yield, wfe, wfi, sev, sevl
+ -- TODO: clrex, dsb, dmb, isb
+ nop_0 = "d503201f",
+ brk_0 = "d4200000",
+ brk_1 = "d4200000W",
+
+ -- Floating point instructions.
+ fmov_2 = "1e204000DNf|1e260000DwNs|1e270000DsNw|9e660000DxNd|9e670000DdNx|1e201000DFf",
+ fabs_2 = "1e20c000DNf",
+ fneg_2 = "1e214000DNf",
+ fsqrt_2 = "1e21c000DNf",
+
+ fcvt_2 = "1e22c000DdNs|1e624000DsNd",
+
+ -- TODO: half-precision and fixed-point conversions.
+ fcvtas_2 = "1e240000DwNs|9e240000DxNs|1e640000DwNd|9e640000DxNd",
+ fcvtau_2 = "1e250000DwNs|9e250000DxNs|1e650000DwNd|9e650000DxNd",
+ fcvtms_2 = "1e300000DwNs|9e300000DxNs|1e700000DwNd|9e700000DxNd",
+ fcvtmu_2 = "1e310000DwNs|9e310000DxNs|1e710000DwNd|9e710000DxNd",
+ fcvtns_2 = "1e200000DwNs|9e200000DxNs|1e600000DwNd|9e600000DxNd",
+ fcvtnu_2 = "1e210000DwNs|9e210000DxNs|1e610000DwNd|9e610000DxNd",
+ fcvtps_2 = "1e280000DwNs|9e280000DxNs|1e680000DwNd|9e680000DxNd",
+ fcvtpu_2 = "1e290000DwNs|9e290000DxNs|1e690000DwNd|9e690000DxNd",
+ fcvtzs_2 = "1e380000DwNs|9e380000DxNs|1e780000DwNd|9e780000DxNd",
+ fcvtzu_2 = "1e390000DwNs|9e390000DxNs|1e790000DwNd|9e790000DxNd",
+
+ scvtf_2 = "1e220000DsNw|9e220000DsNx|1e620000DdNw|9e620000DdNx",
+ ucvtf_2 = "1e230000DsNw|9e230000DsNx|1e630000DdNw|9e630000DdNx",
+
+ frintn_2 = "1e244000DNf",
+ frintp_2 = "1e24c000DNf",
+ frintm_2 = "1e254000DNf",
+ frintz_2 = "1e25c000DNf",
+ frinta_2 = "1e264000DNf",
+ frintx_2 = "1e274000DNf",
+ frinti_2 = "1e27c000DNf",
+
+ fadd_3 = "1e202800DNMf",
+ fsub_3 = "1e203800DNMf",
+ fmul_3 = "1e200800DNMf",
+ fnmul_3 = "1e208800DNMf",
+ fdiv_3 = "1e201800DNMf",
+
+ fmadd_4 = "1f000000DNMAf",
+ fmsub_4 = "1f008000DNMAf",
+ fnmadd_4 = "1f200000DNMAf",
+ fnmsub_4 = "1f208000DNMAf",
+
+ fmax_3 = "1e204800DNMf",
+ fmaxnm_3 = "1e206800DNMf",
+ fmin_3 = "1e205800DNMf",
+ fminnm_3 = "1e207800DNMf",
+
+ fcmp_2 = "1e202000NMf|1e202008NZf",
+ fcmpe_2 = "1e202010NMf|1e202018NZf",
+
+ fccmp_4 = "1e200400NMVCf",
+ fccmpe_4 = "1e200410NMVCf",
+
+ fcsel_4 = "1e200c00DNMCf",
+
+ -- TODO: crc32*, aes*, sha*, pmull
+ -- TODO: SIMD instructions.
+}
+
+for cond,c in pairs(map_cond) do
+ map_op["b"..cond.."_1"] = tohex(0x54000000+c).."B"
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+local function parse_template(params, template, nparams, pos)
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n = 1
+ local rtt = {}
+
+ parse_reg_type = false
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ local q = params[n]
+ if p == "D" then
+ op = op + parse_reg(q); n = n + 1
+ elseif p == "N" then
+ op = op + shl(parse_reg(q), 5); n = n + 1
+ elseif p == "M" then
+ op = op + shl(parse_reg(q), 16); n = n + 1
+ elseif p == "A" then
+ op = op + shl(parse_reg(q), 10); n = n + 1
+ elseif p == "m" then
+ op = op + shl(parse_reg(params[n-1]), 16)
+
+ elseif p == "p" then
+ if q == "sp" then params[n] = "@x31" end
+ elseif p == "g" then
+ if parse_reg_type == "x" then
+ op = op + 0x80000000
+ elseif parse_reg_type ~= "w" then
+ werror("bad register type")
+ end
+ parse_reg_type = false
+ elseif p == "f" then
+ if parse_reg_type == "d" then
+ op = op + 0x00400000
+ elseif parse_reg_type ~= "s" then
+ werror("bad register type")
+ end
+ parse_reg_type = false
+ elseif p == "x" or p == "w" or p == "d" or p == "s" then
+ if parse_reg_type ~= p then
+ werror("register size mismatch")
+ end
+ parse_reg_type = false
+
+ elseif p == "L" then
+ op = parse_load(params, nparams, n, op)
+ elseif p == "P" then
+ op = parse_load_pair(params, nparams, n, op)
+
+ elseif p == "B" then
+ local mode, v, s = parse_label(q, false); n = n + 1
+ local m = branch_type(op)
+ waction("REL_"..mode, v+m, s, 1)
+
+ elseif p == "I" then
+ op = op + parse_imm12(q); n = n + 1
+ elseif p == "i" then
+ op = op + parse_imm13(q); n = n + 1
+ elseif p == "W" then
+ op = op + parse_imm(q, 16, 5, 0, false); n = n + 1
+ elseif p == "T" then
+ op = op + parse_imm6(q); n = n + 1
+ elseif p == "1" then
+ op = op + parse_imm(q, 6, 16, 0, false); n = n + 1
+ elseif p == "2" then
+ op = op + parse_imm(q, 6, 10, 0, false); n = n + 1
+ elseif p == "5" then
+ op = op + parse_imm(q, 5, 16, 0, false); n = n + 1
+ elseif p == "V" then
+ op = op + parse_imm(q, 4, 0, 0, false); n = n + 1
+ elseif p == "F" then
+ op = op + parse_fpimm(q); n = n + 1
+ elseif p == "Z" then
+ if q ~= "#0" and q ~= "#0.0" then werror("expected zero immediate") end
+ n = n + 1
+
+ elseif p == "S" then
+ op = op + parse_shift(q); n = n + 1
+ elseif p == "X" then
+ op = op + parse_extend(q); n = n + 1
+ elseif p == "R" then
+ op = op + parse_lslx16(q); n = n + 1
+ elseif p == "C" then
+ op = op + parse_cond(q, 0); n = n + 1
+ elseif p == "c" then
+ op = op + parse_cond(q, 1); n = n + 1
+
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+function op_template(params, template, nparams)
+ if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 3 positions.
+ if secpos+3 > maxsecpos then wflush() end
+ local pos = wpos()
+ local lpos, apos, spos = #actlist, #actargs, secpos
+
+ local ok, err
+ for t in gmatch(template, "[^|]+") do
+ ok, err = pcall(parse_template, params, t, nparams, pos)
+ if ok then return end
+ secpos = spos
+ actlist[lpos+1] = nil
+ actlist[lpos+2] = nil
+ actlist[lpos+3] = nil
+ actargs[apos+1] = nil
+ actargs[apos+2] = nil
+ actargs[apos+3] = nil
+ end
+ error(err, 0)
+end
+
+map_op[".template__"] = op_template
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_mips.h b/ext/opcache/jit/dynasm/dasm_mips.h
new file mode 100644
index 0000000000..f3b43211de
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_mips.h
@@ -0,0 +1,419 @@
+/*
+** DynASM MIPS encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "mips"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC, DASM_IMM, DASM_IMMS,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16) - 0xff00;
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM: case DASM_IMMS:
+#ifdef DASM_CHECKS
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+#endif
+ n >>= ((ins>>10)&31);
+#ifdef DASM_CHECKS
+ if (ins & 0x8000)
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16) - 0xff00;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMMS: pos++; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16) - 0xff00;
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins & 2047), 1);
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0x60000000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n);
+ if (ins & 2048)
+ n = n - (int)((char *)cp - base);
+ else
+ n = (n + (int)(size_t)base) & 0x0fffffff;
+ patchrel:
+ CK((n & 3) == 0 &&
+ ((n + ((ins & 2048) ? 0x00020000 : 0)) >>
+ ((ins & 2048) ? 18 : 28)) == 0, RANGE_REL);
+ cp[-1] |= ((n>>2) & ((ins & 2048) ? 0x0000ffff: 0x03ffffff));
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMMS:
+ cp[-1] |= ((n>>3) & 4); n &= 0x1f;
+ /* fallthrough */
+ case DASM_IMM:
+ cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_mips.lua b/ext/opcache/jit/dynasm/dasm_mips.lua
new file mode 100644
index 0000000000..c8010561db
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_mips.lua
@@ -0,0 +1,1008 @@
+------------------------------------------------------------------------------
+-- DynASM MIPS32/MIPS64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+local mips64 = mips64
+
+-- Module information:
+local _info = {
+ arch = mips64 and "mips64" or "mips",
+ description = "DynASM MIPS32/MIPS64 module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2016-05-24",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable = assert, setmetatable
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch = _s.match, _s.gmatch
+local concat, sort = table.concat, table.sort
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local tohex = bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMMS",
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(0xff000000 + w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n >= 0xff000000 then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+local map_archdef = { sp="r29", ra="r31" } -- Ext. register name -> int. name.
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ if s == "r29" then return "sp"
+ elseif s == "r31" then return "ra" end
+ return s
+end
+
+------------------------------------------------------------------------------
+
+-- Template strings for MIPS instructions.
+local map_op = {
+ -- First-level opcodes.
+ j_1 = "08000000J",
+ jal_1 = "0c000000J",
+ b_1 = "10000000B",
+ beqz_2 = "10000000SB",
+ beq_3 = "10000000STB",
+ bnez_2 = "14000000SB",
+ bne_3 = "14000000STB",
+ blez_2 = "18000000SB",
+ bgtz_2 = "1c000000SB",
+ addi_3 = "20000000TSI",
+ li_2 = "24000000TI",
+ addiu_3 = "24000000TSI",
+ slti_3 = "28000000TSI",
+ sltiu_3 = "2c000000TSI",
+ andi_3 = "30000000TSU",
+ lu_2 = "34000000TU",
+ ori_3 = "34000000TSU",
+ xori_3 = "38000000TSU",
+ lui_2 = "3c000000TU",
+ beqzl_2 = "50000000SB",
+ beql_3 = "50000000STB",
+ bnezl_2 = "54000000SB",
+ bnel_3 = "54000000STB",
+ blezl_2 = "58000000SB",
+ bgtzl_2 = "5c000000SB",
+ daddi_3 = mips64 and "60000000TSI",
+ daddiu_3 = mips64 and "64000000TSI",
+ ldl_2 = mips64 and "68000000TO",
+ ldr_2 = mips64 and "6c000000TO",
+ lb_2 = "80000000TO",
+ lh_2 = "84000000TO",
+ lwl_2 = "88000000TO",
+ lw_2 = "8c000000TO",
+ lbu_2 = "90000000TO",
+ lhu_2 = "94000000TO",
+ lwr_2 = "98000000TO",
+ lwu_2 = mips64 and "9c000000TO",
+ sb_2 = "a0000000TO",
+ sh_2 = "a4000000TO",
+ swl_2 = "a8000000TO",
+ sw_2 = "ac000000TO",
+ sdl_2 = mips64 and "b0000000TO",
+ sdr_2 = mips64 and "b1000000TO",
+ swr_2 = "b8000000TO",
+ cache_2 = "bc000000NO",
+ ll_2 = "c0000000TO",
+ lwc1_2 = "c4000000HO",
+ pref_2 = "cc000000NO",
+ ldc1_2 = "d4000000HO",
+ ld_2 = mips64 and "dc000000TO",
+ sc_2 = "e0000000TO",
+ swc1_2 = "e4000000HO",
+ scd_2 = mips64 and "f0000000TO",
+ sdc1_2 = "f4000000HO",
+ sd_2 = mips64 and "fc000000TO",
+
+ -- Opcode SPECIAL.
+ nop_0 = "00000000",
+ sll_3 = "00000000DTA",
+ sextw_2 = "00000000DT",
+ movf_2 = "00000001DS",
+ movf_3 = "00000001DSC",
+ movt_2 = "00010001DS",
+ movt_3 = "00010001DSC",
+ srl_3 = "00000002DTA",
+ rotr_3 = "00200002DTA",
+ sra_3 = "00000003DTA",
+ sllv_3 = "00000004DTS",
+ srlv_3 = "00000006DTS",
+ rotrv_3 = "00000046DTS",
+ drotrv_3 = mips64 and "00000056DTS",
+ srav_3 = "00000007DTS",
+ jr_1 = "00000008S",
+ jalr_1 = "0000f809S",
+ jalr_2 = "00000009DS",
+ movz_3 = "0000000aDST",
+ movn_3 = "0000000bDST",
+ syscall_0 = "0000000c",
+ syscall_1 = "0000000cY",
+ break_0 = "0000000d",
+ break_1 = "0000000dY",
+ sync_0 = "0000000f",
+ mfhi_1 = "00000010D",
+ mthi_1 = "00000011S",
+ mflo_1 = "00000012D",
+ mtlo_1 = "00000013S",
+ dsllv_3 = mips64 and "00000014DTS",
+ dsrlv_3 = mips64 and "00000016DTS",
+ dsrav_3 = mips64 and "00000017DTS",
+ mult_2 = "00000018ST",
+ multu_2 = "00000019ST",
+ div_2 = "0000001aST",
+ divu_2 = "0000001bST",
+ dmult_2 = mips64 and "0000001cST",
+ dmultu_2 = mips64 and "0000001dST",
+ ddiv_2 = mips64 and "0000001eST",
+ ddivu_2 = mips64 and "0000001fST",
+ add_3 = "00000020DST",
+ move_2 = mips64 and "00000025DS" or "00000021DS",
+ addu_3 = "00000021DST",
+ sub_3 = "00000022DST",
+ negu_2 = mips64 and "0000002fDT" or "00000023DT",
+ subu_3 = "00000023DST",
+ and_3 = "00000024DST",
+ or_3 = "00000025DST",
+ xor_3 = "00000026DST",
+ not_2 = "00000027DS",
+ nor_3 = "00000027DST",
+ slt_3 = "0000002aDST",
+ sltu_3 = "0000002bDST",
+ dadd_3 = mips64 and "0000002cDST",
+ daddu_3 = mips64 and "0000002dDST",
+ dsub_3 = mips64 and "0000002eDST",
+ dsubu_3 = mips64 and "0000002fDST",
+ tge_2 = "00000030ST",
+ tge_3 = "00000030STZ",
+ tgeu_2 = "00000031ST",
+ tgeu_3 = "00000031STZ",
+ tlt_2 = "00000032ST",
+ tlt_3 = "00000032STZ",
+ tltu_2 = "00000033ST",
+ tltu_3 = "00000033STZ",
+ teq_2 = "00000034ST",
+ teq_3 = "00000034STZ",
+ tne_2 = "00000036ST",
+ tne_3 = "00000036STZ",
+ dsll_3 = mips64 and "00000038DTa",
+ dsrl_3 = mips64 and "0000003aDTa",
+ drotr_3 = mips64 and "0020003aDTa",
+ dsra_3 = mips64 and "0000003bDTa",
+ dsll32_3 = mips64 and "0000003cDTA",
+ dsrl32_3 = mips64 and "0000003eDTA",
+ drotr32_3 = mips64 and "0020003eDTA",
+ dsra32_3 = mips64 and "0000003fDTA",
+
+ -- Opcode REGIMM.
+ bltz_2 = "04000000SB",
+ bgez_2 = "04010000SB",
+ bltzl_2 = "04020000SB",
+ bgezl_2 = "04030000SB",
+ tgei_2 = "04080000SI",
+ tgeiu_2 = "04090000SI",
+ tlti_2 = "040a0000SI",
+ tltiu_2 = "040b0000SI",
+ teqi_2 = "040c0000SI",
+ tnei_2 = "040e0000SI",
+ bltzal_2 = "04100000SB",
+ bal_1 = "04110000B",
+ bgezal_2 = "04110000SB",
+ bltzall_2 = "04120000SB",
+ bgezall_2 = "04130000SB",
+ synci_1 = "041f0000O",
+
+ -- Opcode SPECIAL2.
+ madd_2 = "70000000ST",
+ maddu_2 = "70000001ST",
+ mul_3 = "70000002DST",
+ msub_2 = "70000004ST",
+ msubu_2 = "70000005ST",
+ clz_2 = "70000020DS=",
+ clo_2 = "70000021DS=",
+ dclz_2 = mips64 and "70000024DS=",
+ dclo_2 = mips64 and "70000025DS=",
+ sdbbp_0 = "7000003f",
+ sdbbp_1 = "7000003fY",
+
+ -- Opcode SPECIAL3.
+ ext_4 = "7c000000TSAM", -- Note: last arg is msbd = size-1
+ dextm_4 = mips64 and "7c000001TSAM", -- Args: pos | size-1-32
+ dextu_4 = mips64 and "7c000002TSAM", -- Args: pos-32 | size-1
+ dext_4 = mips64 and "7c000003TSAM", -- Args: pos | size-1
+ zextw_2 = mips64 and "7c00f803TS",
+ ins_4 = "7c000004TSAM", -- Note: last arg is msb = pos+size-1
+ dinsm_4 = mips64 and "7c000005TSAM", -- Args: pos | pos+size-33
+ dinsu_4 = mips64 and "7c000006TSAM", -- Args: pos-32 | pos+size-33
+ dins_4 = mips64 and "7c000007TSAM", -- Args: pos | pos+size-1
+ wsbh_2 = "7c0000a0DT",
+ dsbh_2 = mips64 and "7c0000a4DT",
+ dshd_2 = mips64 and "7c000164DT",
+ seb_2 = "7c000420DT",
+ seh_2 = "7c000620DT",
+ rdhwr_2 = "7c00003bTD",
+
+ -- Opcode COP0.
+ mfc0_2 = "40000000TD",
+ mfc0_3 = "40000000TDW",
+ dmfc0_2 = mips64 and "40200000TD",
+ dmfc0_3 = mips64 and "40200000TDW",
+ mtc0_2 = "40800000TD",
+ mtc0_3 = "40800000TDW",
+ dmtc0_2 = mips64 and "40a00000TD",
+ dmtc0_3 = mips64 and "40a00000TDW",
+ rdpgpr_2 = "41400000DT",
+ di_0 = "41606000",
+ di_1 = "41606000T",
+ ei_0 = "41606020",
+ ei_1 = "41606020T",
+ wrpgpr_2 = "41c00000DT",
+ tlbr_0 = "42000001",
+ tlbwi_0 = "42000002",
+ tlbwr_0 = "42000006",
+ tlbp_0 = "42000008",
+ eret_0 = "42000018",
+ deret_0 = "4200001f",
+ wait_0 = "42000020",
+
+ -- Opcode COP1.
+ mfc1_2 = "44000000TG",
+ dmfc1_2 = mips64 and "44200000TG",
+ cfc1_2 = "44400000TG",
+ mfhc1_2 = "44600000TG",
+ mtc1_2 = "44800000TG",
+ dmtc1_2 = mips64 and "44a00000TG",
+ ctc1_2 = "44c00000TG",
+ mthc1_2 = "44e00000TG",
+
+ bc1f_1 = "45000000B",
+ bc1f_2 = "45000000CB",
+ bc1t_1 = "45010000B",
+ bc1t_2 = "45010000CB",
+ bc1fl_1 = "45020000B",
+ bc1fl_2 = "45020000CB",
+ bc1tl_1 = "45030000B",
+ bc1tl_2 = "45030000CB",
+
+ ["add.s_3"] = "46000000FGH",
+ ["sub.s_3"] = "46000001FGH",
+ ["mul.s_3"] = "46000002FGH",
+ ["div.s_3"] = "46000003FGH",
+ ["sqrt.s_2"] = "46000004FG",
+ ["abs.s_2"] = "46000005FG",
+ ["mov.s_2"] = "46000006FG",
+ ["neg.s_2"] = "46000007FG",
+ ["round.l.s_2"] = "46000008FG",
+ ["trunc.l.s_2"] = "46000009FG",
+ ["ceil.l.s_2"] = "4600000aFG",
+ ["floor.l.s_2"] = "4600000bFG",
+ ["round.w.s_2"] = "4600000cFG",
+ ["trunc.w.s_2"] = "4600000dFG",
+ ["ceil.w.s_2"] = "4600000eFG",
+ ["floor.w.s_2"] = "4600000fFG",
+ ["movf.s_2"] = "46000011FG",
+ ["movf.s_3"] = "46000011FGC",
+ ["movt.s_2"] = "46010011FG",
+ ["movt.s_3"] = "46010011FGC",
+ ["movz.s_3"] = "46000012FGT",
+ ["movn.s_3"] = "46000013FGT",
+ ["recip.s_2"] = "46000015FG",
+ ["rsqrt.s_2"] = "46000016FG",
+ ["cvt.d.s_2"] = "46000021FG",
+ ["cvt.w.s_2"] = "46000024FG",
+ ["cvt.l.s_2"] = "46000025FG",
+ ["cvt.ps.s_3"] = "46000026FGH",
+ ["c.f.s_2"] = "46000030GH",
+ ["c.f.s_3"] = "46000030VGH",
+ ["c.un.s_2"] = "46000031GH",
+ ["c.un.s_3"] = "46000031VGH",
+ ["c.eq.s_2"] = "46000032GH",
+ ["c.eq.s_3"] = "46000032VGH",
+ ["c.ueq.s_2"] = "46000033GH",
+ ["c.ueq.s_3"] = "46000033VGH",
+ ["c.olt.s_2"] = "46000034GH",
+ ["c.olt.s_3"] = "46000034VGH",
+ ["c.ult.s_2"] = "46000035GH",
+ ["c.ult.s_3"] = "46000035VGH",
+ ["c.ole.s_2"] = "46000036GH",
+ ["c.ole.s_3"] = "46000036VGH",
+ ["c.ule.s_2"] = "46000037GH",
+ ["c.ule.s_3"] = "46000037VGH",
+ ["c.sf.s_2"] = "46000038GH",
+ ["c.sf.s_3"] = "46000038VGH",
+ ["c.ngle.s_2"] = "46000039GH",
+ ["c.ngle.s_3"] = "46000039VGH",
+ ["c.seq.s_2"] = "4600003aGH",
+ ["c.seq.s_3"] = "4600003aVGH",
+ ["c.ngl.s_2"] = "4600003bGH",
+ ["c.ngl.s_3"] = "4600003bVGH",
+ ["c.lt.s_2"] = "4600003cGH",
+ ["c.lt.s_3"] = "4600003cVGH",
+ ["c.nge.s_2"] = "4600003dGH",
+ ["c.nge.s_3"] = "4600003dVGH",
+ ["c.le.s_2"] = "4600003eGH",
+ ["c.le.s_3"] = "4600003eVGH",
+ ["c.ngt.s_2"] = "4600003fGH",
+ ["c.ngt.s_3"] = "4600003fVGH",
+
+ ["add.d_3"] = "46200000FGH",
+ ["sub.d_3"] = "46200001FGH",
+ ["mul.d_3"] = "46200002FGH",
+ ["div.d_3"] = "46200003FGH",
+ ["sqrt.d_2"] = "46200004FG",
+ ["abs.d_2"] = "46200005FG",
+ ["mov.d_2"] = "46200006FG",
+ ["neg.d_2"] = "46200007FG",
+ ["round.l.d_2"] = "46200008FG",
+ ["trunc.l.d_2"] = "46200009FG",
+ ["ceil.l.d_2"] = "4620000aFG",
+ ["floor.l.d_2"] = "4620000bFG",
+ ["round.w.d_2"] = "4620000cFG",
+ ["trunc.w.d_2"] = "4620000dFG",
+ ["ceil.w.d_2"] = "4620000eFG",
+ ["floor.w.d_2"] = "4620000fFG",
+ ["movf.d_2"] = "46200011FG",
+ ["movf.d_3"] = "46200011FGC",
+ ["movt.d_2"] = "46210011FG",
+ ["movt.d_3"] = "46210011FGC",
+ ["movz.d_3"] = "46200012FGT",
+ ["movn.d_3"] = "46200013FGT",
+ ["recip.d_2"] = "46200015FG",
+ ["rsqrt.d_2"] = "46200016FG",
+ ["cvt.s.d_2"] = "46200020FG",
+ ["cvt.w.d_2"] = "46200024FG",
+ ["cvt.l.d_2"] = "46200025FG",
+ ["c.f.d_2"] = "46200030GH",
+ ["c.f.d_3"] = "46200030VGH",
+ ["c.un.d_2"] = "46200031GH",
+ ["c.un.d_3"] = "46200031VGH",
+ ["c.eq.d_2"] = "46200032GH",
+ ["c.eq.d_3"] = "46200032VGH",
+ ["c.ueq.d_2"] = "46200033GH",
+ ["c.ueq.d_3"] = "46200033VGH",
+ ["c.olt.d_2"] = "46200034GH",
+ ["c.olt.d_3"] = "46200034VGH",
+ ["c.ult.d_2"] = "46200035GH",
+ ["c.ult.d_3"] = "46200035VGH",
+ ["c.ole.d_2"] = "46200036GH",
+ ["c.ole.d_3"] = "46200036VGH",
+ ["c.ule.d_2"] = "46200037GH",
+ ["c.ule.d_3"] = "46200037VGH",
+ ["c.sf.d_2"] = "46200038GH",
+ ["c.sf.d_3"] = "46200038VGH",
+ ["c.ngle.d_2"] = "46200039GH",
+ ["c.ngle.d_3"] = "46200039VGH",
+ ["c.seq.d_2"] = "4620003aGH",
+ ["c.seq.d_3"] = "4620003aVGH",
+ ["c.ngl.d_2"] = "4620003bGH",
+ ["c.ngl.d_3"] = "4620003bVGH",
+ ["c.lt.d_2"] = "4620003cGH",
+ ["c.lt.d_3"] = "4620003cVGH",
+ ["c.nge.d_2"] = "4620003dGH",
+ ["c.nge.d_3"] = "4620003dVGH",
+ ["c.le.d_2"] = "4620003eGH",
+ ["c.le.d_3"] = "4620003eVGH",
+ ["c.ngt.d_2"] = "4620003fGH",
+ ["c.ngt.d_3"] = "4620003fVGH",
+
+ ["add.ps_3"] = "46c00000FGH",
+ ["sub.ps_3"] = "46c00001FGH",
+ ["mul.ps_3"] = "46c00002FGH",
+ ["abs.ps_2"] = "46c00005FG",
+ ["mov.ps_2"] = "46c00006FG",
+ ["neg.ps_2"] = "46c00007FG",
+ ["movf.ps_2"] = "46c00011FG",
+ ["movf.ps_3"] = "46c00011FGC",
+ ["movt.ps_2"] = "46c10011FG",
+ ["movt.ps_3"] = "46c10011FGC",
+ ["movz.ps_3"] = "46c00012FGT",
+ ["movn.ps_3"] = "46c00013FGT",
+ ["cvt.s.pu_2"] = "46c00020FG",
+ ["cvt.s.pl_2"] = "46c00028FG",
+ ["pll.ps_3"] = "46c0002cFGH",
+ ["plu.ps_3"] = "46c0002dFGH",
+ ["pul.ps_3"] = "46c0002eFGH",
+ ["puu.ps_3"] = "46c0002fFGH",
+ ["c.f.ps_2"] = "46c00030GH",
+ ["c.f.ps_3"] = "46c00030VGH",
+ ["c.un.ps_2"] = "46c00031GH",
+ ["c.un.ps_3"] = "46c00031VGH",
+ ["c.eq.ps_2"] = "46c00032GH",
+ ["c.eq.ps_3"] = "46c00032VGH",
+ ["c.ueq.ps_2"] = "46c00033GH",
+ ["c.ueq.ps_3"] = "46c00033VGH",
+ ["c.olt.ps_2"] = "46c00034GH",
+ ["c.olt.ps_3"] = "46c00034VGH",
+ ["c.ult.ps_2"] = "46c00035GH",
+ ["c.ult.ps_3"] = "46c00035VGH",
+ ["c.ole.ps_2"] = "46c00036GH",
+ ["c.ole.ps_3"] = "46c00036VGH",
+ ["c.ule.ps_2"] = "46c00037GH",
+ ["c.ule.ps_3"] = "46c00037VGH",
+ ["c.sf.ps_2"] = "46c00038GH",
+ ["c.sf.ps_3"] = "46c00038VGH",
+ ["c.ngle.ps_2"] = "46c00039GH",
+ ["c.ngle.ps_3"] = "46c00039VGH",
+ ["c.seq.ps_2"] = "46c0003aGH",
+ ["c.seq.ps_3"] = "46c0003aVGH",
+ ["c.ngl.ps_2"] = "46c0003bGH",
+ ["c.ngl.ps_3"] = "46c0003bVGH",
+ ["c.lt.ps_2"] = "46c0003cGH",
+ ["c.lt.ps_3"] = "46c0003cVGH",
+ ["c.nge.ps_2"] = "46c0003dGH",
+ ["c.nge.ps_3"] = "46c0003dVGH",
+ ["c.le.ps_2"] = "46c0003eGH",
+ ["c.le.ps_3"] = "46c0003eVGH",
+ ["c.ngt.ps_2"] = "46c0003fGH",
+ ["c.ngt.ps_3"] = "46c0003fVGH",
+
+ ["cvt.s.w_2"] = "46800020FG",
+ ["cvt.d.w_2"] = "46800021FG",
+
+ ["cvt.s.l_2"] = "46a00020FG",
+ ["cvt.d.l_2"] = "46a00021FG",
+
+ -- Opcode COP1X.
+ lwxc1_2 = "4c000000FX",
+ ldxc1_2 = "4c000001FX",
+ luxc1_2 = "4c000005FX",
+ swxc1_2 = "4c000008FX",
+ sdxc1_2 = "4c000009FX",
+ suxc1_2 = "4c00000dFX",
+ prefx_2 = "4c00000fMX",
+ ["alnv.ps_4"] = "4c00001eFGHS",
+ ["madd.s_4"] = "4c000020FRGH",
+ ["madd.d_4"] = "4c000021FRGH",
+ ["madd.ps_4"] = "4c000026FRGH",
+ ["msub.s_4"] = "4c000028FRGH",
+ ["msub.d_4"] = "4c000029FRGH",
+ ["msub.ps_4"] = "4c00002eFRGH",
+ ["nmadd.s_4"] = "4c000030FRGH",
+ ["nmadd.d_4"] = "4c000031FRGH",
+ ["nmadd.ps_4"] = "4c000036FRGH",
+ ["nmsub.s_4"] = "4c000038FRGH",
+ ["nmsub.d_4"] = "4c000039FRGH",
+ ["nmsub.ps_4"] = "4c00003eFRGH",
+}
+
+------------------------------------------------------------------------------
+
+local function parse_gpr(expr)
+ local tname, ovreg = match(expr, "^([%w_]+):(r[1-3]?[0-9])$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local r = match(expr, "^r([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r, tp end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_fpr(expr)
+ local r = match(expr, "^f([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_imm(imm, bits, shift, scale, signed, action)
+ local n = tonumber(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif match(imm, "^[rf]([1-3]?[0-9])$") or
+ match(imm, "^([%w_]+):([rf][1-3]?[0-9])$") then
+ werror("expected immediate operand, got register")
+ else
+ waction(action or "IMM",
+ (signed and 32768 or 0)+shl(scale, 10)+shl(bits, 5)+shift, imm)
+ return 0
+ end
+end
+
+local function parse_disp(disp)
+ local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
+ if imm then
+ local r = shl(parse_gpr(reg), 21)
+ local extname = match(imm, "^extern%s+(%S+)$")
+ if extname then
+ waction("REL_EXT", map_extern[extname], nil, 1)
+ return r
+ else
+ return r + parse_imm(imm, 16, 0, 0, true)
+ end
+ end
+ local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local r, tp = parse_gpr(reg)
+ if tp then
+ waction("IMM", 32768+16*32, format(tp.ctypefmt, tailr))
+ return shl(r, 21)
+ end
+ end
+ werror("bad displacement `"..disp.."'")
+end
+
+local function parse_index(idx)
+ local rt, rs = match(idx, "^(.*)%(([%w_:]+)%)$")
+ if rt then
+ rt = parse_gpr(rt)
+ rs = parse_gpr(rs)
+ return shl(rt, 16) + shl(rs, 21)
+ end
+ werror("bad index `"..idx.."'")
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+map_op[".template__"] = function(params, template, nparams)
+ if not params then return sub(template, 9) end
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n = 1
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 2 positions (ins/ext).
+ if secpos+2 > maxsecpos then wflush() end
+ local pos = wpos()
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ if p == "D" then
+ op = op + shl(parse_gpr(params[n]), 11); n = n + 1
+ elseif p == "T" then
+ op = op + shl(parse_gpr(params[n]), 16); n = n + 1
+ elseif p == "S" then
+ op = op + shl(parse_gpr(params[n]), 21); n = n + 1
+ elseif p == "F" then
+ op = op + shl(parse_fpr(params[n]), 6); n = n + 1
+ elseif p == "G" then
+ op = op + shl(parse_fpr(params[n]), 11); n = n + 1
+ elseif p == "H" then
+ op = op + shl(parse_fpr(params[n]), 16); n = n + 1
+ elseif p == "R" then
+ op = op + shl(parse_fpr(params[n]), 21); n = n + 1
+ elseif p == "I" then
+ op = op + parse_imm(params[n], 16, 0, 0, true); n = n + 1
+ elseif p == "U" then
+ op = op + parse_imm(params[n], 16, 0, 0, false); n = n + 1
+ elseif p == "O" then
+ op = op + parse_disp(params[n]); n = n + 1
+ elseif p == "X" then
+ op = op + parse_index(params[n]); n = n + 1
+ elseif p == "B" or p == "J" then
+ local mode, n, s = parse_label(params[n], false)
+ if p == "B" then n = n + 2048 end
+ waction("REL_"..mode, n, s, 1)
+ n = n + 1
+ elseif p == "A" then
+ op = op + parse_imm(params[n], 5, 6, 0, false); n = n + 1
+ elseif p == "a" then
+ local m = parse_imm(params[n], 6, 6, 0, false, "IMMS"); n = n + 1
+ op = op + band(m, 0x7c0) + band(shr(m, 9), 4)
+ elseif p == "M" then
+ op = op + parse_imm(params[n], 5, 11, 0, false); n = n + 1
+ elseif p == "N" then
+ op = op + parse_imm(params[n], 5, 16, 0, false); n = n + 1
+ elseif p == "C" then
+ op = op + parse_imm(params[n], 3, 18, 0, false); n = n + 1
+ elseif p == "V" then
+ op = op + parse_imm(params[n], 3, 8, 0, false); n = n + 1
+ elseif p == "W" then
+ op = op + parse_imm(params[n], 3, 0, 0, false); n = n + 1
+ elseif p == "Y" then
+ op = op + parse_imm(params[n], 20, 6, 0, false); n = n + 1
+ elseif p == "Z" then
+ op = op + parse_imm(params[n], 10, 6, 0, false); n = n + 1
+ elseif p == "=" then
+ op = op + shl(band(op, 0xf800), 5) -- Copy D to T for clz, clo.
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_mips64.lua b/ext/opcache/jit/dynasm/dasm_mips64.lua
new file mode 100644
index 0000000000..94f21921fc
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_mips64.lua
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+-- DynASM MIPS64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+-- This module just sets 64 bit mode for the combined MIPS/MIPS64 module.
+-- All the interesting stuff is there.
+------------------------------------------------------------------------------
+
+mips64 = true -- Using a global is an ugly, but effective solution.
+return require("dasm_mips")
diff --git a/ext/opcache/jit/dynasm/dasm_ppc.h b/ext/opcache/jit/dynasm/dasm_ppc.h
new file mode 100644
index 0000000000..3f267fb824
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_ppc.h
@@ -0,0 +1,419 @@
+/*
+** DynASM PPC/PPC64 encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "ppc"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC, DASM_IMM, DASM_IMMSH,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM:
+#ifdef DASM_CHECKS
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+#endif
+ n >>= ((ins>>10)&31);
+#ifdef DASM_CHECKS
+ if (ins & 0x8000)
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ case DASM_IMMSH:
+ CK((n >> 6) == 0, RANGE_I);
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMMSH: pos++; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins & 2047), 1) - 4;
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0x60000000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base);
+ patchrel:
+ CK((n & 3) == 0 &&
+ (((n+4) + ((ins & 2048) ? 0x00008000 : 0x02000000)) >>
+ ((ins & 2048) ? 16 : 26)) == 0, RANGE_REL);
+ cp[-1] |= ((n+4) & ((ins & 2048) ? 0x0000fffc: 0x03fffffc));
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMM:
+ cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ case DASM_IMMSH:
+ cp[-1] |= (ins & 1) ? ((n&31)<<11)|((n&32)>>4) : ((n&31)<<6)|(n&32);
+ break;
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_ppc.lua b/ext/opcache/jit/dynasm/dasm_ppc.lua
new file mode 100644
index 0000000000..e2f704ec18
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_ppc.lua
@@ -0,0 +1,1919 @@
+------------------------------------------------------------------------------
+-- DynASM PPC/PPC64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+--
+-- Support for various extensions contributed by Caio Souza Oliveira.
+------------------------------------------------------------------------------
+
+-- Module information:
+local _info = {
+ arch = "ppc",
+ description = "DynASM PPC module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable = assert, setmetatable
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch = _s.match, _s.gmatch
+local concat, sort = table.concat, table.sort
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local tohex = bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMMSH"
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n <= 0xffffff then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+local map_archdef = { sp = "r1" } -- Ext. register name -> int. name.
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ if s == "r1" then return "sp" end
+ return s
+end
+
+local map_cond = {
+ lt = 0, gt = 1, eq = 2, so = 3,
+ ge = 4, le = 5, ne = 6, ns = 7,
+}
+
+------------------------------------------------------------------------------
+
+local map_op, op_template
+
+local function op_alias(opname, f)
+ return function(params, nparams)
+ if not params then return "-> "..opname:sub(1, -3) end
+ f(params, nparams)
+ op_template(params, map_op[opname], nparams)
+ end
+end
+
+-- Template strings for PPC instructions.
+map_op = {
+ tdi_3 = "08000000ARI",
+ twi_3 = "0c000000ARI",
+ mulli_3 = "1c000000RRI",
+ subfic_3 = "20000000RRI",
+ cmplwi_3 = "28000000XRU",
+ cmplwi_2 = "28000000-RU",
+ cmpldi_3 = "28200000XRU",
+ cmpldi_2 = "28200000-RU",
+ cmpwi_3 = "2c000000XRI",
+ cmpwi_2 = "2c000000-RI",
+ cmpdi_3 = "2c200000XRI",
+ cmpdi_2 = "2c200000-RI",
+ addic_3 = "30000000RRI",
+ ["addic._3"] = "34000000RRI",
+ addi_3 = "38000000RR0I",
+ li_2 = "38000000RI",
+ la_2 = "38000000RD",
+ addis_3 = "3c000000RR0I",
+ lis_2 = "3c000000RI",
+ lus_2 = "3c000000RU",
+ bc_3 = "40000000AAK",
+ bcl_3 = "40000001AAK",
+ bdnz_1 = "42000000K",
+ bdz_1 = "42400000K",
+ sc_0 = "44000000",
+ b_1 = "48000000J",
+ bl_1 = "48000001J",
+ rlwimi_5 = "50000000RR~AAA.",
+ rlwinm_5 = "54000000RR~AAA.",
+ rlwnm_5 = "5c000000RR~RAA.",
+ ori_3 = "60000000RR~U",
+ nop_0 = "60000000",
+ oris_3 = "64000000RR~U",
+ xori_3 = "68000000RR~U",
+ xoris_3 = "6c000000RR~U",
+ ["andi._3"] = "70000000RR~U",
+ ["andis._3"] = "74000000RR~U",
+ lwz_2 = "80000000RD",
+ lwzu_2 = "84000000RD",
+ lbz_2 = "88000000RD",
+ lbzu_2 = "8c000000RD",
+ stw_2 = "90000000RD",
+ stwu_2 = "94000000RD",
+ stb_2 = "98000000RD",
+ stbu_2 = "9c000000RD",
+ lhz_2 = "a0000000RD",
+ lhzu_2 = "a4000000RD",
+ lha_2 = "a8000000RD",
+ lhau_2 = "ac000000RD",
+ sth_2 = "b0000000RD",
+ sthu_2 = "b4000000RD",
+ lmw_2 = "b8000000RD",
+ stmw_2 = "bc000000RD",
+ lfs_2 = "c0000000FD",
+ lfsu_2 = "c4000000FD",
+ lfd_2 = "c8000000FD",
+ lfdu_2 = "cc000000FD",
+ stfs_2 = "d0000000FD",
+ stfsu_2 = "d4000000FD",
+ stfd_2 = "d8000000FD",
+ stfdu_2 = "dc000000FD",
+ ld_2 = "e8000000RD", -- NYI: displacement must be divisible by 4.
+ ldu_2 = "e8000001RD",
+ lwa_2 = "e8000002RD",
+ std_2 = "f8000000RD",
+ stdu_2 = "f8000001RD",
+
+ subi_3 = op_alias("addi_3", function(p) p[3] = "-("..p[3]..")" end),
+ subis_3 = op_alias("addis_3", function(p) p[3] = "-("..p[3]..")" end),
+ subic_3 = op_alias("addic_3", function(p) p[3] = "-("..p[3]..")" end),
+ ["subic._3"] = op_alias("addic._3", function(p) p[3] = "-("..p[3]..")" end),
+
+ rotlwi_3 = op_alias("rlwinm_5", function(p)
+ p[4] = "0"; p[5] = "31"
+ end),
+ rotrwi_3 = op_alias("rlwinm_5", function(p)
+ p[3] = "32-("..p[3]..")"; p[4] = "0"; p[5] = "31"
+ end),
+ rotlw_3 = op_alias("rlwnm_5", function(p)
+ p[4] = "0"; p[5] = "31"
+ end),
+ slwi_3 = op_alias("rlwinm_5", function(p)
+ p[5] = "31-("..p[3]..")"; p[4] = "0"
+ end),
+ srwi_3 = op_alias("rlwinm_5", function(p)
+ p[4] = p[3]; p[3] = "32-("..p[3]..")"; p[5] = "31"
+ end),
+ clrlwi_3 = op_alias("rlwinm_5", function(p)
+ p[4] = p[3]; p[3] = "0"; p[5] = "31"
+ end),
+ clrrwi_3 = op_alias("rlwinm_5", function(p)
+ p[5] = "31-("..p[3]..")"; p[3] = "0"; p[4] = "0"
+ end),
+
+ -- Primary opcode 4:
+ mulhhwu_3 = "10000010RRR.",
+ machhwu_3 = "10000018RRR.",
+ mulhhw_3 = "10000050RRR.",
+ nmachhw_3 = "1000005cRRR.",
+ machhwsu_3 = "10000098RRR.",
+ machhws_3 = "100000d8RRR.",
+ nmachhws_3 = "100000dcRRR.",
+ mulchwu_3 = "10000110RRR.",
+ macchwu_3 = "10000118RRR.",
+ mulchw_3 = "10000150RRR.",
+ macchw_3 = "10000158RRR.",
+ nmacchw_3 = "1000015cRRR.",
+ macchwsu_3 = "10000198RRR.",
+ macchws_3 = "100001d8RRR.",
+ nmacchws_3 = "100001dcRRR.",
+ mullhw_3 = "10000350RRR.",
+ maclhw_3 = "10000358RRR.",
+ nmaclhw_3 = "1000035cRRR.",
+ maclhwsu_3 = "10000398RRR.",
+ maclhws_3 = "100003d8RRR.",
+ nmaclhws_3 = "100003dcRRR.",
+ machhwuo_3 = "10000418RRR.",
+ nmachhwo_3 = "1000045cRRR.",
+ machhwsuo_3 = "10000498RRR.",
+ machhwso_3 = "100004d8RRR.",
+ nmachhwso_3 = "100004dcRRR.",
+ macchwuo_3 = "10000518RRR.",
+ macchwo_3 = "10000558RRR.",
+ nmacchwo_3 = "1000055cRRR.",
+ macchwsuo_3 = "10000598RRR.",
+ macchwso_3 = "100005d8RRR.",
+ nmacchwso_3 = "100005dcRRR.",
+ maclhwo_3 = "10000758RRR.",
+ nmaclhwo_3 = "1000075cRRR.",
+ maclhwsuo_3 = "10000798RRR.",
+ maclhwso_3 = "100007d8RRR.",
+ nmaclhwso_3 = "100007dcRRR.",
+
+ vaddubm_3 = "10000000VVV",
+ vmaxub_3 = "10000002VVV",
+ vrlb_3 = "10000004VVV",
+ vcmpequb_3 = "10000006VVV",
+ vmuloub_3 = "10000008VVV",
+ vaddfp_3 = "1000000aVVV",
+ vmrghb_3 = "1000000cVVV",
+ vpkuhum_3 = "1000000eVVV",
+ vmhaddshs_4 = "10000020VVVV",
+ vmhraddshs_4 = "10000021VVVV",
+ vmladduhm_4 = "10000022VVVV",
+ vmsumubm_4 = "10000024VVVV",
+ vmsummbm_4 = "10000025VVVV",
+ vmsumuhm_4 = "10000026VVVV",
+ vmsumuhs_4 = "10000027VVVV",
+ vmsumshm_4 = "10000028VVVV",
+ vmsumshs_4 = "10000029VVVV",
+ vsel_4 = "1000002aVVVV",
+ vperm_4 = "1000002bVVVV",
+ vsldoi_4 = "1000002cVVVP",
+ vpermxor_4 = "1000002dVVVV",
+ vmaddfp_4 = "1000002eVVVV~",
+ vnmsubfp_4 = "1000002fVVVV~",
+ vaddeuqm_4 = "1000003cVVVV",
+ vaddecuq_4 = "1000003dVVVV",
+ vsubeuqm_4 = "1000003eVVVV",
+ vsubecuq_4 = "1000003fVVVV",
+ vadduhm_3 = "10000040VVV",
+ vmaxuh_3 = "10000042VVV",
+ vrlh_3 = "10000044VVV",
+ vcmpequh_3 = "10000046VVV",
+ vmulouh_3 = "10000048VVV",
+ vsubfp_3 = "1000004aVVV",
+ vmrghh_3 = "1000004cVVV",
+ vpkuwum_3 = "1000004eVVV",
+ vadduwm_3 = "10000080VVV",
+ vmaxuw_3 = "10000082VVV",
+ vrlw_3 = "10000084VVV",
+ vcmpequw_3 = "10000086VVV",
+ vmulouw_3 = "10000088VVV",
+ vmuluwm_3 = "10000089VVV",
+ vmrghw_3 = "1000008cVVV",
+ vpkuhus_3 = "1000008eVVV",
+ vaddudm_3 = "100000c0VVV",
+ vmaxud_3 = "100000c2VVV",
+ vrld_3 = "100000c4VVV",
+ vcmpeqfp_3 = "100000c6VVV",
+ vcmpequd_3 = "100000c7VVV",
+ vpkuwus_3 = "100000ceVVV",
+ vadduqm_3 = "10000100VVV",
+ vmaxsb_3 = "10000102VVV",
+ vslb_3 = "10000104VVV",
+ vmulosb_3 = "10000108VVV",
+ vrefp_2 = "1000010aV-V",
+ vmrglb_3 = "1000010cVVV",
+ vpkshus_3 = "1000010eVVV",
+ vaddcuq_3 = "10000140VVV",
+ vmaxsh_3 = "10000142VVV",
+ vslh_3 = "10000144VVV",
+ vmulosh_3 = "10000148VVV",
+ vrsqrtefp_2 = "1000014aV-V",
+ vmrglh_3 = "1000014cVVV",
+ vpkswus_3 = "1000014eVVV",
+ vaddcuw_3 = "10000180VVV",
+ vmaxsw_3 = "10000182VVV",
+ vslw_3 = "10000184VVV",
+ vmulosw_3 = "10000188VVV",
+ vexptefp_2 = "1000018aV-V",
+ vmrglw_3 = "1000018cVVV",
+ vpkshss_3 = "1000018eVVV",
+ vmaxsd_3 = "100001c2VVV",
+ vsl_3 = "100001c4VVV",
+ vcmpgefp_3 = "100001c6VVV",
+ vlogefp_2 = "100001caV-V",
+ vpkswss_3 = "100001ceVVV",
+ vadduhs_3 = "10000240VVV",
+ vminuh_3 = "10000242VVV",
+ vsrh_3 = "10000244VVV",
+ vcmpgtuh_3 = "10000246VVV",
+ vmuleuh_3 = "10000248VVV",
+ vrfiz_2 = "1000024aV-V",
+ vsplth_3 = "1000024cVV3",
+ vupkhsh_2 = "1000024eV-V",
+ vminuw_3 = "10000282VVV",
+ vminud_3 = "100002c2VVV",
+ vcmpgtud_3 = "100002c7VVV",
+ vrfim_2 = "100002caV-V",
+ vcmpgtsb_3 = "10000306VVV",
+ vcfux_3 = "1000030aVVA~",
+ vaddshs_3 = "10000340VVV",
+ vminsh_3 = "10000342VVV",
+ vsrah_3 = "10000344VVV",
+ vcmpgtsh_3 = "10000346VVV",
+ vmulesh_3 = "10000348VVV",
+ vcfsx_3 = "1000034aVVA~",
+ vspltish_2 = "1000034cVS",
+ vupkhpx_2 = "1000034eV-V",
+ vaddsws_3 = "10000380VVV",
+ vminsw_3 = "10000382VVV",
+ vsraw_3 = "10000384VVV",
+ vcmpgtsw_3 = "10000386VVV",
+ vmulesw_3 = "10000388VVV",
+ vctuxs_3 = "1000038aVVA~",
+ vspltisw_2 = "1000038cVS",
+ vminsd_3 = "100003c2VVV",
+ vsrad_3 = "100003c4VVV",
+ vcmpbfp_3 = "100003c6VVV",
+ vcmpgtsd_3 = "100003c7VVV",
+ vctsxs_3 = "100003caVVA~",
+ vupklpx_2 = "100003ceV-V",
+ vsububm_3 = "10000400VVV",
+ ["bcdadd._4"] = "10000401VVVy.",
+ vavgub_3 = "10000402VVV",
+ vand_3 = "10000404VVV",
+ ["vcmpequb._3"] = "10000406VVV",
+ vmaxfp_3 = "1000040aVVV",
+ vsubuhm_3 = "10000440VVV",
+ ["bcdsub._4"] = "10000441VVVy.",
+ vavguh_3 = "10000442VVV",
+ vandc_3 = "10000444VVV",
+ ["vcmpequh._3"] = "10000446VVV",
+ vminfp_3 = "1000044aVVV",
+ vpkudum_3 = "1000044eVVV",
+ vsubuwm_3 = "10000480VVV",
+ vavguw_3 = "10000482VVV",
+ vor_3 = "10000484VVV",
+ ["vcmpequw._3"] = "10000486VVV",
+ vpmsumw_3 = "10000488VVV",
+ ["vcmpeqfp._3"] = "100004c6VVV",
+ ["vcmpequd._3"] = "100004c7VVV",
+ vpkudus_3 = "100004ceVVV",
+ vavgsb_3 = "10000502VVV",
+ vavgsh_3 = "10000542VVV",
+ vorc_3 = "10000544VVV",
+ vbpermq_3 = "1000054cVVV",
+ vpksdus_3 = "1000054eVVV",
+ vavgsw_3 = "10000582VVV",
+ vsld_3 = "100005c4VVV",
+ ["vcmpgefp._3"] = "100005c6VVV",
+ vpksdss_3 = "100005ceVVV",
+ vsububs_3 = "10000600VVV",
+ mfvscr_1 = "10000604V--",
+ vsum4ubs_3 = "10000608VVV",
+ vsubuhs_3 = "10000640VVV",
+ mtvscr_1 = "10000644--V",
+ ["vcmpgtuh._3"] = "10000646VVV",
+ vsum4shs_3 = "10000648VVV",
+ vupkhsw_2 = "1000064eV-V",
+ vsubuws_3 = "10000680VVV",
+ vshasigmaw_4 = "10000682VVYp",
+ veqv_3 = "10000684VVV",
+ vsum2sws_3 = "10000688VVV",
+ vmrgow_3 = "1000068cVVV",
+ vshasigmad_4 = "100006c2VVYp",
+ vsrd_3 = "100006c4VVV",
+ ["vcmpgtud._3"] = "100006c7VVV",
+ vupklsw_2 = "100006ceV-V",
+ vupkslw_2 = "100006ceV-V",
+ vsubsbs_3 = "10000700VVV",
+ vclzb_2 = "10000702V-V",
+ vpopcntb_2 = "10000703V-V",
+ ["vcmpgtsb._3"] = "10000706VVV",
+ vsum4sbs_3 = "10000708VVV",
+ vsubshs_3 = "10000740VVV",
+ vclzh_2 = "10000742V-V",
+ vpopcnth_2 = "10000743V-V",
+ ["vcmpgtsh._3"] = "10000746VVV",
+ vsubsws_3 = "10000780VVV",
+ vclzw_2 = "10000782V-V",
+ vpopcntw_2 = "10000783V-V",
+ ["vcmpgtsw._3"] = "10000786VVV",
+ vsumsws_3 = "10000788VVV",
+ vmrgew_3 = "1000078cVVV",
+ vclzd_2 = "100007c2V-V",
+ vpopcntd_2 = "100007c3V-V",
+ ["vcmpbfp._3"] = "100007c6VVV",
+ ["vcmpgtsd._3"] = "100007c7VVV",
+
+ -- Primary opcode 19:
+ mcrf_2 = "4c000000XX",
+ isync_0 = "4c00012c",
+ crnor_3 = "4c000042CCC",
+ crnot_2 = "4c000042CC=",
+ crandc_3 = "4c000102CCC",
+ crxor_3 = "4c000182CCC",
+ crclr_1 = "4c000182C==",
+ crnand_3 = "4c0001c2CCC",
+ crand_3 = "4c000202CCC",
+ creqv_3 = "4c000242CCC",
+ crset_1 = "4c000242C==",
+ crorc_3 = "4c000342CCC",
+ cror_3 = "4c000382CCC",
+ crmove_2 = "4c000382CC=",
+ bclr_2 = "4c000020AA",
+ bclrl_2 = "4c000021AA",
+ bcctr_2 = "4c000420AA",
+ bcctrl_2 = "4c000421AA",
+ bctar_2 = "4c000460AA",
+ bctarl_2 = "4c000461AA",
+ blr_0 = "4e800020",
+ blrl_0 = "4e800021",
+ bctr_0 = "4e800420",
+ bctrl_0 = "4e800421",
+
+ -- Primary opcode 31:
+ cmpw_3 = "7c000000XRR",
+ cmpw_2 = "7c000000-RR",
+ cmpd_3 = "7c200000XRR",
+ cmpd_2 = "7c200000-RR",
+ tw_3 = "7c000008ARR",
+ lvsl_3 = "7c00000cVRR",
+ subfc_3 = "7c000010RRR.",
+ subc_3 = "7c000010RRR~.",
+ mulhdu_3 = "7c000012RRR.",
+ addc_3 = "7c000014RRR.",
+ mulhwu_3 = "7c000016RRR.",
+ isel_4 = "7c00001eRRRC",
+ isellt_3 = "7c00001eRRR",
+ iselgt_3 = "7c00005eRRR",
+ iseleq_3 = "7c00009eRRR",
+ mfcr_1 = "7c000026R",
+ mfocrf_2 = "7c100026RG",
+ mtcrf_2 = "7c000120GR",
+ mtocrf_2 = "7c100120GR",
+ lwarx_3 = "7c000028RR0R",
+ ldx_3 = "7c00002aRR0R",
+ lwzx_3 = "7c00002eRR0R",
+ slw_3 = "7c000030RR~R.",
+ cntlzw_2 = "7c000034RR~",
+ sld_3 = "7c000036RR~R.",
+ and_3 = "7c000038RR~R.",
+ cmplw_3 = "7c000040XRR",
+ cmplw_2 = "7c000040-RR",
+ cmpld_3 = "7c200040XRR",
+ cmpld_2 = "7c200040-RR",
+ lvsr_3 = "7c00004cVRR",
+ subf_3 = "7c000050RRR.",
+ sub_3 = "7c000050RRR~.",
+ lbarx_3 = "7c000068RR0R",
+ ldux_3 = "7c00006aRR0R",
+ dcbst_2 = "7c00006c-RR",
+ lwzux_3 = "7c00006eRR0R",
+ cntlzd_2 = "7c000074RR~",
+ andc_3 = "7c000078RR~R.",
+ td_3 = "7c000088ARR",
+ lvewx_3 = "7c00008eVRR",
+ mulhd_3 = "7c000092RRR.",
+ addg6s_3 = "7c000094RRR",
+ mulhw_3 = "7c000096RRR.",
+ dlmzb_3 = "7c00009cRR~R.",
+ ldarx_3 = "7c0000a8RR0R",
+ dcbf_2 = "7c0000ac-RR",
+ lbzx_3 = "7c0000aeRR0R",
+ lvx_3 = "7c0000ceVRR",
+ neg_2 = "7c0000d0RR.",
+ lharx_3 = "7c0000e8RR0R",
+ lbzux_3 = "7c0000eeRR0R",
+ popcntb_2 = "7c0000f4RR~",
+ not_2 = "7c0000f8RR~%.",
+ nor_3 = "7c0000f8RR~R.",
+ stvebx_3 = "7c00010eVRR",
+ subfe_3 = "7c000110RRR.",
+ sube_3 = "7c000110RRR~.",
+ adde_3 = "7c000114RRR.",
+ stdx_3 = "7c00012aRR0R",
+ ["stwcx._3"] = "7c00012dRR0R.",
+ stwx_3 = "7c00012eRR0R",
+ prtyw_2 = "7c000134RR~",
+ stvehx_3 = "7c00014eVRR",
+ stdux_3 = "7c00016aRR0R",
+ ["stqcx._3"] = "7c00016dR:R0R.",
+ stwux_3 = "7c00016eRR0R",
+ prtyd_2 = "7c000174RR~",
+ stvewx_3 = "7c00018eVRR",
+ subfze_2 = "7c000190RR.",
+ addze_2 = "7c000194RR.",
+ ["stdcx._3"] = "7c0001adRR0R.",
+ stbx_3 = "7c0001aeRR0R",
+ stvx_3 = "7c0001ceVRR",
+ subfme_2 = "7c0001d0RR.",
+ mulld_3 = "7c0001d2RRR.",
+ addme_2 = "7c0001d4RR.",
+ mullw_3 = "7c0001d6RRR.",
+ dcbtst_2 = "7c0001ec-RR",
+ stbux_3 = "7c0001eeRR0R",
+ bpermd_3 = "7c0001f8RR~R",
+ lvepxl_3 = "7c00020eVRR",
+ add_3 = "7c000214RRR.",
+ lqarx_3 = "7c000228R:R0R",
+ dcbt_2 = "7c00022c-RR",
+ lhzx_3 = "7c00022eRR0R",
+ cdtbcd_2 = "7c000234RR~",
+ eqv_3 = "7c000238RR~R.",
+ lvepx_3 = "7c00024eVRR",
+ eciwx_3 = "7c00026cRR0R",
+ lhzux_3 = "7c00026eRR0R",
+ cbcdtd_2 = "7c000274RR~",
+ xor_3 = "7c000278RR~R.",
+ mfspefscr_1 = "7c0082a6R",
+ mfxer_1 = "7c0102a6R",
+ mflr_1 = "7c0802a6R",
+ mfctr_1 = "7c0902a6R",
+ lwax_3 = "7c0002aaRR0R",
+ lhax_3 = "7c0002aeRR0R",
+ mftb_1 = "7c0c42e6R",
+ mftbu_1 = "7c0d42e6R",
+ lvxl_3 = "7c0002ceVRR",
+ lwaux_3 = "7c0002eaRR0R",
+ lhaux_3 = "7c0002eeRR0R",
+ popcntw_2 = "7c0002f4RR~",
+ divdeu_3 = "7c000312RRR.",
+ divweu_3 = "7c000316RRR.",
+ sthx_3 = "7c00032eRR0R",
+ orc_3 = "7c000338RR~R.",
+ ecowx_3 = "7c00036cRR0R",
+ sthux_3 = "7c00036eRR0R",
+ or_3 = "7c000378RR~R.",
+ mr_2 = "7c000378RR~%.",
+ divdu_3 = "7c000392RRR.",
+ divwu_3 = "7c000396RRR.",
+ mtspefscr_1 = "7c0083a6R",
+ mtxer_1 = "7c0103a6R",
+ mtlr_1 = "7c0803a6R",
+ mtctr_1 = "7c0903a6R",
+ dcbi_2 = "7c0003ac-RR",
+ nand_3 = "7c0003b8RR~R.",
+ dsn_2 = "7c0003c6-RR",
+ stvxl_3 = "7c0003ceVRR",
+ divd_3 = "7c0003d2RRR.",
+ divw_3 = "7c0003d6RRR.",
+ popcntd_2 = "7c0003f4RR~",
+ cmpb_3 = "7c0003f8RR~R.",
+ mcrxr_1 = "7c000400X",
+ lbdx_3 = "7c000406RRR",
+ subfco_3 = "7c000410RRR.",
+ subco_3 = "7c000410RRR~.",
+ addco_3 = "7c000414RRR.",
+ ldbrx_3 = "7c000428RR0R",
+ lswx_3 = "7c00042aRR0R",
+ lwbrx_3 = "7c00042cRR0R",
+ lfsx_3 = "7c00042eFR0R",
+ srw_3 = "7c000430RR~R.",
+ srd_3 = "7c000436RR~R.",
+ lhdx_3 = "7c000446RRR",
+ subfo_3 = "7c000450RRR.",
+ subo_3 = "7c000450RRR~.",
+ lfsux_3 = "7c00046eFR0R",
+ lwdx_3 = "7c000486RRR",
+ lswi_3 = "7c0004aaRR0A",
+ sync_0 = "7c0004ac",
+ lwsync_0 = "7c2004ac",
+ ptesync_0 = "7c4004ac",
+ lfdx_3 = "7c0004aeFR0R",
+ lddx_3 = "7c0004c6RRR",
+ nego_2 = "7c0004d0RR.",
+ lfdux_3 = "7c0004eeFR0R",
+ stbdx_3 = "7c000506RRR",
+ subfeo_3 = "7c000510RRR.",
+ subeo_3 = "7c000510RRR~.",
+ addeo_3 = "7c000514RRR.",
+ stdbrx_3 = "7c000528RR0R",
+ stswx_3 = "7c00052aRR0R",
+ stwbrx_3 = "7c00052cRR0R",
+ stfsx_3 = "7c00052eFR0R",
+ sthdx_3 = "7c000546RRR",
+ ["stbcx._3"] = "7c00056dRRR",
+ stfsux_3 = "7c00056eFR0R",
+ stwdx_3 = "7c000586RRR",
+ subfzeo_2 = "7c000590RR.",
+ addzeo_2 = "7c000594RR.",
+ stswi_3 = "7c0005aaRR0A",
+ ["sthcx._3"] = "7c0005adRRR",
+ stfdx_3 = "7c0005aeFR0R",
+ stddx_3 = "7c0005c6RRR",
+ subfmeo_2 = "7c0005d0RR.",
+ mulldo_3 = "7c0005d2RRR.",
+ addmeo_2 = "7c0005d4RR.",
+ mullwo_3 = "7c0005d6RRR.",
+ dcba_2 = "7c0005ec-RR",
+ stfdux_3 = "7c0005eeFR0R",
+ stvepxl_3 = "7c00060eVRR",
+ addo_3 = "7c000614RRR.",
+ lhbrx_3 = "7c00062cRR0R",
+ lfdpx_3 = "7c00062eF:RR",
+ sraw_3 = "7c000630RR~R.",
+ srad_3 = "7c000634RR~R.",
+ lfddx_3 = "7c000646FRR",
+ stvepx_3 = "7c00064eVRR",
+ srawi_3 = "7c000670RR~A.",
+ sradi_3 = "7c000674RR~H.",
+ eieio_0 = "7c0006ac",
+ lfiwax_3 = "7c0006aeFR0R",
+ divdeuo_3 = "7c000712RRR.",
+ divweuo_3 = "7c000716RRR.",
+ sthbrx_3 = "7c00072cRR0R",
+ stfdpx_3 = "7c00072eF:RR",
+ extsh_2 = "7c000734RR~.",
+ stfddx_3 = "7c000746FRR",
+ divdeo_3 = "7c000752RRR.",
+ divweo_3 = "7c000756RRR.",
+ extsb_2 = "7c000774RR~.",
+ divduo_3 = "7c000792RRR.",
+ divwou_3 = "7c000796RRR.",
+ icbi_2 = "7c0007ac-RR",
+ stfiwx_3 = "7c0007aeFR0R",
+ extsw_2 = "7c0007b4RR~.",
+ divdo_3 = "7c0007d2RRR.",
+ divwo_3 = "7c0007d6RRR.",
+ dcbz_2 = "7c0007ec-RR",
+
+ ["tbegin._1"] = "7c00051d1",
+ ["tbegin._0"] = "7c00051d",
+ ["tend._1"] = "7c00055dY",
+ ["tend._0"] = "7c00055d",
+ ["tendall._0"] = "7e00055d",
+ tcheck_1 = "7c00059cX",
+ ["tsr._1"] = "7c0005dd1",
+ ["tsuspend._0"] = "7c0005dd",
+ ["tresume._0"] = "7c2005dd",
+ ["tabortwc._3"] = "7c00061dARR",
+ ["tabortdc._3"] = "7c00065dARR",
+ ["tabortwci._3"] = "7c00069dARS",
+ ["tabortdci._3"] = "7c0006ddARS",
+ ["tabort._1"] = "7c00071d-R-",
+ ["treclaim._1"] = "7c00075d-R",
+ ["trechkpt._0"] = "7c0007dd",
+
+ lxsiwzx_3 = "7c000018QRR",
+ lxsiwax_3 = "7c000098QRR",
+ mfvsrd_2 = "7c000066-Rq",
+ mfvsrwz_2 = "7c0000e6-Rq",
+ stxsiwx_3 = "7c000118QRR",
+ mtvsrd_2 = "7c000166QR",
+ mtvsrwa_2 = "7c0001a6QR",
+ lxvdsx_3 = "7c000298QRR",
+ lxsspx_3 = "7c000418QRR",
+ lxsdx_3 = "7c000498QRR",
+ stxsspx_3 = "7c000518QRR",
+ stxsdx_3 = "7c000598QRR",
+ lxvw4x_3 = "7c000618QRR",
+ lxvd2x_3 = "7c000698QRR",
+ stxvw4x_3 = "7c000718QRR",
+ stxvd2x_3 = "7c000798QRR",
+
+ -- Primary opcode 30:
+ rldicl_4 = "78000000RR~HM.",
+ rldicr_4 = "78000004RR~HM.",
+ rldic_4 = "78000008RR~HM.",
+ rldimi_4 = "7800000cRR~HM.",
+ rldcl_4 = "78000010RR~RM.",
+ rldcr_4 = "78000012RR~RM.",
+
+ rotldi_3 = op_alias("rldicl_4", function(p)
+ p[4] = "0"
+ end),
+ rotrdi_3 = op_alias("rldicl_4", function(p)
+ p[3] = "64-("..p[3]..")"; p[4] = "0"
+ end),
+ rotld_3 = op_alias("rldcl_4", function(p)
+ p[4] = "0"
+ end),
+ sldi_3 = op_alias("rldicr_4", function(p)
+ p[4] = "63-("..p[3]..")"
+ end),
+ srdi_3 = op_alias("rldicl_4", function(p)
+ p[4] = p[3]; p[3] = "64-("..p[3]..")"
+ end),
+ clrldi_3 = op_alias("rldicl_4", function(p)
+ p[4] = p[3]; p[3] = "0"
+ end),
+ clrrdi_3 = op_alias("rldicr_4", function(p)
+ p[4] = "63-("..p[3]..")"; p[3] = "0"
+ end),
+
+ -- Primary opcode 56:
+ lq_2 = "e0000000R:D", -- NYI: displacement must be divisible by 8.
+
+ -- Primary opcode 57:
+ lfdp_2 = "e4000000F:D", -- NYI: displacement must be divisible by 4.
+
+ -- Primary opcode 59:
+ fdivs_3 = "ec000024FFF.",
+ fsubs_3 = "ec000028FFF.",
+ fadds_3 = "ec00002aFFF.",
+ fsqrts_2 = "ec00002cF-F.",
+ fres_2 = "ec000030F-F.",
+ fmuls_3 = "ec000032FF-F.",
+ frsqrtes_2 = "ec000034F-F.",
+ fmsubs_4 = "ec000038FFFF~.",
+ fmadds_4 = "ec00003aFFFF~.",
+ fnmsubs_4 = "ec00003cFFFF~.",
+ fnmadds_4 = "ec00003eFFFF~.",
+ fcfids_2 = "ec00069cF-F.",
+ fcfidus_2 = "ec00079cF-F.",
+
+ dadd_3 = "ec000004FFF.",
+ dqua_4 = "ec000006FFFZ.",
+ dmul_3 = "ec000044FFF.",
+ drrnd_4 = "ec000046FFFZ.",
+ dscli_3 = "ec000084FF6.",
+ dquai_4 = "ec000086SF~FZ.",
+ dscri_3 = "ec0000c4FF6.",
+ drintx_4 = "ec0000c61F~FZ.",
+ dcmpo_3 = "ec000104XFF",
+ dtstex_3 = "ec000144XFF",
+ dtstdc_3 = "ec000184XF6",
+ dtstdg_3 = "ec0001c4XF6",
+ drintn_4 = "ec0001c61F~FZ.",
+ dctdp_2 = "ec000204F-F.",
+ dctfix_2 = "ec000244F-F.",
+ ddedpd_3 = "ec000284ZF~F.",
+ dxex_2 = "ec0002c4F-F.",
+ dsub_3 = "ec000404FFF.",
+ ddiv_3 = "ec000444FFF.",
+ dcmpu_3 = "ec000504XFF",
+ dtstsf_3 = "ec000544XFF",
+ drsp_2 = "ec000604F-F.",
+ dcffix_2 = "ec000644F-F.",
+ denbcd_3 = "ec000684YF~F.",
+ diex_3 = "ec0006c4FFF.",
+
+ -- Primary opcode 60:
+ xsaddsp_3 = "f0000000QQQ",
+ xsmaddasp_3 = "f0000008QQQ",
+ xxsldwi_4 = "f0000010QQQz",
+ xsrsqrtesp_2 = "f0000028Q-Q",
+ xssqrtsp_2 = "f000002cQ-Q",
+ xxsel_4 = "f0000030QQQQ",
+ xssubsp_3 = "f0000040QQQ",
+ xsmaddmsp_3 = "f0000048QQQ",
+ xxpermdi_4 = "f0000050QQQz",
+ xsresp_2 = "f0000068Q-Q",
+ xsmulsp_3 = "f0000080QQQ",
+ xsmsubasp_3 = "f0000088QQQ",
+ xxmrghw_3 = "f0000090QQQ",
+ xsdivsp_3 = "f00000c0QQQ",
+ xsmsubmsp_3 = "f00000c8QQQ",
+ xsadddp_3 = "f0000100QQQ",
+ xsmaddadp_3 = "f0000108QQQ",
+ xscmpudp_3 = "f0000118XQQ",
+ xscvdpuxws_2 = "f0000120Q-Q",
+ xsrdpi_2 = "f0000124Q-Q",
+ xsrsqrtedp_2 = "f0000128Q-Q",
+ xssqrtdp_2 = "f000012cQ-Q",
+ xssubdp_3 = "f0000140QQQ",
+ xsmaddmdp_3 = "f0000148QQQ",
+ xscmpodp_3 = "f0000158XQQ",
+ xscvdpsxws_2 = "f0000160Q-Q",
+ xsrdpiz_2 = "f0000164Q-Q",
+ xsredp_2 = "f0000168Q-Q",
+ xsmuldp_3 = "f0000180QQQ",
+ xsmsubadp_3 = "f0000188QQQ",
+ xxmrglw_3 = "f0000190QQQ",
+ xsrdpip_2 = "f00001a4Q-Q",
+ xstsqrtdp_2 = "f00001a8X-Q",
+ xsrdpic_2 = "f00001acQ-Q",
+ xsdivdp_3 = "f00001c0QQQ",
+ xsmsubmdp_3 = "f00001c8QQQ",
+ xsrdpim_2 = "f00001e4Q-Q",
+ xstdivdp_3 = "f00001e8XQQ",
+ xvaddsp_3 = "f0000200QQQ",
+ xvmaddasp_3 = "f0000208QQQ",
+ xvcmpeqsp_3 = "f0000218QQQ",
+ xvcvspuxws_2 = "f0000220Q-Q",
+ xvrspi_2 = "f0000224Q-Q",
+ xvrsqrtesp_2 = "f0000228Q-Q",
+ xvsqrtsp_2 = "f000022cQ-Q",
+ xvsubsp_3 = "f0000240QQQ",
+ xvmaddmsp_3 = "f0000248QQQ",
+ xvcmpgtsp_3 = "f0000258QQQ",
+ xvcvspsxws_2 = "f0000260Q-Q",
+ xvrspiz_2 = "f0000264Q-Q",
+ xvresp_2 = "f0000268Q-Q",
+ xvmulsp_3 = "f0000280QQQ",
+ xvmsubasp_3 = "f0000288QQQ",
+ xxspltw_3 = "f0000290QQg~",
+ xvcmpgesp_3 = "f0000298QQQ",
+ xvcvuxwsp_2 = "f00002a0Q-Q",
+ xvrspip_2 = "f00002a4Q-Q",
+ xvtsqrtsp_2 = "f00002a8X-Q",
+ xvrspic_2 = "f00002acQ-Q",
+ xvdivsp_3 = "f00002c0QQQ",
+ xvmsubmsp_3 = "f00002c8QQQ",
+ xvcvsxwsp_2 = "f00002e0Q-Q",
+ xvrspim_2 = "f00002e4Q-Q",
+ xvtdivsp_3 = "f00002e8XQQ",
+ xvadddp_3 = "f0000300QQQ",
+ xvmaddadp_3 = "f0000308QQQ",
+ xvcmpeqdp_3 = "f0000318QQQ",
+ xvcvdpuxws_2 = "f0000320Q-Q",
+ xvrdpi_2 = "f0000324Q-Q",
+ xvrsqrtedp_2 = "f0000328Q-Q",
+ xvsqrtdp_2 = "f000032cQ-Q",
+ xvsubdp_3 = "f0000340QQQ",
+ xvmaddmdp_3 = "f0000348QQQ",
+ xvcmpgtdp_3 = "f0000358QQQ",
+ xvcvdpsxws_2 = "f0000360Q-Q",
+ xvrdpiz_2 = "f0000364Q-Q",
+ xvredp_2 = "f0000368Q-Q",
+ xvmuldp_3 = "f0000380QQQ",
+ xvmsubadp_3 = "f0000388QQQ",
+ xvcmpgedp_3 = "f0000398QQQ",
+ xvcvuxwdp_2 = "f00003a0Q-Q",
+ xvrdpip_2 = "f00003a4Q-Q",
+ xvtsqrtdp_2 = "f00003a8X-Q",
+ xvrdpic_2 = "f00003acQ-Q",
+ xvdivdp_3 = "f00003c0QQQ",
+ xvmsubmdp_3 = "f00003c8QQQ",
+ xvcvsxwdp_2 = "f00003e0Q-Q",
+ xvrdpim_2 = "f00003e4Q-Q",
+ xvtdivdp_3 = "f00003e8XQQ",
+ xsnmaddasp_3 = "f0000408QQQ",
+ xxland_3 = "f0000410QQQ",
+ xscvdpsp_2 = "f0000424Q-Q",
+ xscvdpspn_2 = "f000042cQ-Q",
+ xsnmaddmsp_3 = "f0000448QQQ",
+ xxlandc_3 = "f0000450QQQ",
+ xsrsp_2 = "f0000464Q-Q",
+ xsnmsubasp_3 = "f0000488QQQ",
+ xxlor_3 = "f0000490QQQ",
+ xscvuxdsp_2 = "f00004a0Q-Q",
+ xsnmsubmsp_3 = "f00004c8QQQ",
+ xxlxor_3 = "f00004d0QQQ",
+ xscvsxdsp_2 = "f00004e0Q-Q",
+ xsmaxdp_3 = "f0000500QQQ",
+ xsnmaddadp_3 = "f0000508QQQ",
+ xxlnor_3 = "f0000510QQQ",
+ xscvdpuxds_2 = "f0000520Q-Q",
+ xscvspdp_2 = "f0000524Q-Q",
+ xscvspdpn_2 = "f000052cQ-Q",
+ xsmindp_3 = "f0000540QQQ",
+ xsnmaddmdp_3 = "f0000548QQQ",
+ xxlorc_3 = "f0000550QQQ",
+ xscvdpsxds_2 = "f0000560Q-Q",
+ xsabsdp_2 = "f0000564Q-Q",
+ xscpsgndp_3 = "f0000580QQQ",
+ xsnmsubadp_3 = "f0000588QQQ",
+ xxlnand_3 = "f0000590QQQ",
+ xscvuxddp_2 = "f00005a0Q-Q",
+ xsnabsdp_2 = "f00005a4Q-Q",
+ xsnmsubmdp_3 = "f00005c8QQQ",
+ xxleqv_3 = "f00005d0QQQ",
+ xscvsxddp_2 = "f00005e0Q-Q",
+ xsnegdp_2 = "f00005e4Q-Q",
+ xvmaxsp_3 = "f0000600QQQ",
+ xvnmaddasp_3 = "f0000608QQQ",
+ ["xvcmpeqsp._3"] = "f0000618QQQ",
+ xvcvspuxds_2 = "f0000620Q-Q",
+ xvcvdpsp_2 = "f0000624Q-Q",
+ xvminsp_3 = "f0000640QQQ",
+ xvnmaddmsp_3 = "f0000648QQQ",
+ ["xvcmpgtsp._3"] = "f0000658QQQ",
+ xvcvspsxds_2 = "f0000660Q-Q",
+ xvabssp_2 = "f0000664Q-Q",
+ xvcpsgnsp_3 = "f0000680QQQ",
+ xvnmsubasp_3 = "f0000688QQQ",
+ ["xvcmpgesp._3"] = "f0000698QQQ",
+ xvcvuxdsp_2 = "f00006a0Q-Q",
+ xvnabssp_2 = "f00006a4Q-Q",
+ xvnmsubmsp_3 = "f00006c8QQQ",
+ xvcvsxdsp_2 = "f00006e0Q-Q",
+ xvnegsp_2 = "f00006e4Q-Q",
+ xvmaxdp_3 = "f0000700QQQ",
+ xvnmaddadp_3 = "f0000708QQQ",
+ ["xvcmpeqdp._3"] = "f0000718QQQ",
+ xvcvdpuxds_2 = "f0000720Q-Q",
+ xvcvspdp_2 = "f0000724Q-Q",
+ xvmindp_3 = "f0000740QQQ",
+ xvnmaddmdp_3 = "f0000748QQQ",
+ ["xvcmpgtdp._3"] = "f0000758QQQ",
+ xvcvdpsxds_2 = "f0000760Q-Q",
+ xvabsdp_2 = "f0000764Q-Q",
+ xvcpsgndp_3 = "f0000780QQQ",
+ xvnmsubadp_3 = "f0000788QQQ",
+ ["xvcmpgedp._3"] = "f0000798QQQ",
+ xvcvuxddp_2 = "f00007a0Q-Q",
+ xvnabsdp_2 = "f00007a4Q-Q",
+ xvnmsubmdp_3 = "f00007c8QQQ",
+ xvcvsxddp_2 = "f00007e0Q-Q",
+ xvnegdp_2 = "f00007e4Q-Q",
+
+ -- Primary opcode 61:
+ stfdp_2 = "f4000000F:D", -- NYI: displacement must be divisible by 4.
+
+ -- Primary opcode 62:
+ stq_2 = "f8000002R:D", -- NYI: displacement must be divisible by 8.
+
+ -- Primary opcode 63:
+ fdiv_3 = "fc000024FFF.",
+ fsub_3 = "fc000028FFF.",
+ fadd_3 = "fc00002aFFF.",
+ fsqrt_2 = "fc00002cF-F.",
+ fsel_4 = "fc00002eFFFF~.",
+ fre_2 = "fc000030F-F.",
+ fmul_3 = "fc000032FF-F.",
+ frsqrte_2 = "fc000034F-F.",
+ fmsub_4 = "fc000038FFFF~.",
+ fmadd_4 = "fc00003aFFFF~.",
+ fnmsub_4 = "fc00003cFFFF~.",
+ fnmadd_4 = "fc00003eFFFF~.",
+ fcmpu_3 = "fc000000XFF",
+ fcpsgn_3 = "fc000010FFF.",
+ fcmpo_3 = "fc000040XFF",
+ mtfsb1_1 = "fc00004cA",
+ fneg_2 = "fc000050F-F.",
+ mcrfs_2 = "fc000080XX",
+ mtfsb0_1 = "fc00008cA",
+ fmr_2 = "fc000090F-F.",
+ frsp_2 = "fc000018F-F.",
+ fctiw_2 = "fc00001cF-F.",
+ fctiwz_2 = "fc00001eF-F.",
+ ftdiv_2 = "fc000100X-F.",
+ fctiwu_2 = "fc00011cF-F.",
+ fctiwuz_2 = "fc00011eF-F.",
+ mtfsfi_2 = "fc00010cAA", -- NYI: upshift.
+ fnabs_2 = "fc000110F-F.",
+ ftsqrt_2 = "fc000140X-F.",
+ fabs_2 = "fc000210F-F.",
+ frin_2 = "fc000310F-F.",
+ friz_2 = "fc000350F-F.",
+ frip_2 = "fc000390F-F.",
+ frim_2 = "fc0003d0F-F.",
+ mffs_1 = "fc00048eF.",
+ -- NYI: mtfsf, mtfsb0, mtfsb1.
+ fctid_2 = "fc00065cF-F.",
+ fctidz_2 = "fc00065eF-F.",
+ fmrgow_3 = "fc00068cFFF",
+ fcfid_2 = "fc00069cF-F.",
+ fctidu_2 = "fc00075cF-F.",
+ fctiduz_2 = "fc00075eF-F.",
+ fmrgew_3 = "fc00078cFFF",
+ fcfidu_2 = "fc00079cF-F.",
+
+ daddq_3 = "fc000004F:F:F:.",
+ dquaq_4 = "fc000006F:F:F:Z.",
+ dmulq_3 = "fc000044F:F:F:.",
+ drrndq_4 = "fc000046F:F:F:Z.",
+ dscliq_3 = "fc000084F:F:6.",
+ dquaiq_4 = "fc000086SF:~F:Z.",
+ dscriq_3 = "fc0000c4F:F:6.",
+ drintxq_4 = "fc0000c61F:~F:Z.",
+ dcmpoq_3 = "fc000104XF:F:",
+ dtstexq_3 = "fc000144XF:F:",
+ dtstdcq_3 = "fc000184XF:6",
+ dtstdgq_3 = "fc0001c4XF:6",
+ drintnq_4 = "fc0001c61F:~F:Z.",
+ dctqpq_2 = "fc000204F:-F:.",
+ dctfixq_2 = "fc000244F:-F:.",
+ ddedpdq_3 = "fc000284ZF:~F:.",
+ dxexq_2 = "fc0002c4F:-F:.",
+ dsubq_3 = "fc000404F:F:F:.",
+ ddivq_3 = "fc000444F:F:F:.",
+ dcmpuq_3 = "fc000504XF:F:",
+ dtstsfq_3 = "fc000544XF:F:",
+ drdpq_2 = "fc000604F:-F:.",
+ dcffixq_2 = "fc000644F:-F:.",
+ denbcdq_3 = "fc000684YF:~F:.",
+ diexq_3 = "fc0006c4F:FF:.",
+
+ -- Primary opcode 4, SPE APU extension:
+ evaddw_3 = "10000200RRR",
+ evaddiw_3 = "10000202RAR~",
+ evsubw_3 = "10000204RRR~",
+ evsubiw_3 = "10000206RAR~",
+ evabs_2 = "10000208RR",
+ evneg_2 = "10000209RR",
+ evextsb_2 = "1000020aRR",
+ evextsh_2 = "1000020bRR",
+ evrndw_2 = "1000020cRR",
+ evcntlzw_2 = "1000020dRR",
+ evcntlsw_2 = "1000020eRR",
+ brinc_3 = "1000020fRRR",
+ evand_3 = "10000211RRR",
+ evandc_3 = "10000212RRR",
+ evxor_3 = "10000216RRR",
+ evor_3 = "10000217RRR",
+ evmr_2 = "10000217RR=",
+ evnor_3 = "10000218RRR",
+ evnot_2 = "10000218RR=",
+ eveqv_3 = "10000219RRR",
+ evorc_3 = "1000021bRRR",
+ evnand_3 = "1000021eRRR",
+ evsrwu_3 = "10000220RRR",
+ evsrws_3 = "10000221RRR",
+ evsrwiu_3 = "10000222RRA",
+ evsrwis_3 = "10000223RRA",
+ evslw_3 = "10000224RRR",
+ evslwi_3 = "10000226RRA",
+ evrlw_3 = "10000228RRR",
+ evsplati_2 = "10000229RS",
+ evrlwi_3 = "1000022aRRA",
+ evsplatfi_2 = "1000022bRS",
+ evmergehi_3 = "1000022cRRR",
+ evmergelo_3 = "1000022dRRR",
+ evcmpgtu_3 = "10000230XRR",
+ evcmpgtu_2 = "10000230-RR",
+ evcmpgts_3 = "10000231XRR",
+ evcmpgts_2 = "10000231-RR",
+ evcmpltu_3 = "10000232XRR",
+ evcmpltu_2 = "10000232-RR",
+ evcmplts_3 = "10000233XRR",
+ evcmplts_2 = "10000233-RR",
+ evcmpeq_3 = "10000234XRR",
+ evcmpeq_2 = "10000234-RR",
+ evsel_4 = "10000278RRRW",
+ evsel_3 = "10000278RRR",
+ evfsadd_3 = "10000280RRR",
+ evfssub_3 = "10000281RRR",
+ evfsabs_2 = "10000284RR",
+ evfsnabs_2 = "10000285RR",
+ evfsneg_2 = "10000286RR",
+ evfsmul_3 = "10000288RRR",
+ evfsdiv_3 = "10000289RRR",
+ evfscmpgt_3 = "1000028cXRR",
+ evfscmpgt_2 = "1000028c-RR",
+ evfscmplt_3 = "1000028dXRR",
+ evfscmplt_2 = "1000028d-RR",
+ evfscmpeq_3 = "1000028eXRR",
+ evfscmpeq_2 = "1000028e-RR",
+ evfscfui_2 = "10000290R-R",
+ evfscfsi_2 = "10000291R-R",
+ evfscfuf_2 = "10000292R-R",
+ evfscfsf_2 = "10000293R-R",
+ evfsctui_2 = "10000294R-R",
+ evfsctsi_2 = "10000295R-R",
+ evfsctuf_2 = "10000296R-R",
+ evfsctsf_2 = "10000297R-R",
+ evfsctuiz_2 = "10000298R-R",
+ evfsctsiz_2 = "1000029aR-R",
+ evfststgt_3 = "1000029cXRR",
+ evfststgt_2 = "1000029c-RR",
+ evfststlt_3 = "1000029dXRR",
+ evfststlt_2 = "1000029d-RR",
+ evfststeq_3 = "1000029eXRR",
+ evfststeq_2 = "1000029e-RR",
+ efsadd_3 = "100002c0RRR",
+ efssub_3 = "100002c1RRR",
+ efsabs_2 = "100002c4RR",
+ efsnabs_2 = "100002c5RR",
+ efsneg_2 = "100002c6RR",
+ efsmul_3 = "100002c8RRR",
+ efsdiv_3 = "100002c9RRR",
+ efscmpgt_3 = "100002ccXRR",
+ efscmpgt_2 = "100002cc-RR",
+ efscmplt_3 = "100002cdXRR",
+ efscmplt_2 = "100002cd-RR",
+ efscmpeq_3 = "100002ceXRR",
+ efscmpeq_2 = "100002ce-RR",
+ efscfd_2 = "100002cfR-R",
+ efscfui_2 = "100002d0R-R",
+ efscfsi_2 = "100002d1R-R",
+ efscfuf_2 = "100002d2R-R",
+ efscfsf_2 = "100002d3R-R",
+ efsctui_2 = "100002d4R-R",
+ efsctsi_2 = "100002d5R-R",
+ efsctuf_2 = "100002d6R-R",
+ efsctsf_2 = "100002d7R-R",
+ efsctuiz_2 = "100002d8R-R",
+ efsctsiz_2 = "100002daR-R",
+ efststgt_3 = "100002dcXRR",
+ efststgt_2 = "100002dc-RR",
+ efststlt_3 = "100002ddXRR",
+ efststlt_2 = "100002dd-RR",
+ efststeq_3 = "100002deXRR",
+ efststeq_2 = "100002de-RR",
+ efdadd_3 = "100002e0RRR",
+ efdsub_3 = "100002e1RRR",
+ efdcfuid_2 = "100002e2R-R",
+ efdcfsid_2 = "100002e3R-R",
+ efdabs_2 = "100002e4RR",
+ efdnabs_2 = "100002e5RR",
+ efdneg_2 = "100002e6RR",
+ efdmul_3 = "100002e8RRR",
+ efddiv_3 = "100002e9RRR",
+ efdctuidz_2 = "100002eaR-R",
+ efdctsidz_2 = "100002ebR-R",
+ efdcmpgt_3 = "100002ecXRR",
+ efdcmpgt_2 = "100002ec-RR",
+ efdcmplt_3 = "100002edXRR",
+ efdcmplt_2 = "100002ed-RR",
+ efdcmpeq_3 = "100002eeXRR",
+ efdcmpeq_2 = "100002ee-RR",
+ efdcfs_2 = "100002efR-R",
+ efdcfui_2 = "100002f0R-R",
+ efdcfsi_2 = "100002f1R-R",
+ efdcfuf_2 = "100002f2R-R",
+ efdcfsf_2 = "100002f3R-R",
+ efdctui_2 = "100002f4R-R",
+ efdctsi_2 = "100002f5R-R",
+ efdctuf_2 = "100002f6R-R",
+ efdctsf_2 = "100002f7R-R",
+ efdctuiz_2 = "100002f8R-R",
+ efdctsiz_2 = "100002faR-R",
+ efdtstgt_3 = "100002fcXRR",
+ efdtstgt_2 = "100002fc-RR",
+ efdtstlt_3 = "100002fdXRR",
+ efdtstlt_2 = "100002fd-RR",
+ efdtsteq_3 = "100002feXRR",
+ efdtsteq_2 = "100002fe-RR",
+ evlddx_3 = "10000300RR0R",
+ evldd_2 = "10000301R8",
+ evldwx_3 = "10000302RR0R",
+ evldw_2 = "10000303R8",
+ evldhx_3 = "10000304RR0R",
+ evldh_2 = "10000305R8",
+ evlwhex_3 = "10000310RR0R",
+ evlwhe_2 = "10000311R4",
+ evlwhoux_3 = "10000314RR0R",
+ evlwhou_2 = "10000315R4",
+ evlwhosx_3 = "10000316RR0R",
+ evlwhos_2 = "10000317R4",
+ evstddx_3 = "10000320RR0R",
+ evstdd_2 = "10000321R8",
+ evstdwx_3 = "10000322RR0R",
+ evstdw_2 = "10000323R8",
+ evstdhx_3 = "10000324RR0R",
+ evstdh_2 = "10000325R8",
+ evstwhex_3 = "10000330RR0R",
+ evstwhe_2 = "10000331R4",
+ evstwhox_3 = "10000334RR0R",
+ evstwho_2 = "10000335R4",
+ evstwwex_3 = "10000338RR0R",
+ evstwwe_2 = "10000339R4",
+ evstwwox_3 = "1000033cRR0R",
+ evstwwo_2 = "1000033dR4",
+ evmhessf_3 = "10000403RRR",
+ evmhossf_3 = "10000407RRR",
+ evmheumi_3 = "10000408RRR",
+ evmhesmi_3 = "10000409RRR",
+ evmhesmf_3 = "1000040bRRR",
+ evmhoumi_3 = "1000040cRRR",
+ evmhosmi_3 = "1000040dRRR",
+ evmhosmf_3 = "1000040fRRR",
+ evmhessfa_3 = "10000423RRR",
+ evmhossfa_3 = "10000427RRR",
+ evmheumia_3 = "10000428RRR",
+ evmhesmia_3 = "10000429RRR",
+ evmhesmfa_3 = "1000042bRRR",
+ evmhoumia_3 = "1000042cRRR",
+ evmhosmia_3 = "1000042dRRR",
+ evmhosmfa_3 = "1000042fRRR",
+ evmwhssf_3 = "10000447RRR",
+ evmwlumi_3 = "10000448RRR",
+ evmwhumi_3 = "1000044cRRR",
+ evmwhsmi_3 = "1000044dRRR",
+ evmwhsmf_3 = "1000044fRRR",
+ evmwssf_3 = "10000453RRR",
+ evmwumi_3 = "10000458RRR",
+ evmwsmi_3 = "10000459RRR",
+ evmwsmf_3 = "1000045bRRR",
+ evmwhssfa_3 = "10000467RRR",
+ evmwlumia_3 = "10000468RRR",
+ evmwhumia_3 = "1000046cRRR",
+ evmwhsmia_3 = "1000046dRRR",
+ evmwhsmfa_3 = "1000046fRRR",
+ evmwssfa_3 = "10000473RRR",
+ evmwumia_3 = "10000478RRR",
+ evmwsmia_3 = "10000479RRR",
+ evmwsmfa_3 = "1000047bRRR",
+ evmra_2 = "100004c4RR",
+ evdivws_3 = "100004c6RRR",
+ evdivwu_3 = "100004c7RRR",
+ evmwssfaa_3 = "10000553RRR",
+ evmwumiaa_3 = "10000558RRR",
+ evmwsmiaa_3 = "10000559RRR",
+ evmwsmfaa_3 = "1000055bRRR",
+ evmwssfan_3 = "100005d3RRR",
+ evmwumian_3 = "100005d8RRR",
+ evmwsmian_3 = "100005d9RRR",
+ evmwsmfan_3 = "100005dbRRR",
+ evmergehilo_3 = "1000022eRRR",
+ evmergelohi_3 = "1000022fRRR",
+ evlhhesplatx_3 = "10000308RR0R",
+ evlhhesplat_2 = "10000309R2",
+ evlhhousplatx_3 = "1000030cRR0R",
+ evlhhousplat_2 = "1000030dR2",
+ evlhhossplatx_3 = "1000030eRR0R",
+ evlhhossplat_2 = "1000030fR2",
+ evlwwsplatx_3 = "10000318RR0R",
+ evlwwsplat_2 = "10000319R4",
+ evlwhsplatx_3 = "1000031cRR0R",
+ evlwhsplat_2 = "1000031dR4",
+ evaddusiaaw_2 = "100004c0RR",
+ evaddssiaaw_2 = "100004c1RR",
+ evsubfusiaaw_2 = "100004c2RR",
+ evsubfssiaaw_2 = "100004c3RR",
+ evaddumiaaw_2 = "100004c8RR",
+ evaddsmiaaw_2 = "100004c9RR",
+ evsubfumiaaw_2 = "100004caRR",
+ evsubfsmiaaw_2 = "100004cbRR",
+ evmheusiaaw_3 = "10000500RRR",
+ evmhessiaaw_3 = "10000501RRR",
+ evmhessfaaw_3 = "10000503RRR",
+ evmhousiaaw_3 = "10000504RRR",
+ evmhossiaaw_3 = "10000505RRR",
+ evmhossfaaw_3 = "10000507RRR",
+ evmheumiaaw_3 = "10000508RRR",
+ evmhesmiaaw_3 = "10000509RRR",
+ evmhesmfaaw_3 = "1000050bRRR",
+ evmhoumiaaw_3 = "1000050cRRR",
+ evmhosmiaaw_3 = "1000050dRRR",
+ evmhosmfaaw_3 = "1000050fRRR",
+ evmhegumiaa_3 = "10000528RRR",
+ evmhegsmiaa_3 = "10000529RRR",
+ evmhegsmfaa_3 = "1000052bRRR",
+ evmhogumiaa_3 = "1000052cRRR",
+ evmhogsmiaa_3 = "1000052dRRR",
+ evmhogsmfaa_3 = "1000052fRRR",
+ evmwlusiaaw_3 = "10000540RRR",
+ evmwlssiaaw_3 = "10000541RRR",
+ evmwlumiaaw_3 = "10000548RRR",
+ evmwlsmiaaw_3 = "10000549RRR",
+ evmheusianw_3 = "10000580RRR",
+ evmhessianw_3 = "10000581RRR",
+ evmhessfanw_3 = "10000583RRR",
+ evmhousianw_3 = "10000584RRR",
+ evmhossianw_3 = "10000585RRR",
+ evmhossfanw_3 = "10000587RRR",
+ evmheumianw_3 = "10000588RRR",
+ evmhesmianw_3 = "10000589RRR",
+ evmhesmfanw_3 = "1000058bRRR",
+ evmhoumianw_3 = "1000058cRRR",
+ evmhosmianw_3 = "1000058dRRR",
+ evmhosmfanw_3 = "1000058fRRR",
+ evmhegumian_3 = "100005a8RRR",
+ evmhegsmian_3 = "100005a9RRR",
+ evmhegsmfan_3 = "100005abRRR",
+ evmhogumian_3 = "100005acRRR",
+ evmhogsmian_3 = "100005adRRR",
+ evmhogsmfan_3 = "100005afRRR",
+ evmwlusianw_3 = "100005c0RRR",
+ evmwlssianw_3 = "100005c1RRR",
+ evmwlumianw_3 = "100005c8RRR",
+ evmwlsmianw_3 = "100005c9RRR",
+
+ -- NYI: Book E instructions.
+}
+
+-- Add mnemonics for "." variants.
+do
+ local t = {}
+ for k,v in pairs(map_op) do
+ if type(v) == "string" and sub(v, -1) == "." then
+ local v2 = sub(v, 1, 7)..char(byte(v, 8)+1)..sub(v, 9, -2)
+ t[sub(k, 1, -3).."."..sub(k, -2)] = v2
+ end
+ end
+ for k,v in pairs(t) do
+ map_op[k] = v
+ end
+end
+
+-- Add more branch mnemonics.
+for cond,c in pairs(map_cond) do
+ local b1 = "b"..cond
+ local c1 = shl(band(c, 3), 16) + (c < 4 and 0x01000000 or 0)
+ -- bX[l]
+ map_op[b1.."_1"] = tohex(0x40800000 + c1).."K"
+ map_op[b1.."y_1"] = tohex(0x40a00000 + c1).."K"
+ map_op[b1.."l_1"] = tohex(0x40800001 + c1).."K"
+ map_op[b1.."_2"] = tohex(0x40800000 + c1).."-XK"
+ map_op[b1.."y_2"] = tohex(0x40a00000 + c1).."-XK"
+ map_op[b1.."l_2"] = tohex(0x40800001 + c1).."-XK"
+ -- bXlr[l]
+ map_op[b1.."lr_0"] = tohex(0x4c800020 + c1)
+ map_op[b1.."lrl_0"] = tohex(0x4c800021 + c1)
+ map_op[b1.."ctr_0"] = tohex(0x4c800420 + c1)
+ map_op[b1.."ctrl_0"] = tohex(0x4c800421 + c1)
+ -- bXctr[l]
+ map_op[b1.."lr_1"] = tohex(0x4c800020 + c1).."-X"
+ map_op[b1.."lrl_1"] = tohex(0x4c800021 + c1).."-X"
+ map_op[b1.."ctr_1"] = tohex(0x4c800420 + c1).."-X"
+ map_op[b1.."ctrl_1"] = tohex(0x4c800421 + c1).."-X"
+end
+
+------------------------------------------------------------------------------
+
+local function parse_gpr(expr)
+ local tname, ovreg = match(expr, "^([%w_]+):(r[1-3]?[0-9])$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local r = match(expr, "^r([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r, tp end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_fpr(expr)
+ local r = match(expr, "^f([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_vr(expr)
+ local r = match(expr, "^v([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_vs(expr)
+ local r = match(expr, "^vs([1-6]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 63 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_cr(expr)
+ local r = match(expr, "^cr([0-7])$")
+ if r then return tonumber(r) end
+ werror("bad condition register name `"..expr.."'")
+end
+
+local function parse_cond(expr)
+ local r, cond = match(expr, "^4%*cr([0-7])%+(%w%w)$")
+ if r then
+ r = tonumber(r)
+ local c = map_cond[cond]
+ if c and c < 4 then return r*4+c end
+ end
+ werror("bad condition bit name `"..expr.."'")
+end
+
+local parse_ctx = {}
+
+local loadenv = setfenv and function(s)
+ local code = loadstring(s, "")
+ if code then setfenv(code, parse_ctx) end
+ return code
+end or function(s)
+ return load(s, "", nil, parse_ctx)
+end
+
+-- Try to parse simple arithmetic, too, since some basic ops are aliases.
+local function parse_number(n)
+ local x = tonumber(n)
+ if x then return x end
+ local code = loadenv("return "..n)
+ if code then
+ local ok, y = pcall(code)
+ if ok then return y end
+ end
+ return nil
+end
+
+local function parse_imm(imm, bits, shift, scale, signed)
+ local n = parse_number(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif match(imm, "^[rfv]([1-3]?[0-9])$") or
+ match(imm, "^vs([1-6]?[0-9])$") or
+ match(imm, "^([%w_]+):(r[1-3]?[0-9])$") then
+ werror("expected immediate operand, got register")
+ else
+ waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
+ return 0
+ end
+end
+
+local function parse_shiftmask(imm, isshift)
+ local n = parse_number(imm)
+ if n then
+ if shr(n, 6) == 0 then
+ local lsb = band(n, 31)
+ local msb = n - lsb
+ return isshift and (shl(lsb, 11)+shr(msb, 4)) or (shl(lsb, 6)+msb)
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif match(imm, "^r([1-3]?[0-9])$") or
+ match(imm, "^([%w_]+):(r[1-3]?[0-9])$") then
+ werror("expected immediate operand, got register")
+ else
+ waction("IMMSH", isshift and 1 or 0, imm)
+ return 0;
+ end
+end
+
+local function parse_disp(disp)
+ local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
+ if imm then
+ local r = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ return shl(r, 16) + parse_imm(imm, 16, 0, 0, true)
+ end
+ local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local r, tp = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ if tp then
+ waction("IMM", 32768+16*32, format(tp.ctypefmt, tailr))
+ return shl(r, 16)
+ end
+ end
+ werror("bad displacement `"..disp.."'")
+end
+
+local function parse_u5disp(disp, scale)
+ local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
+ if imm then
+ local r = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ return shl(r, 16) + parse_imm(imm, 5, 11, scale, false)
+ end
+ local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local r, tp = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ if tp then
+ waction("IMM", scale*1024+5*32+11, format(tp.ctypefmt, tailr))
+ return shl(r, 16)
+ end
+ end
+ werror("bad displacement `"..disp.."'")
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+op_template = function(params, template, nparams)
+ if not params then return sub(template, 9) end
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n, rs = 1, 26
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 3 positions (rlwinm).
+ if secpos+3 > maxsecpos then wflush() end
+ local pos = wpos()
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ if p == "R" then
+ rs = rs - 5; op = op + shl(parse_gpr(params[n]), rs); n = n + 1
+ elseif p == "F" then
+ rs = rs - 5; op = op + shl(parse_fpr(params[n]), rs); n = n + 1
+ elseif p == "V" then
+ rs = rs - 5; op = op + shl(parse_vr(params[n]), rs); n = n + 1
+ elseif p == "Q" then
+ local vs = parse_vs(params[n]); n = n + 1; rs = rs - 5
+ local sh = rs == 6 and 2 or 3 + band(shr(rs, 1), 3)
+ op = op + shl(band(vs, 31), rs) + shr(band(vs, 32), sh)
+ elseif p == "q" then
+ local vs = parse_vs(params[n]); n = n + 1
+ op = op + shl(band(vs, 31), 21) + shr(band(vs, 32), 5)
+ elseif p == "A" then
+ rs = rs - 5; op = op + parse_imm(params[n], 5, rs, 0, false); n = n + 1
+ elseif p == "S" then
+ rs = rs - 5; op = op + parse_imm(params[n], 5, rs, 0, true); n = n + 1
+ elseif p == "I" then
+ op = op + parse_imm(params[n], 16, 0, 0, true); n = n + 1
+ elseif p == "U" then
+ op = op + parse_imm(params[n], 16, 0, 0, false); n = n + 1
+ elseif p == "D" then
+ op = op + parse_disp(params[n]); n = n + 1
+ elseif p == "2" then
+ op = op + parse_u5disp(params[n], 1); n = n + 1
+ elseif p == "4" then
+ op = op + parse_u5disp(params[n], 2); n = n + 1
+ elseif p == "8" then
+ op = op + parse_u5disp(params[n], 3); n = n + 1
+ elseif p == "C" then
+ rs = rs - 5; op = op + shl(parse_cond(params[n]), rs); n = n + 1
+ elseif p == "X" then
+ rs = rs - 5; op = op + shl(parse_cr(params[n]), rs+2); n = n + 1
+ elseif p == "1" then
+ rs = rs - 5; op = op + parse_imm(params[n], 1, rs, 0, false); n = n + 1
+ elseif p == "g" then
+ rs = rs - 5; op = op + parse_imm(params[n], 2, rs, 0, false); n = n + 1
+ elseif p == "3" then
+ rs = rs - 5; op = op + parse_imm(params[n], 3, rs, 0, false); n = n + 1
+ elseif p == "P" then
+ rs = rs - 5; op = op + parse_imm(params[n], 4, rs, 0, false); n = n + 1
+ elseif p == "p" then
+ op = op + parse_imm(params[n], 4, rs, 0, false); n = n + 1
+ elseif p == "6" then
+ rs = rs - 6; op = op + parse_imm(params[n], 6, rs, 0, false); n = n + 1
+ elseif p == "Y" then
+ rs = rs - 5; op = op + parse_imm(params[n], 1, rs+4, 0, false); n = n + 1
+ elseif p == "y" then
+ rs = rs - 5; op = op + parse_imm(params[n], 1, rs+3, 0, false); n = n + 1
+ elseif p == "Z" then
+ rs = rs - 5; op = op + parse_imm(params[n], 2, rs+3, 0, false); n = n + 1
+ elseif p == "z" then
+ rs = rs - 5; op = op + parse_imm(params[n], 2, rs+2, 0, false); n = n + 1
+ elseif p == "W" then
+ op = op + parse_cr(params[n]); n = n + 1
+ elseif p == "G" then
+ op = op + parse_imm(params[n], 8, 12, 0, false); n = n + 1
+ elseif p == "H" then
+ op = op + parse_shiftmask(params[n], true); n = n + 1
+ elseif p == "M" then
+ op = op + parse_shiftmask(params[n], false); n = n + 1
+ elseif p == "J" or p == "K" then
+ local mode, n, s = parse_label(params[n], false)
+ if p == "K" then n = n + 2048 end
+ waction("REL_"..mode, n, s, 1)
+ n = n + 1
+ elseif p == "0" then
+ if band(shr(op, rs), 31) == 0 then werror("cannot use r0") end
+ elseif p == "=" or p == "%" then
+ local t = band(shr(op, p == "%" and rs+5 or rs), 31)
+ rs = rs - 5
+ op = op + shl(t, rs)
+ elseif p == "~" then
+ local mm = shl(31, rs)
+ local lo = band(op, mm)
+ local hi = band(op, shl(mm, 5))
+ op = op - lo - hi + shl(lo, 5) + shr(hi, 5)
+ elseif p == ":" then
+ if band(shr(op, rs), 1) ~= 0 then werror("register pair expected") end
+ elseif p == "-" then
+ rs = rs - 5
+ elseif p == "." then
+ -- Ignored.
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+map_op[".template__"] = op_template
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_proto.h b/ext/opcache/jit/dynasm/dasm_proto.h
new file mode 100644
index 0000000000..22a654cbfd
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_proto.h
@@ -0,0 +1,83 @@
+/*
+** DynASM encoding engine prototypes.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#ifndef _DASM_PROTO_H
+#define _DASM_PROTO_H
+
+#include <stddef.h>
+#include <stdarg.h>
+
+#define DASM_IDENT "DynASM 1.4.0"
+#define DASM_VERSION 10400 /* 1.4.0 */
+
+#ifndef Dst_DECL
+#define Dst_DECL dasm_State **Dst
+#endif
+
+#ifndef Dst_REF
+#define Dst_REF (*Dst)
+#endif
+
+#ifndef DASM_FDEF
+#define DASM_FDEF extern
+#endif
+
+#ifndef DASM_M_GROW
+#define DASM_M_GROW(ctx, t, p, sz, need) \
+ do { \
+ size_t _sz = (sz), _need = (need); \
+ if (_sz < _need) { \
+ if (_sz < 16) _sz = 16; \
+ while (_sz < _need) _sz += _sz; \
+ (p) = (t *)realloc((p), _sz); \
+ if ((p) == NULL) exit(1); \
+ (sz) = _sz; \
+ } \
+ } while(0)
+#endif
+
+#ifndef DASM_M_FREE
+#define DASM_M_FREE(ctx, p, sz) free(p)
+#endif
+
+/* Internal DynASM encoder state. */
+typedef struct dasm_State dasm_State;
+
+
+/* Initialize and free DynASM state. */
+DASM_FDEF void dasm_init(Dst_DECL, int maxsection);
+DASM_FDEF void dasm_free(Dst_DECL);
+
+/* Setup global array. Must be called before dasm_setup(). */
+DASM_FDEF void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl);
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+DASM_FDEF void dasm_growpc(Dst_DECL, unsigned int maxpc);
+
+/* Setup encoder. */
+DASM_FDEF void dasm_setup(Dst_DECL, const void *actionlist);
+
+/* Feed encoder with actions. Calls are generated by pre-processor. */
+DASM_FDEF void dasm_put(Dst_DECL, int start, ...);
+
+/* Link sections and return the resulting size. */
+DASM_FDEF int dasm_link(Dst_DECL, size_t *szp);
+
+/* Encode sections into buffer. */
+DASM_FDEF int dasm_encode(Dst_DECL, void *buffer);
+
+/* Get PC label offset. */
+DASM_FDEF int dasm_getpclabel(Dst_DECL, unsigned int pc);
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+DASM_FDEF int dasm_checkstep(Dst_DECL, int secmatch);
+#else
+#define dasm_checkstep(a, b) 0
+#endif
+
+
+#endif /* _DASM_PROTO_H */
diff --git a/ext/opcache/jit/dynasm/dasm_x64.lua b/ext/opcache/jit/dynasm/dasm_x64.lua
new file mode 100644
index 0000000000..2133355644
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_x64.lua
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+-- DynASM x64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+-- This module just sets 64 bit mode for the combined x86/x64 module.
+-- All the interesting stuff is there.
+------------------------------------------------------------------------------
+
+x64 = true -- Using a global is an ugly, but effective solution.
+return require("dasm_x86")
diff --git a/ext/opcache/jit/dynasm/dasm_x86.h b/ext/opcache/jit/dynasm/dasm_x86.h
new file mode 100644
index 0000000000..32874b40b9
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_x86.h
@@ -0,0 +1,500 @@
+/*
+** DynASM x86 encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "x86"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. DASM_STOP must be 255. */
+enum {
+ DASM_DISP = 233,
+ DASM_IMM_S, DASM_IMM_B, DASM_IMM_W, DASM_IMM_D, DASM_IMM_WB, DASM_IMM_DB,
+ DASM_VREG, DASM_SPACE, DASM_SETLABEL, DASM_REL_A, DASM_REL_LG, DASM_REL_PC,
+ DASM_IMM_LG, DASM_IMM_PC, DASM_LABEL_LG, DASM_LABEL_PC, DASM_ALIGN,
+ DASM_EXTERN, DASM_ESC, DASM_MARK, DASM_SECTION, DASM_STOP
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_VREG 0x15000000
+#define DASM_S_UNDEF_L 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned char *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(int)(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status=DASM_S_RANGE_##st|(int)(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs, mrm = -1;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ int action = *p++;
+ if (action < DASM_DISP) {
+ ofs++;
+ } else if (action <= DASM_REL_A) {
+ int n = va_arg(ap, int);
+ b[pos++] = n;
+ switch (action) {
+ case DASM_DISP:
+ if (n == 0) { if (mrm < 0) mrm = p[-2]; if ((mrm&7) != 5) break; }
+ case DASM_IMM_DB: if (((n+128)&-256) == 0) goto ob;
+ case DASM_REL_A: /* Assumes ptrdiff_t is int. !x64 */
+ case DASM_IMM_D: ofs += 4; break;
+ case DASM_IMM_S: CK(((n+128)&-256) == 0, RANGE_I); goto ob;
+ case DASM_IMM_B: CK((n&-256) == 0, RANGE_I); ob: ofs++; break;
+ case DASM_IMM_WB: if (((n+128)&-256) == 0) goto ob;
+ case DASM_IMM_W: CK((n&-65536) == 0, RANGE_I); ofs += 2; break;
+ case DASM_SPACE: p++; ofs += n; break;
+ case DASM_SETLABEL: b[pos-2] = -0x40000000; break; /* Neg. label ofs. */
+ case DASM_VREG: CK((n&-16) == 0 && (n != 4 || (*p>>5) != 2), RANGE_VREG);
+ if (*p < 0x40 && p[1] == DASM_DISP) mrm = n;
+ if (*p < 0x20 && (n&7) == 4) ofs++;
+ switch ((*p++ >> 3) & 3) {
+ case 3: n |= b[pos-3];
+ case 2: n |= b[pos-2];
+ case 1: if (n <= 7) { b[pos-1] |= 0x10; ofs--; }
+ }
+ continue;
+ }
+ mrm = -1;
+ } else {
+ int *pl, n;
+ switch (action) {
+ case DASM_REL_LG:
+ case DASM_IMM_LG:
+ n = *p++; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n <= 246) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl -= 246; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ case DASM_IMM_PC: pl = D->pclabels + va_arg(ap, int); CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ ofs += 4; /* Maximum offset needed. */
+ if (action == DASM_REL_LG || action == DASM_REL_PC)
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_LABEL_LG: pl = D->lglabels + *p++; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC: pl = D->pclabels + va_arg(ap, int); CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos; }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_ALIGN:
+ ofs += *p++; /* Maximum alignment needed (arg is 2**n-1). */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_EXTERN: p += 2; ofs += 4; break;
+ case DASM_ESC: p++; ofs++; break;
+ case DASM_MARK: mrm = p[-2]; break;
+ case DASM_SECTION:
+ n = *p; CK(n < D->maxsection, RANGE_SEC); D->section = &D->sections[n];
+ case DASM_STOP: goto stop;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink branches/aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 10; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ int op, action = *p++;
+ switch (action) {
+ case DASM_REL_LG: p++; op = p[-3]; goto rel_pc;
+ case DASM_REL_PC: op = p[-2]; rel_pc: {
+ int shrink = op == 0xe9 ? 3 : ((op&0xf0) == 0x80 ? 4 : 0);
+ if (shrink) { /* Shrinkable branch opcode? */
+ int lofs, lpos = b[pos];
+ if (lpos < 0) goto noshrink; /* Ext global? */
+ lofs = *DASM_POS2PTR(D, lpos);
+ if (lpos > pos) { /* Fwd label: add cumulative section offsets. */
+ int i;
+ for (i = secnum; i < DASM_POS2SEC(lpos); i++)
+ lofs += D->sections[i].ofs;
+ } else {
+ lofs -= ofs; /* Bkwd label: unfix offset. */
+ }
+ lofs -= b[pos+1]; /* Short branch ok? */
+ if (lofs >= -128-shrink && lofs <= 127) ofs -= shrink; /* Yes. */
+ else { noshrink: shrink = 0; } /* No, cannot shrink op. */
+ }
+ b[pos+1] = shrink;
+ pos += 2;
+ break;
+ }
+ case DASM_SPACE: case DASM_IMM_LG: case DASM_VREG: p++;
+ case DASM_DISP: case DASM_IMM_S: case DASM_IMM_B: case DASM_IMM_W:
+ case DASM_IMM_D: case DASM_IMM_WB: case DASM_IMM_DB:
+ case DASM_SETLABEL: case DASM_REL_A: case DASM_IMM_PC: pos++; break;
+ case DASM_LABEL_LG: p++;
+ case DASM_LABEL_PC: b[pos++] += ofs; break; /* Fix label offset. */
+ case DASM_ALIGN: ofs -= (b[pos++]+ofs)&*p++; break; /* Adjust ofs. */
+ case DASM_EXTERN: p += 2; break;
+ case DASM_ESC: p++; break;
+ case DASM_MARK: break;
+ case DASM_SECTION: case DASM_STOP: goto stop;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#define dasmb(x) *cp++ = (unsigned char)(x)
+#ifndef DASM_ALIGNED_WRITES
+typedef ZEND_SET_ALIGNED(1, unsigned short unaligned_short);
+typedef ZEND_SET_ALIGNED(1, unsigned int unaligned_int);
+#define dasmw(x) \
+ do { *((unaligned_short *)cp) = (unsigned short)(x); cp+=2; } while (0)
+#define dasmd(x) \
+ do { *((unaligned_int *)cp) = (unsigned int)(x); cp+=4; } while (0)
+#else
+#define dasmw(x) do { dasmb(x); dasmb((x)>>8); } while (0)
+#define dasmd(x) do { dasmw(x); dasmw((x)>>16); } while (0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ unsigned char *base = (unsigned char *)buffer;
+ unsigned char *cp = base;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ unsigned char *mark = NULL;
+ while (1) {
+ int action = *p++;
+ int n = (action >= DASM_DISP && action <= DASM_ALIGN) ? *b++ : 0;
+ switch (action) {
+ case DASM_DISP: if (!mark) mark = cp; {
+ unsigned char *mm = mark;
+ if (*p != DASM_IMM_DB && *p != DASM_IMM_WB) mark = NULL;
+ if (n == 0) { int mrm = mm[-1]&7; if (mrm == 4) mrm = mm[0]&7;
+ if (mrm != 5) { mm[-1] -= 0x80; break; } }
+ if (((n+128) & -256) != 0) goto wd; else mm[-1] -= 0x40;
+ }
+ case DASM_IMM_S: case DASM_IMM_B: wb: dasmb(n); break;
+ case DASM_IMM_DB: if (((n+128)&-256) == 0) {
+ db: if (!mark) mark = cp; mark[-2] += 2; mark = NULL; goto wb;
+ } else mark = NULL;
+ case DASM_IMM_D: wd: dasmd(n); break;
+ case DASM_IMM_WB: if (((n+128)&-256) == 0) goto db; else mark = NULL;
+ case DASM_IMM_W: dasmw(n); break;
+ case DASM_VREG: {
+ int t = *p++;
+ unsigned char *ex = cp - (t&7);
+ if ((n & 8) && t < 0xa0) {
+ if (*ex & 0x80) ex[1] ^= 0x20 << (t>>6); else *ex ^= 1 << (t>>6);
+ n &= 7;
+ } else if (n & 0x10) {
+ if (*ex & 0x80) {
+ *ex = 0xc5; ex[1] = (ex[1] & 0x80) | ex[2]; ex += 2;
+ }
+ while (++ex < cp) ex[-1] = *ex;
+ if (mark) mark--;
+ cp--;
+ n &= 7;
+ }
+ if (t >= 0xc0) n <<= 4;
+ else if (t >= 0x40) n <<= 3;
+ else if (n == 4 && t < 0x20) { cp[-1] ^= n; *cp++ = 0x20; }
+ cp[-1] ^= n;
+ break;
+ }
+ case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
+ b++; n = (int)(ptrdiff_t)D->globals[-n];
+ case DASM_REL_A: rel_a: n -= (int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
+ case DASM_REL_PC: rel_pc: {
+ int shrink = *b++;
+ int *pb = DASM_POS2PTR(D, n); if (*pb < 0) { n = pb[1]; goto rel_a; }
+ n = *pb - ((int)(cp-base) + 4-shrink);
+ if (shrink == 0) goto wd;
+ if (shrink == 4) { cp--; cp[-1] = *cp-0x10; } else cp[-1] = 0xeb;
+ goto wb;
+ }
+ case DASM_IMM_LG:
+ p++; if (n < 0) { n = (int)(ptrdiff_t)D->globals[-n]; goto wd; }
+ case DASM_IMM_PC: {
+ int *pb = DASM_POS2PTR(D, n);
+ n = *pb < 0 ? pb[1] : (*pb + (int)(ptrdiff_t)base);
+ goto wd;
+ }
+ case DASM_LABEL_LG: {
+ int idx = *p++;
+ if (idx >= 10)
+ D->globals[idx] = (void *)(base + (*p == DASM_SETLABEL ? *b : n));
+ break;
+ }
+ case DASM_LABEL_PC: case DASM_SETLABEL: break;
+ case DASM_SPACE: { int fill = *p++; while (n--) *cp++ = fill; break; }
+ case DASM_ALIGN:
+ n = *p++;
+ while (((cp-base) & n)) *cp++ = 0x90; /* nop */
+ break;
+ case DASM_EXTERN: n = DASM_EXTERN(Dst, cp, p[1], *p); p += 2; goto wd;
+ case DASM_MARK: mark = cp; break;
+ case DASM_ESC: action = *p++;
+ default: *cp++ = action; break;
+ case DASM_SECTION: case DASM_STOP: goto stop;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_L|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(int)(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_x86.lua b/ext/opcache/jit/dynasm/dasm_x86.lua
new file mode 100644
index 0000000000..a5efd98fb5
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_x86.lua
@@ -0,0 +1,2274 @@
+------------------------------------------------------------------------------
+-- DynASM x86/x64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+local x64 = x64
+
+-- Module information:
+local _info = {
+ arch = x64 and "x64" or "x86",
+ description = "DynASM x86/x64 module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, unpack, setmetatable = assert, unpack or table.unpack, setmetatable
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local find, match, gmatch, gsub = _s.find, _s.match, _s.gmatch, _s.gsub
+local concat, sort, remove = table.concat, table.sort, table.remove
+local bit = bit or require("bit")
+local band, bxor, shl, shr = bit.band, bit.bxor, bit.lshift, bit.rshift
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ -- int arg, 1 buffer pos:
+ "DISP", "IMM_S", "IMM_B", "IMM_W", "IMM_D", "IMM_WB", "IMM_DB",
+ -- action arg (1 byte), int arg, 1 buffer pos (reg/num):
+ "VREG", "SPACE",
+ -- ptrdiff_t arg, 1 buffer pos (address): !x64
+ "SETLABEL", "REL_A",
+ -- action arg (1 byte) or int arg, 2 buffer pos (link, offset):
+ "REL_LG", "REL_PC",
+ -- action arg (1 byte) or int arg, 1 buffer pos (link):
+ "IMM_LG", "IMM_PC",
+ -- action arg (1 byte) or int arg, 1 buffer pos (offset):
+ "LABEL_LG", "LABEL_PC",
+ -- action arg (1 byte), 1 buffer pos (offset):
+ "ALIGN",
+ -- action args (2 bytes), no buffer pos.
+ "EXTERN",
+ -- action arg (1 byte), no buffer pos.
+ "ESC",
+ -- no action arg, no buffer pos.
+ "MARK",
+ -- action arg (1 byte), no buffer pos, terminal action:
+ "SECTION",
+ -- no args, no buffer pos, terminal action:
+ "STOP"
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number (dynamically generated below).
+local map_action = {}
+-- First action number. Everything below does not need to be escaped.
+local actfirst = 256-#action_names
+
+-- Action list buffer and string (only used to remove dupes).
+local actlist = {}
+local actstr = ""
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+-- VREG kind encodings, pre-shifted by 5 bits.
+local map_vreg = {
+ ["modrm.rm.m"] = 0x00,
+ ["modrm.rm.r"] = 0x20,
+ ["opcode"] = 0x20,
+ ["sib.base"] = 0x20,
+ ["sib.index"] = 0x40,
+ ["modrm.reg"] = 0x80,
+ ["vex.v"] = 0xa0,
+ ["imm.hi"] = 0xc0,
+}
+
+-- Current number of VREG actions contributing to REX/VEX shrinkage.
+local vreg_shrink_count = 0
+
+------------------------------------------------------------------------------
+
+-- Compute action numbers for action names.
+for n,name in ipairs(action_names) do
+ local num = actfirst + n - 1
+ map_action[name] = num
+end
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ local last = actlist[nn] or 255
+ actlist[nn] = nil -- Remove last byte.
+ if nn == 0 then nn = 1 end
+ out:write("static const unsigned char ", name, "[", nn, "] = {\n")
+ local s = " "
+ for n,b in ipairs(actlist) do
+ s = s..b..","
+ if #s >= 75 then
+ assert(out:write(s, "\n"))
+ s = " "
+ end
+ end
+ out:write(s, last, "\n};\n\n") -- Add last byte back.
+end
+
+------------------------------------------------------------------------------
+
+-- Add byte to action list.
+local function wputxb(n)
+ assert(n >= 0 and n <= 255 and n % 1 == 0, "byte out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, a, num)
+ wputxb(assert(map_action[action], "bad action name `"..action.."'"))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Optionally add a VREG action.
+local function wvreg(kind, vreg, psz, sk, defer)
+ if not vreg then return end
+ waction("VREG", vreg)
+ local b = assert(map_vreg[kind], "bad vreg kind `"..vreg.."'")
+ if b < (sk or 0) then
+ vreg_shrink_count = vreg_shrink_count + 1
+ end
+ if not defer then
+ b = b + vreg_shrink_count * 8
+ vreg_shrink_count = 0
+ end
+ wputxb(b + (psz or 0))
+end
+
+-- Add call to embedded DynASM C code.
+local function wcall(func, args)
+ wline(format("dasm_%s(Dst, %s);", func, concat(args, ", ")), true)
+end
+
+-- Delete duplicate action list chunks. A tad slow, but so what.
+local function dedupechunk(offset)
+ local al, as = actlist, actstr
+ local chunk = char(unpack(al, offset+1, #al))
+ local orig = find(as, chunk, 1, true)
+ if orig then
+ actargs[1] = orig-1 -- Replace with original offset.
+ for i=offset+1,#al do al[i] = nil end -- Kill dupe.
+ else
+ actstr = as..chunk
+ end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ local offset = actargs[1]
+ if #actlist == offset then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ dedupechunk(offset)
+ wcall("put", actargs) -- Add call to dasm_put().
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped byte.
+local function wputb(n)
+ if n >= actfirst then waction("ESC") end -- Need to escape byte.
+ wputxb(n)
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 10
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_@]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 246 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=10,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=10,next_global-1 do
+ out:write(" ", prefix, gsub(t[i], "@.*", ""), ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=10,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = -1
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n < -256 then werror("too many extern labels") end
+ next_extern = n - 1
+ t[name] = n
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ local t = {}
+ for name, n in pairs(map_extern) do t[-n] = name end
+ out:write("Extern labels:\n")
+ for i=1,-next_extern-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ local t = {}
+ for name, n in pairs(map_extern) do t[-n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=1,-next_extern-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+local map_archdef = {} -- Ext. register name -> int. name.
+local map_reg_rev = {} -- Int. register name -> ext. name.
+local map_reg_num = {} -- Int. register name -> register number.
+local map_reg_opsize = {} -- Int. register name -> operand size.
+local map_reg_valid_base = {} -- Int. register name -> valid base register?
+local map_reg_valid_index = {} -- Int. register name -> valid index register?
+local map_reg_needrex = {} -- Int. register name -> need rex vs. no rex.
+local reg_list = {} -- Canonical list of int. register names.
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for _PTx macros).
+
+local addrsize = x64 and "q" or "d" -- Size for address operands.
+
+-- Helper functions to fill register maps.
+local function mkrmap(sz, cl, names)
+ local cname = format("@%s", sz)
+ reg_list[#reg_list+1] = cname
+ map_archdef[cl] = cname
+ map_reg_rev[cname] = cl
+ map_reg_num[cname] = -1
+ map_reg_opsize[cname] = sz
+ if sz == addrsize or sz == "d" then
+ map_reg_valid_base[cname] = true
+ map_reg_valid_index[cname] = true
+ end
+ if names then
+ for n,name in ipairs(names) do
+ local iname = format("@%s%x", sz, n-1)
+ reg_list[#reg_list+1] = iname
+ map_archdef[name] = iname
+ map_reg_rev[iname] = name
+ map_reg_num[iname] = n-1
+ map_reg_opsize[iname] = sz
+ if sz == "b" and n > 4 then map_reg_needrex[iname] = false end
+ if sz == addrsize or sz == "d" then
+ map_reg_valid_base[iname] = true
+ map_reg_valid_index[iname] = true
+ end
+ end
+ end
+ for i=0,(x64 and sz ~= "f") and 15 or 7 do
+ local needrex = sz == "b" and i > 3
+ local iname = format("@%s%x%s", sz, i, needrex and "R" or "")
+ if needrex then map_reg_needrex[iname] = true end
+ local name
+ if sz == "o" or sz == "y" then name = format("%s%d", cl, i)
+ elseif sz == "f" then name = format("st%d", i)
+ else name = format("r%d%s", i, sz == addrsize and "" or sz) end
+ map_archdef[name] = iname
+ if not map_reg_rev[iname] then
+ reg_list[#reg_list+1] = iname
+ map_reg_rev[iname] = name
+ map_reg_num[iname] = i
+ map_reg_opsize[iname] = sz
+ if sz == addrsize or sz == "d" then
+ map_reg_valid_base[iname] = true
+ map_reg_valid_index[iname] = true
+ end
+ end
+ end
+ reg_list[#reg_list+1] = ""
+end
+
+-- Integer registers (qword, dword, word and byte sized).
+if x64 then
+ mkrmap("q", "Rq", {"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi"})
+end
+mkrmap("d", "Rd", {"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"})
+mkrmap("w", "Rw", {"ax", "cx", "dx", "bx", "sp", "bp", "si", "di"})
+mkrmap("b", "Rb", {"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"})
+map_reg_valid_index[map_archdef.esp] = false
+if x64 then map_reg_valid_index[map_archdef.rsp] = false end
+if x64 then map_reg_needrex[map_archdef.Rb] = true end
+map_archdef["Ra"] = "@"..addrsize
+
+-- FP registers (internally tword sized, but use "f" as operand size).
+mkrmap("f", "Rf")
+
+-- SSE registers (oword sized, but qword and dword accessible).
+mkrmap("o", "xmm")
+
+-- AVX registers (yword sized, but oword, qword and dword accessible).
+mkrmap("y", "ymm")
+
+-- Operand size prefixes to codes.
+local map_opsize = {
+ byte = "b", word = "w", dword = "d", qword = "q", oword = "o", yword = "y",
+ tword = "t", aword = addrsize,
+}
+
+-- Operand size code to number.
+local map_opsizenum = {
+ b = 1, w = 2, d = 4, q = 8, o = 16, y = 32, t = 10,
+}
+
+-- Operand size code to name.
+local map_opsizename = {
+ b = "byte", w = "word", d = "dword", q = "qword", o = "oword", y = "yword",
+ t = "tword", f = "fpword",
+}
+
+-- Valid index register scale factors.
+local map_xsc = {
+ ["1"] = 0, ["2"] = 1, ["4"] = 2, ["8"] = 3,
+}
+
+-- Condition codes.
+local map_cc = {
+ o = 0, no = 1, b = 2, nb = 3, e = 4, ne = 5, be = 6, nbe = 7,
+ s = 8, ns = 9, p = 10, np = 11, l = 12, nl = 13, le = 14, nle = 15,
+ c = 2, nae = 2, nc = 3, ae = 3, z = 4, nz = 5, na = 6, a = 7,
+ pe = 10, po = 11, nge = 12, ge = 13, ng = 14, g = 15,
+}
+
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ return gsub(s, "@%w+", map_reg_rev)
+end
+
+-- Dump register names and numbers
+local function dumpregs(out)
+ out:write("Register names, sizes and internal numbers:\n")
+ for _,reg in ipairs(reg_list) do
+ if reg == "" then
+ out:write("\n")
+ else
+ local name = map_reg_rev[reg]
+ local num = map_reg_num[reg]
+ local opsize = map_opsizename[map_reg_opsize[reg]]
+ out:write(format(" %-5s %-8s %s\n", name, opsize,
+ num < 0 and "(variable)" or num))
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Put action for label arg (IMM_LG, IMM_PC, REL_LG, REL_PC).
+local function wputlabel(aprefix, imm, num)
+ if type(imm) == "number" then
+ if imm < 0 then
+ waction("EXTERN")
+ wputxb(aprefix == "IMM_" and 0 or 1)
+ imm = -imm-1
+ else
+ waction(aprefix.."LG", nil, num);
+ end
+ wputxb(imm)
+ else
+ waction(aprefix.."PC", imm, num)
+ end
+end
+
+-- Put signed byte or arg.
+local function wputsbarg(n)
+ if type(n) == "number" then
+ if n < -128 or n > 127 then
+ werror("signed immediate byte out of range")
+ end
+ if n < 0 then n = n + 256 end
+ wputb(n)
+ else waction("IMM_S", n) end
+end
+
+-- Put unsigned byte or arg.
+local function wputbarg(n)
+ if type(n) == "number" then
+ if n < 0 or n > 255 then
+ werror("unsigned immediate byte out of range")
+ end
+ wputb(n)
+ else waction("IMM_B", n) end
+end
+
+-- Put unsigned word or arg.
+local function wputwarg(n)
+ if type(n) == "number" then
+ if shr(n, 16) ~= 0 then
+ werror("unsigned immediate word out of range")
+ end
+ wputb(band(n, 255)); wputb(shr(n, 8));
+ else waction("IMM_W", n) end
+end
+
+-- Put signed or unsigned dword or arg.
+local function wputdarg(n)
+ local tn = type(n)
+ if tn == "number" then
+ wputb(band(n, 255))
+ wputb(band(shr(n, 8), 255))
+ wputb(band(shr(n, 16), 255))
+ wputb(shr(n, 24))
+ elseif tn == "table" then
+ wputlabel("IMM_", n[1], 1)
+ else
+ waction("IMM_D", n)
+ end
+end
+
+-- Put operand-size dependent number or arg (defaults to dword).
+local function wputszarg(sz, n)
+ if not sz or sz == "d" or sz == "q" then wputdarg(n)
+ elseif sz == "w" then wputwarg(n)
+ elseif sz == "b" then wputbarg(n)
+ elseif sz == "s" then wputsbarg(n)
+ else werror("bad operand size") end
+end
+
+-- Put multi-byte opcode with operand-size dependent modifications.
+local function wputop(sz, op, rex, vex, vregr, vregxb)
+ local psz, sk = 0, nil
+ if vex then
+ local tail
+ if vex.m == 1 and band(rex, 11) == 0 then
+ if x64 and vregxb then
+ sk = map_vreg["modrm.reg"]
+ else
+ wputb(0xc5)
+ tail = shl(bxor(band(rex, 4), 4), 5)
+ psz = 3
+ end
+ end
+ if not tail then
+ wputb(0xc4)
+ wputb(shl(bxor(band(rex, 7), 7), 5) + vex.m)
+ tail = shl(band(rex, 8), 4)
+ psz = 4
+ end
+ local reg, vreg = 0, nil
+ if vex.v then
+ reg = vex.v.reg
+ if not reg then werror("bad vex operand") end
+ if reg < 0 then reg = 0; vreg = vex.v.vreg end
+ end
+ if sz == "y" or vex.l then tail = tail + 4 end
+ wputb(tail + shl(bxor(reg, 15), 3) + vex.p)
+ wvreg("vex.v", vreg)
+ rex = 0
+ if op >= 256 then werror("bad vex opcode") end
+ else
+ if rex ~= 0 then
+ if not x64 then werror("bad operand size") end
+ elseif (vregr or vregxb) and x64 then
+ rex = 0x10
+ sk = map_vreg["vex.v"]
+ end
+ end
+ local r
+ if sz == "w" then wputb(102) end
+ -- Needs >32 bit numbers, but only for crc32 eax, word [ebx]
+ if op >= 4294967296 then r = op%4294967296 wputb((op-r)/4294967296) op = r end
+ if op >= 16777216 then wputb(shr(op, 24)); op = band(op, 0xffffff) end
+ if op >= 65536 then
+ if rex ~= 0 then
+ local opc3 = band(op, 0xffff00)
+ if opc3 == 0x0f3a00 or opc3 == 0x0f3800 then
+ wputb(64 + band(rex, 15)); rex = 0; psz = 2
+ end
+ end
+ wputb(shr(op, 16)); op = band(op, 0xffff); psz = psz + 1
+ end
+ if op >= 256 then
+ local b = shr(op, 8)
+ if b == 15 and rex ~= 0 then wputb(64 + band(rex, 15)); rex = 0; psz = 2 end
+ wputb(b); op = band(op, 255); psz = psz + 1
+ end
+ if rex ~= 0 then wputb(64 + band(rex, 15)); psz = 2 end
+ if sz == "b" then op = op - 1 end
+ wputb(op)
+ return psz, sk
+end
+
+-- Put ModRM or SIB formatted byte.
+local function wputmodrm(m, s, rm, vs, vrm)
+ assert(m < 4 and s < 16 and rm < 16, "bad modrm operands")
+ wputb(shl(m, 6) + shl(band(s, 7), 3) + band(rm, 7))
+end
+
+-- Put ModRM/SIB plus optional displacement.
+local function wputmrmsib(t, imark, s, vsreg, psz, sk)
+ local vreg, vxreg
+ local reg, xreg = t.reg, t.xreg
+ if reg and reg < 0 then reg = 0; vreg = t.vreg end
+ if xreg and xreg < 0 then xreg = 0; vxreg = t.vxreg end
+ if s < 0 then s = 0 end
+
+ -- Register mode.
+ if sub(t.mode, 1, 1) == "r" then
+ wputmodrm(3, s, reg)
+ wvreg("modrm.reg", vsreg, psz+1, sk, vreg)
+ wvreg("modrm.rm.r", vreg, psz+1, sk)
+ return
+ end
+
+ local disp = t.disp
+ local tdisp = type(disp)
+ -- No base register?
+ if not reg then
+ local riprel = false
+ if xreg then
+ -- Indexed mode with index register only.
+ -- [xreg*xsc+disp] -> (0, s, esp) (xsc, xreg, ebp)
+ wputmodrm(0, s, 4)
+ if imark == "I" then waction("MARK") end
+ wvreg("modrm.reg", vsreg, psz+1, sk, vxreg)
+ wputmodrm(t.xsc, xreg, 5)
+ wvreg("sib.index", vxreg, psz+2, sk)
+ else
+ -- Pure 32 bit displacement.
+ if x64 and tdisp ~= "table" then
+ wputmodrm(0, s, 4) -- [disp] -> (0, s, esp) (0, esp, ebp)
+ wvreg("modrm.reg", vsreg, psz+1, sk)
+ if imark == "I" then waction("MARK") end
+ wputmodrm(0, 4, 5)
+ else
+ riprel = x64
+ wputmodrm(0, s, 5) -- [disp|rip-label] -> (0, s, ebp)
+ wvreg("modrm.reg", vsreg, psz+1, sk)
+ if imark == "I" then waction("MARK") end
+ end
+ end
+ if riprel then -- Emit rip-relative displacement.
+ if match("UWSiI", imark) then
+ werror("NYI: rip-relative displacement followed by immediate")
+ end
+ -- The previous byte in the action buffer cannot be 0xe9 or 0x80-0x8f.
+ wputlabel("REL_", disp[1], 2)
+ else
+ wputdarg(disp)
+ end
+ return
+ end
+
+ local m
+ if tdisp == "number" then -- Check displacement size at assembly time.
+ if disp == 0 and band(reg, 7) ~= 5 then -- [ebp] -> [ebp+0] (in SIB, too)
+ if not vreg then m = 0 end -- Force DISP to allow [Rd(5)] -> [ebp+0]
+ elseif disp >= -128 and disp <= 127 then m = 1
+ else m = 2 end
+ elseif tdisp == "table" then
+ m = 2
+ end
+
+ -- Index register present or esp as base register: need SIB encoding.
+ if xreg or band(reg, 7) == 4 then
+ wputmodrm(m or 2, s, 4) -- ModRM.
+ if m == nil or imark == "I" then waction("MARK") end
+ wvreg("modrm.reg", vsreg, psz+1, sk, vxreg or vreg)
+ wputmodrm(t.xsc or 0, xreg or 4, reg) -- SIB.
+ wvreg("sib.index", vxreg, psz+2, sk, vreg)
+ wvreg("sib.base", vreg, psz+2, sk)
+ else
+ wputmodrm(m or 2, s, reg) -- ModRM.
+ if (imark == "I" and (m == 1 or m == 2)) or
+ (m == nil and (vsreg or vreg)) then waction("MARK") end
+ wvreg("modrm.reg", vsreg, psz+1, sk, vreg)
+ wvreg("modrm.rm.m", vreg, psz+1, sk)
+ end
+
+ -- Put displacement.
+ if m == 1 then wputsbarg(disp)
+ elseif m == 2 then wputdarg(disp)
+ elseif m == nil then waction("DISP", disp) end
+end
+
+------------------------------------------------------------------------------
+
+-- Return human-readable operand mode string.
+local function opmodestr(op, args)
+ local m = {}
+ for i=1,#args do
+ local a = args[i]
+ m[#m+1] = sub(a.mode, 1, 1)..(a.opsize or "?")
+ end
+ return op.." "..concat(m, ",")
+end
+
+-- Convert number to valid integer or nil.
+local function toint(expr)
+ local n = tonumber(expr)
+ if n then
+ if n % 1 ~= 0 or n < -2147483648 or n > 4294967295 then
+ werror("bad integer number `"..expr.."'")
+ end
+ return n
+ end
+end
+
+-- Parse immediate expression.
+local function immexpr(expr)
+ -- &expr (pointer)
+ if sub(expr, 1, 1) == "&" then
+ return "iPJ", format("(ptrdiff_t)(%s)", sub(expr,2))
+ end
+
+ local prefix = sub(expr, 1, 2)
+ -- =>expr (pc label reference)
+ if prefix == "=>" then
+ return "iJ", sub(expr, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "iJ", map_global[sub(expr, 3)]
+ end
+
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(expr, "^([<>])([1-9])$")
+ if dir then -- Fwd: 247-255, Bkwd: 1-9.
+ return "iJ", lnum + (dir == ">" and 246 or 0)
+ end
+
+ local extname = match(expr, "^extern%s+(%S+)$")
+ if extname then
+ return "iJ", map_extern[extname]
+ end
+
+ -- expr (interpreted as immediate)
+ return "iI", expr
+end
+
+-- Parse displacement expression: +-num, +-expr, +-opsize*num
+local function dispexpr(expr)
+ local disp = expr == "" and 0 or toint(expr)
+ if disp then return disp end
+ local c, dispt = match(expr, "^([+-])%s*(.+)$")
+ if c == "+" then
+ expr = dispt
+ elseif not c then
+ werror("bad displacement expression `"..expr.."'")
+ end
+ local opsize, tailops = match(dispt, "^(%w+)%s*%*%s*(.+)$")
+ local ops, imm = map_opsize[opsize], toint(tailops)
+ if ops and imm then
+ if c == "-" then imm = -imm end
+ return imm*map_opsizenum[ops]
+ end
+ local mode, iexpr = immexpr(dispt)
+ if mode == "iJ" then
+ if c == "-" then werror("cannot invert label reference") end
+ return { iexpr }
+ end
+ return expr -- Need to return original signed expression.
+end
+
+-- Parse register or type expression.
+local function rtexpr(expr)
+ if not expr then return end
+ local tname, ovreg = match(expr, "^([%w_]+):(@[%w_]+)$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ local rnum = map_reg_num[reg]
+ if not rnum then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ if not map_reg_valid_base[reg] then
+ werror("bad base register override `"..(map_reg_rev[reg] or reg).."'")
+ end
+ return reg, rnum, tp
+ end
+ return expr, map_reg_num[expr]
+end
+
+-- Parse operand and return { mode, opsize, reg, xreg, xsc, disp, imm }.
+local function parseoperand(param)
+ local t = {}
+
+ local expr = param
+ local opsize, tailops = match(param, "^(%w+)%s*(.+)$")
+ if opsize then
+ t.opsize = map_opsize[opsize]
+ if t.opsize then expr = tailops end
+ end
+
+ local br = match(expr, "^%[%s*(.-)%s*%]$")
+ repeat
+ if br then
+ t.mode = "xm"
+
+ -- [disp]
+ t.disp = toint(br)
+ if t.disp then
+ t.mode = x64 and "xm" or "xmO"
+ break
+ end
+
+ -- [reg...]
+ local tp
+ local reg, tailr = match(br, "^([@%w_:]+)%s*(.*)$")
+ reg, t.reg, tp = rtexpr(reg)
+ if not t.reg then
+ -- [expr]
+ t.mode = x64 and "xm" or "xmO"
+ t.disp = dispexpr("+"..br)
+ break
+ end
+
+ if t.reg == -1 then
+ t.vreg, tailr = match(tailr, "^(%b())(.*)$")
+ if not t.vreg then werror("bad variable register expression") end
+ end
+
+ -- [xreg*xsc] or [xreg*xsc+-disp] or [xreg*xsc+-expr]
+ local xsc, tailsc = match(tailr, "^%*%s*([1248])%s*(.*)$")
+ if xsc then
+ if not map_reg_valid_index[reg] then
+ werror("bad index register `"..map_reg_rev[reg].."'")
+ end
+ t.xsc = map_xsc[xsc]
+ t.xreg = t.reg
+ t.vxreg = t.vreg
+ t.reg = nil
+ t.vreg = nil
+ t.disp = dispexpr(tailsc)
+ break
+ end
+ if not map_reg_valid_base[reg] then
+ werror("bad base register `"..map_reg_rev[reg].."'")
+ end
+
+ -- [reg] or [reg+-disp]
+ t.disp = toint(tailr) or (tailr == "" and 0)
+ if t.disp then break end
+
+ -- [reg+xreg...]
+ local xreg, tailx = match(tailr, "^+%s*([@%w_:]+)%s*(.*)$")
+ xreg, t.xreg, tp = rtexpr(xreg)
+ if not t.xreg then
+ -- [reg+-expr]
+ t.disp = dispexpr(tailr)
+ break
+ end
+ if not map_reg_valid_index[xreg] then
+ werror("bad index register `"..map_reg_rev[xreg].."'")
+ end
+
+ if t.xreg == -1 then
+ t.vxreg, tailx = match(tailx, "^(%b())(.*)$")
+ if not t.vxreg then werror("bad variable register expression") end
+ end
+
+ -- [reg+xreg*xsc...]
+ local xsc, tailsc = match(tailx, "^%*%s*([1248])%s*(.*)$")
+ if xsc then
+ t.xsc = map_xsc[xsc]
+ tailx = tailsc
+ end
+
+ -- [...] or [...+-disp] or [...+-expr]
+ t.disp = dispexpr(tailx)
+ else
+ -- imm or opsize*imm
+ local imm = toint(expr)
+ if not imm and sub(expr, 1, 1) == "*" and t.opsize then
+ imm = toint(sub(expr, 2))
+ if imm then
+ imm = imm * map_opsizenum[t.opsize]
+ t.opsize = nil
+ end
+ end
+ if imm then
+ if t.opsize then werror("bad operand size override") end
+ local m = "i"
+ if imm == 1 then m = m.."1" end
+ if imm >= 4294967168 and imm <= 4294967295 then imm = imm-4294967296 end
+ if imm >= -128 and imm <= 127 then m = m.."S" end
+ t.imm = imm
+ t.mode = m
+ break
+ end
+
+ local tp
+ local reg, tailr = match(expr, "^([@%w_:]+)%s*(.*)$")
+ reg, t.reg, tp = rtexpr(reg)
+ if t.reg then
+ if t.reg == -1 then
+ t.vreg, tailr = match(tailr, "^(%b())(.*)$")
+ if not t.vreg then werror("bad variable register expression") end
+ end
+ -- reg
+ if tailr == "" then
+ if t.opsize then werror("bad operand size override") end
+ t.opsize = map_reg_opsize[reg]
+ if t.opsize == "f" then
+ t.mode = t.reg == 0 and "fF" or "f"
+ else
+ if reg == "@w4" or (x64 and reg == "@d4") then
+ wwarn("bad idea, try again with `"..(x64 and "rsp'" or "esp'"))
+ end
+ t.mode = t.reg == 0 and "rmR" or (reg == "@b1" and "rmC" or "rm")
+ end
+ t.needrex = map_reg_needrex[reg]
+ break
+ end
+
+ -- type[idx], type[idx].field, type->field -> [reg+offset_expr]
+ if not tp then werror("bad operand `"..param.."'") end
+ t.mode = "xm"
+ t.disp = format(tp.ctypefmt, tailr)
+ else
+ t.mode, t.imm = immexpr(expr)
+ if sub(t.mode, -1) == "J" then
+ if t.opsize and t.opsize ~= addrsize then
+ werror("bad operand size override")
+ end
+ t.opsize = addrsize
+ end
+ end
+ end
+ until true
+ return t
+end
+
+------------------------------------------------------------------------------
+-- x86 Template String Description
+-- ===============================
+--
+-- Each template string is a list of [match:]pattern pairs,
+-- separated by "|". The first match wins. No match means a
+-- bad or unsupported combination of operand modes or sizes.
+--
+-- The match part and the ":" is omitted if the operation has
+-- no operands. Otherwise the first N characters are matched
+-- against the mode strings of each of the N operands.
+--
+-- The mode string for each operand type is (see parseoperand()):
+-- Integer register: "rm", +"R" for eax, ax, al, +"C" for cl
+-- FP register: "f", +"F" for st0
+-- Index operand: "xm", +"O" for [disp] (pure offset)
+-- Immediate: "i", +"S" for signed 8 bit, +"1" for 1,
+-- +"I" for arg, +"P" for pointer
+-- Any: +"J" for valid jump targets
+--
+-- So a match character "m" (mixed) matches both an integer register
+-- and an index operand (to be encoded with the ModRM/SIB scheme).
+-- But "r" matches only a register and "x" only an index operand
+-- (e.g. for FP memory access operations).
+--
+-- The operand size match string starts right after the mode match
+-- characters and ends before the ":". "dwb" or "qdwb" is assumed, if empty.
+-- The effective data size of the operation is matched against this list.
+--
+-- If only the regular "b", "w", "d", "q", "t" operand sizes are
+-- present, then all operands must be the same size. Unspecified sizes
+-- are ignored, but at least one operand must have a size or the pattern
+-- won't match (use the "byte", "word", "dword", "qword", "tword"
+-- operand size overrides. E.g.: mov dword [eax], 1).
+--
+-- If the list has a "1" or "2" prefix, the operand size is taken
+-- from the respective operand and any other operand sizes are ignored.
+-- If the list contains only ".", all operand sizes are ignored.
+-- If the list has a "/" prefix, the concatenated (mixed) operand sizes
+-- are compared to the match.
+--
+-- E.g. "rrdw" matches for either two dword registers or two word
+-- registers. "Fx2dq" matches an st0 operand plus an index operand
+-- pointing to a dword (float) or qword (double).
+--
+-- Every character after the ":" is part of the pattern string:
+-- Hex chars are accumulated to form the opcode (left to right).
+-- "n" disables the standard opcode mods
+-- (otherwise: -1 for "b", o16 prefix for "w", rex.w for "q")
+-- "X" Force REX.W.
+-- "r"/"R" adds the reg. number from the 1st/2nd operand to the opcode.
+-- "m"/"M" generates ModRM/SIB from the 1st/2nd operand.
+-- The spare 3 bits are either filled with the last hex digit or
+-- the result from a previous "r"/"R". The opcode is restored.
+-- "u" Use VEX encoding, vvvv unused.
+-- "v"/"V" Use VEX encoding, vvvv from 1st/2nd operand (the operand is
+-- removed from the list used by future characters).
+-- "L" Force VEX.L
+--
+-- All of the following characters force a flush of the opcode:
+-- "o"/"O" stores a pure 32 bit disp (offset) from the 1st/2nd operand.
+-- "s" stores a 4 bit immediate from the last register operand,
+-- followed by 4 zero bits.
+-- "S" stores a signed 8 bit immediate from the last operand.
+-- "U" stores an unsigned 8 bit immediate from the last operand.
+-- "W" stores an unsigned 16 bit immediate from the last operand.
+-- "i" stores an operand sized immediate from the last operand.
+-- "I" dito, but generates an action code to optionally modify
+-- the opcode (+2) for a signed 8 bit immediate.
+-- "J" generates one of the REL action codes from the last operand.
+--
+------------------------------------------------------------------------------
+
+-- Template strings for x86 instructions. Ordered by first opcode byte.
+-- Unimplemented opcodes (deliberate omissions) are marked with *.
+local map_op = {
+ -- 00-05: add...
+ -- 06: *push es
+ -- 07: *pop es
+ -- 08-0D: or...
+ -- 0E: *push cs
+ -- 0F: two byte opcode prefix
+ -- 10-15: adc...
+ -- 16: *push ss
+ -- 17: *pop ss
+ -- 18-1D: sbb...
+ -- 1E: *push ds
+ -- 1F: *pop ds
+ -- 20-25: and...
+ es_0 = "26",
+ -- 27: *daa
+ -- 28-2D: sub...
+ cs_0 = "2E",
+ -- 2F: *das
+ -- 30-35: xor...
+ ss_0 = "36",
+ -- 37: *aaa
+ -- 38-3D: cmp...
+ ds_0 = "3E",
+ -- 3F: *aas
+ inc_1 = x64 and "m:FF0m" or "rdw:40r|m:FF0m",
+ dec_1 = x64 and "m:FF1m" or "rdw:48r|m:FF1m",
+ push_1 = (x64 and "rq:n50r|rw:50r|mq:nFF6m|mw:FF6m" or
+ "rdw:50r|mdw:FF6m").."|S.:6AS|ib:n6Ai|i.:68i",
+ pop_1 = x64 and "rq:n58r|rw:58r|mq:n8F0m|mw:8F0m" or "rdw:58r|mdw:8F0m",
+ -- 60: *pusha, *pushad, *pushaw
+ -- 61: *popa, *popad, *popaw
+ -- 62: *bound rdw,x
+ -- 63: x86: *arpl mw,rw
+ movsxd_2 = x64 and "rm/qd:63rM",
+ fs_0 = "64",
+ gs_0 = "65",
+ o16_0 = "66",
+ a16_0 = not x64 and "67" or nil,
+ a32_0 = x64 and "67",
+ -- 68: push idw
+ -- 69: imul rdw,mdw,idw
+ -- 6A: push ib
+ -- 6B: imul rdw,mdw,S
+ -- 6C: *insb
+ -- 6D: *insd, *insw
+ -- 6E: *outsb
+ -- 6F: *outsd, *outsw
+ -- 70-7F: jcc lb
+ -- 80: add... mb,i
+ -- 81: add... mdw,i
+ -- 82: *undefined
+ -- 83: add... mdw,S
+ test_2 = "mr:85Rm|rm:85rM|Ri:A9ri|mi:F70mi",
+ -- 86: xchg rb,mb
+ -- 87: xchg rdw,mdw
+ -- 88: mov mb,r
+ -- 89: mov mdw,r
+ -- 8A: mov r,mb
+ -- 8B: mov r,mdw
+ -- 8C: *mov mdw,seg
+ lea_2 = "rx1dq:8DrM",
+ -- 8E: *mov seg,mdw
+ -- 8F: pop mdw
+ nop_0 = "90",
+ xchg_2 = "Rrqdw:90R|rRqdw:90r|rm:87rM|mr:87Rm",
+ cbw_0 = "6698",
+ cwde_0 = "98",
+ cdqe_0 = "4898",
+ cwd_0 = "6699",
+ cdq_0 = "99",
+ cqo_0 = "4899",
+ -- 9A: *call iw:idw
+ wait_0 = "9B",
+ fwait_0 = "9B",
+ pushf_0 = "9C",
+ pushfd_0 = not x64 and "9C",
+ pushfq_0 = x64 and "9C",
+ popf_0 = "9D",
+ popfd_0 = not x64 and "9D",
+ popfq_0 = x64 and "9D",
+ sahf_0 = "9E",
+ lahf_0 = "9F",
+ mov_2 = "OR:A3o|RO:A1O|mr:89Rm|rm:8BrM|rib:nB0ri|ridw:B8ri|mi:C70mi",
+ movsb_0 = "A4",
+ movsw_0 = "66A5",
+ movsd_0 = "A5",
+ cmpsb_0 = "A6",
+ cmpsw_0 = "66A7",
+ cmpsd_0 = "A7",
+ -- A8: test Rb,i
+ -- A9: test Rdw,i
+ stosb_0 = "AA",
+ stosw_0 = "66AB",
+ stosd_0 = "AB",
+ lodsb_0 = "AC",
+ lodsw_0 = "66AD",
+ lodsd_0 = "AD",
+ scasb_0 = "AE",
+ scasw_0 = "66AF",
+ scasd_0 = "AF",
+ -- B0-B7: mov rb,i
+ -- B8-BF: mov rdw,i
+ -- C0: rol... mb,i
+ -- C1: rol... mdw,i
+ ret_1 = "i.:nC2W",
+ ret_0 = "C3",
+ -- C4: *les rdw,mq
+ -- C5: *lds rdw,mq
+ -- C6: mov mb,i
+ -- C7: mov mdw,i
+ -- C8: *enter iw,ib
+ leave_0 = "C9",
+ -- CA: *retf iw
+ -- CB: *retf
+ int3_0 = "CC",
+ int_1 = "i.:nCDU",
+ into_0 = "CE",
+ -- CF: *iret
+ -- D0: rol... mb,1
+ -- D1: rol... mdw,1
+ -- D2: rol... mb,cl
+ -- D3: rol... mb,cl
+ -- D4: *aam ib
+ -- D5: *aad ib
+ -- D6: *salc
+ -- D7: *xlat
+ -- D8-DF: floating point ops
+ -- E0: *loopne
+ -- E1: *loope
+ -- E2: *loop
+ -- E3: *jcxz, *jecxz
+ -- E4: *in Rb,ib
+ -- E5: *in Rdw,ib
+ -- E6: *out ib,Rb
+ -- E7: *out ib,Rdw
+ call_1 = x64 and "mq:nFF2m|J.:E8nJ" or "md:FF2m|J.:E8J",
+ jmp_1 = x64 and "mq:nFF4m|J.:E9nJ" or "md:FF4m|J.:E9J", -- short: EB
+ -- EA: *jmp iw:idw
+ -- EB: jmp ib
+ -- EC: *in Rb,dx
+ -- ED: *in Rdw,dx
+ -- EE: *out dx,Rb
+ -- EF: *out dx,Rdw
+ lock_0 = "F0",
+ int1_0 = "F1",
+ repne_0 = "F2",
+ repnz_0 = "F2",
+ rep_0 = "F3",
+ repe_0 = "F3",
+ repz_0 = "F3",
+ -- F4: *hlt
+ cmc_0 = "F5",
+ -- F6: test... mb,i; div... mb
+ -- F7: test... mdw,i; div... mdw
+ clc_0 = "F8",
+ stc_0 = "F9",
+ -- FA: *cli
+ cld_0 = "FC",
+ std_0 = "FD",
+ -- FE: inc... mb
+ -- FF: inc... mdw
+
+ -- misc ops
+ not_1 = "m:F72m",
+ neg_1 = "m:F73m",
+ mul_1 = "m:F74m",
+ imul_1 = "m:F75m",
+ div_1 = "m:F76m",
+ idiv_1 = "m:F77m",
+
+ imul_2 = "rmqdw:0FAFrM|rIqdw:69rmI|rSqdw:6BrmS|riqdw:69rmi",
+ imul_3 = "rmIqdw:69rMI|rmSqdw:6BrMS|rmiqdw:69rMi",
+
+ movzx_2 = "rm/db:0FB6rM|rm/qb:|rm/wb:0FB6rM|rm/dw:0FB7rM|rm/qw:",
+ movsx_2 = "rm/db:0FBErM|rm/qb:|rm/wb:0FBErM|rm/dw:0FBFrM|rm/qw:",
+
+ bswap_1 = "rqd:0FC8r",
+ bsf_2 = "rmqdw:0FBCrM",
+ bsr_2 = "rmqdw:0FBDrM",
+ bt_2 = "mrqdw:0FA3Rm|miqdw:0FBA4mU",
+ btc_2 = "mrqdw:0FBBRm|miqdw:0FBA7mU",
+ btr_2 = "mrqdw:0FB3Rm|miqdw:0FBA6mU",
+ bts_2 = "mrqdw:0FABRm|miqdw:0FBA5mU",
+
+ shld_3 = "mriqdw:0FA4RmU|mrC/qq:0FA5Rm|mrC/dd:|mrC/ww:",
+ shrd_3 = "mriqdw:0FACRmU|mrC/qq:0FADRm|mrC/dd:|mrC/ww:",
+
+ rdtsc_0 = "0F31", -- P1+
+ rdpmc_0 = "0F33", -- P6+
+ cpuid_0 = "0FA2", -- P1+
+
+ -- floating point ops
+ fst_1 = "ff:DDD0r|xd:D92m|xq:nDD2m",
+ fstp_1 = "ff:DDD8r|xd:D93m|xq:nDD3m|xt:DB7m",
+ fld_1 = "ff:D9C0r|xd:D90m|xq:nDD0m|xt:DB5m",
+
+ fpop_0 = "DDD8", -- Alias for fstp st0.
+
+ fist_1 = "xw:nDF2m|xd:DB2m",
+ fistp_1 = "xw:nDF3m|xd:DB3m|xq:nDF7m",
+ fild_1 = "xw:nDF0m|xd:DB0m|xq:nDF5m",
+
+ fxch_0 = "D9C9",
+ fxch_1 = "ff:D9C8r",
+ fxch_2 = "fFf:D9C8r|Fff:D9C8R",
+
+ fucom_1 = "ff:DDE0r",
+ fucom_2 = "Fff:DDE0R",
+ fucomp_1 = "ff:DDE8r",
+ fucomp_2 = "Fff:DDE8R",
+ fucomi_1 = "ff:DBE8r", -- P6+
+ fucomi_2 = "Fff:DBE8R", -- P6+
+ fucomip_1 = "ff:DFE8r", -- P6+
+ fucomip_2 = "Fff:DFE8R", -- P6+
+ fcomi_1 = "ff:DBF0r", -- P6+
+ fcomi_2 = "Fff:DBF0R", -- P6+
+ fcomip_1 = "ff:DFF0r", -- P6+
+ fcomip_2 = "Fff:DFF0R", -- P6+
+ fucompp_0 = "DAE9",
+ fcompp_0 = "DED9",
+
+ fldenv_1 = "x.:D94m",
+ fnstenv_1 = "x.:D96m",
+ fstenv_1 = "x.:9BD96m",
+ fldcw_1 = "xw:nD95m",
+ fstcw_1 = "xw:n9BD97m",
+ fnstcw_1 = "xw:nD97m",
+ fstsw_1 = "Rw:n9BDFE0|xw:n9BDD7m",
+ fnstsw_1 = "Rw:nDFE0|xw:nDD7m",
+ fclex_0 = "9BDBE2",
+ fnclex_0 = "DBE2",
+
+ fnop_0 = "D9D0",
+ -- D9D1-D9DF: unassigned
+
+ fchs_0 = "D9E0",
+ fabs_0 = "D9E1",
+ -- D9E2: unassigned
+ -- D9E3: unassigned
+ ftst_0 = "D9E4",
+ fxam_0 = "D9E5",
+ -- D9E6: unassigned
+ -- D9E7: unassigned
+ fld1_0 = "D9E8",
+ fldl2t_0 = "D9E9",
+ fldl2e_0 = "D9EA",
+ fldpi_0 = "D9EB",
+ fldlg2_0 = "D9EC",
+ fldln2_0 = "D9ED",
+ fldz_0 = "D9EE",
+ -- D9EF: unassigned
+
+ f2xm1_0 = "D9F0",
+ fyl2x_0 = "D9F1",
+ fptan_0 = "D9F2",
+ fpatan_0 = "D9F3",
+ fxtract_0 = "D9F4",
+ fprem1_0 = "D9F5",
+ fdecstp_0 = "D9F6",
+ fincstp_0 = "D9F7",
+ fprem_0 = "D9F8",
+ fyl2xp1_0 = "D9F9",
+ fsqrt_0 = "D9FA",
+ fsincos_0 = "D9FB",
+ frndint_0 = "D9FC",
+ fscale_0 = "D9FD",
+ fsin_0 = "D9FE",
+ fcos_0 = "D9FF",
+
+ -- SSE, SSE2
+ andnpd_2 = "rmo:660F55rM",
+ andnps_2 = "rmo:0F55rM",
+ andpd_2 = "rmo:660F54rM",
+ andps_2 = "rmo:0F54rM",
+ clflush_1 = "x.:0FAE7m",
+ cmppd_3 = "rmio:660FC2rMU",
+ cmpps_3 = "rmio:0FC2rMU",
+ cmpsd_3 = "rrio:F20FC2rMU|rxi/oq:",
+ cmpss_3 = "rrio:F30FC2rMU|rxi/od:",
+ comisd_2 = "rro:660F2FrM|rx/oq:",
+ comiss_2 = "rro:0F2FrM|rx/od:",
+ cvtdq2pd_2 = "rro:F30FE6rM|rx/oq:",
+ cvtdq2ps_2 = "rmo:0F5BrM",
+ cvtpd2dq_2 = "rmo:F20FE6rM",
+ cvtpd2ps_2 = "rmo:660F5ArM",
+ cvtpi2pd_2 = "rx/oq:660F2ArM",
+ cvtpi2ps_2 = "rx/oq:0F2ArM",
+ cvtps2dq_2 = "rmo:660F5BrM",
+ cvtps2pd_2 = "rro:0F5ArM|rx/oq:",
+ cvtsd2si_2 = "rr/do:F20F2DrM|rr/qo:|rx/dq:|rxq:",
+ cvtsd2ss_2 = "rro:F20F5ArM|rx/oq:",
+ cvtsi2sd_2 = "rm/od:F20F2ArM|rm/oq:F20F2ArXM",
+ cvtsi2ss_2 = "rm/od:F30F2ArM|rm/oq:F30F2ArXM",
+ cvtss2sd_2 = "rro:F30F5ArM|rx/od:",
+ cvtss2si_2 = "rr/do:F30F2DrM|rr/qo:|rxd:|rx/qd:",
+ cvttpd2dq_2 = "rmo:660FE6rM",
+ cvttps2dq_2 = "rmo:F30F5BrM",
+ cvttsd2si_2 = "rr/do:F20F2CrM|rr/qo:|rx/dq:|rxq:",
+ cvttss2si_2 = "rr/do:F30F2CrM|rr/qo:|rxd:|rx/qd:",
+ fxsave_1 = "x.:0FAE0m",
+ fxrstor_1 = "x.:0FAE1m",
+ ldmxcsr_1 = "xd:0FAE2m",
+ lfence_0 = "0FAEE8",
+ maskmovdqu_2 = "rro:660FF7rM",
+ mfence_0 = "0FAEF0",
+ movapd_2 = "rmo:660F28rM|mro:660F29Rm",
+ movaps_2 = "rmo:0F28rM|mro:0F29Rm",
+ movd_2 = "rm/od:660F6ErM|rm/oq:660F6ErXM|mr/do:660F7ERm|mr/qo:",
+ movdqa_2 = "rmo:660F6FrM|mro:660F7FRm",
+ movdqu_2 = "rmo:F30F6FrM|mro:F30F7FRm",
+ movhlps_2 = "rro:0F12rM",
+ movhpd_2 = "rx/oq:660F16rM|xr/qo:n660F17Rm",
+ movhps_2 = "rx/oq:0F16rM|xr/qo:n0F17Rm",
+ movlhps_2 = "rro:0F16rM",
+ movlpd_2 = "rx/oq:660F12rM|xr/qo:n660F13Rm",
+ movlps_2 = "rx/oq:0F12rM|xr/qo:n0F13Rm",
+ movmskpd_2 = "rr/do:660F50rM",
+ movmskps_2 = "rr/do:0F50rM",
+ movntdq_2 = "xro:660FE7Rm",
+ movnti_2 = "xrqd:0FC3Rm",
+ movntpd_2 = "xro:660F2BRm",
+ movntps_2 = "xro:0F2BRm",
+ movq_2 = "rro:F30F7ErM|rx/oq:|xr/qo:n660FD6Rm",
+ movsd_2 = "rro:F20F10rM|rx/oq:|xr/qo:nF20F11Rm",
+ movss_2 = "rro:F30F10rM|rx/od:|xr/do:F30F11Rm",
+ movupd_2 = "rmo:660F10rM|mro:660F11Rm",
+ movups_2 = "rmo:0F10rM|mro:0F11Rm",
+ orpd_2 = "rmo:660F56rM",
+ orps_2 = "rmo:0F56rM",
+ pause_0 = "F390",
+ pextrw_3 = "rri/do:660FC5rMU|xri/wo:660F3A15nRmU", -- Mem op: SSE4.1 only.
+ pinsrw_3 = "rri/od:660FC4rMU|rxi/ow:",
+ pmovmskb_2 = "rr/do:660FD7rM",
+ prefetchnta_1 = "xb:n0F180m",
+ prefetcht0_1 = "xb:n0F181m",
+ prefetcht1_1 = "xb:n0F182m",
+ prefetcht2_1 = "xb:n0F183m",
+ pshufd_3 = "rmio:660F70rMU",
+ pshufhw_3 = "rmio:F30F70rMU",
+ pshuflw_3 = "rmio:F20F70rMU",
+ pslld_2 = "rmo:660FF2rM|rio:660F726mU",
+ pslldq_2 = "rio:660F737mU",
+ psllq_2 = "rmo:660FF3rM|rio:660F736mU",
+ psllw_2 = "rmo:660FF1rM|rio:660F716mU",
+ psrad_2 = "rmo:660FE2rM|rio:660F724mU",
+ psraw_2 = "rmo:660FE1rM|rio:660F714mU",
+ psrld_2 = "rmo:660FD2rM|rio:660F722mU",
+ psrldq_2 = "rio:660F733mU",
+ psrlq_2 = "rmo:660FD3rM|rio:660F732mU",
+ psrlw_2 = "rmo:660FD1rM|rio:660F712mU",
+ rcpps_2 = "rmo:0F53rM",
+ rcpss_2 = "rro:F30F53rM|rx/od:",
+ rsqrtps_2 = "rmo:0F52rM",
+ rsqrtss_2 = "rmo:F30F52rM",
+ sfence_0 = "0FAEF8",
+ shufpd_3 = "rmio:660FC6rMU",
+ shufps_3 = "rmio:0FC6rMU",
+ stmxcsr_1 = "xd:0FAE3m",
+ ucomisd_2 = "rro:660F2ErM|rx/oq:",
+ ucomiss_2 = "rro:0F2ErM|rx/od:",
+ unpckhpd_2 = "rmo:660F15rM",
+ unpckhps_2 = "rmo:0F15rM",
+ unpcklpd_2 = "rmo:660F14rM",
+ unpcklps_2 = "rmo:0F14rM",
+ xorpd_2 = "rmo:660F57rM",
+ xorps_2 = "rmo:0F57rM",
+
+ -- SSE3 ops
+ fisttp_1 = "xw:nDF1m|xd:DB1m|xq:nDD1m",
+ addsubpd_2 = "rmo:660FD0rM",
+ addsubps_2 = "rmo:F20FD0rM",
+ haddpd_2 = "rmo:660F7CrM",
+ haddps_2 = "rmo:F20F7CrM",
+ hsubpd_2 = "rmo:660F7DrM",
+ hsubps_2 = "rmo:F20F7DrM",
+ lddqu_2 = "rxo:F20FF0rM",
+ movddup_2 = "rmo:F20F12rM",
+ movshdup_2 = "rmo:F30F16rM",
+ movsldup_2 = "rmo:F30F12rM",
+
+ -- SSSE3 ops
+ pabsb_2 = "rmo:660F381CrM",
+ pabsd_2 = "rmo:660F381ErM",
+ pabsw_2 = "rmo:660F381DrM",
+ palignr_3 = "rmio:660F3A0FrMU",
+ phaddd_2 = "rmo:660F3802rM",
+ phaddsw_2 = "rmo:660F3803rM",
+ phaddw_2 = "rmo:660F3801rM",
+ phsubd_2 = "rmo:660F3806rM",
+ phsubsw_2 = "rmo:660F3807rM",
+ phsubw_2 = "rmo:660F3805rM",
+ pmaddubsw_2 = "rmo:660F3804rM",
+ pmulhrsw_2 = "rmo:660F380BrM",
+ pshufb_2 = "rmo:660F3800rM",
+ psignb_2 = "rmo:660F3808rM",
+ psignd_2 = "rmo:660F380ArM",
+ psignw_2 = "rmo:660F3809rM",
+
+ -- SSE4.1 ops
+ blendpd_3 = "rmio:660F3A0DrMU",
+ blendps_3 = "rmio:660F3A0CrMU",
+ blendvpd_3 = "rmRo:660F3815rM",
+ blendvps_3 = "rmRo:660F3814rM",
+ dppd_3 = "rmio:660F3A41rMU",
+ dpps_3 = "rmio:660F3A40rMU",
+ extractps_3 = "mri/do:660F3A17RmU|rri/qo:660F3A17RXmU",
+ insertps_3 = "rrio:660F3A41rMU|rxi/od:",
+ movntdqa_2 = "rxo:660F382ArM",
+ mpsadbw_3 = "rmio:660F3A42rMU",
+ packusdw_2 = "rmo:660F382BrM",
+ pblendvb_3 = "rmRo:660F3810rM",
+ pblendw_3 = "rmio:660F3A0ErMU",
+ pcmpeqq_2 = "rmo:660F3829rM",
+ pextrb_3 = "rri/do:660F3A14nRmU|rri/qo:|xri/bo:",
+ pextrd_3 = "mri/do:660F3A16RmU",
+ pextrq_3 = "mri/qo:660F3A16RmU",
+ -- pextrw is SSE2, mem operand is SSE4.1 only
+ phminposuw_2 = "rmo:660F3841rM",
+ pinsrb_3 = "rri/od:660F3A20nrMU|rxi/ob:",
+ pinsrd_3 = "rmi/od:660F3A22rMU",
+ pinsrq_3 = "rmi/oq:660F3A22rXMU",
+ pmaxsb_2 = "rmo:660F383CrM",
+ pmaxsd_2 = "rmo:660F383DrM",
+ pmaxud_2 = "rmo:660F383FrM",
+ pmaxuw_2 = "rmo:660F383ErM",
+ pminsb_2 = "rmo:660F3838rM",
+ pminsd_2 = "rmo:660F3839rM",
+ pminud_2 = "rmo:660F383BrM",
+ pminuw_2 = "rmo:660F383ArM",
+ pmovsxbd_2 = "rro:660F3821rM|rx/od:",
+ pmovsxbq_2 = "rro:660F3822rM|rx/ow:",
+ pmovsxbw_2 = "rro:660F3820rM|rx/oq:",
+ pmovsxdq_2 = "rro:660F3825rM|rx/oq:",
+ pmovsxwd_2 = "rro:660F3823rM|rx/oq:",
+ pmovsxwq_2 = "rro:660F3824rM|rx/od:",
+ pmovzxbd_2 = "rro:660F3831rM|rx/od:",
+ pmovzxbq_2 = "rro:660F3832rM|rx/ow:",
+ pmovzxbw_2 = "rro:660F3830rM|rx/oq:",
+ pmovzxdq_2 = "rro:660F3835rM|rx/oq:",
+ pmovzxwd_2 = "rro:660F3833rM|rx/oq:",
+ pmovzxwq_2 = "rro:660F3834rM|rx/od:",
+ pmuldq_2 = "rmo:660F3828rM",
+ pmulld_2 = "rmo:660F3840rM",
+ ptest_2 = "rmo:660F3817rM",
+ roundpd_3 = "rmio:660F3A09rMU",
+ roundps_3 = "rmio:660F3A08rMU",
+ roundsd_3 = "rrio:660F3A0BrMU|rxi/oq:",
+ roundss_3 = "rrio:660F3A0ArMU|rxi/od:",
+
+ -- SSE4.2 ops
+ crc32_2 = "rmqd:F20F38F1rM|rm/dw:66F20F38F1rM|rm/db:F20F38F0rM|rm/qb:",
+ pcmpestri_3 = "rmio:660F3A61rMU",
+ pcmpestrm_3 = "rmio:660F3A60rMU",
+ pcmpgtq_2 = "rmo:660F3837rM",
+ pcmpistri_3 = "rmio:660F3A63rMU",
+ pcmpistrm_3 = "rmio:660F3A62rMU",
+ popcnt_2 = "rmqdw:F30FB8rM",
+
+ -- SSE4a
+ extrq_2 = "rro:660F79rM",
+ extrq_3 = "riio:660F780mUU",
+ insertq_2 = "rro:F20F79rM",
+ insertq_4 = "rriio:F20F78rMUU",
+ lzcnt_2 = "rmqdw:F30FBDrM",
+ movntsd_2 = "xr/qo:nF20F2BRm",
+ movntss_2 = "xr/do:F30F2BRm",
+ -- popcnt is also in SSE4.2
+
+ -- AES-NI
+ aesdec_2 = "rmo:660F38DErM",
+ aesdeclast_2 = "rmo:660F38DFrM",
+ aesenc_2 = "rmo:660F38DCrM",
+ aesenclast_2 = "rmo:660F38DDrM",
+ aesimc_2 = "rmo:660F38DBrM",
+ aeskeygenassist_3 = "rmio:660F3ADFrMU",
+ pclmulqdq_3 = "rmio:660F3A44rMU",
+
+ -- AVX FP ops
+ vaddsubpd_3 = "rrmoy:660FVD0rM",
+ vaddsubps_3 = "rrmoy:F20FVD0rM",
+ vandpd_3 = "rrmoy:660FV54rM",
+ vandps_3 = "rrmoy:0FV54rM",
+ vandnpd_3 = "rrmoy:660FV55rM",
+ vandnps_3 = "rrmoy:0FV55rM",
+ vblendpd_4 = "rrmioy:660F3AV0DrMU",
+ vblendps_4 = "rrmioy:660F3AV0CrMU",
+ vblendvpd_4 = "rrmroy:660F3AV4BrMs",
+ vblendvps_4 = "rrmroy:660F3AV4ArMs",
+ vbroadcastf128_2 = "rx/yo:660F38u1ArM",
+ vcmppd_4 = "rrmioy:660FVC2rMU",
+ vcmpps_4 = "rrmioy:0FVC2rMU",
+ vcmpsd_4 = "rrrio:F20FVC2rMU|rrxi/ooq:",
+ vcmpss_4 = "rrrio:F30FVC2rMU|rrxi/ood:",
+ vcomisd_2 = "rro:660Fu2FrM|rx/oq:",
+ vcomiss_2 = "rro:0Fu2FrM|rx/od:",
+ vcvtdq2pd_2 = "rro:F30FuE6rM|rx/oq:|rm/yo:",
+ vcvtdq2ps_2 = "rmoy:0Fu5BrM",
+ vcvtpd2dq_2 = "rmoy:F20FuE6rM",
+ vcvtpd2ps_2 = "rmoy:660Fu5ArM",
+ vcvtps2dq_2 = "rmoy:660Fu5BrM",
+ vcvtps2pd_2 = "rro:0Fu5ArM|rx/oq:|rm/yo:",
+ vcvtsd2si_2 = "rr/do:F20Fu2DrM|rx/dq:|rr/qo:|rxq:",
+ vcvtsd2ss_3 = "rrro:F20FV5ArM|rrx/ooq:",
+ vcvtsi2sd_3 = "rrm/ood:F20FV2ArM|rrm/ooq:F20FVX2ArM",
+ vcvtsi2ss_3 = "rrm/ood:F30FV2ArM|rrm/ooq:F30FVX2ArM",
+ vcvtss2sd_3 = "rrro:F30FV5ArM|rrx/ood:",
+ vcvtss2si_2 = "rr/do:F30Fu2DrM|rxd:|rr/qo:|rx/qd:",
+ vcvttpd2dq_2 = "rmo:660FuE6rM|rm/oy:660FuLE6rM",
+ vcvttps2dq_2 = "rmoy:F30Fu5BrM",
+ vcvttsd2si_2 = "rr/do:F20Fu2CrM|rx/dq:|rr/qo:|rxq:",
+ vcvttss2si_2 = "rr/do:F30Fu2CrM|rxd:|rr/qo:|rx/qd:",
+ vdppd_4 = "rrmio:660F3AV41rMU",
+ vdpps_4 = "rrmioy:660F3AV40rMU",
+ vextractf128_3 = "mri/oy:660F3AuL19RmU",
+ vextractps_3 = "mri/do:660F3Au17RmU",
+ vhaddpd_3 = "rrmoy:660FV7CrM",
+ vhaddps_3 = "rrmoy:F20FV7CrM",
+ vhsubpd_3 = "rrmoy:660FV7DrM",
+ vhsubps_3 = "rrmoy:F20FV7DrM",
+ vinsertf128_4 = "rrmi/yyo:660F3AV18rMU",
+ vinsertps_4 = "rrrio:660F3AV21rMU|rrxi/ood:",
+ vldmxcsr_1 = "xd:0FuAE2m",
+ vmaskmovps_3 = "rrxoy:660F38V2CrM|xrroy:660F38V2ERm",
+ vmaskmovpd_3 = "rrxoy:660F38V2DrM|xrroy:660F38V2FRm",
+ vmovapd_2 = "rmoy:660Fu28rM|mroy:660Fu29Rm",
+ vmovaps_2 = "rmoy:0Fu28rM|mroy:0Fu29Rm",
+ vmovd_2 = "rm/od:660Fu6ErM|rm/oq:660FuX6ErM|mr/do:660Fu7ERm|mr/qo:",
+ vmovq_2 = "rro:F30Fu7ErM|rx/oq:|xr/qo:660FuD6Rm",
+ vmovddup_2 = "rmy:F20Fu12rM|rro:|rx/oq:",
+ vmovhlps_3 = "rrro:0FV12rM",
+ vmovhpd_2 = "xr/qo:660Fu17Rm",
+ vmovhpd_3 = "rrx/ooq:660FV16rM",
+ vmovhps_2 = "xr/qo:0Fu17Rm",
+ vmovhps_3 = "rrx/ooq:0FV16rM",
+ vmovlhps_3 = "rrro:0FV16rM",
+ vmovlpd_2 = "xr/qo:660Fu13Rm",
+ vmovlpd_3 = "rrx/ooq:660FV12rM",
+ vmovlps_2 = "xr/qo:0Fu13Rm",
+ vmovlps_3 = "rrx/ooq:0FV12rM",
+ vmovmskpd_2 = "rr/do:660Fu50rM|rr/dy:660FuL50rM",
+ vmovmskps_2 = "rr/do:0Fu50rM|rr/dy:0FuL50rM",
+ vmovntpd_2 = "xroy:660Fu2BRm",
+ vmovntps_2 = "xroy:0Fu2BRm",
+ vmovsd_2 = "rx/oq:F20Fu10rM|xr/qo:F20Fu11Rm",
+ vmovsd_3 = "rrro:F20FV10rM",
+ vmovshdup_2 = "rmoy:F30Fu16rM",
+ vmovsldup_2 = "rmoy:F30Fu12rM",
+ vmovss_2 = "rx/od:F30Fu10rM|xr/do:F30Fu11Rm",
+ vmovss_3 = "rrro:F30FV10rM",
+ vmovupd_2 = "rmoy:660Fu10rM|mroy:660Fu11Rm",
+ vmovups_2 = "rmoy:0Fu10rM|mroy:0Fu11Rm",
+ vorpd_3 = "rrmoy:660FV56rM",
+ vorps_3 = "rrmoy:0FV56rM",
+ vpermilpd_3 = "rrmoy:660F38V0DrM|rmioy:660F3Au05rMU",
+ vpermilps_3 = "rrmoy:660F38V0CrM|rmioy:660F3Au04rMU",
+ vperm2f128_4 = "rrmiy:660F3AV06rMU",
+ vptestpd_2 = "rmoy:660F38u0FrM",
+ vptestps_2 = "rmoy:660F38u0ErM",
+ vrcpps_2 = "rmoy:0Fu53rM",
+ vrcpss_3 = "rrro:F30FV53rM|rrx/ood:",
+ vrsqrtps_2 = "rmoy:0Fu52rM",
+ vrsqrtss_3 = "rrro:F30FV52rM|rrx/ood:",
+ vroundpd_3 = "rmioy:660F3AV09rMU",
+ vroundps_3 = "rmioy:660F3AV08rMU",
+ vroundsd_4 = "rrrio:660F3AV0BrMU|rrxi/ooq:",
+ vroundss_4 = "rrrio:660F3AV0ArMU|rrxi/ood:",
+ vshufpd_4 = "rrmioy:660FVC6rMU",
+ vshufps_4 = "rrmioy:0FVC6rMU",
+ vsqrtps_2 = "rmoy:0Fu51rM",
+ vsqrtss_2 = "rro:F30Fu51rM|rx/od:",
+ vsqrtpd_2 = "rmoy:660Fu51rM",
+ vsqrtsd_2 = "rro:F20Fu51rM|rx/oq:",
+ vstmxcsr_1 = "xd:0FuAE3m",
+ vucomisd_2 = "rro:660Fu2ErM|rx/oq:",
+ vucomiss_2 = "rro:0Fu2ErM|rx/od:",
+ vunpckhpd_3 = "rrmoy:660FV15rM",
+ vunpckhps_3 = "rrmoy:0FV15rM",
+ vunpcklpd_3 = "rrmoy:660FV14rM",
+ vunpcklps_3 = "rrmoy:0FV14rM",
+ vxorpd_3 = "rrmoy:660FV57rM",
+ vxorps_3 = "rrmoy:0FV57rM",
+ vzeroall_0 = "0FuL77",
+ vzeroupper_0 = "0Fu77",
+
+ -- AVX2 FP ops
+ vbroadcastss_2 = "rx/od:660F38u18rM|rx/yd:|rro:|rr/yo:",
+ vbroadcastsd_2 = "rx/yq:660F38u19rM|rr/yo:",
+ -- *vgather* (!vsib)
+ vpermpd_3 = "rmiy:660F3AuX01rMU",
+ vpermps_3 = "rrmy:660F38V16rM",
+
+ -- AVX, AVX2 integer ops
+ -- In general, xmm requires AVX, ymm requires AVX2.
+ vaesdec_3 = "rrmo:660F38VDErM",
+ vaesdeclast_3 = "rrmo:660F38VDFrM",
+ vaesenc_3 = "rrmo:660F38VDCrM",
+ vaesenclast_3 = "rrmo:660F38VDDrM",
+ vaesimc_2 = "rmo:660F38uDBrM",
+ vaeskeygenassist_3 = "rmio:660F3AuDFrMU",
+ vlddqu_2 = "rxoy:F20FuF0rM",
+ vmaskmovdqu_2 = "rro:660FuF7rM",
+ vmovdqa_2 = "rmoy:660Fu6FrM|mroy:660Fu7FRm",
+ vmovdqu_2 = "rmoy:F30Fu6FrM|mroy:F30Fu7FRm",
+ vmovntdq_2 = "xroy:660FuE7Rm",
+ vmovntdqa_2 = "rxoy:660F38u2ArM",
+ vmpsadbw_4 = "rrmioy:660F3AV42rMU",
+ vpabsb_2 = "rmoy:660F38u1CrM",
+ vpabsd_2 = "rmoy:660F38u1ErM",
+ vpabsw_2 = "rmoy:660F38u1DrM",
+ vpackusdw_3 = "rrmoy:660F38V2BrM",
+ vpalignr_4 = "rrmioy:660F3AV0FrMU",
+ vpblendvb_4 = "rrmroy:660F3AV4CrMs",
+ vpblendw_4 = "rrmioy:660F3AV0ErMU",
+ vpclmulqdq_4 = "rrmio:660F3AV44rMU",
+ vpcmpeqq_3 = "rrmoy:660F38V29rM",
+ vpcmpestri_3 = "rmio:660F3Au61rMU",
+ vpcmpestrm_3 = "rmio:660F3Au60rMU",
+ vpcmpgtq_3 = "rrmoy:660F38V37rM",
+ vpcmpistri_3 = "rmio:660F3Au63rMU",
+ vpcmpistrm_3 = "rmio:660F3Au62rMU",
+ vpextrb_3 = "rri/do:660F3Au14nRmU|rri/qo:|xri/bo:",
+ vpextrw_3 = "rri/do:660FuC5rMU|xri/wo:660F3Au15nRmU",
+ vpextrd_3 = "mri/do:660F3Au16RmU",
+ vpextrq_3 = "mri/qo:660F3Au16RmU",
+ vphaddw_3 = "rrmoy:660F38V01rM",
+ vphaddd_3 = "rrmoy:660F38V02rM",
+ vphaddsw_3 = "rrmoy:660F38V03rM",
+ vphminposuw_2 = "rmo:660F38u41rM",
+ vphsubw_3 = "rrmoy:660F38V05rM",
+ vphsubd_3 = "rrmoy:660F38V06rM",
+ vphsubsw_3 = "rrmoy:660F38V07rM",
+ vpinsrb_4 = "rrri/ood:660F3AV20rMU|rrxi/oob:",
+ vpinsrw_4 = "rrri/ood:660FVC4rMU|rrxi/oow:",
+ vpinsrd_4 = "rrmi/ood:660F3AV22rMU",
+ vpinsrq_4 = "rrmi/ooq:660F3AVX22rMU",
+ vpmaddubsw_3 = "rrmoy:660F38V04rM",
+ vpmaxsb_3 = "rrmoy:660F38V3CrM",
+ vpmaxsd_3 = "rrmoy:660F38V3DrM",
+ vpmaxuw_3 = "rrmoy:660F38V3ErM",
+ vpmaxud_3 = "rrmoy:660F38V3FrM",
+ vpminsb_3 = "rrmoy:660F38V38rM",
+ vpminsd_3 = "rrmoy:660F38V39rM",
+ vpminuw_3 = "rrmoy:660F38V3ArM",
+ vpminud_3 = "rrmoy:660F38V3BrM",
+ vpmovmskb_2 = "rr/do:660FuD7rM|rr/dy:660FuLD7rM",
+ vpmovsxbw_2 = "rroy:660F38u20rM|rx/oq:|rx/yo:",
+ vpmovsxbd_2 = "rroy:660F38u21rM|rx/od:|rx/yq:",
+ vpmovsxbq_2 = "rroy:660F38u22rM|rx/ow:|rx/yd:",
+ vpmovsxwd_2 = "rroy:660F38u23rM|rx/oq:|rx/yo:",
+ vpmovsxwq_2 = "rroy:660F38u24rM|rx/od:|rx/yq:",
+ vpmovsxdq_2 = "rroy:660F38u25rM|rx/oq:|rx/yo:",
+ vpmovzxbw_2 = "rroy:660F38u30rM|rx/oq:|rx/yo:",
+ vpmovzxbd_2 = "rroy:660F38u31rM|rx/od:|rx/yq:",
+ vpmovzxbq_2 = "rroy:660F38u32rM|rx/ow:|rx/yd:",
+ vpmovzxwd_2 = "rroy:660F38u33rM|rx/oq:|rx/yo:",
+ vpmovzxwq_2 = "rroy:660F38u34rM|rx/od:|rx/yq:",
+ vpmovzxdq_2 = "rroy:660F38u35rM|rx/oq:|rx/yo:",
+ vpmuldq_3 = "rrmoy:660F38V28rM",
+ vpmulhrsw_3 = "rrmoy:660F38V0BrM",
+ vpmulld_3 = "rrmoy:660F38V40rM",
+ vpshufb_3 = "rrmoy:660F38V00rM",
+ vpshufd_3 = "rmioy:660Fu70rMU",
+ vpshufhw_3 = "rmioy:F30Fu70rMU",
+ vpshuflw_3 = "rmioy:F20Fu70rMU",
+ vpsignb_3 = "rrmoy:660F38V08rM",
+ vpsignw_3 = "rrmoy:660F38V09rM",
+ vpsignd_3 = "rrmoy:660F38V0ArM",
+ vpslldq_3 = "rrioy:660Fv737mU",
+ vpsllw_3 = "rrmoy:660FVF1rM|rrioy:660Fv716mU",
+ vpslld_3 = "rrmoy:660FVF2rM|rrioy:660Fv726mU",
+ vpsllq_3 = "rrmoy:660FVF3rM|rrioy:660Fv736mU",
+ vpsraw_3 = "rrmoy:660FVE1rM|rrioy:660Fv714mU",
+ vpsrad_3 = "rrmoy:660FVE2rM|rrioy:660Fv724mU",
+ vpsrldq_3 = "rrioy:660Fv733mU",
+ vpsrlw_3 = "rrmoy:660FVD1rM|rrioy:660Fv712mU",
+ vpsrld_3 = "rrmoy:660FVD2rM|rrioy:660Fv722mU",
+ vpsrlq_3 = "rrmoy:660FVD3rM|rrioy:660Fv732mU",
+ vptest_2 = "rmoy:660F38u17rM",
+
+ -- AVX2 integer ops
+ vbroadcasti128_2 = "rx/yo:660F38u5ArM",
+ vinserti128_4 = "rrmi/yyo:660F3AV38rMU",
+ vextracti128_3 = "mri/oy:660F3AuL39RmU",
+ vpblendd_4 = "rrmioy:660F3AV02rMU",
+ vpbroadcastb_2 = "rro:660F38u78rM|rx/ob:|rr/yo:|rx/yb:",
+ vpbroadcastw_2 = "rro:660F38u79rM|rx/ow:|rr/yo:|rx/yw:",
+ vpbroadcastd_2 = "rro:660F38u58rM|rx/od:|rr/yo:|rx/yd:",
+ vpbroadcastq_2 = "rro:660F38u59rM|rx/oq:|rr/yo:|rx/yq:",
+ vpermd_3 = "rrmy:660F38V36rM",
+ vpermq_3 = "rmiy:660F3AuX00rMU",
+ -- *vpgather* (!vsib)
+ vperm2i128_4 = "rrmiy:660F3AV46rMU",
+ vpmaskmovd_3 = "rrxoy:660F38V8CrM|xrroy:660F38V8ERm",
+ vpmaskmovq_3 = "rrxoy:660F38VX8CrM|xrroy:660F38VX8ERm",
+ vpsllvd_3 = "rrmoy:660F38V47rM",
+ vpsllvq_3 = "rrmoy:660F38VX47rM",
+ vpsravd_3 = "rrmoy:660F38V46rM",
+ vpsrlvd_3 = "rrmoy:660F38V45rM",
+ vpsrlvq_3 = "rrmoy:660F38VX45rM",
+
+ -- Intel ADX
+ adcx_2 = "rmqd:660F38F6rM",
+ adox_2 = "rmqd:F30F38F6rM",
+}
+
+------------------------------------------------------------------------------
+
+-- Arithmetic ops.
+for name,n in pairs{ add = 0, ["or"] = 1, adc = 2, sbb = 3,
+ ["and"] = 4, sub = 5, xor = 6, cmp = 7 } do
+ local n8 = shl(n, 3)
+ map_op[name.."_2"] = format(
+ "mr:%02XRm|rm:%02XrM|mI1qdw:81%XmI|mS1qdw:83%XmS|Ri1qdwb:%02Xri|mi1qdwb:81%Xmi",
+ 1+n8, 3+n8, n, n, 5+n8, n)
+end
+
+-- Shift ops.
+for name,n in pairs{ rol = 0, ror = 1, rcl = 2, rcr = 3,
+ shl = 4, shr = 5, sar = 7, sal = 4 } do
+ map_op[name.."_2"] = format("m1:D1%Xm|mC1qdwb:D3%Xm|mi:C1%XmU", n, n, n)
+end
+
+-- Conditional ops.
+for cc,n in pairs(map_cc) do
+ map_op["j"..cc.."_1"] = format("J.:n0F8%XJ", n) -- short: 7%X
+ map_op["set"..cc.."_1"] = format("mb:n0F9%X2m", n)
+ map_op["cmov"..cc.."_2"] = format("rmqdw:0F4%XrM", n) -- P6+
+end
+
+-- FP arithmetic ops.
+for name,n in pairs{ add = 0, mul = 1, com = 2, comp = 3,
+ sub = 4, subr = 5, div = 6, divr = 7 } do
+ local nc = 0xc0 + shl(n, 3)
+ local nr = nc + (n < 4 and 0 or (n % 2 == 0 and 8 or -8))
+ local fn = "f"..name
+ map_op[fn.."_1"] = format("ff:D8%02Xr|xd:D8%Xm|xq:nDC%Xm", nc, n, n)
+ if n == 2 or n == 3 then
+ map_op[fn.."_2"] = format("Fff:D8%02XR|Fx2d:D8%XM|Fx2q:nDC%XM", nc, n, n)
+ else
+ map_op[fn.."_2"] = format("Fff:D8%02XR|fFf:DC%02Xr|Fx2d:D8%XM|Fx2q:nDC%XM", nc, nr, n, n)
+ map_op[fn.."p_1"] = format("ff:DE%02Xr", nr)
+ map_op[fn.."p_2"] = format("fFf:DE%02Xr", nr)
+ end
+ map_op["fi"..name.."_1"] = format("xd:DA%Xm|xw:nDE%Xm", n, n)
+end
+
+-- FP conditional moves.
+for cc,n in pairs{ b=0, e=1, be=2, u=3, nb=4, ne=5, nbe=6, nu=7 } do
+ local nc = 0xdac0 + shl(band(n, 3), 3) + shl(band(n, 4), 6)
+ map_op["fcmov"..cc.."_1"] = format("ff:%04Xr", nc) -- P6+
+ map_op["fcmov"..cc.."_2"] = format("Fff:%04XR", nc) -- P6+
+end
+
+-- SSE / AVX FP arithmetic ops.
+for name,n in pairs{ sqrt = 1, add = 8, mul = 9,
+ sub = 12, min = 13, div = 14, max = 15 } do
+ map_op[name.."ps_2"] = format("rmo:0F5%XrM", n)
+ map_op[name.."ss_2"] = format("rro:F30F5%XrM|rx/od:", n)
+ map_op[name.."pd_2"] = format("rmo:660F5%XrM", n)
+ map_op[name.."sd_2"] = format("rro:F20F5%XrM|rx/oq:", n)
+ if n ~= 1 then
+ map_op["v"..name.."ps_3"] = format("rrmoy:0FV5%XrM", n)
+ map_op["v"..name.."ss_3"] = format("rrro:F30FV5%XrM|rrx/ood:", n)
+ map_op["v"..name.."pd_3"] = format("rrmoy:660FV5%XrM", n)
+ map_op["v"..name.."sd_3"] = format("rrro:F20FV5%XrM|rrx/ooq:", n)
+ end
+end
+
+-- SSE2 / AVX / AVX2 integer arithmetic ops (66 0F leaf).
+for name,n in pairs{
+ paddb = 0xFC, paddw = 0xFD, paddd = 0xFE, paddq = 0xD4,
+ paddsb = 0xEC, paddsw = 0xED, packssdw = 0x6B,
+ packsswb = 0x63, packuswb = 0x67, paddusb = 0xDC,
+ paddusw = 0xDD, pand = 0xDB, pandn = 0xDF, pavgb = 0xE0,
+ pavgw = 0xE3, pcmpeqb = 0x74, pcmpeqd = 0x76,
+ pcmpeqw = 0x75, pcmpgtb = 0x64, pcmpgtd = 0x66,
+ pcmpgtw = 0x65, pmaddwd = 0xF5, pmaxsw = 0xEE,
+ pmaxub = 0xDE, pminsw = 0xEA, pminub = 0xDA,
+ pmulhuw = 0xE4, pmulhw = 0xE5, pmullw = 0xD5,
+ pmuludq = 0xF4, por = 0xEB, psadbw = 0xF6, psubb = 0xF8,
+ psubw = 0xF9, psubd = 0xFA, psubq = 0xFB, psubsb = 0xE8,
+ psubsw = 0xE9, psubusb = 0xD8, psubusw = 0xD9,
+ punpckhbw = 0x68, punpckhwd = 0x69, punpckhdq = 0x6A,
+ punpckhqdq = 0x6D, punpcklbw = 0x60, punpcklwd = 0x61,
+ punpckldq = 0x62, punpcklqdq = 0x6C, pxor = 0xEF
+} do
+ map_op[name.."_2"] = format("rmo:660F%02XrM", n)
+ map_op["v"..name.."_3"] = format("rrmoy:660FV%02XrM", n)
+end
+
+------------------------------------------------------------------------------
+
+local map_vexarg = { u = false, v = 1, V = 2 }
+
+-- Process pattern string.
+local function dopattern(pat, args, sz, op, needrex)
+ local digit, addin, vex
+ local opcode = 0
+ local szov = sz
+ local narg = 1
+ local rex = 0
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 6 positions.
+ if secpos+6 > maxsecpos then wflush() end
+
+ -- Process each character.
+ for c in gmatch(pat.."|", ".") do
+ if match(c, "%x") then -- Hex digit.
+ digit = byte(c) - 48
+ if digit > 48 then digit = digit - 39
+ elseif digit > 16 then digit = digit - 7 end
+ opcode = opcode*16 + digit
+ addin = nil
+ elseif c == "n" then -- Disable operand size mods for opcode.
+ szov = nil
+ elseif c == "X" then -- Force REX.W.
+ rex = 8
+ elseif c == "L" then -- Force VEX.L.
+ vex.l = true
+ elseif c == "r" then -- Merge 1st operand regno. into opcode.
+ addin = args[1]; opcode = opcode + (addin.reg % 8)
+ if narg < 2 then narg = 2 end
+ elseif c == "R" then -- Merge 2nd operand regno. into opcode.
+ addin = args[2]; opcode = opcode + (addin.reg % 8)
+ narg = 3
+ elseif c == "m" or c == "M" then -- Encode ModRM/SIB.
+ local s
+ if addin then
+ s = addin.reg
+ opcode = opcode - band(s, 7) -- Undo regno opcode merge.
+ else
+ s = band(opcode, 15) -- Undo last digit.
+ opcode = shr(opcode, 4)
+ end
+ local nn = c == "m" and 1 or 2
+ local t = args[nn]
+ if narg <= nn then narg = nn + 1 end
+ if szov == "q" and rex == 0 then rex = rex + 8 end
+ if t.reg and t.reg > 7 then rex = rex + 1 end
+ if t.xreg and t.xreg > 7 then rex = rex + 2 end
+ if s > 7 then rex = rex + 4 end
+ if needrex then rex = rex + 16 end
+ local psz, sk = wputop(szov, opcode, rex, vex, s < 0, t.vreg or t.vxreg)
+ opcode = nil
+ local imark = sub(pat, -1) -- Force a mark (ugly).
+ -- Put ModRM/SIB with regno/last digit as spare.
+ wputmrmsib(t, imark, s, addin and addin.vreg, psz, sk)
+ addin = nil
+ elseif map_vexarg[c] ~= nil then -- Encode using VEX prefix
+ local b = band(opcode, 255); opcode = shr(opcode, 8)
+ local m = 1
+ if b == 0x38 then m = 2
+ elseif b == 0x3a then m = 3 end
+ if m ~= 1 then b = band(opcode, 255); opcode = shr(opcode, 8) end
+ if b ~= 0x0f then
+ werror("expected `0F', `0F38', or `0F3A' to precede `"..c..
+ "' in pattern `"..pat.."' for `"..op.."'")
+ end
+ local v = map_vexarg[c]
+ if v then v = remove(args, v) end
+ b = band(opcode, 255)
+ local p = 0
+ if b == 0x66 then p = 1
+ elseif b == 0xf3 then p = 2
+ elseif b == 0xf2 then p = 3 end
+ if p ~= 0 then opcode = shr(opcode, 8) end
+ if opcode ~= 0 then wputop(nil, opcode, 0); opcode = 0 end
+ vex = { m = m, p = p, v = v }
+ else
+ if opcode then -- Flush opcode.
+ if szov == "q" and rex == 0 then rex = rex + 8 end
+ if needrex then rex = rex + 16 end
+ if addin and addin.reg == -1 then
+ local psz, sk = wputop(szov, opcode - 7, rex, vex, true)
+ wvreg("opcode", addin.vreg, psz, sk)
+ else
+ if addin and addin.reg > 7 then rex = rex + 1 end
+ wputop(szov, opcode, rex, vex)
+ end
+ opcode = nil
+ end
+ if c == "|" then break end
+ if c == "o" then -- Offset (pure 32 bit displacement).
+ wputdarg(args[1].disp); if narg < 2 then narg = 2 end
+ elseif c == "O" then
+ wputdarg(args[2].disp); narg = 3
+ else
+ -- Anything else is an immediate operand.
+ local a = args[narg]
+ narg = narg + 1
+ local mode, imm = a.mode, a.imm
+ if mode == "iJ" and not match("iIJ", c) then
+ werror("bad operand size for label")
+ end
+ if c == "S" then
+ wputsbarg(imm)
+ elseif c == "U" then
+ wputbarg(imm)
+ elseif c == "W" then
+ wputwarg(imm)
+ elseif c == "i" or c == "I" then
+ if mode == "iJ" then
+ wputlabel("IMM_", imm, 1)
+ elseif mode == "iI" and c == "I" then
+ waction(sz == "w" and "IMM_WB" or "IMM_DB", imm)
+ else
+ wputszarg(sz, imm)
+ end
+ elseif c == "J" then
+ if mode == "iPJ" then
+ waction("REL_A", imm) -- !x64 (secpos)
+ else
+ wputlabel("REL_", imm, 2)
+ end
+ elseif c == "s" then
+ local reg = a.reg
+ if reg < 0 then
+ wputb(0)
+ wvreg("imm.hi", a.vreg)
+ else
+ wputb(shl(reg, 4))
+ end
+ else
+ werror("bad char `"..c.."' in pattern `"..pat.."' for `"..op.."'")
+ end
+ end
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Mapping of operand modes to short names. Suppress output with '#'.
+local map_modename = {
+ r = "reg", R = "eax", C = "cl", x = "mem", m = "mrm", i = "imm",
+ f = "stx", F = "st0", J = "lbl", ["1"] = "1",
+ I = "#", S = "#", O = "#",
+}
+
+-- Return a table/string showing all possible operand modes.
+local function templatehelp(template, nparams)
+ if nparams == 0 then return "" end
+ local t = {}
+ for tm in gmatch(template, "[^%|]+") do
+ local s = map_modename[sub(tm, 1, 1)]
+ s = s..gsub(sub(tm, 2, nparams), ".", function(c)
+ return ", "..map_modename[c]
+ end)
+ if not match(s, "#") then t[#t+1] = s end
+ end
+ return t
+end
+
+-- Match operand modes against mode match part of template.
+local function matchtm(tm, args)
+ for i=1,#args do
+ if not match(args[i].mode, sub(tm, i, i)) then return end
+ end
+ return true
+end
+
+-- Handle opcodes defined with template strings.
+map_op[".template__"] = function(params, template, nparams)
+ if not params then return templatehelp(template, nparams) end
+ local args = {}
+
+ -- Zero-operand opcodes have no match part.
+ if #params == 0 then
+ dopattern(template, args, "d", params.op, nil)
+ return
+ end
+
+ -- Determine common operand size (coerce undefined size) or flag as mixed.
+ local sz, szmix, needrex
+ for i,p in ipairs(params) do
+ args[i] = parseoperand(p)
+ local nsz = args[i].opsize
+ if nsz then
+ if sz and sz ~= nsz then szmix = true else sz = nsz end
+ end
+ local nrex = args[i].needrex
+ if nrex ~= nil then
+ if needrex == nil then
+ needrex = nrex
+ elseif needrex ~= nrex then
+ werror("bad mix of byte-addressable registers")
+ end
+ end
+ end
+
+ -- Try all match:pattern pairs (separated by '|').
+ local gotmatch, lastpat
+ for tm in gmatch(template, "[^%|]+") do
+ -- Split off size match (starts after mode match) and pattern string.
+ local szm, pat = match(tm, "^(.-):(.*)$", #args+1)
+ if pat == "" then pat = lastpat else lastpat = pat end
+ if matchtm(tm, args) then
+ local prefix = sub(szm, 1, 1)
+ if prefix == "/" then -- Exactly match leading operand sizes.
+ for i = #szm,1,-1 do
+ if i == 1 then
+ dopattern(pat, args, sz, params.op, needrex) -- Process pattern.
+ return
+ elseif args[i-1].opsize ~= sub(szm, i, i) then
+ break
+ end
+ end
+ else -- Match common operand size.
+ local szp = sz
+ if szm == "" then szm = x64 and "qdwb" or "dwb" end -- Default sizes.
+ if prefix == "1" then szp = args[1].opsize; szmix = nil
+ elseif prefix == "2" then szp = args[2].opsize; szmix = nil end
+ if not szmix and (prefix == "." or match(szm, szp or "#")) then
+ dopattern(pat, args, szp, params.op, needrex) -- Process pattern.
+ return
+ end
+ end
+ gotmatch = true
+ end
+ end
+
+ local msg = "bad operand mode"
+ if gotmatch then
+ if szmix then
+ msg = "mixed operand size"
+ else
+ msg = sz and "bad operand size" or "missing operand size"
+ end
+ end
+
+ werror(msg.." in `"..opmodestr(params.op, args).."'")
+end
+
+------------------------------------------------------------------------------
+
+-- x64-specific opcode for 64 bit immediates and displacements.
+if x64 then
+ function map_op.mov64_2(params)
+ if not params then return { "reg, imm", "reg, [disp]", "[disp], reg" } end
+ if secpos+2 > maxsecpos then wflush() end
+ local opcode, op64, sz, rex, vreg
+ local op64 = match(params[1], "^%[%s*(.-)%s*%]$")
+ if op64 then
+ local a = parseoperand(params[2])
+ if a.mode ~= "rmR" then werror("bad operand mode") end
+ sz = a.opsize
+ rex = sz == "q" and 8 or 0
+ opcode = 0xa3
+ else
+ op64 = match(params[2], "^%[%s*(.-)%s*%]$")
+ local a = parseoperand(params[1])
+ if op64 then
+ if a.mode ~= "rmR" then werror("bad operand mode") end
+ sz = a.opsize
+ rex = sz == "q" and 8 or 0
+ opcode = 0xa1
+ else
+ if sub(a.mode, 1, 1) ~= "r" or a.opsize ~= "q" then
+ werror("bad operand mode")
+ end
+ op64 = params[2]
+ if a.reg == -1 then
+ vreg = a.vreg
+ opcode = 0xb8
+ else
+ opcode = 0xb8 + band(a.reg, 7)
+ end
+ rex = a.reg > 7 and 9 or 8
+ end
+ end
+ local psz, sk = wputop(sz, opcode, rex, nil, vreg)
+ wvreg("opcode", vreg, psz, sk)
+ waction("IMM_D", format("(unsigned int)(%s)", op64))
+ waction("IMM_D", format("(unsigned int)((%s)>>32)", op64))
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+local function op_data(params)
+ if not params then return "imm..." end
+ local sz = sub(params.op, 2, 2)
+ if sz == "a" then sz = addrsize end
+ for _,p in ipairs(params) do
+ local a = parseoperand(p)
+ if sub(a.mode, 1, 1) ~= "i" or (a.opsize and a.opsize ~= sz) then
+ werror("bad mode or size in `"..p.."'")
+ end
+ if a.mode == "iJ" then
+ wputlabel("IMM_", a.imm, 1)
+ else
+ wputszarg(sz, a.imm)
+ end
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+map_op[".byte_*"] = op_data
+map_op[".sbyte_*"] = op_data
+map_op[".word_*"] = op_data
+map_op[".dword_*"] = op_data
+map_op[".aword_*"] = op_data
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_2"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr [, addr]" end
+ if secpos+2 > maxsecpos then wflush() end
+ local a = parseoperand(params[1])
+ local mode, imm = a.mode, a.imm
+ if type(imm) == "number" and (mode == "iJ" or (imm >= 1 and imm <= 9)) then
+ -- Local label (1: ... 9:) or global label (->global:).
+ waction("LABEL_LG", nil, 1)
+ wputxb(imm)
+ elseif mode == "iJ" then
+ -- PC label (=>pcexpr:).
+ waction("LABEL_PC", imm)
+ else
+ werror("bad label definition")
+ end
+ -- SETLABEL must immediately follow LABEL_LG/LABEL_PC.
+ local addr = params[2]
+ if addr then
+ local a = parseoperand(addr)
+ if a.mode == "iPJ" then
+ waction("SETLABEL", a.imm)
+ else
+ werror("bad label assignment")
+ end
+ end
+end
+map_op[".label_1"] = map_op[".label_2"]
+
+------------------------------------------------------------------------------
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1]) or map_opsizenum[map_opsize[params[1]]]
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", nil, 1)
+ wputxb(align-1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+-- Spacing pseudo-opcode.
+map_op[".space_2"] = function(params)
+ if not params then return "num [, filler]" end
+ if secpos+1 > maxsecpos then wflush() end
+ waction("SPACE", params[1])
+ local fill = params[2]
+ if fill then
+ fill = tonumber(fill)
+ if not fill or fill < 0 or fill > 255 then werror("bad filler") end
+ end
+ wputxb(fill or 0)
+end
+map_op[".space_1"] = map_op[".space_2"]
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ if reg and not map_reg_valid_base[reg] then
+ werror("bad base register `"..(map_reg_rev[reg] or reg).."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg and map_reg_rev[tp.reg] or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION")
+ wputxb(num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpregs(out)
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dynasm.lua b/ext/opcache/jit/dynasm/dynasm.lua
new file mode 100644
index 0000000000..1e5899a4bf
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dynasm.lua
@@ -0,0 +1,1094 @@
+------------------------------------------------------------------------------
+-- DynASM. A dynamic assembler for code generation engines.
+-- Originally designed and implemented for LuaJIT.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See below for full copyright notice.
+------------------------------------------------------------------------------
+
+-- Application information.
+local _info = {
+ name = "DynASM",
+ description = "A dynamic assembler for code generation engines",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ url = "http://luajit.org/dynasm.html",
+ license = "MIT",
+ copyright = [[
+Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+[ MIT license: http://www.opensource.org/licenses/mit-license.php ]
+]],
+}
+
+-- Cache library functions.
+local type, pairs, ipairs = type, pairs, ipairs
+local pcall, error, assert = pcall, error, assert
+local _s = string
+local sub, match, gmatch, gsub = _s.sub, _s.match, _s.gmatch, _s.gsub
+local format, rep, upper = _s.format, _s.rep, _s.upper
+local _t = table
+local insert, remove, concat, sort = _t.insert, _t.remove, _t.concat, _t.sort
+local exit = os.exit
+local io = io
+local stdin, stdout, stderr = io.stdin, io.stdout, io.stderr
+
+------------------------------------------------------------------------------
+
+-- Program options.
+local g_opt = {}
+
+-- Global state for current file.
+local g_fname, g_curline, g_indent, g_lineno, g_synclineno, g_arch
+local g_errcount = 0
+
+-- Write buffer for output file.
+local g_wbuffer, g_capbuffer
+
+------------------------------------------------------------------------------
+
+-- Write an output line (or callback function) to the buffer.
+local function wline(line, needindent)
+ local buf = g_capbuffer or g_wbuffer
+ buf[#buf+1] = needindent and g_indent..line or line
+ g_synclineno = g_synclineno + 1
+end
+
+-- Write assembler line as a comment, if requestd.
+local function wcomment(aline)
+ if g_opt.comment then
+ wline(g_opt.comment..aline..g_opt.endcomment, true)
+ end
+end
+
+-- Resync CPP line numbers.
+local function wsync()
+ if g_synclineno ~= g_lineno and g_opt.cpp then
+ wline("#line "..g_lineno..' "'..g_fname..'"')
+ g_synclineno = g_lineno
+ end
+end
+
+-- Dummy action flush function. Replaced with arch-specific function later.
+local function wflush(term)
+end
+
+-- Dump all buffered output lines.
+local function wdumplines(out, buf)
+ for _,line in ipairs(buf) do
+ if type(line) == "string" then
+ assert(out:write(line, "\n"))
+ else
+ -- Special callback to dynamically insert lines after end of processing.
+ line(out)
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Emit an error. Processing continues with next statement.
+local function werror(msg)
+ error(format("%s:%s: error: %s:\n%s", g_fname, g_lineno, msg, g_curline), 0)
+end
+
+-- Emit a fatal error. Processing stops.
+local function wfatal(msg)
+ g_errcount = "fatal"
+ werror(msg)
+end
+
+-- Print a warning. Processing continues.
+local function wwarn(msg)
+ stderr:write(format("%s:%s: warning: %s:\n%s\n",
+ g_fname, g_lineno, msg, g_curline))
+end
+
+-- Print caught error message. But suppress excessive errors.
+local function wprinterr(...)
+ if type(g_errcount) == "number" then
+ -- Regular error.
+ g_errcount = g_errcount + 1
+ if g_errcount < 21 then -- Seems to be a reasonable limit.
+ stderr:write(...)
+ elseif g_errcount == 21 then
+ stderr:write(g_fname,
+ ":*: warning: too many errors (suppressed further messages).\n")
+ end
+ else
+ -- Fatal error.
+ stderr:write(...)
+ return true -- Stop processing.
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Map holding all option handlers.
+local opt_map = {}
+local opt_current
+
+-- Print error and exit with error status.
+local function opterror(...)
+ stderr:write("dynasm.lua: ERROR: ", ...)
+ stderr:write("\n")
+ exit(1)
+end
+
+-- Get option parameter.
+local function optparam(args)
+ local argn = args.argn
+ local p = args[argn]
+ if not p then
+ opterror("missing parameter for option `", opt_current, "'.")
+ end
+ args.argn = argn + 1
+ return p
+end
+
+------------------------------------------------------------------------------
+
+-- Core pseudo-opcodes.
+local map_coreop = {}
+-- Dummy opcode map. Replaced by arch-specific map.
+local map_op = {}
+
+-- Forward declarations.
+local dostmt
+local readfile
+
+------------------------------------------------------------------------------
+
+-- Map for defines (initially empty, chains to arch-specific map).
+local map_def = {}
+
+-- Pseudo-opcode to define a substitution.
+map_coreop[".define_2"] = function(params, nparams)
+ if not params then return nparams == 1 and "name" or "name, subst" end
+ local name, def = params[1], params[2] or "1"
+ if not match(name, "^[%a_][%w_]*$") then werror("bad or duplicate define") end
+ map_def[name] = def
+end
+map_coreop[".define_1"] = map_coreop[".define_2"]
+
+-- Define a substitution on the command line.
+function opt_map.D(args)
+ local namesubst = optparam(args)
+ local name, subst = match(namesubst, "^([%a_][%w_]*)=(.*)$")
+ if name then
+ map_def[name] = subst
+ elseif match(namesubst, "^[%a_][%w_]*$") then
+ map_def[namesubst] = "1"
+ else
+ opterror("bad define")
+ end
+end
+
+-- Undefine a substitution on the command line.
+function opt_map.U(args)
+ local name = optparam(args)
+ if match(name, "^[%a_][%w_]*$") then
+ map_def[name] = nil
+ else
+ opterror("bad define")
+ end
+end
+
+-- Helper for definesubst.
+local gotsubst
+
+local function definesubst_one(word)
+ local subst = map_def[word]
+ if subst then gotsubst = word; return subst else return word end
+end
+
+-- Iteratively substitute defines.
+local function definesubst(stmt)
+ -- Limit number of iterations.
+ for i=1,100 do
+ gotsubst = false
+ stmt = gsub(stmt, "#?[%w_]+", definesubst_one)
+ if not gotsubst then break end
+ end
+ if gotsubst then wfatal("recursive define involving `"..gotsubst.."'") end
+ return stmt
+end
+
+-- Dump all defines.
+local function dumpdefines(out, lvl)
+ local t = {}
+ for name in pairs(map_def) do
+ t[#t+1] = name
+ end
+ sort(t)
+ out:write("Defines:\n")
+ for _,name in ipairs(t) do
+ local subst = map_def[name]
+ if g_arch then subst = g_arch.revdef(subst) end
+ out:write(format(" %-20s %s\n", name, subst))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Support variables for conditional assembly.
+local condlevel = 0
+local condstack = {}
+
+-- Evaluate condition with a Lua expression. Substitutions already performed.
+local function cond_eval(cond)
+ local func, err
+ if setfenv then
+ func, err = loadstring("return "..cond, "=expr")
+ else
+ -- No globals. All unknown identifiers evaluate to nil.
+ func, err = load("return "..cond, "=expr", "t", {})
+ end
+ if func then
+ if setfenv then
+ setfenv(func, {}) -- No globals. All unknown identifiers evaluate to nil.
+ end
+ local ok, res = pcall(func)
+ if ok then
+ if res == 0 then return false end -- Oh well.
+ return not not res
+ end
+ err = res
+ end
+ wfatal("bad condition: "..err)
+end
+
+-- Skip statements until next conditional pseudo-opcode at the same level.
+local function stmtskip()
+ local dostmt_save = dostmt
+ local lvl = 0
+ dostmt = function(stmt)
+ local op = match(stmt, "^%s*(%S+)")
+ if op == ".if" then
+ lvl = lvl + 1
+ elseif lvl ~= 0 then
+ if op == ".endif" then lvl = lvl - 1 end
+ elseif op == ".elif" or op == ".else" or op == ".endif" then
+ dostmt = dostmt_save
+ dostmt(stmt)
+ end
+ end
+end
+
+-- Pseudo-opcodes for conditional assembly.
+map_coreop[".if_1"] = function(params)
+ if not params then return "condition" end
+ local lvl = condlevel + 1
+ local res = cond_eval(params[1])
+ condlevel = lvl
+ condstack[lvl] = res
+ if not res then stmtskip() end
+end
+
+map_coreop[".elif_1"] = function(params)
+ if not params then return "condition" end
+ if condlevel == 0 then wfatal(".elif without .if") end
+ local lvl = condlevel
+ local res = condstack[lvl]
+ if res then
+ if res == "else" then wfatal(".elif after .else") end
+ else
+ res = cond_eval(params[1])
+ if res then
+ condstack[lvl] = res
+ return
+ end
+ end
+ stmtskip()
+end
+
+map_coreop[".else_0"] = function(params)
+ if condlevel == 0 then wfatal(".else without .if") end
+ local lvl = condlevel
+ local res = condstack[lvl]
+ condstack[lvl] = "else"
+ if res then
+ if res == "else" then wfatal(".else after .else") end
+ stmtskip()
+ end
+end
+
+map_coreop[".endif_0"] = function(params)
+ local lvl = condlevel
+ if lvl == 0 then wfatal(".endif without .if") end
+ condlevel = lvl - 1
+end
+
+-- Check for unfinished conditionals.
+local function checkconds()
+ if g_errcount ~= "fatal" and condlevel ~= 0 then
+ wprinterr(g_fname, ":*: error: unbalanced conditional\n")
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Search for a file in the given path and open it for reading.
+local function pathopen(path, name)
+ local dirsep = package and match(package.path, "\\") and "\\" or "/"
+ for _,p in ipairs(path) do
+ local fullname = p == "" and name or p..dirsep..name
+ local fin = io.open(fullname, "r")
+ if fin then
+ g_fname = fullname
+ return fin
+ end
+ end
+end
+
+-- Include a file.
+map_coreop[".include_1"] = function(params)
+ if not params then return "filename" end
+ local name = params[1]
+ -- Save state. Ugly, I know. but upvalues are fast.
+ local gf, gl, gcl, gi = g_fname, g_lineno, g_curline, g_indent
+ -- Read the included file.
+ local fatal = readfile(pathopen(g_opt.include, name) or
+ wfatal("include file `"..name.."' not found"))
+ -- Restore state.
+ g_synclineno = -1
+ g_fname, g_lineno, g_curline, g_indent = gf, gl, gcl, gi
+ if fatal then wfatal("in include file") end
+end
+
+-- Make .include and conditionals initially available, too.
+map_op[".include_1"] = map_coreop[".include_1"]
+map_op[".if_1"] = map_coreop[".if_1"]
+map_op[".elif_1"] = map_coreop[".elif_1"]
+map_op[".else_0"] = map_coreop[".else_0"]
+map_op[".endif_0"] = map_coreop[".endif_0"]
+
+------------------------------------------------------------------------------
+
+-- Support variables for macros.
+local mac_capture, mac_lineno, mac_name
+local mac_active = {}
+local mac_list = {}
+
+-- Pseudo-opcode to define a macro.
+map_coreop[".macro_*"] = function(mparams)
+ if not mparams then return "name [, params...]" end
+ -- Split off and validate macro name.
+ local name = remove(mparams, 1)
+ if not name then werror("missing macro name") end
+ if not (match(name, "^[%a_][%w_%.]*$") or match(name, "^%.[%w_%.]*$")) then
+ wfatal("bad macro name `"..name.."'")
+ end
+ -- Validate macro parameter names.
+ local mdup = {}
+ for _,mp in ipairs(mparams) do
+ if not match(mp, "^[%a_][%w_]*$") then
+ wfatal("bad macro parameter name `"..mp.."'")
+ end
+ if mdup[mp] then wfatal("duplicate macro parameter name `"..mp.."'") end
+ mdup[mp] = true
+ end
+ -- Check for duplicate or recursive macro definitions.
+ local opname = name.."_"..#mparams
+ if map_op[opname] or map_op[name.."_*"] then
+ wfatal("duplicate macro `"..name.."' ("..#mparams.." parameters)")
+ end
+ if mac_capture then wfatal("recursive macro definition") end
+
+ -- Enable statement capture.
+ local lines = {}
+ mac_lineno = g_lineno
+ mac_name = name
+ mac_capture = function(stmt) -- Statement capture function.
+ -- Stop macro definition with .endmacro pseudo-opcode.
+ if not match(stmt, "^%s*.endmacro%s*$") then
+ lines[#lines+1] = stmt
+ return
+ end
+ mac_capture = nil
+ mac_lineno = nil
+ mac_name = nil
+ mac_list[#mac_list+1] = opname
+ -- Add macro-op definition.
+ map_op[opname] = function(params)
+ if not params then return mparams, lines end
+ -- Protect against recursive macro invocation.
+ if mac_active[opname] then wfatal("recursive macro invocation") end
+ mac_active[opname] = true
+ -- Setup substitution map.
+ local subst = {}
+ for i,mp in ipairs(mparams) do subst[mp] = params[i] end
+ local mcom
+ if g_opt.maccomment and g_opt.comment then
+ mcom = " MACRO "..name.." ("..#mparams..")"
+ wcomment("{"..mcom)
+ end
+ -- Loop through all captured statements
+ for _,stmt in ipairs(lines) do
+ -- Substitute macro parameters.
+ local st = gsub(stmt, "[%w_]+", subst)
+ st = definesubst(st)
+ st = gsub(st, "%s*%.%.%s*", "") -- Token paste a..b.
+ if mcom and sub(st, 1, 1) ~= "|" then wcomment(st) end
+ -- Emit statement. Use a protected call for better diagnostics.
+ local ok, err = pcall(dostmt, st)
+ if not ok then
+ -- Add the captured statement to the error.
+ wprinterr(err, "\n", g_indent, "| ", stmt,
+ "\t[MACRO ", name, " (", #mparams, ")]\n")
+ end
+ end
+ if mcom then wcomment("}"..mcom) end
+ mac_active[opname] = nil
+ end
+ end
+end
+
+-- An .endmacro pseudo-opcode outside of a macro definition is an error.
+map_coreop[".endmacro_0"] = function(params)
+ wfatal(".endmacro without .macro")
+end
+
+-- Dump all macros and their contents (with -PP only).
+local function dumpmacros(out, lvl)
+ sort(mac_list)
+ out:write("Macros:\n")
+ for _,opname in ipairs(mac_list) do
+ local name = sub(opname, 1, -3)
+ local params, lines = map_op[opname]()
+ out:write(format(" %-20s %s\n", name, concat(params, ", ")))
+ if lvl > 1 then
+ for _,line in ipairs(lines) do
+ out:write(" |", line, "\n")
+ end
+ out:write("\n")
+ end
+ end
+ out:write("\n")
+end
+
+-- Check for unfinished macro definitions.
+local function checkmacros()
+ if mac_capture then
+ wprinterr(g_fname, ":", mac_lineno,
+ ": error: unfinished .macro `", mac_name ,"'\n")
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Support variables for captures.
+local cap_lineno, cap_name
+local cap_buffers = {}
+local cap_used = {}
+
+-- Start a capture.
+map_coreop[".capture_1"] = function(params)
+ if not params then return "name" end
+ wflush()
+ local name = params[1]
+ if not match(name, "^[%a_][%w_]*$") then
+ wfatal("bad capture name `"..name.."'")
+ end
+ if cap_name then
+ wfatal("already capturing to `"..cap_name.."' since line "..cap_lineno)
+ end
+ cap_name = name
+ cap_lineno = g_lineno
+ -- Create or continue a capture buffer and start the output line capture.
+ local buf = cap_buffers[name]
+ if not buf then buf = {}; cap_buffers[name] = buf end
+ g_capbuffer = buf
+ g_synclineno = 0
+end
+
+-- Stop a capture.
+map_coreop[".endcapture_0"] = function(params)
+ wflush()
+ if not cap_name then wfatal(".endcapture without a valid .capture") end
+ cap_name = nil
+ cap_lineno = nil
+ g_capbuffer = nil
+ g_synclineno = 0
+end
+
+-- Dump a capture buffer.
+map_coreop[".dumpcapture_1"] = function(params)
+ if not params then return "name" end
+ wflush()
+ local name = params[1]
+ if not match(name, "^[%a_][%w_]*$") then
+ wfatal("bad capture name `"..name.."'")
+ end
+ cap_used[name] = true
+ wline(function(out)
+ local buf = cap_buffers[name]
+ if buf then wdumplines(out, buf) end
+ end)
+ g_synclineno = 0
+end
+
+-- Dump all captures and their buffers (with -PP only).
+local function dumpcaptures(out, lvl)
+ out:write("Captures:\n")
+ for name,buf in pairs(cap_buffers) do
+ out:write(format(" %-20s %4s)\n", name, "("..#buf))
+ if lvl > 1 then
+ local bar = rep("=", 76)
+ out:write(" ", bar, "\n")
+ for _,line in ipairs(buf) do
+ out:write(" ", line, "\n")
+ end
+ out:write(" ", bar, "\n\n")
+ end
+ end
+ out:write("\n")
+end
+
+-- Check for unfinished or unused captures.
+local function checkcaptures()
+ if cap_name then
+ wprinterr(g_fname, ":", cap_lineno,
+ ": error: unfinished .capture `", cap_name,"'\n")
+ return
+ end
+ for name in pairs(cap_buffers) do
+ if not cap_used[name] then
+ wprinterr(g_fname, ":*: error: missing .dumpcapture ", name ,"\n")
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Sections names.
+local map_sections = {}
+
+-- Pseudo-opcode to define code sections.
+-- TODO: Data sections, BSS sections. Needs extra C code and API.
+map_coreop[".section_*"] = function(params)
+ if not params then return "name..." end
+ if #map_sections > 0 then werror("duplicate section definition") end
+ wflush()
+ for sn,name in ipairs(params) do
+ local opname = "."..name.."_0"
+ if not match(name, "^[%a][%w_]*$") or
+ map_op[opname] or map_op["."..name.."_*"] then
+ werror("bad section name `"..name.."'")
+ end
+ map_sections[#map_sections+1] = name
+ wline(format("#define DASM_SECTION_%s\t%d", upper(name), sn-1))
+ map_op[opname] = function(params) g_arch.section(sn-1) end
+ end
+ wline(format("#define DASM_MAXSECTION\t\t%d", #map_sections))
+end
+
+-- Dump all sections.
+local function dumpsections(out, lvl)
+ out:write("Sections:\n")
+ for _,name in ipairs(map_sections) do
+ out:write(format(" %s\n", name))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Replacement for customized Lua, which lacks the package library.
+local prefix = ""
+if not require then
+ function require(name)
+ local fp = assert(io.open(prefix..name..".lua"))
+ local s = fp:read("*a")
+ assert(fp:close())
+ return assert(loadstring(s, "@"..name..".lua"))()
+ end
+end
+
+-- Load architecture-specific module.
+local function loadarch(arch)
+ if not match(arch, "^[%w_]+$") then return "bad arch name" end
+ local ok, m_arch = pcall(require, "dasm_"..arch)
+ if not ok then return "cannot load module: "..m_arch end
+ g_arch = m_arch
+ wflush = m_arch.passcb(wline, werror, wfatal, wwarn)
+ m_arch.setup(arch, g_opt)
+ map_op, map_def = m_arch.mergemaps(map_coreop, map_def)
+end
+
+-- Dump architecture description.
+function opt_map.dumparch(args)
+ local name = optparam(args)
+ if not g_arch then
+ local err = loadarch(name)
+ if err then opterror(err) end
+ end
+
+ local t = {}
+ for name in pairs(map_coreop) do t[#t+1] = name end
+ for name in pairs(map_op) do t[#t+1] = name end
+ sort(t)
+
+ local out = stdout
+ local _arch = g_arch._info
+ out:write(format("%s version %s, released %s, %s\n",
+ _info.name, _info.version, _info.release, _info.url))
+ g_arch.dumparch(out)
+
+ local pseudo = true
+ out:write("Pseudo-Opcodes:\n")
+ for _,sname in ipairs(t) do
+ local name, nparam = match(sname, "^(.+)_([0-9%*])$")
+ if name then
+ if pseudo and sub(name, 1, 1) ~= "." then
+ out:write("\nOpcodes:\n")
+ pseudo = false
+ end
+ local f = map_op[sname]
+ local s
+ if nparam ~= "*" then nparam = nparam + 0 end
+ if nparam == 0 then
+ s = ""
+ elseif type(f) == "string" then
+ s = map_op[".template__"](nil, f, nparam)
+ else
+ s = f(nil, nparam)
+ end
+ if type(s) == "table" then
+ for _,s2 in ipairs(s) do
+ out:write(format(" %-12s %s\n", name, s2))
+ end
+ else
+ out:write(format(" %-12s %s\n", name, s))
+ end
+ end
+ end
+ out:write("\n")
+ exit(0)
+end
+
+-- Pseudo-opcode to set the architecture.
+-- Only initially available (map_op is replaced when called).
+map_op[".arch_1"] = function(params)
+ if not params then return "name" end
+ local err = loadarch(params[1])
+ if err then wfatal(err) end
+ wline(format("#if DASM_VERSION != %d", _info.vernum))
+ wline('#error "Version mismatch between DynASM and included encoding engine"')
+ wline("#endif")
+end
+
+-- Dummy .arch pseudo-opcode to improve the error report.
+map_coreop[".arch_1"] = function(params)
+ if not params then return "name" end
+ wfatal("duplicate .arch statement")
+end
+
+------------------------------------------------------------------------------
+
+-- Dummy pseudo-opcode. Don't confuse '.nop' with 'nop'.
+map_coreop[".nop_*"] = function(params)
+ if not params then return "[ignored...]" end
+end
+
+-- Pseudo-opcodes to raise errors.
+map_coreop[".error_1"] = function(params)
+ if not params then return "message" end
+ werror(params[1])
+end
+
+map_coreop[".fatal_1"] = function(params)
+ if not params then return "message" end
+ wfatal(params[1])
+end
+
+-- Dump all user defined elements.
+local function dumpdef(out)
+ local lvl = g_opt.dumpdef
+ if lvl == 0 then return end
+ dumpsections(out, lvl)
+ dumpdefines(out, lvl)
+ if g_arch then g_arch.dumpdef(out, lvl) end
+ dumpmacros(out, lvl)
+ dumpcaptures(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Helper for splitstmt.
+local splitlvl
+
+local function splitstmt_one(c)
+ if c == "(" then
+ splitlvl = ")"..splitlvl
+ elseif c == "[" then
+ splitlvl = "]"..splitlvl
+ elseif c == "{" then
+ splitlvl = "}"..splitlvl
+ elseif c == ")" or c == "]" or c == "}" then
+ if sub(splitlvl, 1, 1) ~= c then werror("unbalanced (), [] or {}") end
+ splitlvl = sub(splitlvl, 2)
+ elseif splitlvl == "" then
+ return " \0 "
+ end
+ return c
+end
+
+-- Split statement into (pseudo-)opcode and params.
+local function splitstmt(stmt)
+ -- Convert label with trailing-colon into .label statement.
+ local label = match(stmt, "^%s*(.+):%s*$")
+ if label then return ".label", {label} end
+
+ -- Split at commas and equal signs, but obey parentheses and brackets.
+ splitlvl = ""
+ stmt = gsub(stmt, "[,%(%)%[%]{}]", splitstmt_one)
+ if splitlvl ~= "" then werror("unbalanced () or []") end
+
+ -- Split off opcode.
+ local op, other = match(stmt, "^%s*([^%s%z]+)%s*(.*)$")
+ if not op then werror("bad statement syntax") end
+
+ -- Split parameters.
+ local params = {}
+ for p in gmatch(other, "%s*(%Z+)%z?") do
+ params[#params+1] = gsub(p, "%s+$", "")
+ end
+ if #params > 16 then werror("too many parameters") end
+
+ params.op = op
+ return op, params
+end
+
+-- Process a single statement.
+dostmt = function(stmt)
+ -- Ignore empty statements.
+ if match(stmt, "^%s*$") then return end
+
+ -- Capture macro defs before substitution.
+ if mac_capture then return mac_capture(stmt) end
+ stmt = definesubst(stmt)
+
+ -- Emit C code without parsing the line.
+ if sub(stmt, 1, 1) == "|" then
+ local tail = sub(stmt, 2)
+ wflush()
+ if sub(tail, 1, 2) == "//" then wcomment(tail) else wline(tail, true) end
+ return
+ end
+
+ -- Split into (pseudo-)opcode and params.
+ local op, params = splitstmt(stmt)
+
+ -- Get opcode handler (matching # of parameters or generic handler).
+ local f = map_op[op.."_"..#params] or map_op[op.."_*"]
+ if not f then
+ if not g_arch then wfatal("first statement must be .arch") end
+ -- Improve error report.
+ for i=0,9 do
+ if map_op[op.."_"..i] then
+ werror("wrong number of parameters for `"..op.."'")
+ end
+ end
+ werror("unknown statement `"..op.."'")
+ end
+
+ -- Call opcode handler or special handler for template strings.
+ if type(f) == "string" then
+ map_op[".template__"](params, f)
+ else
+ f(params)
+ end
+end
+
+-- Process a single line.
+local function doline(line)
+ if g_opt.flushline then wflush() end
+
+ -- Assembler line?
+ local indent, aline = match(line, "^(%s*)%|(.*)$")
+ if not aline then
+ -- No, plain C code line, need to flush first.
+ wflush()
+ wsync()
+ wline(line, false)
+ return
+ end
+
+ g_indent = indent -- Remember current line indentation.
+
+ -- Emit C code (even from macros). Avoids echo and line parsing.
+ if sub(aline, 1, 1) == "|" then
+ if not mac_capture then
+ wsync()
+ elseif g_opt.comment then
+ wsync()
+ wcomment(aline)
+ end
+ dostmt(aline)
+ return
+ end
+
+ -- Echo assembler line as a comment.
+ if g_opt.comment then
+ wsync()
+ wcomment(aline)
+ end
+
+ -- Strip assembler comments.
+ aline = gsub(aline, "//.*$", "")
+
+ -- Split line into statements at semicolons.
+ if match(aline, ";") then
+ for stmt in gmatch(aline, "[^;]+") do dostmt(stmt) end
+ else
+ dostmt(aline)
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Write DynASM header.
+local function dasmhead(out)
+ out:write(format([[
+/*
+** This file has been pre-processed with DynASM.
+** %s
+** DynASM version %s, DynASM %s version %s
+** DO NOT EDIT! The original file is in "%s".
+*/
+
+]], _info.url,
+ _info.version, g_arch._info.arch, g_arch._info.version,
+ g_fname))
+end
+
+-- Read input file.
+readfile = function(fin)
+ g_indent = ""
+ g_lineno = 0
+ g_synclineno = -1
+
+ -- Process all lines.
+ for line in fin:lines() do
+ g_lineno = g_lineno + 1
+ g_curline = line
+ local ok, err = pcall(doline, line)
+ if not ok and wprinterr(err, "\n") then return true end
+ end
+ wflush()
+
+ -- Close input file.
+ assert(fin == stdin or fin:close())
+end
+
+-- Write output file.
+local function writefile(outfile)
+ local fout
+
+ -- Open output file.
+ if outfile == nil or outfile == "-" then
+ fout = stdout
+ else
+ fout = assert(io.open(outfile, "w"))
+ end
+
+ -- Write all buffered lines
+ wdumplines(fout, g_wbuffer)
+
+ -- Close output file.
+ assert(fout == stdout or fout:close())
+
+ -- Optionally dump definitions.
+ dumpdef(fout == stdout and stderr or stdout)
+end
+
+-- Translate an input file to an output file.
+local function translate(infile, outfile)
+ g_wbuffer = {}
+ g_indent = ""
+ g_lineno = 0
+ g_synclineno = -1
+
+ -- Put header.
+ wline(dasmhead)
+
+ -- Read input file.
+ local fin
+ if infile == "-" then
+ g_fname = "(stdin)"
+ fin = stdin
+ else
+ g_fname = infile
+ fin = assert(io.open(infile, "r"))
+ end
+ readfile(fin)
+
+ -- Check for errors.
+ if not g_arch then
+ wprinterr(g_fname, ":*: error: missing .arch directive\n")
+ end
+ checkconds()
+ checkmacros()
+ checkcaptures()
+
+ if g_errcount ~= 0 then
+ stderr:write(g_fname, ":*: info: ", g_errcount, " error",
+ (type(g_errcount) == "number" and g_errcount > 1) and "s" or "",
+ " in input file -- no output file generated.\n")
+ dumpdef(stderr)
+ exit(1)
+ end
+
+ -- Write output file.
+ writefile(outfile)
+end
+
+------------------------------------------------------------------------------
+
+-- Print help text.
+function opt_map.help()
+ stdout:write("DynASM -- ", _info.description, ".\n")
+ stdout:write("DynASM ", _info.version, " ", _info.release, " ", _info.url, "\n")
+ stdout:write[[
+
+Usage: dynasm [OPTION]... INFILE.dasc|-
+
+ -h, --help Display this help text.
+ -V, --version Display version and copyright information.
+
+ -o, --outfile FILE Output file name (default is stdout).
+ -I, --include DIR Add directory to the include search path.
+
+ -c, --ccomment Use /* */ comments for assembler lines.
+ -C, --cppcomment Use // comments for assembler lines (default).
+ -N, --nocomment Suppress assembler lines in output.
+ -M, --maccomment Show macro expansions as comments (default off).
+
+ -L, --nolineno Suppress CPP line number information in output.
+ -F, --flushline Flush action list for every line.
+
+ -D NAME[=SUBST] Define a substitution.
+ -U NAME Undefine a substitution.
+
+ -P, --dumpdef Dump defines, macros, etc. Repeat for more output.
+ -A, --dumparch ARCH Load architecture ARCH and dump description.
+]]
+ exit(0)
+end
+
+-- Print version information.
+function opt_map.version()
+ stdout:write(format("%s version %s, released %s\n%s\n\n%s",
+ _info.name, _info.version, _info.release, _info.url, _info.copyright))
+ exit(0)
+end
+
+-- Misc. options.
+function opt_map.outfile(args) g_opt.outfile = optparam(args) end
+function opt_map.include(args) insert(g_opt.include, 1, optparam(args)) end
+function opt_map.ccomment() g_opt.comment = "/*|"; g_opt.endcomment = " */" end
+function opt_map.cppcomment() g_opt.comment = "//|"; g_opt.endcomment = "" end
+function opt_map.nocomment() g_opt.comment = false end
+function opt_map.maccomment() g_opt.maccomment = true end
+function opt_map.nolineno() g_opt.cpp = false end
+function opt_map.flushline() g_opt.flushline = true end
+function opt_map.dumpdef() g_opt.dumpdef = g_opt.dumpdef + 1 end
+
+------------------------------------------------------------------------------
+
+-- Short aliases for long options.
+local opt_alias = {
+ h = "help", ["?"] = "help", V = "version",
+ o = "outfile", I = "include",
+ c = "ccomment", C = "cppcomment", N = "nocomment", M = "maccomment",
+ L = "nolineno", F = "flushline",
+ P = "dumpdef", A = "dumparch",
+}
+
+-- Parse single option.
+local function parseopt(opt, args)
+ opt_current = #opt == 1 and "-"..opt or "--"..opt
+ local f = opt_map[opt] or opt_map[opt_alias[opt]]
+ if not f then
+ opterror("unrecognized option `", opt_current, "'. Try `--help'.\n")
+ end
+ f(args)
+end
+
+-- Parse arguments.
+local function parseargs(args)
+ -- Default options.
+ g_opt.comment = "//|"
+ g_opt.endcomment = ""
+ g_opt.cpp = true
+ g_opt.dumpdef = 0
+ g_opt.include = { "" }
+
+ -- Process all option arguments.
+ args.argn = 1
+ repeat
+ local a = args[args.argn]
+ if not a then break end
+ local lopt, opt = match(a, "^%-(%-?)(.+)")
+ if not opt then break end
+ args.argn = args.argn + 1
+ if lopt == "" then
+ -- Loop through short options.
+ for o in gmatch(opt, ".") do parseopt(o, args) end
+ else
+ -- Long option.
+ parseopt(opt, args)
+ end
+ until false
+
+ -- Check for proper number of arguments.
+ local nargs = #args - args.argn + 1
+ if nargs ~= 1 then
+ if nargs == 0 then
+ if g_opt.dumpdef > 0 then return dumpdef(stdout) end
+ end
+ opt_map.help()
+ end
+
+ -- Translate a single input file to a single output file
+ -- TODO: Handle multiple files?
+ translate(args[args.argn], g_opt.outfile)
+end
+
+------------------------------------------------------------------------------
+
+-- Add the directory dynasm.lua resides in to the Lua module search path.
+local arg = arg
+if arg and arg[0] then
+ prefix = match(arg[0], "^(.*[/\\])")
+ if package and prefix then package.path = prefix.."?.lua;"..package.path end
+end
+
+-- Start DynASM.
+parseargs{...}
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/minilua.c b/ext/opcache/jit/dynasm/minilua.c
new file mode 100644
index 0000000000..79150286cf
--- /dev/null
+++ b/ext/opcache/jit/dynasm/minilua.c
@@ -0,0 +1,7770 @@
+/* This is a heavily customized and minimized copy of Lua 5.1.5. */
+/* It's only used to build LuaJIT. It does NOT have all standard functions! */
+/******************************************************************************
+* Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+******************************************************************************/
+#ifdef _MSC_VER
+typedef unsigned __int64 U64;
+#else
+typedef unsigned long long U64;
+#endif
+int _CRT_glob = 0;
+#include <stddef.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <math.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <errno.h>
+#include <time.h>
+typedef enum{
+TM_INDEX,
+TM_NEWINDEX,
+TM_GC,
+TM_MODE,
+TM_EQ,
+TM_ADD,
+TM_SUB,
+TM_MUL,
+TM_DIV,
+TM_MOD,
+TM_POW,
+TM_UNM,
+TM_LEN,
+TM_LT,
+TM_LE,
+TM_CONCAT,
+TM_CALL,
+TM_N
+}TMS;
+enum OpMode{iABC,iABx,iAsBx};
+typedef enum{
+OP_MOVE,
+OP_LOADK,
+OP_LOADBOOL,
+OP_LOADNIL,
+OP_GETUPVAL,
+OP_GETGLOBAL,
+OP_GETTABLE,
+OP_SETGLOBAL,
+OP_SETUPVAL,
+OP_SETTABLE,
+OP_NEWTABLE,
+OP_SELF,
+OP_ADD,
+OP_SUB,
+OP_MUL,
+OP_DIV,
+OP_MOD,
+OP_POW,
+OP_UNM,
+OP_NOT,
+OP_LEN,
+OP_CONCAT,
+OP_JMP,
+OP_EQ,
+OP_LT,
+OP_LE,
+OP_TEST,
+OP_TESTSET,
+OP_CALL,
+OP_TAILCALL,
+OP_RETURN,
+OP_FORLOOP,
+OP_FORPREP,
+OP_TFORLOOP,
+OP_SETLIST,
+OP_CLOSE,
+OP_CLOSURE,
+OP_VARARG
+}OpCode;
+enum OpArgMask{
+OpArgN,
+OpArgU,
+OpArgR,
+OpArgK
+};
+typedef enum{
+VVOID,
+VNIL,
+VTRUE,
+VFALSE,
+VK,
+VKNUM,
+VLOCAL,
+VUPVAL,
+VGLOBAL,
+VINDEXED,
+VJMP,
+VRELOCABLE,
+VNONRELOC,
+VCALL,
+VVARARG
+}expkind;
+enum RESERVED{
+TK_AND=257,TK_BREAK,
+TK_DO,TK_ELSE,TK_ELSEIF,TK_END,TK_FALSE,TK_FOR,TK_FUNCTION,
+TK_IF,TK_IN,TK_LOCAL,TK_NIL,TK_NOT,TK_OR,TK_REPEAT,
+TK_RETURN,TK_THEN,TK_TRUE,TK_UNTIL,TK_WHILE,
+TK_CONCAT,TK_DOTS,TK_EQ,TK_GE,TK_LE,TK_NE,TK_NUMBER,
+TK_NAME,TK_STRING,TK_EOS
+};
+typedef enum BinOpr{
+OPR_ADD,OPR_SUB,OPR_MUL,OPR_DIV,OPR_MOD,OPR_POW,
+OPR_CONCAT,
+OPR_NE,OPR_EQ,
+OPR_LT,OPR_LE,OPR_GT,OPR_GE,
+OPR_AND,OPR_OR,
+OPR_NOBINOPR
+}BinOpr;
+typedef enum UnOpr{OPR_MINUS,OPR_NOT,OPR_LEN,OPR_NOUNOPR}UnOpr;
+#define LUA_QL(x)"'"x"'"
+#define luai_apicheck(L,o){(void)L;}
+#define lua_number2str(s,n)sprintf((s),"%.14g",(n))
+#define lua_str2number(s,p)strtod((s),(p))
+#define luai_numadd(a,b)((a)+(b))
+#define luai_numsub(a,b)((a)-(b))
+#define luai_nummul(a,b)((a)*(b))
+#define luai_numdiv(a,b)((a)/(b))
+#define luai_nummod(a,b)((a)-floor((a)/(b))*(b))
+#define luai_numpow(a,b)(pow(a,b))
+#define luai_numunm(a)(-(a))
+#define luai_numeq(a,b)((a)==(b))
+#define luai_numlt(a,b)((a)<(b))
+#define luai_numle(a,b)((a)<=(b))
+#define luai_numisnan(a)(!luai_numeq((a),(a)))
+#define lua_number2int(i,d)((i)=(int)(d))
+#define lua_number2integer(i,d)((i)=(lua_Integer)(d))
+#define LUAI_THROW(L,c)longjmp((c)->b,1)
+#define LUAI_TRY(L,c,a)if(setjmp((c)->b)==0){a}
+#define lua_pclose(L,file)((void)((void)L,file),0)
+#define lua_upvalueindex(i)((-10002)-(i))
+typedef struct lua_State lua_State;
+typedef int(*lua_CFunction)(lua_State*L);
+typedef const char*(*lua_Reader)(lua_State*L,void*ud,size_t*sz);
+typedef void*(*lua_Alloc)(void*ud,void*ptr,size_t osize,size_t nsize);
+typedef double lua_Number;
+typedef ptrdiff_t lua_Integer;
+static void lua_settop(lua_State*L,int idx);
+static int lua_type(lua_State*L,int idx);
+static const char* lua_tolstring(lua_State*L,int idx,size_t*len);
+static size_t lua_objlen(lua_State*L,int idx);
+static void lua_pushlstring(lua_State*L,const char*s,size_t l);
+static void lua_pushcclosure(lua_State*L,lua_CFunction fn,int n);
+static void lua_createtable(lua_State*L,int narr,int nrec);
+static void lua_setfield(lua_State*L,int idx,const char*k);
+#define lua_pop(L,n)lua_settop(L,-(n)-1)
+#define lua_newtable(L)lua_createtable(L,0,0)
+#define lua_pushcfunction(L,f)lua_pushcclosure(L,(f),0)
+#define lua_strlen(L,i)lua_objlen(L,(i))
+#define lua_isfunction(L,n)(lua_type(L,(n))==6)
+#define lua_istable(L,n)(lua_type(L,(n))==5)
+#define lua_isnil(L,n)(lua_type(L,(n))==0)
+#define lua_isboolean(L,n)(lua_type(L,(n))==1)
+#define lua_isnone(L,n)(lua_type(L,(n))==(-1))
+#define lua_isnoneornil(L,n)(lua_type(L,(n))<=0)
+#define lua_pushliteral(L,s)lua_pushlstring(L,""s,(sizeof(s)/sizeof(char))-1)
+#define lua_setglobal(L,s)lua_setfield(L,(-10002),(s))
+#define lua_tostring(L,i)lua_tolstring(L,(i),NULL)
+typedef struct lua_Debug lua_Debug;
+typedef void(*lua_Hook)(lua_State*L,lua_Debug*ar);
+struct lua_Debug{
+int event;
+const char*name;
+const char*namewhat;
+const char*what;
+const char*source;
+int currentline;
+int nups;
+int linedefined;
+int lastlinedefined;
+char short_src[60];
+int i_ci;
+};
+typedef unsigned int lu_int32;
+typedef size_t lu_mem;
+typedef ptrdiff_t l_mem;
+typedef unsigned char lu_byte;
+#define IntPoint(p)((unsigned int)(lu_mem)(p))
+typedef union{double u;void*s;long l;}L_Umaxalign;
+typedef double l_uacNumber;
+#define check_exp(c,e)(e)
+#define UNUSED(x)((void)(x))
+#define cast(t,exp)((t)(exp))
+#define cast_byte(i)cast(lu_byte,(i))
+#define cast_num(i)cast(lua_Number,(i))
+#define cast_int(i)cast(int,(i))
+typedef lu_int32 Instruction;
+#define condhardstacktests(x)((void)0)
+typedef union GCObject GCObject;
+typedef struct GCheader{
+GCObject*next;lu_byte tt;lu_byte marked;
+}GCheader;
+typedef union{
+GCObject*gc;
+void*p;
+lua_Number n;
+int b;
+}Value;
+typedef struct lua_TValue{
+Value value;int tt;
+}TValue;
+#define ttisnil(o)(ttype(o)==0)
+#define ttisnumber(o)(ttype(o)==3)
+#define ttisstring(o)(ttype(o)==4)
+#define ttistable(o)(ttype(o)==5)
+#define ttisfunction(o)(ttype(o)==6)
+#define ttisboolean(o)(ttype(o)==1)
+#define ttisuserdata(o)(ttype(o)==7)
+#define ttisthread(o)(ttype(o)==8)
+#define ttislightuserdata(o)(ttype(o)==2)
+#define ttype(o)((o)->tt)
+#define gcvalue(o)check_exp(iscollectable(o),(o)->value.gc)
+#define pvalue(o)check_exp(ttislightuserdata(o),(o)->value.p)
+#define nvalue(o)check_exp(ttisnumber(o),(o)->value.n)
+#define rawtsvalue(o)check_exp(ttisstring(o),&(o)->value.gc->ts)
+#define tsvalue(o)(&rawtsvalue(o)->tsv)
+#define rawuvalue(o)check_exp(ttisuserdata(o),&(o)->value.gc->u)
+#define uvalue(o)(&rawuvalue(o)->uv)
+#define clvalue(o)check_exp(ttisfunction(o),&(o)->value.gc->cl)
+#define hvalue(o)check_exp(ttistable(o),&(o)->value.gc->h)
+#define bvalue(o)check_exp(ttisboolean(o),(o)->value.b)
+#define thvalue(o)check_exp(ttisthread(o),&(o)->value.gc->th)
+#define l_isfalse(o)(ttisnil(o)||(ttisboolean(o)&&bvalue(o)==0))
+#define checkconsistency(obj)
+#define checkliveness(g,obj)
+#define setnilvalue(obj)((obj)->tt=0)
+#define setnvalue(obj,x){TValue*i_o=(obj);i_o->value.n=(x);i_o->tt=3;}
+#define setbvalue(obj,x){TValue*i_o=(obj);i_o->value.b=(x);i_o->tt=1;}
+#define setsvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=4;checkliveness(G(L),i_o);}
+#define setuvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=7;checkliveness(G(L),i_o);}
+#define setthvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=8;checkliveness(G(L),i_o);}
+#define setclvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=6;checkliveness(G(L),i_o);}
+#define sethvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=5;checkliveness(G(L),i_o);}
+#define setptvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=(8+1);checkliveness(G(L),i_o);}
+#define setobj(L,obj1,obj2){const TValue*o2=(obj2);TValue*o1=(obj1);o1->value=o2->value;o1->tt=o2->tt;checkliveness(G(L),o1);}
+#define setttype(obj,tt)(ttype(obj)=(tt))
+#define iscollectable(o)(ttype(o)>=4)
+typedef TValue*StkId;
+typedef union TString{
+L_Umaxalign dummy;
+struct{
+GCObject*next;lu_byte tt;lu_byte marked;
+lu_byte reserved;
+unsigned int hash;
+size_t len;
+}tsv;
+}TString;
+#define getstr(ts)cast(const char*,(ts)+1)
+#define svalue(o)getstr(rawtsvalue(o))
+typedef union Udata{
+L_Umaxalign dummy;
+struct{
+GCObject*next;lu_byte tt;lu_byte marked;
+struct Table*metatable;
+struct Table*env;
+size_t len;
+}uv;
+}Udata;
+typedef struct Proto{
+GCObject*next;lu_byte tt;lu_byte marked;
+TValue*k;
+Instruction*code;
+struct Proto**p;
+int*lineinfo;
+struct LocVar*locvars;
+TString**upvalues;
+TString*source;
+int sizeupvalues;
+int sizek;
+int sizecode;
+int sizelineinfo;
+int sizep;
+int sizelocvars;
+int linedefined;
+int lastlinedefined;
+GCObject*gclist;
+lu_byte nups;
+lu_byte numparams;
+lu_byte is_vararg;
+lu_byte maxstacksize;
+}Proto;
+typedef struct LocVar{
+TString*varname;
+int startpc;
+int endpc;
+}LocVar;
+typedef struct UpVal{
+GCObject*next;lu_byte tt;lu_byte marked;
+TValue*v;
+union{
+TValue value;
+struct{
+struct UpVal*prev;
+struct UpVal*next;
+}l;
+}u;
+}UpVal;
+typedef struct CClosure{
+GCObject*next;lu_byte tt;lu_byte marked;lu_byte isC;lu_byte nupvalues;GCObject*gclist;struct Table*env;
+lua_CFunction f;
+TValue upvalue[1];
+}CClosure;
+typedef struct LClosure{
+GCObject*next;lu_byte tt;lu_byte marked;lu_byte isC;lu_byte nupvalues;GCObject*gclist;struct Table*env;
+struct Proto*p;
+UpVal*upvals[1];
+}LClosure;
+typedef union Closure{
+CClosure c;
+LClosure l;
+}Closure;
+#define iscfunction(o)(ttype(o)==6&&clvalue(o)->c.isC)
+typedef union TKey{
+struct{
+Value value;int tt;
+struct Node*next;
+}nk;
+TValue tvk;
+}TKey;
+typedef struct Node{
+TValue i_val;
+TKey i_key;
+}Node;
+typedef struct Table{
+GCObject*next;lu_byte tt;lu_byte marked;
+lu_byte flags;
+lu_byte lsizenode;
+struct Table*metatable;
+TValue*array;
+Node*node;
+Node*lastfree;
+GCObject*gclist;
+int sizearray;
+}Table;
+#define lmod(s,size)(check_exp((size&(size-1))==0,(cast(int,(s)&((size)-1)))))
+#define twoto(x)((size_t)1<<(x))
+#define sizenode(t)(twoto((t)->lsizenode))
+static const TValue luaO_nilobject_;
+#define ceillog2(x)(luaO_log2((x)-1)+1)
+static int luaO_log2(unsigned int x);
+#define gfasttm(g,et,e)((et)==NULL?NULL:((et)->flags&(1u<<(e)))?NULL:luaT_gettm(et,e,(g)->tmname[e]))
+#define fasttm(l,et,e)gfasttm(G(l),et,e)
+static const TValue*luaT_gettm(Table*events,TMS event,TString*ename);
+#define luaM_reallocv(L,b,on,n,e)((cast(size_t,(n)+1)<=((size_t)(~(size_t)0)-2)/(e))?luaM_realloc_(L,(b),(on)*(e),(n)*(e)):luaM_toobig(L))
+#define luaM_freemem(L,b,s)luaM_realloc_(L,(b),(s),0)
+#define luaM_free(L,b)luaM_realloc_(L,(b),sizeof(*(b)),0)
+#define luaM_freearray(L,b,n,t)luaM_reallocv(L,(b),n,0,sizeof(t))
+#define luaM_malloc(L,t)luaM_realloc_(L,NULL,0,(t))
+#define luaM_new(L,t)cast(t*,luaM_malloc(L,sizeof(t)))
+#define luaM_newvector(L,n,t)cast(t*,luaM_reallocv(L,NULL,0,n,sizeof(t)))
+#define luaM_growvector(L,v,nelems,size,t,limit,e)if((nelems)+1>(size))((v)=cast(t*,luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
+#define luaM_reallocvector(L,v,oldn,n,t)((v)=cast(t*,luaM_reallocv(L,v,oldn,n,sizeof(t))))
+static void*luaM_realloc_(lua_State*L,void*block,size_t oldsize,
+size_t size);
+static void*luaM_toobig(lua_State*L);
+static void*luaM_growaux_(lua_State*L,void*block,int*size,
+size_t size_elem,int limit,
+const char*errormsg);
+typedef struct Zio ZIO;
+#define char2int(c)cast(int,cast(unsigned char,(c)))
+#define zgetc(z)(((z)->n--)>0?char2int(*(z)->p++):luaZ_fill(z))
+typedef struct Mbuffer{
+char*buffer;
+size_t n;
+size_t buffsize;
+}Mbuffer;
+#define luaZ_initbuffer(L,buff)((buff)->buffer=NULL,(buff)->buffsize=0)
+#define luaZ_buffer(buff)((buff)->buffer)
+#define luaZ_sizebuffer(buff)((buff)->buffsize)
+#define luaZ_bufflen(buff)((buff)->n)
+#define luaZ_resetbuffer(buff)((buff)->n=0)
+#define luaZ_resizebuffer(L,buff,size)(luaM_reallocvector(L,(buff)->buffer,(buff)->buffsize,size,char),(buff)->buffsize=size)
+#define luaZ_freebuffer(L,buff)luaZ_resizebuffer(L,buff,0)
+struct Zio{
+size_t n;
+const char*p;
+lua_Reader reader;
+void*data;
+lua_State*L;
+};
+static int luaZ_fill(ZIO*z);
+struct lua_longjmp;
+#define gt(L)(&L->l_gt)
+#define registry(L)(&G(L)->l_registry)
+typedef struct stringtable{
+GCObject**hash;
+lu_int32 nuse;
+int size;
+}stringtable;
+typedef struct CallInfo{
+StkId base;
+StkId func;
+StkId top;
+const Instruction*savedpc;
+int nresults;
+int tailcalls;
+}CallInfo;
+#define curr_func(L)(clvalue(L->ci->func))
+#define ci_func(ci)(clvalue((ci)->func))
+#define f_isLua(ci)(!ci_func(ci)->c.isC)
+#define isLua(ci)(ttisfunction((ci)->func)&&f_isLua(ci))
+typedef struct global_State{
+stringtable strt;
+lua_Alloc frealloc;
+void*ud;
+lu_byte currentwhite;
+lu_byte gcstate;
+int sweepstrgc;
+GCObject*rootgc;
+GCObject**sweepgc;
+GCObject*gray;
+GCObject*grayagain;
+GCObject*weak;
+GCObject*tmudata;
+Mbuffer buff;
+lu_mem GCthreshold;
+lu_mem totalbytes;
+lu_mem estimate;
+lu_mem gcdept;
+int gcpause;
+int gcstepmul;
+lua_CFunction panic;
+TValue l_registry;
+struct lua_State*mainthread;
+UpVal uvhead;
+struct Table*mt[(8+1)];
+TString*tmname[TM_N];
+}global_State;
+struct lua_State{
+GCObject*next;lu_byte tt;lu_byte marked;
+lu_byte status;
+StkId top;
+StkId base;
+global_State*l_G;
+CallInfo*ci;
+const Instruction*savedpc;
+StkId stack_last;
+StkId stack;
+CallInfo*end_ci;
+CallInfo*base_ci;
+int stacksize;
+int size_ci;
+unsigned short nCcalls;
+unsigned short baseCcalls;
+lu_byte hookmask;
+lu_byte allowhook;
+int basehookcount;
+int hookcount;
+lua_Hook hook;
+TValue l_gt;
+TValue env;
+GCObject*openupval;
+GCObject*gclist;
+struct lua_longjmp*errorJmp;
+ptrdiff_t errfunc;
+};
+#define G(L)(L->l_G)
+union GCObject{
+GCheader gch;
+union TString ts;
+union Udata u;
+union Closure cl;
+struct Table h;
+struct Proto p;
+struct UpVal uv;
+struct lua_State th;
+};
+#define rawgco2ts(o)check_exp((o)->gch.tt==4,&((o)->ts))
+#define gco2ts(o)(&rawgco2ts(o)->tsv)
+#define rawgco2u(o)check_exp((o)->gch.tt==7,&((o)->u))
+#define gco2u(o)(&rawgco2u(o)->uv)
+#define gco2cl(o)check_exp((o)->gch.tt==6,&((o)->cl))
+#define gco2h(o)check_exp((o)->gch.tt==5,&((o)->h))
+#define gco2p(o)check_exp((o)->gch.tt==(8+1),&((o)->p))
+#define gco2uv(o)check_exp((o)->gch.tt==(8+2),&((o)->uv))
+#define ngcotouv(o)check_exp((o)==NULL||(o)->gch.tt==(8+2),&((o)->uv))
+#define gco2th(o)check_exp((o)->gch.tt==8,&((o)->th))
+#define obj2gco(v)(cast(GCObject*,(v)))
+static void luaE_freethread(lua_State*L,lua_State*L1);
+#define pcRel(pc,p)(cast(int,(pc)-(p)->code)-1)
+#define getline_(f,pc)(((f)->lineinfo)?(f)->lineinfo[pc]:0)
+#define resethookcount(L)(L->hookcount=L->basehookcount)
+static void luaG_typeerror(lua_State*L,const TValue*o,
+const char*opname);
+static void luaG_runerror(lua_State*L,const char*fmt,...);
+#define luaD_checkstack(L,n)if((char*)L->stack_last-(char*)L->top<=(n)*(int)sizeof(TValue))luaD_growstack(L,n);else condhardstacktests(luaD_reallocstack(L,L->stacksize-5-1));
+#define incr_top(L){luaD_checkstack(L,1);L->top++;}
+#define savestack(L,p)((char*)(p)-(char*)L->stack)
+#define restorestack(L,n)((TValue*)((char*)L->stack+(n)))
+#define saveci(L,p)((char*)(p)-(char*)L->base_ci)
+#define restoreci(L,n)((CallInfo*)((char*)L->base_ci+(n)))
+typedef void(*Pfunc)(lua_State*L,void*ud);
+static int luaD_poscall(lua_State*L,StkId firstResult);
+static void luaD_reallocCI(lua_State*L,int newsize);
+static void luaD_reallocstack(lua_State*L,int newsize);
+static void luaD_growstack(lua_State*L,int n);
+static void luaD_throw(lua_State*L,int errcode);
+static void*luaM_growaux_(lua_State*L,void*block,int*size,size_t size_elems,
+int limit,const char*errormsg){
+void*newblock;
+int newsize;
+if(*size>=limit/2){
+if(*size>=limit)
+luaG_runerror(L,errormsg);
+newsize=limit;
+}
+else{
+newsize=(*size)*2;
+if(newsize<4)
+newsize=4;
+}
+newblock=luaM_reallocv(L,block,*size,newsize,size_elems);
+*size=newsize;
+return newblock;
+}
+static void*luaM_toobig(lua_State*L){
+luaG_runerror(L,"memory allocation error: block too big");
+return NULL;
+}
+static void*luaM_realloc_(lua_State*L,void*block,size_t osize,size_t nsize){
+global_State*g=G(L);
+block=(*g->frealloc)(g->ud,block,osize,nsize);
+if(block==NULL&&nsize>0)
+luaD_throw(L,4);
+g->totalbytes=(g->totalbytes-osize)+nsize;
+return block;
+}
+#define resetbits(x,m)((x)&=cast(lu_byte,~(m)))
+#define setbits(x,m)((x)|=(m))
+#define testbits(x,m)((x)&(m))
+#define bitmask(b)(1<<(b))
+#define bit2mask(b1,b2)(bitmask(b1)|bitmask(b2))
+#define l_setbit(x,b)setbits(x,bitmask(b))
+#define resetbit(x,b)resetbits(x,bitmask(b))
+#define testbit(x,b)testbits(x,bitmask(b))
+#define set2bits(x,b1,b2)setbits(x,(bit2mask(b1,b2)))
+#define reset2bits(x,b1,b2)resetbits(x,(bit2mask(b1,b2)))
+#define test2bits(x,b1,b2)testbits(x,(bit2mask(b1,b2)))
+#define iswhite(x)test2bits((x)->gch.marked,0,1)
+#define isblack(x)testbit((x)->gch.marked,2)
+#define isgray(x)(!isblack(x)&&!iswhite(x))
+#define otherwhite(g)(g->currentwhite^bit2mask(0,1))
+#define isdead(g,v)((v)->gch.marked&otherwhite(g)&bit2mask(0,1))
+#define changewhite(x)((x)->gch.marked^=bit2mask(0,1))
+#define gray2black(x)l_setbit((x)->gch.marked,2)
+#define valiswhite(x)(iscollectable(x)&&iswhite(gcvalue(x)))
+#define luaC_white(g)cast(lu_byte,(g)->currentwhite&bit2mask(0,1))
+#define luaC_checkGC(L){condhardstacktests(luaD_reallocstack(L,L->stacksize-5-1));if(G(L)->totalbytes>=G(L)->GCthreshold)luaC_step(L);}
+#define luaC_barrier(L,p,v){if(valiswhite(v)&&isblack(obj2gco(p)))luaC_barrierf(L,obj2gco(p),gcvalue(v));}
+#define luaC_barriert(L,t,v){if(valiswhite(v)&&isblack(obj2gco(t)))luaC_barrierback(L,t);}
+#define luaC_objbarrier(L,p,o){if(iswhite(obj2gco(o))&&isblack(obj2gco(p)))luaC_barrierf(L,obj2gco(p),obj2gco(o));}
+#define luaC_objbarriert(L,t,o){if(iswhite(obj2gco(o))&&isblack(obj2gco(t)))luaC_barrierback(L,t);}
+static void luaC_step(lua_State*L);
+static void luaC_link(lua_State*L,GCObject*o,lu_byte tt);
+static void luaC_linkupval(lua_State*L,UpVal*uv);
+static void luaC_barrierf(lua_State*L,GCObject*o,GCObject*v);
+static void luaC_barrierback(lua_State*L,Table*t);
+#define sizestring(s)(sizeof(union TString)+((s)->len+1)*sizeof(char))
+#define sizeudata(u)(sizeof(union Udata)+(u)->len)
+#define luaS_new(L,s)(luaS_newlstr(L,s,strlen(s)))
+#define luaS_newliteral(L,s)(luaS_newlstr(L,""s,(sizeof(s)/sizeof(char))-1))
+#define luaS_fix(s)l_setbit((s)->tsv.marked,5)
+static TString*luaS_newlstr(lua_State*L,const char*str,size_t l);
+#define tostring(L,o)((ttype(o)==4)||(luaV_tostring(L,o)))
+#define tonumber(o,n)(ttype(o)==3||(((o)=luaV_tonumber(o,n))!=NULL))
+#define equalobj(L,o1,o2)(ttype(o1)==ttype(o2)&&luaV_equalval(L,o1,o2))
+static int luaV_equalval(lua_State*L,const TValue*t1,const TValue*t2);
+static const TValue*luaV_tonumber(const TValue*obj,TValue*n);
+static int luaV_tostring(lua_State*L,StkId obj);
+static void luaV_execute(lua_State*L,int nexeccalls);
+static void luaV_concat(lua_State*L,int total,int last);
+static const TValue luaO_nilobject_={{NULL},0};
+static int luaO_int2fb(unsigned int x){
+int e=0;
+while(x>=16){
+x=(x+1)>>1;
+e++;
+}
+if(x<8)return x;
+else return((e+1)<<3)|(cast_int(x)-8);
+}
+static int luaO_fb2int(int x){
+int e=(x>>3)&31;
+if(e==0)return x;
+else return((x&7)+8)<<(e-1);
+}
+static int luaO_log2(unsigned int x){
+static const lu_byte log_2[256]={
+0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+};
+int l=-1;
+while(x>=256){l+=8;x>>=8;}
+return l+log_2[x];
+}
+static int luaO_rawequalObj(const TValue*t1,const TValue*t2){
+if(ttype(t1)!=ttype(t2))return 0;
+else switch(ttype(t1)){
+case 0:
+return 1;
+case 3:
+return luai_numeq(nvalue(t1),nvalue(t2));
+case 1:
+return bvalue(t1)==bvalue(t2);
+case 2:
+return pvalue(t1)==pvalue(t2);
+default:
+return gcvalue(t1)==gcvalue(t2);
+}
+}
+static int luaO_str2d(const char*s,lua_Number*result){
+char*endptr;
+*result=lua_str2number(s,&endptr);
+if(endptr==s)return 0;
+if(*endptr=='x'||*endptr=='X')
+*result=cast_num(strtoul(s,&endptr,16));
+if(*endptr=='\0')return 1;
+while(isspace(cast(unsigned char,*endptr)))endptr++;
+if(*endptr!='\0')return 0;
+return 1;
+}
+static void pushstr(lua_State*L,const char*str){
+setsvalue(L,L->top,luaS_new(L,str));
+incr_top(L);
+}
+static const char*luaO_pushvfstring(lua_State*L,const char*fmt,va_list argp){
+int n=1;
+pushstr(L,"");
+for(;;){
+const char*e=strchr(fmt,'%');
+if(e==NULL)break;
+setsvalue(L,L->top,luaS_newlstr(L,fmt,e-fmt));
+incr_top(L);
+switch(*(e+1)){
+case's':{
+const char*s=va_arg(argp,char*);
+if(s==NULL)s="(null)";
+pushstr(L,s);
+break;
+}
+case'c':{
+char buff[2];
+buff[0]=cast(char,va_arg(argp,int));
+buff[1]='\0';
+pushstr(L,buff);
+break;
+}
+case'd':{
+setnvalue(L->top,cast_num(va_arg(argp,int)));
+incr_top(L);
+break;
+}
+case'f':{
+setnvalue(L->top,cast_num(va_arg(argp,l_uacNumber)));
+incr_top(L);
+break;
+}
+case'p':{
+char buff[4*sizeof(void*)+8];
+sprintf(buff,"%p",va_arg(argp,void*));
+pushstr(L,buff);
+break;
+}
+case'%':{
+pushstr(L,"%");
+break;
+}
+default:{
+char buff[3];
+buff[0]='%';
+buff[1]=*(e+1);
+buff[2]='\0';
+pushstr(L,buff);
+break;
+}
+}
+n+=2;
+fmt=e+2;
+}
+pushstr(L,fmt);
+luaV_concat(L,n+1,cast_int(L->top-L->base)-1);
+L->top-=n;
+return svalue(L->top-1);
+}
+static const char*luaO_pushfstring(lua_State*L,const char*fmt,...){
+const char*msg;
+va_list argp;
+va_start(argp,fmt);
+msg=luaO_pushvfstring(L,fmt,argp);
+va_end(argp);
+return msg;
+}
+static void luaO_chunkid(char*out,const char*source,size_t bufflen){
+if(*source=='='){
+strncpy(out,source+1,bufflen);
+out[bufflen-1]='\0';
+}
+else{
+if(*source=='@'){
+size_t l;
+source++;
+bufflen-=sizeof(" '...' ");
+l=strlen(source);
+strcpy(out,"");
+if(l>bufflen){
+source+=(l-bufflen);
+strcat(out,"...");
+}
+strcat(out,source);
+}
+else{
+size_t len=strcspn(source,"\n\r");
+bufflen-=sizeof(" [string \"...\"] ");
+if(len>bufflen)len=bufflen;
+strcpy(out,"[string \"");
+if(source[len]!='\0'){
+strncat(out,source,len);
+strcat(out,"...");
+}
+else
+strcat(out,source);
+strcat(out,"\"]");
+}
+}
+}
+#define gnode(t,i)(&(t)->node[i])
+#define gkey(n)(&(n)->i_key.nk)
+#define gval(n)(&(n)->i_val)
+#define gnext(n)((n)->i_key.nk.next)
+#define key2tval(n)(&(n)->i_key.tvk)
+static TValue*luaH_setnum(lua_State*L,Table*t,int key);
+static const TValue*luaH_getstr(Table*t,TString*key);
+static TValue*luaH_set(lua_State*L,Table*t,const TValue*key);
+static const char*const luaT_typenames[]={
+"nil","boolean","userdata","number",
+"string","table","function","userdata","thread",
+"proto","upval"
+};
+static void luaT_init(lua_State*L){
+static const char*const luaT_eventname[]={
+"__index","__newindex",
+"__gc","__mode","__eq",
+"__add","__sub","__mul","__div","__mod",
+"__pow","__unm","__len","__lt","__le",
+"__concat","__call"
+};
+int i;
+for(i=0;i<TM_N;i++){
+G(L)->tmname[i]=luaS_new(L,luaT_eventname[i]);
+luaS_fix(G(L)->tmname[i]);
+}
+}
+static const TValue*luaT_gettm(Table*events,TMS event,TString*ename){
+const TValue*tm=luaH_getstr(events,ename);
+if(ttisnil(tm)){
+events->flags|=cast_byte(1u<<event);
+return NULL;
+}
+else return tm;
+}
+static const TValue*luaT_gettmbyobj(lua_State*L,const TValue*o,TMS event){
+Table*mt;
+switch(ttype(o)){
+case 5:
+mt=hvalue(o)->metatable;
+break;
+case 7:
+mt=uvalue(o)->metatable;
+break;
+default:
+mt=G(L)->mt[ttype(o)];
+}
+return(mt?luaH_getstr(mt,G(L)->tmname[event]):(&luaO_nilobject_));
+}
+#define sizeCclosure(n)(cast(int,sizeof(CClosure))+cast(int,sizeof(TValue)*((n)-1)))
+#define sizeLclosure(n)(cast(int,sizeof(LClosure))+cast(int,sizeof(TValue*)*((n)-1)))
+static Closure*luaF_newCclosure(lua_State*L,int nelems,Table*e){
+Closure*c=cast(Closure*,luaM_malloc(L,sizeCclosure(nelems)));
+luaC_link(L,obj2gco(c),6);
+c->c.isC=1;
+c->c.env=e;
+c->c.nupvalues=cast_byte(nelems);
+return c;
+}
+static Closure*luaF_newLclosure(lua_State*L,int nelems,Table*e){
+Closure*c=cast(Closure*,luaM_malloc(L,sizeLclosure(nelems)));
+luaC_link(L,obj2gco(c),6);
+c->l.isC=0;
+c->l.env=e;
+c->l.nupvalues=cast_byte(nelems);
+while(nelems--)c->l.upvals[nelems]=NULL;
+return c;
+}
+static UpVal*luaF_newupval(lua_State*L){
+UpVal*uv=luaM_new(L,UpVal);
+luaC_link(L,obj2gco(uv),(8+2));
+uv->v=&uv->u.value;
+setnilvalue(uv->v);
+return uv;
+}
+static UpVal*luaF_findupval(lua_State*L,StkId level){
+global_State*g=G(L);
+GCObject**pp=&L->openupval;
+UpVal*p;
+UpVal*uv;
+while(*pp!=NULL&&(p=ngcotouv(*pp))->v>=level){
+if(p->v==level){
+if(isdead(g,obj2gco(p)))
+changewhite(obj2gco(p));
+return p;
+}
+pp=&p->next;
+}
+uv=luaM_new(L,UpVal);
+uv->tt=(8+2);
+uv->marked=luaC_white(g);
+uv->v=level;
+uv->next=*pp;
+*pp=obj2gco(uv);
+uv->u.l.prev=&g->uvhead;
+uv->u.l.next=g->uvhead.u.l.next;
+uv->u.l.next->u.l.prev=uv;
+g->uvhead.u.l.next=uv;
+return uv;
+}
+static void unlinkupval(UpVal*uv){
+uv->u.l.next->u.l.prev=uv->u.l.prev;
+uv->u.l.prev->u.l.next=uv->u.l.next;
+}
+static void luaF_freeupval(lua_State*L,UpVal*uv){
+if(uv->v!=&uv->u.value)
+unlinkupval(uv);
+luaM_free(L,uv);
+}
+static void luaF_close(lua_State*L,StkId level){
+UpVal*uv;
+global_State*g=G(L);
+while(L->openupval!=NULL&&(uv=ngcotouv(L->openupval))->v>=level){
+GCObject*o=obj2gco(uv);
+L->openupval=uv->next;
+if(isdead(g,o))
+luaF_freeupval(L,uv);
+else{
+unlinkupval(uv);
+setobj(L,&uv->u.value,uv->v);
+uv->v=&uv->u.value;
+luaC_linkupval(L,uv);
+}
+}
+}
+static Proto*luaF_newproto(lua_State*L){
+Proto*f=luaM_new(L,Proto);
+luaC_link(L,obj2gco(f),(8+1));
+f->k=NULL;
+f->sizek=0;
+f->p=NULL;
+f->sizep=0;
+f->code=NULL;
+f->sizecode=0;
+f->sizelineinfo=0;
+f->sizeupvalues=0;
+f->nups=0;
+f->upvalues=NULL;
+f->numparams=0;
+f->is_vararg=0;
+f->maxstacksize=0;
+f->lineinfo=NULL;
+f->sizelocvars=0;
+f->locvars=NULL;
+f->linedefined=0;
+f->lastlinedefined=0;
+f->source=NULL;
+return f;
+}
+static void luaF_freeproto(lua_State*L,Proto*f){
+luaM_freearray(L,f->code,f->sizecode,Instruction);
+luaM_freearray(L,f->p,f->sizep,Proto*);
+luaM_freearray(L,f->k,f->sizek,TValue);
+luaM_freearray(L,f->lineinfo,f->sizelineinfo,int);
+luaM_freearray(L,f->locvars,f->sizelocvars,struct LocVar);
+luaM_freearray(L,f->upvalues,f->sizeupvalues,TString*);
+luaM_free(L,f);
+}
+static void luaF_freeclosure(lua_State*L,Closure*c){
+int size=(c->c.isC)?sizeCclosure(c->c.nupvalues):
+sizeLclosure(c->l.nupvalues);
+luaM_freemem(L,c,size);
+}
+#define MASK1(n,p)((~((~(Instruction)0)<<n))<<p)
+#define MASK0(n,p)(~MASK1(n,p))
+#define GET_OPCODE(i)(cast(OpCode,((i)>>0)&MASK1(6,0)))
+#define SET_OPCODE(i,o)((i)=(((i)&MASK0(6,0))|((cast(Instruction,o)<<0)&MASK1(6,0))))
+#define GETARG_A(i)(cast(int,((i)>>(0+6))&MASK1(8,0)))
+#define SETARG_A(i,u)((i)=(((i)&MASK0(8,(0+6)))|((cast(Instruction,u)<<(0+6))&MASK1(8,(0+6)))))
+#define GETARG_B(i)(cast(int,((i)>>(((0+6)+8)+9))&MASK1(9,0)))
+#define SETARG_B(i,b)((i)=(((i)&MASK0(9,(((0+6)+8)+9)))|((cast(Instruction,b)<<(((0+6)+8)+9))&MASK1(9,(((0+6)+8)+9)))))
+#define GETARG_C(i)(cast(int,((i)>>((0+6)+8))&MASK1(9,0)))
+#define SETARG_C(i,b)((i)=(((i)&MASK0(9,((0+6)+8)))|((cast(Instruction,b)<<((0+6)+8))&MASK1(9,((0+6)+8)))))
+#define GETARG_Bx(i)(cast(int,((i)>>((0+6)+8))&MASK1((9+9),0)))
+#define SETARG_Bx(i,b)((i)=(((i)&MASK0((9+9),((0+6)+8)))|((cast(Instruction,b)<<((0+6)+8))&MASK1((9+9),((0+6)+8)))))
+#define GETARG_sBx(i)(GETARG_Bx(i)-(((1<<(9+9))-1)>>1))
+#define SETARG_sBx(i,b)SETARG_Bx((i),cast(unsigned int,(b)+(((1<<(9+9))-1)>>1)))
+#define CREATE_ABC(o,a,b,c)((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,b)<<(((0+6)+8)+9))|(cast(Instruction,c)<<((0+6)+8)))
+#define CREATE_ABx(o,a,bc)((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,bc)<<((0+6)+8)))
+#define ISK(x)((x)&(1<<(9-1)))
+#define INDEXK(r)((int)(r)&~(1<<(9-1)))
+#define RKASK(x)((x)|(1<<(9-1)))
+static const lu_byte luaP_opmodes[(cast(int,OP_VARARG)+1)];
+#define getBMode(m)(cast(enum OpArgMask,(luaP_opmodes[m]>>4)&3))
+#define getCMode(m)(cast(enum OpArgMask,(luaP_opmodes[m]>>2)&3))
+#define testTMode(m)(luaP_opmodes[m]&(1<<7))
+typedef struct expdesc{
+expkind k;
+union{
+struct{int info,aux;}s;
+lua_Number nval;
+}u;
+int t;
+int f;
+}expdesc;
+typedef struct upvaldesc{
+lu_byte k;
+lu_byte info;
+}upvaldesc;
+struct BlockCnt;
+typedef struct FuncState{
+Proto*f;
+Table*h;
+struct FuncState*prev;
+struct LexState*ls;
+struct lua_State*L;
+struct BlockCnt*bl;
+int pc;
+int lasttarget;
+int jpc;
+int freereg;
+int nk;
+int np;
+short nlocvars;
+lu_byte nactvar;
+upvaldesc upvalues[60];
+unsigned short actvar[200];
+}FuncState;
+static Proto*luaY_parser(lua_State*L,ZIO*z,Mbuffer*buff,
+const char*name);
+struct lua_longjmp{
+struct lua_longjmp*previous;
+jmp_buf b;
+volatile int status;
+};
+static void luaD_seterrorobj(lua_State*L,int errcode,StkId oldtop){
+switch(errcode){
+case 4:{
+setsvalue(L,oldtop,luaS_newliteral(L,"not enough memory"));
+break;
+}
+case 5:{
+setsvalue(L,oldtop,luaS_newliteral(L,"error in error handling"));
+break;
+}
+case 3:
+case 2:{
+setobj(L,oldtop,L->top-1);
+break;
+}
+}
+L->top=oldtop+1;
+}
+static void restore_stack_limit(lua_State*L){
+if(L->size_ci>20000){
+int inuse=cast_int(L->ci-L->base_ci);
+if(inuse+1<20000)
+luaD_reallocCI(L,20000);
+}
+}
+static void resetstack(lua_State*L,int status){
+L->ci=L->base_ci;
+L->base=L->ci->base;
+luaF_close(L,L->base);
+luaD_seterrorobj(L,status,L->base);
+L->nCcalls=L->baseCcalls;
+L->allowhook=1;
+restore_stack_limit(L);
+L->errfunc=0;
+L->errorJmp=NULL;
+}
+static void luaD_throw(lua_State*L,int errcode){
+if(L->errorJmp){
+L->errorJmp->status=errcode;
+LUAI_THROW(L,L->errorJmp);
+}
+else{
+L->status=cast_byte(errcode);
+if(G(L)->panic){
+resetstack(L,errcode);
+G(L)->panic(L);
+}
+exit(EXIT_FAILURE);
+}
+}
+static int luaD_rawrunprotected(lua_State*L,Pfunc f,void*ud){
+struct lua_longjmp lj;
+lj.status=0;
+lj.previous=L->errorJmp;
+L->errorJmp=&lj;
+LUAI_TRY(L,&lj,
+(*f)(L,ud);
+);
+L->errorJmp=lj.previous;
+return lj.status;
+}
+static void correctstack(lua_State*L,TValue*oldstack){
+CallInfo*ci;
+GCObject*up;
+L->top=(L->top-oldstack)+L->stack;
+for(up=L->openupval;up!=NULL;up=up->gch.next)
+gco2uv(up)->v=(gco2uv(up)->v-oldstack)+L->stack;
+for(ci=L->base_ci;ci<=L->ci;ci++){
+ci->top=(ci->top-oldstack)+L->stack;
+ci->base=(ci->base-oldstack)+L->stack;
+ci->func=(ci->func-oldstack)+L->stack;
+}
+L->base=(L->base-oldstack)+L->stack;
+}
+static void luaD_reallocstack(lua_State*L,int newsize){
+TValue*oldstack=L->stack;
+int realsize=newsize+1+5;
+luaM_reallocvector(L,L->stack,L->stacksize,realsize,TValue);
+L->stacksize=realsize;
+L->stack_last=L->stack+newsize;
+correctstack(L,oldstack);
+}
+static void luaD_reallocCI(lua_State*L,int newsize){
+CallInfo*oldci=L->base_ci;
+luaM_reallocvector(L,L->base_ci,L->size_ci,newsize,CallInfo);
+L->size_ci=newsize;
+L->ci=(L->ci-oldci)+L->base_ci;
+L->end_ci=L->base_ci+L->size_ci-1;
+}
+static void luaD_growstack(lua_State*L,int n){
+if(n<=L->stacksize)
+luaD_reallocstack(L,2*L->stacksize);
+else
+luaD_reallocstack(L,L->stacksize+n);
+}
+static CallInfo*growCI(lua_State*L){
+if(L->size_ci>20000)
+luaD_throw(L,5);
+else{
+luaD_reallocCI(L,2*L->size_ci);
+if(L->size_ci>20000)
+luaG_runerror(L,"stack overflow");
+}
+return++L->ci;
+}
+static StkId adjust_varargs(lua_State*L,Proto*p,int actual){
+int i;
+int nfixargs=p->numparams;
+Table*htab=NULL;
+StkId base,fixed;
+for(;actual<nfixargs;++actual)
+setnilvalue(L->top++);
+fixed=L->top-actual;
+base=L->top;
+for(i=0;i<nfixargs;i++){
+setobj(L,L->top++,fixed+i);
+setnilvalue(fixed+i);
+}
+if(htab){
+sethvalue(L,L->top++,htab);
+}
+return base;
+}
+static StkId tryfuncTM(lua_State*L,StkId func){
+const TValue*tm=luaT_gettmbyobj(L,func,TM_CALL);
+StkId p;
+ptrdiff_t funcr=savestack(L,func);
+if(!ttisfunction(tm))
+luaG_typeerror(L,func,"call");
+for(p=L->top;p>func;p--)setobj(L,p,p-1);
+incr_top(L);
+func=restorestack(L,funcr);
+setobj(L,func,tm);
+return func;
+}
+#define inc_ci(L)((L->ci==L->end_ci)?growCI(L):(condhardstacktests(luaD_reallocCI(L,L->size_ci)),++L->ci))
+static int luaD_precall(lua_State*L,StkId func,int nresults){
+LClosure*cl;
+ptrdiff_t funcr;
+if(!ttisfunction(func))
+func=tryfuncTM(L,func);
+funcr=savestack(L,func);
+cl=&clvalue(func)->l;
+L->ci->savedpc=L->savedpc;
+if(!cl->isC){
+CallInfo*ci;
+StkId st,base;
+Proto*p=cl->p;
+luaD_checkstack(L,p->maxstacksize);
+func=restorestack(L,funcr);
+if(!p->is_vararg){
+base=func+1;
+if(L->top>base+p->numparams)
+L->top=base+p->numparams;
+}
+else{
+int nargs=cast_int(L->top-func)-1;
+base=adjust_varargs(L,p,nargs);
+func=restorestack(L,funcr);
+}
+ci=inc_ci(L);
+ci->func=func;
+L->base=ci->base=base;
+ci->top=L->base+p->maxstacksize;
+L->savedpc=p->code;
+ci->tailcalls=0;
+ci->nresults=nresults;
+for(st=L->top;st<ci->top;st++)
+setnilvalue(st);
+L->top=ci->top;
+return 0;
+}
+else{
+CallInfo*ci;
+int n;
+luaD_checkstack(L,20);
+ci=inc_ci(L);
+ci->func=restorestack(L,funcr);
+L->base=ci->base=ci->func+1;
+ci->top=L->top+20;
+ci->nresults=nresults;
+n=(*curr_func(L)->c.f)(L);
+if(n<0)
+return 2;
+else{
+luaD_poscall(L,L->top-n);
+return 1;
+}
+}
+}
+static int luaD_poscall(lua_State*L,StkId firstResult){
+StkId res;
+int wanted,i;
+CallInfo*ci;
+ci=L->ci--;
+res=ci->func;
+wanted=ci->nresults;
+L->base=(ci-1)->base;
+L->savedpc=(ci-1)->savedpc;
+for(i=wanted;i!=0&&firstResult<L->top;i--)
+setobj(L,res++,firstResult++);
+while(i-->0)
+setnilvalue(res++);
+L->top=res;
+return(wanted-(-1));
+}
+static void luaD_call(lua_State*L,StkId func,int nResults){
+if(++L->nCcalls>=200){
+if(L->nCcalls==200)
+luaG_runerror(L,"C stack overflow");
+else if(L->nCcalls>=(200+(200>>3)))
+luaD_throw(L,5);
+}
+if(luaD_precall(L,func,nResults)==0)
+luaV_execute(L,1);
+L->nCcalls--;
+luaC_checkGC(L);
+}
+static int luaD_pcall(lua_State*L,Pfunc func,void*u,
+ptrdiff_t old_top,ptrdiff_t ef){
+int status;
+unsigned short oldnCcalls=L->nCcalls;
+ptrdiff_t old_ci=saveci(L,L->ci);
+lu_byte old_allowhooks=L->allowhook;
+ptrdiff_t old_errfunc=L->errfunc;
+L->errfunc=ef;
+status=luaD_rawrunprotected(L,func,u);
+if(status!=0){
+StkId oldtop=restorestack(L,old_top);
+luaF_close(L,oldtop);
+luaD_seterrorobj(L,status,oldtop);
+L->nCcalls=oldnCcalls;
+L->ci=restoreci(L,old_ci);
+L->base=L->ci->base;
+L->savedpc=L->ci->savedpc;
+L->allowhook=old_allowhooks;
+restore_stack_limit(L);
+}
+L->errfunc=old_errfunc;
+return status;
+}
+struct SParser{
+ZIO*z;
+Mbuffer buff;
+const char*name;
+};
+static void f_parser(lua_State*L,void*ud){
+int i;
+Proto*tf;
+Closure*cl;
+struct SParser*p=cast(struct SParser*,ud);
+luaC_checkGC(L);
+tf=luaY_parser(L,p->z,
+&p->buff,p->name);
+cl=luaF_newLclosure(L,tf->nups,hvalue(gt(L)));
+cl->l.p=tf;
+for(i=0;i<tf->nups;i++)
+cl->l.upvals[i]=luaF_newupval(L);
+setclvalue(L,L->top,cl);
+incr_top(L);
+}
+static int luaD_protectedparser(lua_State*L,ZIO*z,const char*name){
+struct SParser p;
+int status;
+p.z=z;p.name=name;
+luaZ_initbuffer(L,&p.buff);
+status=luaD_pcall(L,f_parser,&p,savestack(L,L->top),L->errfunc);
+luaZ_freebuffer(L,&p.buff);
+return status;
+}
+static void luaS_resize(lua_State*L,int newsize){
+GCObject**newhash;
+stringtable*tb;
+int i;
+if(G(L)->gcstate==2)
+return;
+newhash=luaM_newvector(L,newsize,GCObject*);
+tb=&G(L)->strt;
+for(i=0;i<newsize;i++)newhash[i]=NULL;
+for(i=0;i<tb->size;i++){
+GCObject*p=tb->hash[i];
+while(p){
+GCObject*next=p->gch.next;
+unsigned int h=gco2ts(p)->hash;
+int h1=lmod(h,newsize);
+p->gch.next=newhash[h1];
+newhash[h1]=p;
+p=next;
+}
+}
+luaM_freearray(L,tb->hash,tb->size,TString*);
+tb->size=newsize;
+tb->hash=newhash;
+}
+static TString*newlstr(lua_State*L,const char*str,size_t l,
+unsigned int h){
+TString*ts;
+stringtable*tb;
+if(l+1>(((size_t)(~(size_t)0)-2)-sizeof(TString))/sizeof(char))
+luaM_toobig(L);
+ts=cast(TString*,luaM_malloc(L,(l+1)*sizeof(char)+sizeof(TString)));
+ts->tsv.len=l;
+ts->tsv.hash=h;
+ts->tsv.marked=luaC_white(G(L));
+ts->tsv.tt=4;
+ts->tsv.reserved=0;
+memcpy(ts+1,str,l*sizeof(char));
+((char*)(ts+1))[l]='\0';
+tb=&G(L)->strt;
+h=lmod(h,tb->size);
+ts->tsv.next=tb->hash[h];
+tb->hash[h]=obj2gco(ts);
+tb->nuse++;
+if(tb->nuse>cast(lu_int32,tb->size)&&tb->size<=(INT_MAX-2)/2)
+luaS_resize(L,tb->size*2);
+return ts;
+}
+static TString*luaS_newlstr(lua_State*L,const char*str,size_t l){
+GCObject*o;
+unsigned int h=cast(unsigned int,l);
+size_t step=(l>>5)+1;
+size_t l1;
+for(l1=l;l1>=step;l1-=step)
+h=h^((h<<5)+(h>>2)+cast(unsigned char,str[l1-1]));
+for(o=G(L)->strt.hash[lmod(h,G(L)->strt.size)];
+o!=NULL;
+o=o->gch.next){
+TString*ts=rawgco2ts(o);
+if(ts->tsv.len==l&&(memcmp(str,getstr(ts),l)==0)){
+if(isdead(G(L),o))changewhite(o);
+return ts;
+}
+}
+return newlstr(L,str,l,h);
+}
+static Udata*luaS_newudata(lua_State*L,size_t s,Table*e){
+Udata*u;
+if(s>((size_t)(~(size_t)0)-2)-sizeof(Udata))
+luaM_toobig(L);
+u=cast(Udata*,luaM_malloc(L,s+sizeof(Udata)));
+u->uv.marked=luaC_white(G(L));
+u->uv.tt=7;
+u->uv.len=s;
+u->uv.metatable=NULL;
+u->uv.env=e;
+u->uv.next=G(L)->mainthread->next;
+G(L)->mainthread->next=obj2gco(u);
+return u;
+}
+#define hashpow2(t,n)(gnode(t,lmod((n),sizenode(t))))
+#define hashstr(t,str)hashpow2(t,(str)->tsv.hash)
+#define hashboolean(t,p)hashpow2(t,p)
+#define hashmod(t,n)(gnode(t,((n)%((sizenode(t)-1)|1))))
+#define hashpointer(t,p)hashmod(t,IntPoint(p))
+static const Node dummynode_={
+{{NULL},0},
+{{{NULL},0,NULL}}
+};
+static Node*hashnum(const Table*t,lua_Number n){
+unsigned int a[cast_int(sizeof(lua_Number)/sizeof(int))];
+int i;
+if(luai_numeq(n,0))
+return gnode(t,0);
+memcpy(a,&n,sizeof(a));
+for(i=1;i<cast_int(sizeof(lua_Number)/sizeof(int));i++)a[0]+=a[i];
+return hashmod(t,a[0]);
+}
+static Node*mainposition(const Table*t,const TValue*key){
+switch(ttype(key)){
+case 3:
+return hashnum(t,nvalue(key));
+case 4:
+return hashstr(t,rawtsvalue(key));
+case 1:
+return hashboolean(t,bvalue(key));
+case 2:
+return hashpointer(t,pvalue(key));
+default:
+return hashpointer(t,gcvalue(key));
+}
+}
+static int arrayindex(const TValue*key){
+if(ttisnumber(key)){
+lua_Number n=nvalue(key);
+int k;
+lua_number2int(k,n);
+if(luai_numeq(cast_num(k),n))
+return k;
+}
+return-1;
+}
+static int findindex(lua_State*L,Table*t,StkId key){
+int i;
+if(ttisnil(key))return-1;
+i=arrayindex(key);
+if(0<i&&i<=t->sizearray)
+return i-1;
+else{
+Node*n=mainposition(t,key);
+do{
+if(luaO_rawequalObj(key2tval(n),key)||
+(ttype(gkey(n))==(8+3)&&iscollectable(key)&&
+gcvalue(gkey(n))==gcvalue(key))){
+i=cast_int(n-gnode(t,0));
+return i+t->sizearray;
+}
+else n=gnext(n);
+}while(n);
+luaG_runerror(L,"invalid key to "LUA_QL("next"));
+return 0;
+}
+}
+static int luaH_next(lua_State*L,Table*t,StkId key){
+int i=findindex(L,t,key);
+for(i++;i<t->sizearray;i++){
+if(!ttisnil(&t->array[i])){
+setnvalue(key,cast_num(i+1));
+setobj(L,key+1,&t->array[i]);
+return 1;
+}
+}
+for(i-=t->sizearray;i<(int)sizenode(t);i++){
+if(!ttisnil(gval(gnode(t,i)))){
+setobj(L,key,key2tval(gnode(t,i)));
+setobj(L,key+1,gval(gnode(t,i)));
+return 1;
+}
+}
+return 0;
+}
+static int computesizes(int nums[],int*narray){
+int i;
+int twotoi;
+int a=0;
+int na=0;
+int n=0;
+for(i=0,twotoi=1;twotoi/2<*narray;i++,twotoi*=2){
+if(nums[i]>0){
+a+=nums[i];
+if(a>twotoi/2){
+n=twotoi;
+na=a;
+}
+}
+if(a==*narray)break;
+}
+*narray=n;
+return na;
+}
+static int countint(const TValue*key,int*nums){
+int k=arrayindex(key);
+if(0<k&&k<=(1<<(32-2))){
+nums[ceillog2(k)]++;
+return 1;
+}
+else
+return 0;
+}
+static int numusearray(const Table*t,int*nums){
+int lg;
+int ttlg;
+int ause=0;
+int i=1;
+for(lg=0,ttlg=1;lg<=(32-2);lg++,ttlg*=2){
+int lc=0;
+int lim=ttlg;
+if(lim>t->sizearray){
+lim=t->sizearray;
+if(i>lim)
+break;
+}
+for(;i<=lim;i++){
+if(!ttisnil(&t->array[i-1]))
+lc++;
+}
+nums[lg]+=lc;
+ause+=lc;
+}
+return ause;
+}
+static int numusehash(const Table*t,int*nums,int*pnasize){
+int totaluse=0;
+int ause=0;
+int i=sizenode(t);
+while(i--){
+Node*n=&t->node[i];
+if(!ttisnil(gval(n))){
+ause+=countint(key2tval(n),nums);
+totaluse++;
+}
+}
+*pnasize+=ause;
+return totaluse;
+}
+static void setarrayvector(lua_State*L,Table*t,int size){
+int i;
+luaM_reallocvector(L,t->array,t->sizearray,size,TValue);
+for(i=t->sizearray;i<size;i++)
+setnilvalue(&t->array[i]);
+t->sizearray=size;
+}
+static void setnodevector(lua_State*L,Table*t,int size){
+int lsize;
+if(size==0){
+t->node=cast(Node*,(&dummynode_));
+lsize=0;
+}
+else{
+int i;
+lsize=ceillog2(size);
+if(lsize>(32-2))
+luaG_runerror(L,"table overflow");
+size=twoto(lsize);
+t->node=luaM_newvector(L,size,Node);
+for(i=0;i<size;i++){
+Node*n=gnode(t,i);
+gnext(n)=NULL;
+setnilvalue(gkey(n));
+setnilvalue(gval(n));
+}
+}
+t->lsizenode=cast_byte(lsize);
+t->lastfree=gnode(t,size);
+}
+static void resize(lua_State*L,Table*t,int nasize,int nhsize){
+int i;
+int oldasize=t->sizearray;
+int oldhsize=t->lsizenode;
+Node*nold=t->node;
+if(nasize>oldasize)
+setarrayvector(L,t,nasize);
+setnodevector(L,t,nhsize);
+if(nasize<oldasize){
+t->sizearray=nasize;
+for(i=nasize;i<oldasize;i++){
+if(!ttisnil(&t->array[i]))
+setobj(L,luaH_setnum(L,t,i+1),&t->array[i]);
+}
+luaM_reallocvector(L,t->array,oldasize,nasize,TValue);
+}
+for(i=twoto(oldhsize)-1;i>=0;i--){
+Node*old=nold+i;
+if(!ttisnil(gval(old)))
+setobj(L,luaH_set(L,t,key2tval(old)),gval(old));
+}
+if(nold!=(&dummynode_))
+luaM_freearray(L,nold,twoto(oldhsize),Node);
+}
+static void luaH_resizearray(lua_State*L,Table*t,int nasize){
+int nsize=(t->node==(&dummynode_))?0:sizenode(t);
+resize(L,t,nasize,nsize);
+}
+static void rehash(lua_State*L,Table*t,const TValue*ek){
+int nasize,na;
+int nums[(32-2)+1];
+int i;
+int totaluse;
+for(i=0;i<=(32-2);i++)nums[i]=0;
+nasize=numusearray(t,nums);
+totaluse=nasize;
+totaluse+=numusehash(t,nums,&nasize);
+nasize+=countint(ek,nums);
+totaluse++;
+na=computesizes(nums,&nasize);
+resize(L,t,nasize,totaluse-na);
+}
+static Table*luaH_new(lua_State*L,int narray,int nhash){
+Table*t=luaM_new(L,Table);
+luaC_link(L,obj2gco(t),5);
+t->metatable=NULL;
+t->flags=cast_byte(~0);
+t->array=NULL;
+t->sizearray=0;
+t->lsizenode=0;
+t->node=cast(Node*,(&dummynode_));
+setarrayvector(L,t,narray);
+setnodevector(L,t,nhash);
+return t;
+}
+static void luaH_free(lua_State*L,Table*t){
+if(t->node!=(&dummynode_))
+luaM_freearray(L,t->node,sizenode(t),Node);
+luaM_freearray(L,t->array,t->sizearray,TValue);
+luaM_free(L,t);
+}
+static Node*getfreepos(Table*t){
+while(t->lastfree-->t->node){
+if(ttisnil(gkey(t->lastfree)))
+return t->lastfree;
+}
+return NULL;
+}
+static TValue*newkey(lua_State*L,Table*t,const TValue*key){
+Node*mp=mainposition(t,key);
+if(!ttisnil(gval(mp))||mp==(&dummynode_)){
+Node*othern;
+Node*n=getfreepos(t);
+if(n==NULL){
+rehash(L,t,key);
+return luaH_set(L,t,key);
+}
+othern=mainposition(t,key2tval(mp));
+if(othern!=mp){
+while(gnext(othern)!=mp)othern=gnext(othern);
+gnext(othern)=n;
+*n=*mp;
+gnext(mp)=NULL;
+setnilvalue(gval(mp));
+}
+else{
+gnext(n)=gnext(mp);
+gnext(mp)=n;
+mp=n;
+}
+}
+gkey(mp)->value=key->value;gkey(mp)->tt=key->tt;
+luaC_barriert(L,t,key);
+return gval(mp);
+}
+static const TValue*luaH_getnum(Table*t,int key){
+if(cast(unsigned int,key)-1<cast(unsigned int,t->sizearray))
+return&t->array[key-1];
+else{
+lua_Number nk=cast_num(key);
+Node*n=hashnum(t,nk);
+do{
+if(ttisnumber(gkey(n))&&luai_numeq(nvalue(gkey(n)),nk))
+return gval(n);
+else n=gnext(n);
+}while(n);
+return(&luaO_nilobject_);
+}
+}
+static const TValue*luaH_getstr(Table*t,TString*key){
+Node*n=hashstr(t,key);
+do{
+if(ttisstring(gkey(n))&&rawtsvalue(gkey(n))==key)
+return gval(n);
+else n=gnext(n);
+}while(n);
+return(&luaO_nilobject_);
+}
+static const TValue*luaH_get(Table*t,const TValue*key){
+switch(ttype(key)){
+case 0:return(&luaO_nilobject_);
+case 4:return luaH_getstr(t,rawtsvalue(key));
+case 3:{
+int k;
+lua_Number n=nvalue(key);
+lua_number2int(k,n);
+if(luai_numeq(cast_num(k),nvalue(key)))
+return luaH_getnum(t,k);
+}
+default:{
+Node*n=mainposition(t,key);
+do{
+if(luaO_rawequalObj(key2tval(n),key))
+return gval(n);
+else n=gnext(n);
+}while(n);
+return(&luaO_nilobject_);
+}
+}
+}
+static TValue*luaH_set(lua_State*L,Table*t,const TValue*key){
+const TValue*p=luaH_get(t,key);
+t->flags=0;
+if(p!=(&luaO_nilobject_))
+return cast(TValue*,p);
+else{
+if(ttisnil(key))luaG_runerror(L,"table index is nil");
+else if(ttisnumber(key)&&luai_numisnan(nvalue(key)))
+luaG_runerror(L,"table index is NaN");
+return newkey(L,t,key);
+}
+}
+static TValue*luaH_setnum(lua_State*L,Table*t,int key){
+const TValue*p=luaH_getnum(t,key);
+if(p!=(&luaO_nilobject_))
+return cast(TValue*,p);
+else{
+TValue k;
+setnvalue(&k,cast_num(key));
+return newkey(L,t,&k);
+}
+}
+static TValue*luaH_setstr(lua_State*L,Table*t,TString*key){
+const TValue*p=luaH_getstr(t,key);
+if(p!=(&luaO_nilobject_))
+return cast(TValue*,p);
+else{
+TValue k;
+setsvalue(L,&k,key);
+return newkey(L,t,&k);
+}
+}
+static int unbound_search(Table*t,unsigned int j){
+unsigned int i=j;
+j++;
+while(!ttisnil(luaH_getnum(t,j))){
+i=j;
+j*=2;
+if(j>cast(unsigned int,(INT_MAX-2))){
+i=1;
+while(!ttisnil(luaH_getnum(t,i)))i++;
+return i-1;
+}
+}
+while(j-i>1){
+unsigned int m=(i+j)/2;
+if(ttisnil(luaH_getnum(t,m)))j=m;
+else i=m;
+}
+return i;
+}
+static int luaH_getn(Table*t){
+unsigned int j=t->sizearray;
+if(j>0&&ttisnil(&t->array[j-1])){
+unsigned int i=0;
+while(j-i>1){
+unsigned int m=(i+j)/2;
+if(ttisnil(&t->array[m-1]))j=m;
+else i=m;
+}
+return i;
+}
+else if(t->node==(&dummynode_))
+return j;
+else return unbound_search(t,j);
+}
+#define makewhite(g,x)((x)->gch.marked=cast_byte(((x)->gch.marked&cast_byte(~(bitmask(2)|bit2mask(0,1))))|luaC_white(g)))
+#define white2gray(x)reset2bits((x)->gch.marked,0,1)
+#define black2gray(x)resetbit((x)->gch.marked,2)
+#define stringmark(s)reset2bits((s)->tsv.marked,0,1)
+#define isfinalized(u)testbit((u)->marked,3)
+#define markfinalized(u)l_setbit((u)->marked,3)
+#define markvalue(g,o){checkconsistency(o);if(iscollectable(o)&&iswhite(gcvalue(o)))reallymarkobject(g,gcvalue(o));}
+#define markobject(g,t){if(iswhite(obj2gco(t)))reallymarkobject(g,obj2gco(t));}
+#define setthreshold(g)(g->GCthreshold=(g->estimate/100)*g->gcpause)
+static void removeentry(Node*n){
+if(iscollectable(gkey(n)))
+setttype(gkey(n),(8+3));
+}
+static void reallymarkobject(global_State*g,GCObject*o){
+white2gray(o);
+switch(o->gch.tt){
+case 4:{
+return;
+}
+case 7:{
+Table*mt=gco2u(o)->metatable;
+gray2black(o);
+if(mt)markobject(g,mt);
+markobject(g,gco2u(o)->env);
+return;
+}
+case(8+2):{
+UpVal*uv=gco2uv(o);
+markvalue(g,uv->v);
+if(uv->v==&uv->u.value)
+gray2black(o);
+return;
+}
+case 6:{
+gco2cl(o)->c.gclist=g->gray;
+g->gray=o;
+break;
+}
+case 5:{
+gco2h(o)->gclist=g->gray;
+g->gray=o;
+break;
+}
+case 8:{
+gco2th(o)->gclist=g->gray;
+g->gray=o;
+break;
+}
+case(8+1):{
+gco2p(o)->gclist=g->gray;
+g->gray=o;
+break;
+}
+default:;
+}
+}
+static void marktmu(global_State*g){
+GCObject*u=g->tmudata;
+if(u){
+do{
+u=u->gch.next;
+makewhite(g,u);
+reallymarkobject(g,u);
+}while(u!=g->tmudata);
+}
+}
+static size_t luaC_separateudata(lua_State*L,int all){
+global_State*g=G(L);
+size_t deadmem=0;
+GCObject**p=&g->mainthread->next;
+GCObject*curr;
+while((curr=*p)!=NULL){
+if(!(iswhite(curr)||all)||isfinalized(gco2u(curr)))
+p=&curr->gch.next;
+else if(fasttm(L,gco2u(curr)->metatable,TM_GC)==NULL){
+markfinalized(gco2u(curr));
+p=&curr->gch.next;
+}
+else{
+deadmem+=sizeudata(gco2u(curr));
+markfinalized(gco2u(curr));
+*p=curr->gch.next;
+if(g->tmudata==NULL)
+g->tmudata=curr->gch.next=curr;
+else{
+curr->gch.next=g->tmudata->gch.next;
+g->tmudata->gch.next=curr;
+g->tmudata=curr;
+}
+}
+}
+return deadmem;
+}
+static int traversetable(global_State*g,Table*h){
+int i;
+int weakkey=0;
+int weakvalue=0;
+const TValue*mode;
+if(h->metatable)
+markobject(g,h->metatable);
+mode=gfasttm(g,h->metatable,TM_MODE);
+if(mode&&ttisstring(mode)){
+weakkey=(strchr(svalue(mode),'k')!=NULL);
+weakvalue=(strchr(svalue(mode),'v')!=NULL);
+if(weakkey||weakvalue){
+h->marked&=~(bitmask(3)|bitmask(4));
+h->marked|=cast_byte((weakkey<<3)|
+(weakvalue<<4));
+h->gclist=g->weak;
+g->weak=obj2gco(h);
+}
+}
+if(weakkey&&weakvalue)return 1;
+if(!weakvalue){
+i=h->sizearray;
+while(i--)
+markvalue(g,&h->array[i]);
+}
+i=sizenode(h);
+while(i--){
+Node*n=gnode(h,i);
+if(ttisnil(gval(n)))
+removeentry(n);
+else{
+if(!weakkey)markvalue(g,gkey(n));
+if(!weakvalue)markvalue(g,gval(n));
+}
+}
+return weakkey||weakvalue;
+}
+static void traverseproto(global_State*g,Proto*f){
+int i;
+if(f->source)stringmark(f->source);
+for(i=0;i<f->sizek;i++)
+markvalue(g,&f->k[i]);
+for(i=0;i<f->sizeupvalues;i++){
+if(f->upvalues[i])
+stringmark(f->upvalues[i]);
+}
+for(i=0;i<f->sizep;i++){
+if(f->p[i])
+markobject(g,f->p[i]);
+}
+for(i=0;i<f->sizelocvars;i++){
+if(f->locvars[i].varname)
+stringmark(f->locvars[i].varname);
+}
+}
+static void traverseclosure(global_State*g,Closure*cl){
+markobject(g,cl->c.env);
+if(cl->c.isC){
+int i;
+for(i=0;i<cl->c.nupvalues;i++)
+markvalue(g,&cl->c.upvalue[i]);
+}
+else{
+int i;
+markobject(g,cl->l.p);
+for(i=0;i<cl->l.nupvalues;i++)
+markobject(g,cl->l.upvals[i]);
+}
+}
+static void checkstacksizes(lua_State*L,StkId max){
+int ci_used=cast_int(L->ci-L->base_ci);
+int s_used=cast_int(max-L->stack);
+if(L->size_ci>20000)
+return;
+if(4*ci_used<L->size_ci&&2*8<L->size_ci)
+luaD_reallocCI(L,L->size_ci/2);
+condhardstacktests(luaD_reallocCI(L,ci_used+1));
+if(4*s_used<L->stacksize&&
+2*((2*20)+5)<L->stacksize)
+luaD_reallocstack(L,L->stacksize/2);
+condhardstacktests(luaD_reallocstack(L,s_used));
+}
+static void traversestack(global_State*g,lua_State*l){
+StkId o,lim;
+CallInfo*ci;
+markvalue(g,gt(l));
+lim=l->top;
+for(ci=l->base_ci;ci<=l->ci;ci++){
+if(lim<ci->top)lim=ci->top;
+}
+for(o=l->stack;o<l->top;o++)
+markvalue(g,o);
+for(;o<=lim;o++)
+setnilvalue(o);
+checkstacksizes(l,lim);
+}
+static l_mem propagatemark(global_State*g){
+GCObject*o=g->gray;
+gray2black(o);
+switch(o->gch.tt){
+case 5:{
+Table*h=gco2h(o);
+g->gray=h->gclist;
+if(traversetable(g,h))
+black2gray(o);
+return sizeof(Table)+sizeof(TValue)*h->sizearray+
+sizeof(Node)*sizenode(h);
+}
+case 6:{
+Closure*cl=gco2cl(o);
+g->gray=cl->c.gclist;
+traverseclosure(g,cl);
+return(cl->c.isC)?sizeCclosure(cl->c.nupvalues):
+sizeLclosure(cl->l.nupvalues);
+}
+case 8:{
+lua_State*th=gco2th(o);
+g->gray=th->gclist;
+th->gclist=g->grayagain;
+g->grayagain=o;
+black2gray(o);
+traversestack(g,th);
+return sizeof(lua_State)+sizeof(TValue)*th->stacksize+
+sizeof(CallInfo)*th->size_ci;
+}
+case(8+1):{
+Proto*p=gco2p(o);
+g->gray=p->gclist;
+traverseproto(g,p);
+return sizeof(Proto)+sizeof(Instruction)*p->sizecode+
+sizeof(Proto*)*p->sizep+
+sizeof(TValue)*p->sizek+
+sizeof(int)*p->sizelineinfo+
+sizeof(LocVar)*p->sizelocvars+
+sizeof(TString*)*p->sizeupvalues;
+}
+default:return 0;
+}
+}
+static size_t propagateall(global_State*g){
+size_t m=0;
+while(g->gray)m+=propagatemark(g);
+return m;
+}
+static int iscleared(const TValue*o,int iskey){
+if(!iscollectable(o))return 0;
+if(ttisstring(o)){
+stringmark(rawtsvalue(o));
+return 0;
+}
+return iswhite(gcvalue(o))||
+(ttisuserdata(o)&&(!iskey&&isfinalized(uvalue(o))));
+}
+static void cleartable(GCObject*l){
+while(l){
+Table*h=gco2h(l);
+int i=h->sizearray;
+if(testbit(h->marked,4)){
+while(i--){
+TValue*o=&h->array[i];
+if(iscleared(o,0))
+setnilvalue(o);
+}
+}
+i=sizenode(h);
+while(i--){
+Node*n=gnode(h,i);
+if(!ttisnil(gval(n))&&
+(iscleared(key2tval(n),1)||iscleared(gval(n),0))){
+setnilvalue(gval(n));
+removeentry(n);
+}
+}
+l=h->gclist;
+}
+}
+static void freeobj(lua_State*L,GCObject*o){
+switch(o->gch.tt){
+case(8+1):luaF_freeproto(L,gco2p(o));break;
+case 6:luaF_freeclosure(L,gco2cl(o));break;
+case(8+2):luaF_freeupval(L,gco2uv(o));break;
+case 5:luaH_free(L,gco2h(o));break;
+case 8:{
+luaE_freethread(L,gco2th(o));
+break;
+}
+case 4:{
+G(L)->strt.nuse--;
+luaM_freemem(L,o,sizestring(gco2ts(o)));
+break;
+}
+case 7:{
+luaM_freemem(L,o,sizeudata(gco2u(o)));
+break;
+}
+default:;
+}
+}
+#define sweepwholelist(L,p)sweeplist(L,p,((lu_mem)(~(lu_mem)0)-2))
+static GCObject**sweeplist(lua_State*L,GCObject**p,lu_mem count){
+GCObject*curr;
+global_State*g=G(L);
+int deadmask=otherwhite(g);
+while((curr=*p)!=NULL&&count-->0){
+if(curr->gch.tt==8)
+sweepwholelist(L,&gco2th(curr)->openupval);
+if((curr->gch.marked^bit2mask(0,1))&deadmask){
+makewhite(g,curr);
+p=&curr->gch.next;
+}
+else{
+*p=curr->gch.next;
+if(curr==g->rootgc)
+g->rootgc=curr->gch.next;
+freeobj(L,curr);
+}
+}
+return p;
+}
+static void checkSizes(lua_State*L){
+global_State*g=G(L);
+if(g->strt.nuse<cast(lu_int32,g->strt.size/4)&&
+g->strt.size>32*2)
+luaS_resize(L,g->strt.size/2);
+if(luaZ_sizebuffer(&g->buff)>32*2){
+size_t newsize=luaZ_sizebuffer(&g->buff)/2;
+luaZ_resizebuffer(L,&g->buff,newsize);
+}
+}
+static void GCTM(lua_State*L){
+global_State*g=G(L);
+GCObject*o=g->tmudata->gch.next;
+Udata*udata=rawgco2u(o);
+const TValue*tm;
+if(o==g->tmudata)
+g->tmudata=NULL;
+else
+g->tmudata->gch.next=udata->uv.next;
+udata->uv.next=g->mainthread->next;
+g->mainthread->next=o;
+makewhite(g,o);
+tm=fasttm(L,udata->uv.metatable,TM_GC);
+if(tm!=NULL){
+lu_byte oldah=L->allowhook;
+lu_mem oldt=g->GCthreshold;
+L->allowhook=0;
+g->GCthreshold=2*g->totalbytes;
+setobj(L,L->top,tm);
+setuvalue(L,L->top+1,udata);
+L->top+=2;
+luaD_call(L,L->top-2,0);
+L->allowhook=oldah;
+g->GCthreshold=oldt;
+}
+}
+static void luaC_callGCTM(lua_State*L){
+while(G(L)->tmudata)
+GCTM(L);
+}
+static void luaC_freeall(lua_State*L){
+global_State*g=G(L);
+int i;
+g->currentwhite=bit2mask(0,1)|bitmask(6);
+sweepwholelist(L,&g->rootgc);
+for(i=0;i<g->strt.size;i++)
+sweepwholelist(L,&g->strt.hash[i]);
+}
+static void markmt(global_State*g){
+int i;
+for(i=0;i<(8+1);i++)
+if(g->mt[i])markobject(g,g->mt[i]);
+}
+static void markroot(lua_State*L){
+global_State*g=G(L);
+g->gray=NULL;
+g->grayagain=NULL;
+g->weak=NULL;
+markobject(g,g->mainthread);
+markvalue(g,gt(g->mainthread));
+markvalue(g,registry(L));
+markmt(g);
+g->gcstate=1;
+}
+static void remarkupvals(global_State*g){
+UpVal*uv;
+for(uv=g->uvhead.u.l.next;uv!=&g->uvhead;uv=uv->u.l.next){
+if(isgray(obj2gco(uv)))
+markvalue(g,uv->v);
+}
+}
+static void atomic(lua_State*L){
+global_State*g=G(L);
+size_t udsize;
+remarkupvals(g);
+propagateall(g);
+g->gray=g->weak;
+g->weak=NULL;
+markobject(g,L);
+markmt(g);
+propagateall(g);
+g->gray=g->grayagain;
+g->grayagain=NULL;
+propagateall(g);
+udsize=luaC_separateudata(L,0);
+marktmu(g);
+udsize+=propagateall(g);
+cleartable(g->weak);
+g->currentwhite=cast_byte(otherwhite(g));
+g->sweepstrgc=0;
+g->sweepgc=&g->rootgc;
+g->gcstate=2;
+g->estimate=g->totalbytes-udsize;
+}
+static l_mem singlestep(lua_State*L){
+global_State*g=G(L);
+switch(g->gcstate){
+case 0:{
+markroot(L);
+return 0;
+}
+case 1:{
+if(g->gray)
+return propagatemark(g);
+else{
+atomic(L);
+return 0;
+}
+}
+case 2:{
+lu_mem old=g->totalbytes;
+sweepwholelist(L,&g->strt.hash[g->sweepstrgc++]);
+if(g->sweepstrgc>=g->strt.size)
+g->gcstate=3;
+g->estimate-=old-g->totalbytes;
+return 10;
+}
+case 3:{
+lu_mem old=g->totalbytes;
+g->sweepgc=sweeplist(L,g->sweepgc,40);
+if(*g->sweepgc==NULL){
+checkSizes(L);
+g->gcstate=4;
+}
+g->estimate-=old-g->totalbytes;
+return 40*10;
+}
+case 4:{
+if(g->tmudata){
+GCTM(L);
+if(g->estimate>100)
+g->estimate-=100;
+return 100;
+}
+else{
+g->gcstate=0;
+g->gcdept=0;
+return 0;
+}
+}
+default:return 0;
+}
+}
+static void luaC_step(lua_State*L){
+global_State*g=G(L);
+l_mem lim=(1024u/100)*g->gcstepmul;
+if(lim==0)
+lim=(((lu_mem)(~(lu_mem)0)-2)-1)/2;
+g->gcdept+=g->totalbytes-g->GCthreshold;
+do{
+lim-=singlestep(L);
+if(g->gcstate==0)
+break;
+}while(lim>0);
+if(g->gcstate!=0){
+if(g->gcdept<1024u)
+g->GCthreshold=g->totalbytes+1024u;
+else{
+g->gcdept-=1024u;
+g->GCthreshold=g->totalbytes;
+}
+}
+else{
+setthreshold(g);
+}
+}
+static void luaC_barrierf(lua_State*L,GCObject*o,GCObject*v){
+global_State*g=G(L);
+if(g->gcstate==1)
+reallymarkobject(g,v);
+else
+makewhite(g,o);
+}
+static void luaC_barrierback(lua_State*L,Table*t){
+global_State*g=G(L);
+GCObject*o=obj2gco(t);
+black2gray(o);
+t->gclist=g->grayagain;
+g->grayagain=o;
+}
+static void luaC_link(lua_State*L,GCObject*o,lu_byte tt){
+global_State*g=G(L);
+o->gch.next=g->rootgc;
+g->rootgc=o;
+o->gch.marked=luaC_white(g);
+o->gch.tt=tt;
+}
+static void luaC_linkupval(lua_State*L,UpVal*uv){
+global_State*g=G(L);
+GCObject*o=obj2gco(uv);
+o->gch.next=g->rootgc;
+g->rootgc=o;
+if(isgray(o)){
+if(g->gcstate==1){
+gray2black(o);
+luaC_barrier(L,uv,uv->v);
+}
+else{
+makewhite(g,o);
+}
+}
+}
+typedef union{
+lua_Number r;
+TString*ts;
+}SemInfo;
+typedef struct Token{
+int token;
+SemInfo seminfo;
+}Token;
+typedef struct LexState{
+int current;
+int linenumber;
+int lastline;
+Token t;
+Token lookahead;
+struct FuncState*fs;
+struct lua_State*L;
+ZIO*z;
+Mbuffer*buff;
+TString*source;
+char decpoint;
+}LexState;
+static void luaX_init(lua_State*L);
+static void luaX_lexerror(LexState*ls,const char*msg,int token);
+#define state_size(x)(sizeof(x)+0)
+#define fromstate(l)(cast(lu_byte*,(l))-0)
+#define tostate(l)(cast(lua_State*,cast(lu_byte*,l)+0))
+typedef struct LG{
+lua_State l;
+global_State g;
+}LG;
+static void stack_init(lua_State*L1,lua_State*L){
+L1->base_ci=luaM_newvector(L,8,CallInfo);
+L1->ci=L1->base_ci;
+L1->size_ci=8;
+L1->end_ci=L1->base_ci+L1->size_ci-1;
+L1->stack=luaM_newvector(L,(2*20)+5,TValue);
+L1->stacksize=(2*20)+5;
+L1->top=L1->stack;
+L1->stack_last=L1->stack+(L1->stacksize-5)-1;
+L1->ci->func=L1->top;
+setnilvalue(L1->top++);
+L1->base=L1->ci->base=L1->top;
+L1->ci->top=L1->top+20;
+}
+static void freestack(lua_State*L,lua_State*L1){
+luaM_freearray(L,L1->base_ci,L1->size_ci,CallInfo);
+luaM_freearray(L,L1->stack,L1->stacksize,TValue);
+}
+static void f_luaopen(lua_State*L,void*ud){
+global_State*g=G(L);
+UNUSED(ud);
+stack_init(L,L);
+sethvalue(L,gt(L),luaH_new(L,0,2));
+sethvalue(L,registry(L),luaH_new(L,0,2));
+luaS_resize(L,32);
+luaT_init(L);
+luaX_init(L);
+luaS_fix(luaS_newliteral(L,"not enough memory"));
+g->GCthreshold=4*g->totalbytes;
+}
+static void preinit_state(lua_State*L,global_State*g){
+G(L)=g;
+L->stack=NULL;
+L->stacksize=0;
+L->errorJmp=NULL;
+L->hook=NULL;
+L->hookmask=0;
+L->basehookcount=0;
+L->allowhook=1;
+resethookcount(L);
+L->openupval=NULL;
+L->size_ci=0;
+L->nCcalls=L->baseCcalls=0;
+L->status=0;
+L->base_ci=L->ci=NULL;
+L->savedpc=NULL;
+L->errfunc=0;
+setnilvalue(gt(L));
+}
+static void close_state(lua_State*L){
+global_State*g=G(L);
+luaF_close(L,L->stack);
+luaC_freeall(L);
+luaM_freearray(L,G(L)->strt.hash,G(L)->strt.size,TString*);
+luaZ_freebuffer(L,&g->buff);
+freestack(L,L);
+(*g->frealloc)(g->ud,fromstate(L),state_size(LG),0);
+}
+static void luaE_freethread(lua_State*L,lua_State*L1){
+luaF_close(L1,L1->stack);
+freestack(L,L1);
+luaM_freemem(L,fromstate(L1),state_size(lua_State));
+}
+static lua_State*lua_newstate(lua_Alloc f,void*ud){
+int i;
+lua_State*L;
+global_State*g;
+void*l=(*f)(ud,NULL,0,state_size(LG));
+if(l==NULL)return NULL;
+L=tostate(l);
+g=&((LG*)L)->g;
+L->next=NULL;
+L->tt=8;
+g->currentwhite=bit2mask(0,5);
+L->marked=luaC_white(g);
+set2bits(L->marked,5,6);
+preinit_state(L,g);
+g->frealloc=f;
+g->ud=ud;
+g->mainthread=L;
+g->uvhead.u.l.prev=&g->uvhead;
+g->uvhead.u.l.next=&g->uvhead;
+g->GCthreshold=0;
+g->strt.size=0;
+g->strt.nuse=0;
+g->strt.hash=NULL;
+setnilvalue(registry(L));
+luaZ_initbuffer(L,&g->buff);
+g->panic=NULL;
+g->gcstate=0;
+g->rootgc=obj2gco(L);
+g->sweepstrgc=0;
+g->sweepgc=&g->rootgc;
+g->gray=NULL;
+g->grayagain=NULL;
+g->weak=NULL;
+g->tmudata=NULL;
+g->totalbytes=sizeof(LG);
+g->gcpause=200;
+g->gcstepmul=200;
+g->gcdept=0;
+for(i=0;i<(8+1);i++)g->mt[i]=NULL;
+if(luaD_rawrunprotected(L,f_luaopen,NULL)!=0){
+close_state(L);
+L=NULL;
+}
+else
+{}
+return L;
+}
+static void callallgcTM(lua_State*L,void*ud){
+UNUSED(ud);
+luaC_callGCTM(L);
+}
+static void lua_close(lua_State*L){
+L=G(L)->mainthread;
+luaF_close(L,L->stack);
+luaC_separateudata(L,1);
+L->errfunc=0;
+do{
+L->ci=L->base_ci;
+L->base=L->top=L->ci->base;
+L->nCcalls=L->baseCcalls=0;
+}while(luaD_rawrunprotected(L,callallgcTM,NULL)!=0);
+close_state(L);
+}
+#define getcode(fs,e)((fs)->f->code[(e)->u.s.info])
+#define luaK_codeAsBx(fs,o,A,sBx)luaK_codeABx(fs,o,A,(sBx)+(((1<<(9+9))-1)>>1))
+#define luaK_setmultret(fs,e)luaK_setreturns(fs,e,(-1))
+static int luaK_codeABx(FuncState*fs,OpCode o,int A,unsigned int Bx);
+static int luaK_codeABC(FuncState*fs,OpCode o,int A,int B,int C);
+static void luaK_setreturns(FuncState*fs,expdesc*e,int nresults);
+static void luaK_patchtohere(FuncState*fs,int list);
+static void luaK_concat(FuncState*fs,int*l1,int l2);
+static int currentpc(lua_State*L,CallInfo*ci){
+if(!isLua(ci))return-1;
+if(ci==L->ci)
+ci->savedpc=L->savedpc;
+return pcRel(ci->savedpc,ci_func(ci)->l.p);
+}
+static int currentline(lua_State*L,CallInfo*ci){
+int pc=currentpc(L,ci);
+if(pc<0)
+return-1;
+else
+return getline_(ci_func(ci)->l.p,pc);
+}
+static int lua_getstack(lua_State*L,int level,lua_Debug*ar){
+int status;
+CallInfo*ci;
+for(ci=L->ci;level>0&&ci>L->base_ci;ci--){
+level--;
+if(f_isLua(ci))
+level-=ci->tailcalls;
+}
+if(level==0&&ci>L->base_ci){
+status=1;
+ar->i_ci=cast_int(ci-L->base_ci);
+}
+else if(level<0){
+status=1;
+ar->i_ci=0;
+}
+else status=0;
+return status;
+}
+static Proto*getluaproto(CallInfo*ci){
+return(isLua(ci)?ci_func(ci)->l.p:NULL);
+}
+static void funcinfo(lua_Debug*ar,Closure*cl){
+if(cl->c.isC){
+ar->source="=[C]";
+ar->linedefined=-1;
+ar->lastlinedefined=-1;
+ar->what="C";
+}
+else{
+ar->source=getstr(cl->l.p->source);
+ar->linedefined=cl->l.p->linedefined;
+ar->lastlinedefined=cl->l.p->lastlinedefined;
+ar->what=(ar->linedefined==0)?"main":"Lua";
+}
+luaO_chunkid(ar->short_src,ar->source,60);
+}
+static void info_tailcall(lua_Debug*ar){
+ar->name=ar->namewhat="";
+ar->what="tail";
+ar->lastlinedefined=ar->linedefined=ar->currentline=-1;
+ar->source="=(tail call)";
+luaO_chunkid(ar->short_src,ar->source,60);
+ar->nups=0;
+}
+static void collectvalidlines(lua_State*L,Closure*f){
+if(f==NULL||f->c.isC){
+setnilvalue(L->top);
+}
+else{
+Table*t=luaH_new(L,0,0);
+int*lineinfo=f->l.p->lineinfo;
+int i;
+for(i=0;i<f->l.p->sizelineinfo;i++)
+setbvalue(luaH_setnum(L,t,lineinfo[i]),1);
+sethvalue(L,L->top,t);
+}
+incr_top(L);
+}
+static int auxgetinfo(lua_State*L,const char*what,lua_Debug*ar,
+Closure*f,CallInfo*ci){
+int status=1;
+if(f==NULL){
+info_tailcall(ar);
+return status;
+}
+for(;*what;what++){
+switch(*what){
+case'S':{
+funcinfo(ar,f);
+break;
+}
+case'l':{
+ar->currentline=(ci)?currentline(L,ci):-1;
+break;
+}
+case'u':{
+ar->nups=f->c.nupvalues;
+break;
+}
+case'n':{
+ar->namewhat=(ci)?NULL:NULL;
+if(ar->namewhat==NULL){
+ar->namewhat="";
+ar->name=NULL;
+}
+break;
+}
+case'L':
+case'f':
+break;
+default:status=0;
+}
+}
+return status;
+}
+static int lua_getinfo(lua_State*L,const char*what,lua_Debug*ar){
+int status;
+Closure*f=NULL;
+CallInfo*ci=NULL;
+if(*what=='>'){
+StkId func=L->top-1;
+luai_apicheck(L,ttisfunction(func));
+what++;
+f=clvalue(func);
+L->top--;
+}
+else if(ar->i_ci!=0){
+ci=L->base_ci+ar->i_ci;
+f=clvalue(ci->func);
+}
+status=auxgetinfo(L,what,ar,f,ci);
+if(strchr(what,'f')){
+if(f==NULL)setnilvalue(L->top);
+else setclvalue(L,L->top,f);
+incr_top(L);
+}
+if(strchr(what,'L'))
+collectvalidlines(L,f);
+return status;
+}
+static int isinstack(CallInfo*ci,const TValue*o){
+StkId p;
+for(p=ci->base;p<ci->top;p++)
+if(o==p)return 1;
+return 0;
+}
+static void luaG_typeerror(lua_State*L,const TValue*o,const char*op){
+const char*name=NULL;
+const char*t=luaT_typenames[ttype(o)];
+const char*kind=(isinstack(L->ci,o))?
+NULL:
+NULL;
+if(kind)
+luaG_runerror(L,"attempt to %s %s "LUA_QL("%s")" (a %s value)",
+op,kind,name,t);
+else
+luaG_runerror(L,"attempt to %s a %s value",op,t);
+}
+static void luaG_concaterror(lua_State*L,StkId p1,StkId p2){
+if(ttisstring(p1)||ttisnumber(p1))p1=p2;
+luaG_typeerror(L,p1,"concatenate");
+}
+static void luaG_aritherror(lua_State*L,const TValue*p1,const TValue*p2){
+TValue temp;
+if(luaV_tonumber(p1,&temp)==NULL)
+p2=p1;
+luaG_typeerror(L,p2,"perform arithmetic on");
+}
+static int luaG_ordererror(lua_State*L,const TValue*p1,const TValue*p2){
+const char*t1=luaT_typenames[ttype(p1)];
+const char*t2=luaT_typenames[ttype(p2)];
+if(t1[2]==t2[2])
+luaG_runerror(L,"attempt to compare two %s values",t1);
+else
+luaG_runerror(L,"attempt to compare %s with %s",t1,t2);
+return 0;
+}
+static void addinfo(lua_State*L,const char*msg){
+CallInfo*ci=L->ci;
+if(isLua(ci)){
+char buff[60];
+int line=currentline(L,ci);
+luaO_chunkid(buff,getstr(getluaproto(ci)->source),60);
+luaO_pushfstring(L,"%s:%d: %s",buff,line,msg);
+}
+}
+static void luaG_errormsg(lua_State*L){
+if(L->errfunc!=0){
+StkId errfunc=restorestack(L,L->errfunc);
+if(!ttisfunction(errfunc))luaD_throw(L,5);
+setobj(L,L->top,L->top-1);
+setobj(L,L->top-1,errfunc);
+incr_top(L);
+luaD_call(L,L->top-2,1);
+}
+luaD_throw(L,2);
+}
+static void luaG_runerror(lua_State*L,const char*fmt,...){
+va_list argp;
+va_start(argp,fmt);
+addinfo(L,luaO_pushvfstring(L,fmt,argp));
+va_end(argp);
+luaG_errormsg(L);
+}
+static int luaZ_fill(ZIO*z){
+size_t size;
+lua_State*L=z->L;
+const char*buff;
+buff=z->reader(L,z->data,&size);
+if(buff==NULL||size==0)return(-1);
+z->n=size-1;
+z->p=buff;
+return char2int(*(z->p++));
+}
+static void luaZ_init(lua_State*L,ZIO*z,lua_Reader reader,void*data){
+z->L=L;
+z->reader=reader;
+z->data=data;
+z->n=0;
+z->p=NULL;
+}
+static char*luaZ_openspace(lua_State*L,Mbuffer*buff,size_t n){
+if(n>buff->buffsize){
+if(n<32)n=32;
+luaZ_resizebuffer(L,buff,n);
+}
+return buff->buffer;
+}
+#define opmode(t,a,b,c,m)(((t)<<7)|((a)<<6)|((b)<<4)|((c)<<2)|(m))
+static const lu_byte luaP_opmodes[(cast(int,OP_VARARG)+1)]={
+opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgK,OpArgN,iABx)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgU,OpArgN,iABC)
+,opmode(0,1,OpArgK,OpArgN,iABx)
+,opmode(0,1,OpArgR,OpArgK,iABC)
+,opmode(0,0,OpArgK,OpArgN,iABx)
+,opmode(0,0,OpArgU,OpArgN,iABC)
+,opmode(0,0,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,1,OpArgR,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgR,iABC)
+,opmode(0,0,OpArgR,OpArgN,iAsBx)
+,opmode(1,0,OpArgK,OpArgK,iABC)
+,opmode(1,0,OpArgK,OpArgK,iABC)
+,opmode(1,0,OpArgK,OpArgK,iABC)
+,opmode(1,1,OpArgR,OpArgU,iABC)
+,opmode(1,1,OpArgR,OpArgU,iABC)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,0,OpArgU,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgN,iAsBx)
+,opmode(0,1,OpArgR,OpArgN,iAsBx)
+,opmode(1,0,OpArgN,OpArgU,iABC)
+,opmode(0,0,OpArgU,OpArgU,iABC)
+,opmode(0,0,OpArgN,OpArgN,iABC)
+,opmode(0,1,OpArgU,OpArgN,iABx)
+,opmode(0,1,OpArgU,OpArgN,iABC)
+};
+#define next(ls)(ls->current=zgetc(ls->z))
+#define currIsNewline(ls)(ls->current=='\n'||ls->current=='\r')
+static const char*const luaX_tokens[]={
+"and","break","do","else","elseif",
+"end","false","for","function","if",
+"in","local","nil","not","or","repeat",
+"return","then","true","until","while",
+"..","...","==",">=","<=","~=",
+"<number>","<name>","<string>","<eof>",
+NULL
+};
+#define save_and_next(ls)(save(ls,ls->current),next(ls))
+static void save(LexState*ls,int c){
+Mbuffer*b=ls->buff;
+if(b->n+1>b->buffsize){
+size_t newsize;
+if(b->buffsize>=((size_t)(~(size_t)0)-2)/2)
+luaX_lexerror(ls,"lexical element too long",0);
+newsize=b->buffsize*2;
+luaZ_resizebuffer(ls->L,b,newsize);
+}
+b->buffer[b->n++]=cast(char,c);
+}
+static void luaX_init(lua_State*L){
+int i;
+for(i=0;i<(cast(int,TK_WHILE-257+1));i++){
+TString*ts=luaS_new(L,luaX_tokens[i]);
+luaS_fix(ts);
+ts->tsv.reserved=cast_byte(i+1);
+}
+}
+static const char*luaX_token2str(LexState*ls,int token){
+if(token<257){
+return(iscntrl(token))?luaO_pushfstring(ls->L,"char(%d)",token):
+luaO_pushfstring(ls->L,"%c",token);
+}
+else
+return luaX_tokens[token-257];
+}
+static const char*txtToken(LexState*ls,int token){
+switch(token){
+case TK_NAME:
+case TK_STRING:
+case TK_NUMBER:
+save(ls,'\0');
+return luaZ_buffer(ls->buff);
+default:
+return luaX_token2str(ls,token);
+}
+}
+static void luaX_lexerror(LexState*ls,const char*msg,int token){
+char buff[80];
+luaO_chunkid(buff,getstr(ls->source),80);
+msg=luaO_pushfstring(ls->L,"%s:%d: %s",buff,ls->linenumber,msg);
+if(token)
+luaO_pushfstring(ls->L,"%s near "LUA_QL("%s"),msg,txtToken(ls,token));
+luaD_throw(ls->L,3);
+}
+static void luaX_syntaxerror(LexState*ls,const char*msg){
+luaX_lexerror(ls,msg,ls->t.token);
+}
+static TString*luaX_newstring(LexState*ls,const char*str,size_t l){
+lua_State*L=ls->L;
+TString*ts=luaS_newlstr(L,str,l);
+TValue*o=luaH_setstr(L,ls->fs->h,ts);
+if(ttisnil(o)){
+setbvalue(o,1);
+luaC_checkGC(L);
+}
+return ts;
+}
+static void inclinenumber(LexState*ls){
+int old=ls->current;
+next(ls);
+if(currIsNewline(ls)&&ls->current!=old)
+next(ls);
+if(++ls->linenumber>=(INT_MAX-2))
+luaX_syntaxerror(ls,"chunk has too many lines");
+}
+static void luaX_setinput(lua_State*L,LexState*ls,ZIO*z,TString*source){
+ls->decpoint='.';
+ls->L=L;
+ls->lookahead.token=TK_EOS;
+ls->z=z;
+ls->fs=NULL;
+ls->linenumber=1;
+ls->lastline=1;
+ls->source=source;
+luaZ_resizebuffer(ls->L,ls->buff,32);
+next(ls);
+}
+static int check_next(LexState*ls,const char*set){
+if(!strchr(set,ls->current))
+return 0;
+save_and_next(ls);
+return 1;
+}
+static void buffreplace(LexState*ls,char from,char to){
+size_t n=luaZ_bufflen(ls->buff);
+char*p=luaZ_buffer(ls->buff);
+while(n--)
+if(p[n]==from)p[n]=to;
+}
+static void read_numeral(LexState*ls,SemInfo*seminfo){
+do{
+save_and_next(ls);
+}while(isdigit(ls->current)||ls->current=='.');
+if(check_next(ls,"Ee"))
+check_next(ls,"+-");
+while(isalnum(ls->current)||ls->current=='_')
+save_and_next(ls);
+save(ls,'\0');
+buffreplace(ls,'.',ls->decpoint);
+if(!luaO_str2d(luaZ_buffer(ls->buff),&seminfo->r))
+luaX_lexerror(ls,"malformed number",TK_NUMBER);
+}
+static int skip_sep(LexState*ls){
+int count=0;
+int s=ls->current;
+save_and_next(ls);
+while(ls->current=='='){
+save_and_next(ls);
+count++;
+}
+return(ls->current==s)?count:(-count)-1;
+}
+static void read_long_string(LexState*ls,SemInfo*seminfo,int sep){
+int cont=0;
+(void)(cont);
+save_and_next(ls);
+if(currIsNewline(ls))
+inclinenumber(ls);
+for(;;){
+switch(ls->current){
+case(-1):
+luaX_lexerror(ls,(seminfo)?"unfinished long string":
+"unfinished long comment",TK_EOS);
+break;
+case']':{
+if(skip_sep(ls)==sep){
+save_and_next(ls);
+goto endloop;
+}
+break;
+}
+case'\n':
+case'\r':{
+save(ls,'\n');
+inclinenumber(ls);
+if(!seminfo)luaZ_resetbuffer(ls->buff);
+break;
+}
+default:{
+if(seminfo)save_and_next(ls);
+else next(ls);
+}
+}
+}endloop:
+if(seminfo)
+seminfo->ts=luaX_newstring(ls,luaZ_buffer(ls->buff)+(2+sep),
+luaZ_bufflen(ls->buff)-2*(2+sep));
+}
+static void read_string(LexState*ls,int del,SemInfo*seminfo){
+save_and_next(ls);
+while(ls->current!=del){
+switch(ls->current){
+case(-1):
+luaX_lexerror(ls,"unfinished string",TK_EOS);
+continue;
+case'\n':
+case'\r':
+luaX_lexerror(ls,"unfinished string",TK_STRING);
+continue;
+case'\\':{
+int c;
+next(ls);
+switch(ls->current){
+case'a':c='\a';break;
+case'b':c='\b';break;
+case'f':c='\f';break;
+case'n':c='\n';break;
+case'r':c='\r';break;
+case't':c='\t';break;
+case'v':c='\v';break;
+case'\n':
+case'\r':save(ls,'\n');inclinenumber(ls);continue;
+case(-1):continue;
+default:{
+if(!isdigit(ls->current))
+save_and_next(ls);
+else{
+int i=0;
+c=0;
+do{
+c=10*c+(ls->current-'0');
+next(ls);
+}while(++i<3&&isdigit(ls->current));
+if(c>UCHAR_MAX)
+luaX_lexerror(ls,"escape sequence too large",TK_STRING);
+save(ls,c);
+}
+continue;
+}
+}
+save(ls,c);
+next(ls);
+continue;
+}
+default:
+save_and_next(ls);
+}
+}
+save_and_next(ls);
+seminfo->ts=luaX_newstring(ls,luaZ_buffer(ls->buff)+1,
+luaZ_bufflen(ls->buff)-2);
+}
+static int llex(LexState*ls,SemInfo*seminfo){
+luaZ_resetbuffer(ls->buff);
+for(;;){
+switch(ls->current){
+case'\n':
+case'\r':{
+inclinenumber(ls);
+continue;
+}
+case'-':{
+next(ls);
+if(ls->current!='-')return'-';
+next(ls);
+if(ls->current=='['){
+int sep=skip_sep(ls);
+luaZ_resetbuffer(ls->buff);
+if(sep>=0){
+read_long_string(ls,NULL,sep);
+luaZ_resetbuffer(ls->buff);
+continue;
+}
+}
+while(!currIsNewline(ls)&&ls->current!=(-1))
+next(ls);
+continue;
+}
+case'[':{
+int sep=skip_sep(ls);
+if(sep>=0){
+read_long_string(ls,seminfo,sep);
+return TK_STRING;
+}
+else if(sep==-1)return'[';
+else luaX_lexerror(ls,"invalid long string delimiter",TK_STRING);
+}
+case'=':{
+next(ls);
+if(ls->current!='=')return'=';
+else{next(ls);return TK_EQ;}
+}
+case'<':{
+next(ls);
+if(ls->current!='=')return'<';
+else{next(ls);return TK_LE;}
+}
+case'>':{
+next(ls);
+if(ls->current!='=')return'>';
+else{next(ls);return TK_GE;}
+}
+case'~':{
+next(ls);
+if(ls->current!='=')return'~';
+else{next(ls);return TK_NE;}
+}
+case'"':
+case'\'':{
+read_string(ls,ls->current,seminfo);
+return TK_STRING;
+}
+case'.':{
+save_and_next(ls);
+if(check_next(ls,".")){
+if(check_next(ls,"."))
+return TK_DOTS;
+else return TK_CONCAT;
+}
+else if(!isdigit(ls->current))return'.';
+else{
+read_numeral(ls,seminfo);
+return TK_NUMBER;
+}
+}
+case(-1):{
+return TK_EOS;
+}
+default:{
+if(isspace(ls->current)){
+next(ls);
+continue;
+}
+else if(isdigit(ls->current)){
+read_numeral(ls,seminfo);
+return TK_NUMBER;
+}
+else if(isalpha(ls->current)||ls->current=='_'){
+TString*ts;
+do{
+save_and_next(ls);
+}while(isalnum(ls->current)||ls->current=='_');
+ts=luaX_newstring(ls,luaZ_buffer(ls->buff),
+luaZ_bufflen(ls->buff));
+if(ts->tsv.reserved>0)
+return ts->tsv.reserved-1+257;
+else{
+seminfo->ts=ts;
+return TK_NAME;
+}
+}
+else{
+int c=ls->current;
+next(ls);
+return c;
+}
+}
+}
+}
+}
+static void luaX_next(LexState*ls){
+ls->lastline=ls->linenumber;
+if(ls->lookahead.token!=TK_EOS){
+ls->t=ls->lookahead;
+ls->lookahead.token=TK_EOS;
+}
+else
+ls->t.token=llex(ls,&ls->t.seminfo);
+}
+static void luaX_lookahead(LexState*ls){
+ls->lookahead.token=llex(ls,&ls->lookahead.seminfo);
+}
+#define hasjumps(e)((e)->t!=(e)->f)
+static int isnumeral(expdesc*e){
+return(e->k==VKNUM&&e->t==(-1)&&e->f==(-1));
+}
+static void luaK_nil(FuncState*fs,int from,int n){
+Instruction*previous;
+if(fs->pc>fs->lasttarget){
+if(fs->pc==0){
+if(from>=fs->nactvar)
+return;
+}
+else{
+previous=&fs->f->code[fs->pc-1];
+if(GET_OPCODE(*previous)==OP_LOADNIL){
+int pfrom=GETARG_A(*previous);
+int pto=GETARG_B(*previous);
+if(pfrom<=from&&from<=pto+1){
+if(from+n-1>pto)
+SETARG_B(*previous,from+n-1);
+return;
+}
+}
+}
+}
+luaK_codeABC(fs,OP_LOADNIL,from,from+n-1,0);
+}
+static int luaK_jump(FuncState*fs){
+int jpc=fs->jpc;
+int j;
+fs->jpc=(-1);
+j=luaK_codeAsBx(fs,OP_JMP,0,(-1));
+luaK_concat(fs,&j,jpc);
+return j;
+}
+static void luaK_ret(FuncState*fs,int first,int nret){
+luaK_codeABC(fs,OP_RETURN,first,nret+1,0);
+}
+static int condjump(FuncState*fs,OpCode op,int A,int B,int C){
+luaK_codeABC(fs,op,A,B,C);
+return luaK_jump(fs);
+}
+static void fixjump(FuncState*fs,int pc,int dest){
+Instruction*jmp=&fs->f->code[pc];
+int offset=dest-(pc+1);
+if(abs(offset)>(((1<<(9+9))-1)>>1))
+luaX_syntaxerror(fs->ls,"control structure too long");
+SETARG_sBx(*jmp,offset);
+}
+static int luaK_getlabel(FuncState*fs){
+fs->lasttarget=fs->pc;
+return fs->pc;
+}
+static int getjump(FuncState*fs,int pc){
+int offset=GETARG_sBx(fs->f->code[pc]);
+if(offset==(-1))
+return(-1);
+else
+return(pc+1)+offset;
+}
+static Instruction*getjumpcontrol(FuncState*fs,int pc){
+Instruction*pi=&fs->f->code[pc];
+if(pc>=1&&testTMode(GET_OPCODE(*(pi-1))))
+return pi-1;
+else
+return pi;
+}
+static int need_value(FuncState*fs,int list){
+for(;list!=(-1);list=getjump(fs,list)){
+Instruction i=*getjumpcontrol(fs,list);
+if(GET_OPCODE(i)!=OP_TESTSET)return 1;
+}
+return 0;
+}
+static int patchtestreg(FuncState*fs,int node,int reg){
+Instruction*i=getjumpcontrol(fs,node);
+if(GET_OPCODE(*i)!=OP_TESTSET)
+return 0;
+if(reg!=((1<<8)-1)&&reg!=GETARG_B(*i))
+SETARG_A(*i,reg);
+else
+*i=CREATE_ABC(OP_TEST,GETARG_B(*i),0,GETARG_C(*i));
+return 1;
+}
+static void removevalues(FuncState*fs,int list){
+for(;list!=(-1);list=getjump(fs,list))
+patchtestreg(fs,list,((1<<8)-1));
+}
+static void patchlistaux(FuncState*fs,int list,int vtarget,int reg,
+int dtarget){
+while(list!=(-1)){
+int next=getjump(fs,list);
+if(patchtestreg(fs,list,reg))
+fixjump(fs,list,vtarget);
+else
+fixjump(fs,list,dtarget);
+list=next;
+}
+}
+static void dischargejpc(FuncState*fs){
+patchlistaux(fs,fs->jpc,fs->pc,((1<<8)-1),fs->pc);
+fs->jpc=(-1);
+}
+static void luaK_patchlist(FuncState*fs,int list,int target){
+if(target==fs->pc)
+luaK_patchtohere(fs,list);
+else{
+patchlistaux(fs,list,target,((1<<8)-1),target);
+}
+}
+static void luaK_patchtohere(FuncState*fs,int list){
+luaK_getlabel(fs);
+luaK_concat(fs,&fs->jpc,list);
+}
+static void luaK_concat(FuncState*fs,int*l1,int l2){
+if(l2==(-1))return;
+else if(*l1==(-1))
+*l1=l2;
+else{
+int list=*l1;
+int next;
+while((next=getjump(fs,list))!=(-1))
+list=next;
+fixjump(fs,list,l2);
+}
+}
+static void luaK_checkstack(FuncState*fs,int n){
+int newstack=fs->freereg+n;
+if(newstack>fs->f->maxstacksize){
+if(newstack>=250)
+luaX_syntaxerror(fs->ls,"function or expression too complex");
+fs->f->maxstacksize=cast_byte(newstack);
+}
+}
+static void luaK_reserveregs(FuncState*fs,int n){
+luaK_checkstack(fs,n);
+fs->freereg+=n;
+}
+static void freereg(FuncState*fs,int reg){
+if(!ISK(reg)&&reg>=fs->nactvar){
+fs->freereg--;
+}
+}
+static void freeexp(FuncState*fs,expdesc*e){
+if(e->k==VNONRELOC)
+freereg(fs,e->u.s.info);
+}
+static int addk(FuncState*fs,TValue*k,TValue*v){
+lua_State*L=fs->L;
+TValue*idx=luaH_set(L,fs->h,k);
+Proto*f=fs->f;
+int oldsize=f->sizek;
+if(ttisnumber(idx)){
+return cast_int(nvalue(idx));
+}
+else{
+setnvalue(idx,cast_num(fs->nk));
+luaM_growvector(L,f->k,fs->nk,f->sizek,TValue,
+((1<<(9+9))-1),"constant table overflow");
+while(oldsize<f->sizek)setnilvalue(&f->k[oldsize++]);
+setobj(L,&f->k[fs->nk],v);
+luaC_barrier(L,f,v);
+return fs->nk++;
+}
+}
+static int luaK_stringK(FuncState*fs,TString*s){
+TValue o;
+setsvalue(fs->L,&o,s);
+return addk(fs,&o,&o);
+}
+static int luaK_numberK(FuncState*fs,lua_Number r){
+TValue o;
+setnvalue(&o,r);
+return addk(fs,&o,&o);
+}
+static int boolK(FuncState*fs,int b){
+TValue o;
+setbvalue(&o,b);
+return addk(fs,&o,&o);
+}
+static int nilK(FuncState*fs){
+TValue k,v;
+setnilvalue(&v);
+sethvalue(fs->L,&k,fs->h);
+return addk(fs,&k,&v);
+}
+static void luaK_setreturns(FuncState*fs,expdesc*e,int nresults){
+if(e->k==VCALL){
+SETARG_C(getcode(fs,e),nresults+1);
+}
+else if(e->k==VVARARG){
+SETARG_B(getcode(fs,e),nresults+1);
+SETARG_A(getcode(fs,e),fs->freereg);
+luaK_reserveregs(fs,1);
+}
+}
+static void luaK_setoneret(FuncState*fs,expdesc*e){
+if(e->k==VCALL){
+e->k=VNONRELOC;
+e->u.s.info=GETARG_A(getcode(fs,e));
+}
+else if(e->k==VVARARG){
+SETARG_B(getcode(fs,e),2);
+e->k=VRELOCABLE;
+}
+}
+static void luaK_dischargevars(FuncState*fs,expdesc*e){
+switch(e->k){
+case VLOCAL:{
+e->k=VNONRELOC;
+break;
+}
+case VUPVAL:{
+e->u.s.info=luaK_codeABC(fs,OP_GETUPVAL,0,e->u.s.info,0);
+e->k=VRELOCABLE;
+break;
+}
+case VGLOBAL:{
+e->u.s.info=luaK_codeABx(fs,OP_GETGLOBAL,0,e->u.s.info);
+e->k=VRELOCABLE;
+break;
+}
+case VINDEXED:{
+freereg(fs,e->u.s.aux);
+freereg(fs,e->u.s.info);
+e->u.s.info=luaK_codeABC(fs,OP_GETTABLE,0,e->u.s.info,e->u.s.aux);
+e->k=VRELOCABLE;
+break;
+}
+case VVARARG:
+case VCALL:{
+luaK_setoneret(fs,e);
+break;
+}
+default:break;
+}
+}
+static int code_label(FuncState*fs,int A,int b,int jump){
+luaK_getlabel(fs);
+return luaK_codeABC(fs,OP_LOADBOOL,A,b,jump);
+}
+static void discharge2reg(FuncState*fs,expdesc*e,int reg){
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VNIL:{
+luaK_nil(fs,reg,1);
+break;
+}
+case VFALSE:case VTRUE:{
+luaK_codeABC(fs,OP_LOADBOOL,reg,e->k==VTRUE,0);
+break;
+}
+case VK:{
+luaK_codeABx(fs,OP_LOADK,reg,e->u.s.info);
+break;
+}
+case VKNUM:{
+luaK_codeABx(fs,OP_LOADK,reg,luaK_numberK(fs,e->u.nval));
+break;
+}
+case VRELOCABLE:{
+Instruction*pc=&getcode(fs,e);
+SETARG_A(*pc,reg);
+break;
+}
+case VNONRELOC:{
+if(reg!=e->u.s.info)
+luaK_codeABC(fs,OP_MOVE,reg,e->u.s.info,0);
+break;
+}
+default:{
+return;
+}
+}
+e->u.s.info=reg;
+e->k=VNONRELOC;
+}
+static void discharge2anyreg(FuncState*fs,expdesc*e){
+if(e->k!=VNONRELOC){
+luaK_reserveregs(fs,1);
+discharge2reg(fs,e,fs->freereg-1);
+}
+}
+static void exp2reg(FuncState*fs,expdesc*e,int reg){
+discharge2reg(fs,e,reg);
+if(e->k==VJMP)
+luaK_concat(fs,&e->t,e->u.s.info);
+if(hasjumps(e)){
+int final;
+int p_f=(-1);
+int p_t=(-1);
+if(need_value(fs,e->t)||need_value(fs,e->f)){
+int fj=(e->k==VJMP)?(-1):luaK_jump(fs);
+p_f=code_label(fs,reg,0,1);
+p_t=code_label(fs,reg,1,0);
+luaK_patchtohere(fs,fj);
+}
+final=luaK_getlabel(fs);
+patchlistaux(fs,e->f,final,reg,p_f);
+patchlistaux(fs,e->t,final,reg,p_t);
+}
+e->f=e->t=(-1);
+e->u.s.info=reg;
+e->k=VNONRELOC;
+}
+static void luaK_exp2nextreg(FuncState*fs,expdesc*e){
+luaK_dischargevars(fs,e);
+freeexp(fs,e);
+luaK_reserveregs(fs,1);
+exp2reg(fs,e,fs->freereg-1);
+}
+static int luaK_exp2anyreg(FuncState*fs,expdesc*e){
+luaK_dischargevars(fs,e);
+if(e->k==VNONRELOC){
+if(!hasjumps(e))return e->u.s.info;
+if(e->u.s.info>=fs->nactvar){
+exp2reg(fs,e,e->u.s.info);
+return e->u.s.info;
+}
+}
+luaK_exp2nextreg(fs,e);
+return e->u.s.info;
+}
+static void luaK_exp2val(FuncState*fs,expdesc*e){
+if(hasjumps(e))
+luaK_exp2anyreg(fs,e);
+else
+luaK_dischargevars(fs,e);
+}
+static int luaK_exp2RK(FuncState*fs,expdesc*e){
+luaK_exp2val(fs,e);
+switch(e->k){
+case VKNUM:
+case VTRUE:
+case VFALSE:
+case VNIL:{
+if(fs->nk<=((1<<(9-1))-1)){
+e->u.s.info=(e->k==VNIL)?nilK(fs):
+(e->k==VKNUM)?luaK_numberK(fs,e->u.nval):
+boolK(fs,(e->k==VTRUE));
+e->k=VK;
+return RKASK(e->u.s.info);
+}
+else break;
+}
+case VK:{
+if(e->u.s.info<=((1<<(9-1))-1))
+return RKASK(e->u.s.info);
+else break;
+}
+default:break;
+}
+return luaK_exp2anyreg(fs,e);
+}
+static void luaK_storevar(FuncState*fs,expdesc*var,expdesc*ex){
+switch(var->k){
+case VLOCAL:{
+freeexp(fs,ex);
+exp2reg(fs,ex,var->u.s.info);
+return;
+}
+case VUPVAL:{
+int e=luaK_exp2anyreg(fs,ex);
+luaK_codeABC(fs,OP_SETUPVAL,e,var->u.s.info,0);
+break;
+}
+case VGLOBAL:{
+int e=luaK_exp2anyreg(fs,ex);
+luaK_codeABx(fs,OP_SETGLOBAL,e,var->u.s.info);
+break;
+}
+case VINDEXED:{
+int e=luaK_exp2RK(fs,ex);
+luaK_codeABC(fs,OP_SETTABLE,var->u.s.info,var->u.s.aux,e);
+break;
+}
+default:{
+break;
+}
+}
+freeexp(fs,ex);
+}
+static void luaK_self(FuncState*fs,expdesc*e,expdesc*key){
+int func;
+luaK_exp2anyreg(fs,e);
+freeexp(fs,e);
+func=fs->freereg;
+luaK_reserveregs(fs,2);
+luaK_codeABC(fs,OP_SELF,func,e->u.s.info,luaK_exp2RK(fs,key));
+freeexp(fs,key);
+e->u.s.info=func;
+e->k=VNONRELOC;
+}
+static void invertjump(FuncState*fs,expdesc*e){
+Instruction*pc=getjumpcontrol(fs,e->u.s.info);
+SETARG_A(*pc,!(GETARG_A(*pc)));
+}
+static int jumponcond(FuncState*fs,expdesc*e,int cond){
+if(e->k==VRELOCABLE){
+Instruction ie=getcode(fs,e);
+if(GET_OPCODE(ie)==OP_NOT){
+fs->pc--;
+return condjump(fs,OP_TEST,GETARG_B(ie),0,!cond);
+}
+}
+discharge2anyreg(fs,e);
+freeexp(fs,e);
+return condjump(fs,OP_TESTSET,((1<<8)-1),e->u.s.info,cond);
+}
+static void luaK_goiftrue(FuncState*fs,expdesc*e){
+int pc;
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VK:case VKNUM:case VTRUE:{
+pc=(-1);
+break;
+}
+case VJMP:{
+invertjump(fs,e);
+pc=e->u.s.info;
+break;
+}
+default:{
+pc=jumponcond(fs,e,0);
+break;
+}
+}
+luaK_concat(fs,&e->f,pc);
+luaK_patchtohere(fs,e->t);
+e->t=(-1);
+}
+static void luaK_goiffalse(FuncState*fs,expdesc*e){
+int pc;
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VNIL:case VFALSE:{
+pc=(-1);
+break;
+}
+case VJMP:{
+pc=e->u.s.info;
+break;
+}
+default:{
+pc=jumponcond(fs,e,1);
+break;
+}
+}
+luaK_concat(fs,&e->t,pc);
+luaK_patchtohere(fs,e->f);
+e->f=(-1);
+}
+static void codenot(FuncState*fs,expdesc*e){
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VNIL:case VFALSE:{
+e->k=VTRUE;
+break;
+}
+case VK:case VKNUM:case VTRUE:{
+e->k=VFALSE;
+break;
+}
+case VJMP:{
+invertjump(fs,e);
+break;
+}
+case VRELOCABLE:
+case VNONRELOC:{
+discharge2anyreg(fs,e);
+freeexp(fs,e);
+e->u.s.info=luaK_codeABC(fs,OP_NOT,0,e->u.s.info,0);
+e->k=VRELOCABLE;
+break;
+}
+default:{
+break;
+}
+}
+{int temp=e->f;e->f=e->t;e->t=temp;}
+removevalues(fs,e->f);
+removevalues(fs,e->t);
+}
+static void luaK_indexed(FuncState*fs,expdesc*t,expdesc*k){
+t->u.s.aux=luaK_exp2RK(fs,k);
+t->k=VINDEXED;
+}
+static int constfolding(OpCode op,expdesc*e1,expdesc*e2){
+lua_Number v1,v2,r;
+if(!isnumeral(e1)||!isnumeral(e2))return 0;
+v1=e1->u.nval;
+v2=e2->u.nval;
+switch(op){
+case OP_ADD:r=luai_numadd(v1,v2);break;
+case OP_SUB:r=luai_numsub(v1,v2);break;
+case OP_MUL:r=luai_nummul(v1,v2);break;
+case OP_DIV:
+if(v2==0)return 0;
+r=luai_numdiv(v1,v2);break;
+case OP_MOD:
+if(v2==0)return 0;
+r=luai_nummod(v1,v2);break;
+case OP_POW:r=luai_numpow(v1,v2);break;
+case OP_UNM:r=luai_numunm(v1);break;
+case OP_LEN:return 0;
+default:r=0;break;
+}
+if(luai_numisnan(r))return 0;
+e1->u.nval=r;
+return 1;
+}
+static void codearith(FuncState*fs,OpCode op,expdesc*e1,expdesc*e2){
+if(constfolding(op,e1,e2))
+return;
+else{
+int o2=(op!=OP_UNM&&op!=OP_LEN)?luaK_exp2RK(fs,e2):0;
+int o1=luaK_exp2RK(fs,e1);
+if(o1>o2){
+freeexp(fs,e1);
+freeexp(fs,e2);
+}
+else{
+freeexp(fs,e2);
+freeexp(fs,e1);
+}
+e1->u.s.info=luaK_codeABC(fs,op,0,o1,o2);
+e1->k=VRELOCABLE;
+}
+}
+static void codecomp(FuncState*fs,OpCode op,int cond,expdesc*e1,
+expdesc*e2){
+int o1=luaK_exp2RK(fs,e1);
+int o2=luaK_exp2RK(fs,e2);
+freeexp(fs,e2);
+freeexp(fs,e1);
+if(cond==0&&op!=OP_EQ){
+int temp;
+temp=o1;o1=o2;o2=temp;
+cond=1;
+}
+e1->u.s.info=condjump(fs,op,cond,o1,o2);
+e1->k=VJMP;
+}
+static void luaK_prefix(FuncState*fs,UnOpr op,expdesc*e){
+expdesc e2;
+e2.t=e2.f=(-1);e2.k=VKNUM;e2.u.nval=0;
+switch(op){
+case OPR_MINUS:{
+if(!isnumeral(e))
+luaK_exp2anyreg(fs,e);
+codearith(fs,OP_UNM,e,&e2);
+break;
+}
+case OPR_NOT:codenot(fs,e);break;
+case OPR_LEN:{
+luaK_exp2anyreg(fs,e);
+codearith(fs,OP_LEN,e,&e2);
+break;
+}
+default:;
+}
+}
+static void luaK_infix(FuncState*fs,BinOpr op,expdesc*v){
+switch(op){
+case OPR_AND:{
+luaK_goiftrue(fs,v);
+break;
+}
+case OPR_OR:{
+luaK_goiffalse(fs,v);
+break;
+}
+case OPR_CONCAT:{
+luaK_exp2nextreg(fs,v);
+break;
+}
+case OPR_ADD:case OPR_SUB:case OPR_MUL:case OPR_DIV:
+case OPR_MOD:case OPR_POW:{
+if(!isnumeral(v))luaK_exp2RK(fs,v);
+break;
+}
+default:{
+luaK_exp2RK(fs,v);
+break;
+}
+}
+}
+static void luaK_posfix(FuncState*fs,BinOpr op,expdesc*e1,expdesc*e2){
+switch(op){
+case OPR_AND:{
+luaK_dischargevars(fs,e2);
+luaK_concat(fs,&e2->f,e1->f);
+*e1=*e2;
+break;
+}
+case OPR_OR:{
+luaK_dischargevars(fs,e2);
+luaK_concat(fs,&e2->t,e1->t);
+*e1=*e2;
+break;
+}
+case OPR_CONCAT:{
+luaK_exp2val(fs,e2);
+if(e2->k==VRELOCABLE&&GET_OPCODE(getcode(fs,e2))==OP_CONCAT){
+freeexp(fs,e1);
+SETARG_B(getcode(fs,e2),e1->u.s.info);
+e1->k=VRELOCABLE;e1->u.s.info=e2->u.s.info;
+}
+else{
+luaK_exp2nextreg(fs,e2);
+codearith(fs,OP_CONCAT,e1,e2);
+}
+break;
+}
+case OPR_ADD:codearith(fs,OP_ADD,e1,e2);break;
+case OPR_SUB:codearith(fs,OP_SUB,e1,e2);break;
+case OPR_MUL:codearith(fs,OP_MUL,e1,e2);break;
+case OPR_DIV:codearith(fs,OP_DIV,e1,e2);break;
+case OPR_MOD:codearith(fs,OP_MOD,e1,e2);break;
+case OPR_POW:codearith(fs,OP_POW,e1,e2);break;
+case OPR_EQ:codecomp(fs,OP_EQ,1,e1,e2);break;
+case OPR_NE:codecomp(fs,OP_EQ,0,e1,e2);break;
+case OPR_LT:codecomp(fs,OP_LT,1,e1,e2);break;
+case OPR_LE:codecomp(fs,OP_LE,1,e1,e2);break;
+case OPR_GT:codecomp(fs,OP_LT,0,e1,e2);break;
+case OPR_GE:codecomp(fs,OP_LE,0,e1,e2);break;
+default:;
+}
+}
+static void luaK_fixline(FuncState*fs,int line){
+fs->f->lineinfo[fs->pc-1]=line;
+}
+static int luaK_code(FuncState*fs,Instruction i,int line){
+Proto*f=fs->f;
+dischargejpc(fs);
+luaM_growvector(fs->L,f->code,fs->pc,f->sizecode,Instruction,
+(INT_MAX-2),"code size overflow");
+f->code[fs->pc]=i;
+luaM_growvector(fs->L,f->lineinfo,fs->pc,f->sizelineinfo,int,
+(INT_MAX-2),"code size overflow");
+f->lineinfo[fs->pc]=line;
+return fs->pc++;
+}
+static int luaK_codeABC(FuncState*fs,OpCode o,int a,int b,int c){
+return luaK_code(fs,CREATE_ABC(o,a,b,c),fs->ls->lastline);
+}
+static int luaK_codeABx(FuncState*fs,OpCode o,int a,unsigned int bc){
+return luaK_code(fs,CREATE_ABx(o,a,bc),fs->ls->lastline);
+}
+static void luaK_setlist(FuncState*fs,int base,int nelems,int tostore){
+int c=(nelems-1)/50+1;
+int b=(tostore==(-1))?0:tostore;
+if(c<=((1<<9)-1))
+luaK_codeABC(fs,OP_SETLIST,base,b,c);
+else{
+luaK_codeABC(fs,OP_SETLIST,base,b,0);
+luaK_code(fs,cast(Instruction,c),fs->ls->lastline);
+}
+fs->freereg=base+1;
+}
+#define hasmultret(k)((k)==VCALL||(k)==VVARARG)
+#define getlocvar(fs,i)((fs)->f->locvars[(fs)->actvar[i]])
+#define luaY_checklimit(fs,v,l,m)if((v)>(l))errorlimit(fs,l,m)
+typedef struct BlockCnt{
+struct BlockCnt*previous;
+int breaklist;
+lu_byte nactvar;
+lu_byte upval;
+lu_byte isbreakable;
+}BlockCnt;
+static void chunk(LexState*ls);
+static void expr(LexState*ls,expdesc*v);
+static void anchor_token(LexState*ls){
+if(ls->t.token==TK_NAME||ls->t.token==TK_STRING){
+TString*ts=ls->t.seminfo.ts;
+luaX_newstring(ls,getstr(ts),ts->tsv.len);
+}
+}
+static void error_expected(LexState*ls,int token){
+luaX_syntaxerror(ls,
+luaO_pushfstring(ls->L,LUA_QL("%s")" expected",luaX_token2str(ls,token)));
+}
+static void errorlimit(FuncState*fs,int limit,const char*what){
+const char*msg=(fs->f->linedefined==0)?
+luaO_pushfstring(fs->L,"main function has more than %d %s",limit,what):
+luaO_pushfstring(fs->L,"function at line %d has more than %d %s",
+fs->f->linedefined,limit,what);
+luaX_lexerror(fs->ls,msg,0);
+}
+static int testnext(LexState*ls,int c){
+if(ls->t.token==c){
+luaX_next(ls);
+return 1;
+}
+else return 0;
+}
+static void check(LexState*ls,int c){
+if(ls->t.token!=c)
+error_expected(ls,c);
+}
+static void checknext(LexState*ls,int c){
+check(ls,c);
+luaX_next(ls);
+}
+#define check_condition(ls,c,msg){if(!(c))luaX_syntaxerror(ls,msg);}
+static void check_match(LexState*ls,int what,int who,int where){
+if(!testnext(ls,what)){
+if(where==ls->linenumber)
+error_expected(ls,what);
+else{
+luaX_syntaxerror(ls,luaO_pushfstring(ls->L,
+LUA_QL("%s")" expected (to close "LUA_QL("%s")" at line %d)",
+luaX_token2str(ls,what),luaX_token2str(ls,who),where));
+}
+}
+}
+static TString*str_checkname(LexState*ls){
+TString*ts;
+check(ls,TK_NAME);
+ts=ls->t.seminfo.ts;
+luaX_next(ls);
+return ts;
+}
+static void init_exp(expdesc*e,expkind k,int i){
+e->f=e->t=(-1);
+e->k=k;
+e->u.s.info=i;
+}
+static void codestring(LexState*ls,expdesc*e,TString*s){
+init_exp(e,VK,luaK_stringK(ls->fs,s));
+}
+static void checkname(LexState*ls,expdesc*e){
+codestring(ls,e,str_checkname(ls));
+}
+static int registerlocalvar(LexState*ls,TString*varname){
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+int oldsize=f->sizelocvars;
+luaM_growvector(ls->L,f->locvars,fs->nlocvars,f->sizelocvars,
+LocVar,SHRT_MAX,"too many local variables");
+while(oldsize<f->sizelocvars)f->locvars[oldsize++].varname=NULL;
+f->locvars[fs->nlocvars].varname=varname;
+luaC_objbarrier(ls->L,f,varname);
+return fs->nlocvars++;
+}
+#define new_localvarliteral(ls,v,n)new_localvar(ls,luaX_newstring(ls,""v,(sizeof(v)/sizeof(char))-1),n)
+static void new_localvar(LexState*ls,TString*name,int n){
+FuncState*fs=ls->fs;
+luaY_checklimit(fs,fs->nactvar+n+1,200,"local variables");
+fs->actvar[fs->nactvar+n]=cast(unsigned short,registerlocalvar(ls,name));
+}
+static void adjustlocalvars(LexState*ls,int nvars){
+FuncState*fs=ls->fs;
+fs->nactvar=cast_byte(fs->nactvar+nvars);
+for(;nvars;nvars--){
+getlocvar(fs,fs->nactvar-nvars).startpc=fs->pc;
+}
+}
+static void removevars(LexState*ls,int tolevel){
+FuncState*fs=ls->fs;
+while(fs->nactvar>tolevel)
+getlocvar(fs,--fs->nactvar).endpc=fs->pc;
+}
+static int indexupvalue(FuncState*fs,TString*name,expdesc*v){
+int i;
+Proto*f=fs->f;
+int oldsize=f->sizeupvalues;
+for(i=0;i<f->nups;i++){
+if(fs->upvalues[i].k==v->k&&fs->upvalues[i].info==v->u.s.info){
+return i;
+}
+}
+luaY_checklimit(fs,f->nups+1,60,"upvalues");
+luaM_growvector(fs->L,f->upvalues,f->nups,f->sizeupvalues,
+TString*,(INT_MAX-2),"");
+while(oldsize<f->sizeupvalues)f->upvalues[oldsize++]=NULL;
+f->upvalues[f->nups]=name;
+luaC_objbarrier(fs->L,f,name);
+fs->upvalues[f->nups].k=cast_byte(v->k);
+fs->upvalues[f->nups].info=cast_byte(v->u.s.info);
+return f->nups++;
+}
+static int searchvar(FuncState*fs,TString*n){
+int i;
+for(i=fs->nactvar-1;i>=0;i--){
+if(n==getlocvar(fs,i).varname)
+return i;
+}
+return-1;
+}
+static void markupval(FuncState*fs,int level){
+BlockCnt*bl=fs->bl;
+while(bl&&bl->nactvar>level)bl=bl->previous;
+if(bl)bl->upval=1;
+}
+static int singlevaraux(FuncState*fs,TString*n,expdesc*var,int base){
+if(fs==NULL){
+init_exp(var,VGLOBAL,((1<<8)-1));
+return VGLOBAL;
+}
+else{
+int v=searchvar(fs,n);
+if(v>=0){
+init_exp(var,VLOCAL,v);
+if(!base)
+markupval(fs,v);
+return VLOCAL;
+}
+else{
+if(singlevaraux(fs->prev,n,var,0)==VGLOBAL)
+return VGLOBAL;
+var->u.s.info=indexupvalue(fs,n,var);
+var->k=VUPVAL;
+return VUPVAL;
+}
+}
+}
+static void singlevar(LexState*ls,expdesc*var){
+TString*varname=str_checkname(ls);
+FuncState*fs=ls->fs;
+if(singlevaraux(fs,varname,var,1)==VGLOBAL)
+var->u.s.info=luaK_stringK(fs,varname);
+}
+static void adjust_assign(LexState*ls,int nvars,int nexps,expdesc*e){
+FuncState*fs=ls->fs;
+int extra=nvars-nexps;
+if(hasmultret(e->k)){
+extra++;
+if(extra<0)extra=0;
+luaK_setreturns(fs,e,extra);
+if(extra>1)luaK_reserveregs(fs,extra-1);
+}
+else{
+if(e->k!=VVOID)luaK_exp2nextreg(fs,e);
+if(extra>0){
+int reg=fs->freereg;
+luaK_reserveregs(fs,extra);
+luaK_nil(fs,reg,extra);
+}
+}
+}
+static void enterlevel(LexState*ls){
+if(++ls->L->nCcalls>200)
+luaX_lexerror(ls,"chunk has too many syntax levels",0);
+}
+#define leavelevel(ls)((ls)->L->nCcalls--)
+static void enterblock(FuncState*fs,BlockCnt*bl,lu_byte isbreakable){
+bl->breaklist=(-1);
+bl->isbreakable=isbreakable;
+bl->nactvar=fs->nactvar;
+bl->upval=0;
+bl->previous=fs->bl;
+fs->bl=bl;
+}
+static void leaveblock(FuncState*fs){
+BlockCnt*bl=fs->bl;
+fs->bl=bl->previous;
+removevars(fs->ls,bl->nactvar);
+if(bl->upval)
+luaK_codeABC(fs,OP_CLOSE,bl->nactvar,0,0);
+fs->freereg=fs->nactvar;
+luaK_patchtohere(fs,bl->breaklist);
+}
+static void pushclosure(LexState*ls,FuncState*func,expdesc*v){
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+int oldsize=f->sizep;
+int i;
+luaM_growvector(ls->L,f->p,fs->np,f->sizep,Proto*,
+((1<<(9+9))-1),"constant table overflow");
+while(oldsize<f->sizep)f->p[oldsize++]=NULL;
+f->p[fs->np++]=func->f;
+luaC_objbarrier(ls->L,f,func->f);
+init_exp(v,VRELOCABLE,luaK_codeABx(fs,OP_CLOSURE,0,fs->np-1));
+for(i=0;i<func->f->nups;i++){
+OpCode o=(func->upvalues[i].k==VLOCAL)?OP_MOVE:OP_GETUPVAL;
+luaK_codeABC(fs,o,0,func->upvalues[i].info,0);
+}
+}
+static void open_func(LexState*ls,FuncState*fs){
+lua_State*L=ls->L;
+Proto*f=luaF_newproto(L);
+fs->f=f;
+fs->prev=ls->fs;
+fs->ls=ls;
+fs->L=L;
+ls->fs=fs;
+fs->pc=0;
+fs->lasttarget=-1;
+fs->jpc=(-1);
+fs->freereg=0;
+fs->nk=0;
+fs->np=0;
+fs->nlocvars=0;
+fs->nactvar=0;
+fs->bl=NULL;
+f->source=ls->source;
+f->maxstacksize=2;
+fs->h=luaH_new(L,0,0);
+sethvalue(L,L->top,fs->h);
+incr_top(L);
+setptvalue(L,L->top,f);
+incr_top(L);
+}
+static void close_func(LexState*ls){
+lua_State*L=ls->L;
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+removevars(ls,0);
+luaK_ret(fs,0,0);
+luaM_reallocvector(L,f->code,f->sizecode,fs->pc,Instruction);
+f->sizecode=fs->pc;
+luaM_reallocvector(L,f->lineinfo,f->sizelineinfo,fs->pc,int);
+f->sizelineinfo=fs->pc;
+luaM_reallocvector(L,f->k,f->sizek,fs->nk,TValue);
+f->sizek=fs->nk;
+luaM_reallocvector(L,f->p,f->sizep,fs->np,Proto*);
+f->sizep=fs->np;
+luaM_reallocvector(L,f->locvars,f->sizelocvars,fs->nlocvars,LocVar);
+f->sizelocvars=fs->nlocvars;
+luaM_reallocvector(L,f->upvalues,f->sizeupvalues,f->nups,TString*);
+f->sizeupvalues=f->nups;
+ls->fs=fs->prev;
+if(fs)anchor_token(ls);
+L->top-=2;
+}
+static Proto*luaY_parser(lua_State*L,ZIO*z,Mbuffer*buff,const char*name){
+struct LexState lexstate;
+struct FuncState funcstate;
+lexstate.buff=buff;
+luaX_setinput(L,&lexstate,z,luaS_new(L,name));
+open_func(&lexstate,&funcstate);
+funcstate.f->is_vararg=2;
+luaX_next(&lexstate);
+chunk(&lexstate);
+check(&lexstate,TK_EOS);
+close_func(&lexstate);
+return funcstate.f;
+}
+static void field(LexState*ls,expdesc*v){
+FuncState*fs=ls->fs;
+expdesc key;
+luaK_exp2anyreg(fs,v);
+luaX_next(ls);
+checkname(ls,&key);
+luaK_indexed(fs,v,&key);
+}
+static void yindex(LexState*ls,expdesc*v){
+luaX_next(ls);
+expr(ls,v);
+luaK_exp2val(ls->fs,v);
+checknext(ls,']');
+}
+struct ConsControl{
+expdesc v;
+expdesc*t;
+int nh;
+int na;
+int tostore;
+};
+static void recfield(LexState*ls,struct ConsControl*cc){
+FuncState*fs=ls->fs;
+int reg=ls->fs->freereg;
+expdesc key,val;
+int rkkey;
+if(ls->t.token==TK_NAME){
+luaY_checklimit(fs,cc->nh,(INT_MAX-2),"items in a constructor");
+checkname(ls,&key);
+}
+else
+yindex(ls,&key);
+cc->nh++;
+checknext(ls,'=');
+rkkey=luaK_exp2RK(fs,&key);
+expr(ls,&val);
+luaK_codeABC(fs,OP_SETTABLE,cc->t->u.s.info,rkkey,luaK_exp2RK(fs,&val));
+fs->freereg=reg;
+}
+static void closelistfield(FuncState*fs,struct ConsControl*cc){
+if(cc->v.k==VVOID)return;
+luaK_exp2nextreg(fs,&cc->v);
+cc->v.k=VVOID;
+if(cc->tostore==50){
+luaK_setlist(fs,cc->t->u.s.info,cc->na,cc->tostore);
+cc->tostore=0;
+}
+}
+static void lastlistfield(FuncState*fs,struct ConsControl*cc){
+if(cc->tostore==0)return;
+if(hasmultret(cc->v.k)){
+luaK_setmultret(fs,&cc->v);
+luaK_setlist(fs,cc->t->u.s.info,cc->na,(-1));
+cc->na--;
+}
+else{
+if(cc->v.k!=VVOID)
+luaK_exp2nextreg(fs,&cc->v);
+luaK_setlist(fs,cc->t->u.s.info,cc->na,cc->tostore);
+}
+}
+static void listfield(LexState*ls,struct ConsControl*cc){
+expr(ls,&cc->v);
+luaY_checklimit(ls->fs,cc->na,(INT_MAX-2),"items in a constructor");
+cc->na++;
+cc->tostore++;
+}
+static void constructor(LexState*ls,expdesc*t){
+FuncState*fs=ls->fs;
+int line=ls->linenumber;
+int pc=luaK_codeABC(fs,OP_NEWTABLE,0,0,0);
+struct ConsControl cc;
+cc.na=cc.nh=cc.tostore=0;
+cc.t=t;
+init_exp(t,VRELOCABLE,pc);
+init_exp(&cc.v,VVOID,0);
+luaK_exp2nextreg(ls->fs,t);
+checknext(ls,'{');
+do{
+if(ls->t.token=='}')break;
+closelistfield(fs,&cc);
+switch(ls->t.token){
+case TK_NAME:{
+luaX_lookahead(ls);
+if(ls->lookahead.token!='=')
+listfield(ls,&cc);
+else
+recfield(ls,&cc);
+break;
+}
+case'[':{
+recfield(ls,&cc);
+break;
+}
+default:{
+listfield(ls,&cc);
+break;
+}
+}
+}while(testnext(ls,',')||testnext(ls,';'));
+check_match(ls,'}','{',line);
+lastlistfield(fs,&cc);
+SETARG_B(fs->f->code[pc],luaO_int2fb(cc.na));
+SETARG_C(fs->f->code[pc],luaO_int2fb(cc.nh));
+}
+static void parlist(LexState*ls){
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+int nparams=0;
+f->is_vararg=0;
+if(ls->t.token!=')'){
+do{
+switch(ls->t.token){
+case TK_NAME:{
+new_localvar(ls,str_checkname(ls),nparams++);
+break;
+}
+case TK_DOTS:{
+luaX_next(ls);
+f->is_vararg|=2;
+break;
+}
+default:luaX_syntaxerror(ls,"<name> or "LUA_QL("...")" expected");
+}
+}while(!f->is_vararg&&testnext(ls,','));
+}
+adjustlocalvars(ls,nparams);
+f->numparams=cast_byte(fs->nactvar-(f->is_vararg&1));
+luaK_reserveregs(fs,fs->nactvar);
+}
+static void body(LexState*ls,expdesc*e,int needself,int line){
+FuncState new_fs;
+open_func(ls,&new_fs);
+new_fs.f->linedefined=line;
+checknext(ls,'(');
+if(needself){
+new_localvarliteral(ls,"self",0);
+adjustlocalvars(ls,1);
+}
+parlist(ls);
+checknext(ls,')');
+chunk(ls);
+new_fs.f->lastlinedefined=ls->linenumber;
+check_match(ls,TK_END,TK_FUNCTION,line);
+close_func(ls);
+pushclosure(ls,&new_fs,e);
+}
+static int explist1(LexState*ls,expdesc*v){
+int n=1;
+expr(ls,v);
+while(testnext(ls,',')){
+luaK_exp2nextreg(ls->fs,v);
+expr(ls,v);
+n++;
+}
+return n;
+}
+static void funcargs(LexState*ls,expdesc*f){
+FuncState*fs=ls->fs;
+expdesc args;
+int base,nparams;
+int line=ls->linenumber;
+switch(ls->t.token){
+case'(':{
+if(line!=ls->lastline)
+luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
+luaX_next(ls);
+if(ls->t.token==')')
+args.k=VVOID;
+else{
+explist1(ls,&args);
+luaK_setmultret(fs,&args);
+}
+check_match(ls,')','(',line);
+break;
+}
+case'{':{
+constructor(ls,&args);
+break;
+}
+case TK_STRING:{
+codestring(ls,&args,ls->t.seminfo.ts);
+luaX_next(ls);
+break;
+}
+default:{
+luaX_syntaxerror(ls,"function arguments expected");
+return;
+}
+}
+base=f->u.s.info;
+if(hasmultret(args.k))
+nparams=(-1);
+else{
+if(args.k!=VVOID)
+luaK_exp2nextreg(fs,&args);
+nparams=fs->freereg-(base+1);
+}
+init_exp(f,VCALL,luaK_codeABC(fs,OP_CALL,base,nparams+1,2));
+luaK_fixline(fs,line);
+fs->freereg=base+1;
+}
+static void prefixexp(LexState*ls,expdesc*v){
+switch(ls->t.token){
+case'(':{
+int line=ls->linenumber;
+luaX_next(ls);
+expr(ls,v);
+check_match(ls,')','(',line);
+luaK_dischargevars(ls->fs,v);
+return;
+}
+case TK_NAME:{
+singlevar(ls,v);
+return;
+}
+default:{
+luaX_syntaxerror(ls,"unexpected symbol");
+return;
+}
+}
+}
+static void primaryexp(LexState*ls,expdesc*v){
+FuncState*fs=ls->fs;
+prefixexp(ls,v);
+for(;;){
+switch(ls->t.token){
+case'.':{
+field(ls,v);
+break;
+}
+case'[':{
+expdesc key;
+luaK_exp2anyreg(fs,v);
+yindex(ls,&key);
+luaK_indexed(fs,v,&key);
+break;
+}
+case':':{
+expdesc key;
+luaX_next(ls);
+checkname(ls,&key);
+luaK_self(fs,v,&key);
+funcargs(ls,v);
+break;
+}
+case'(':case TK_STRING:case'{':{
+luaK_exp2nextreg(fs,v);
+funcargs(ls,v);
+break;
+}
+default:return;
+}
+}
+}
+static void simpleexp(LexState*ls,expdesc*v){
+switch(ls->t.token){
+case TK_NUMBER:{
+init_exp(v,VKNUM,0);
+v->u.nval=ls->t.seminfo.r;
+break;
+}
+case TK_STRING:{
+codestring(ls,v,ls->t.seminfo.ts);
+break;
+}
+case TK_NIL:{
+init_exp(v,VNIL,0);
+break;
+}
+case TK_TRUE:{
+init_exp(v,VTRUE,0);
+break;
+}
+case TK_FALSE:{
+init_exp(v,VFALSE,0);
+break;
+}
+case TK_DOTS:{
+FuncState*fs=ls->fs;
+check_condition(ls,fs->f->is_vararg,
+"cannot use "LUA_QL("...")" outside a vararg function");
+fs->f->is_vararg&=~4;
+init_exp(v,VVARARG,luaK_codeABC(fs,OP_VARARG,0,1,0));
+break;
+}
+case'{':{
+constructor(ls,v);
+return;
+}
+case TK_FUNCTION:{
+luaX_next(ls);
+body(ls,v,0,ls->linenumber);
+return;
+}
+default:{
+primaryexp(ls,v);
+return;
+}
+}
+luaX_next(ls);
+}
+static UnOpr getunopr(int op){
+switch(op){
+case TK_NOT:return OPR_NOT;
+case'-':return OPR_MINUS;
+case'#':return OPR_LEN;
+default:return OPR_NOUNOPR;
+}
+}
+static BinOpr getbinopr(int op){
+switch(op){
+case'+':return OPR_ADD;
+case'-':return OPR_SUB;
+case'*':return OPR_MUL;
+case'/':return OPR_DIV;
+case'%':return OPR_MOD;
+case'^':return OPR_POW;
+case TK_CONCAT:return OPR_CONCAT;
+case TK_NE:return OPR_NE;
+case TK_EQ:return OPR_EQ;
+case'<':return OPR_LT;
+case TK_LE:return OPR_LE;
+case'>':return OPR_GT;
+case TK_GE:return OPR_GE;
+case TK_AND:return OPR_AND;
+case TK_OR:return OPR_OR;
+default:return OPR_NOBINOPR;
+}
+}
+static const struct{
+lu_byte left;
+lu_byte right;
+}priority[]={
+{6,6},{6,6},{7,7},{7,7},{7,7},
+{10,9},{5,4},
+{3,3},{3,3},
+{3,3},{3,3},{3,3},{3,3},
+{2,2},{1,1}
+};
+static BinOpr subexpr(LexState*ls,expdesc*v,unsigned int limit){
+BinOpr op;
+UnOpr uop;
+enterlevel(ls);
+uop=getunopr(ls->t.token);
+if(uop!=OPR_NOUNOPR){
+luaX_next(ls);
+subexpr(ls,v,8);
+luaK_prefix(ls->fs,uop,v);
+}
+else simpleexp(ls,v);
+op=getbinopr(ls->t.token);
+while(op!=OPR_NOBINOPR&&priority[op].left>limit){
+expdesc v2;
+BinOpr nextop;
+luaX_next(ls);
+luaK_infix(ls->fs,op,v);
+nextop=subexpr(ls,&v2,priority[op].right);
+luaK_posfix(ls->fs,op,v,&v2);
+op=nextop;
+}
+leavelevel(ls);
+return op;
+}
+static void expr(LexState*ls,expdesc*v){
+subexpr(ls,v,0);
+}
+static int block_follow(int token){
+switch(token){
+case TK_ELSE:case TK_ELSEIF:case TK_END:
+case TK_UNTIL:case TK_EOS:
+return 1;
+default:return 0;
+}
+}
+static void block(LexState*ls){
+FuncState*fs=ls->fs;
+BlockCnt bl;
+enterblock(fs,&bl,0);
+chunk(ls);
+leaveblock(fs);
+}
+struct LHS_assign{
+struct LHS_assign*prev;
+expdesc v;
+};
+static void check_conflict(LexState*ls,struct LHS_assign*lh,expdesc*v){
+FuncState*fs=ls->fs;
+int extra=fs->freereg;
+int conflict=0;
+for(;lh;lh=lh->prev){
+if(lh->v.k==VINDEXED){
+if(lh->v.u.s.info==v->u.s.info){
+conflict=1;
+lh->v.u.s.info=extra;
+}
+if(lh->v.u.s.aux==v->u.s.info){
+conflict=1;
+lh->v.u.s.aux=extra;
+}
+}
+}
+if(conflict){
+luaK_codeABC(fs,OP_MOVE,fs->freereg,v->u.s.info,0);
+luaK_reserveregs(fs,1);
+}
+}
+static void assignment(LexState*ls,struct LHS_assign*lh,int nvars){
+expdesc e;
+check_condition(ls,VLOCAL<=lh->v.k&&lh->v.k<=VINDEXED,
+"syntax error");
+if(testnext(ls,',')){
+struct LHS_assign nv;
+nv.prev=lh;
+primaryexp(ls,&nv.v);
+if(nv.v.k==VLOCAL)
+check_conflict(ls,lh,&nv.v);
+luaY_checklimit(ls->fs,nvars,200-ls->L->nCcalls,
+"variables in assignment");
+assignment(ls,&nv,nvars+1);
+}
+else{
+int nexps;
+checknext(ls,'=');
+nexps=explist1(ls,&e);
+if(nexps!=nvars){
+adjust_assign(ls,nvars,nexps,&e);
+if(nexps>nvars)
+ls->fs->freereg-=nexps-nvars;
+}
+else{
+luaK_setoneret(ls->fs,&e);
+luaK_storevar(ls->fs,&lh->v,&e);
+return;
+}
+}
+init_exp(&e,VNONRELOC,ls->fs->freereg-1);
+luaK_storevar(ls->fs,&lh->v,&e);
+}
+static int cond(LexState*ls){
+expdesc v;
+expr(ls,&v);
+if(v.k==VNIL)v.k=VFALSE;
+luaK_goiftrue(ls->fs,&v);
+return v.f;
+}
+static void breakstat(LexState*ls){
+FuncState*fs=ls->fs;
+BlockCnt*bl=fs->bl;
+int upval=0;
+while(bl&&!bl->isbreakable){
+upval|=bl->upval;
+bl=bl->previous;
+}
+if(!bl)
+luaX_syntaxerror(ls,"no loop to break");
+if(upval)
+luaK_codeABC(fs,OP_CLOSE,bl->nactvar,0,0);
+luaK_concat(fs,&bl->breaklist,luaK_jump(fs));
+}
+static void whilestat(LexState*ls,int line){
+FuncState*fs=ls->fs;
+int whileinit;
+int condexit;
+BlockCnt bl;
+luaX_next(ls);
+whileinit=luaK_getlabel(fs);
+condexit=cond(ls);
+enterblock(fs,&bl,1);
+checknext(ls,TK_DO);
+block(ls);
+luaK_patchlist(fs,luaK_jump(fs),whileinit);
+check_match(ls,TK_END,TK_WHILE,line);
+leaveblock(fs);
+luaK_patchtohere(fs,condexit);
+}
+static void repeatstat(LexState*ls,int line){
+int condexit;
+FuncState*fs=ls->fs;
+int repeat_init=luaK_getlabel(fs);
+BlockCnt bl1,bl2;
+enterblock(fs,&bl1,1);
+enterblock(fs,&bl2,0);
+luaX_next(ls);
+chunk(ls);
+check_match(ls,TK_UNTIL,TK_REPEAT,line);
+condexit=cond(ls);
+if(!bl2.upval){
+leaveblock(fs);
+luaK_patchlist(ls->fs,condexit,repeat_init);
+}
+else{
+breakstat(ls);
+luaK_patchtohere(ls->fs,condexit);
+leaveblock(fs);
+luaK_patchlist(ls->fs,luaK_jump(fs),repeat_init);
+}
+leaveblock(fs);
+}
+static int exp1(LexState*ls){
+expdesc e;
+int k;
+expr(ls,&e);
+k=e.k;
+luaK_exp2nextreg(ls->fs,&e);
+return k;
+}
+static void forbody(LexState*ls,int base,int line,int nvars,int isnum){
+BlockCnt bl;
+FuncState*fs=ls->fs;
+int prep,endfor;
+adjustlocalvars(ls,3);
+checknext(ls,TK_DO);
+prep=isnum?luaK_codeAsBx(fs,OP_FORPREP,base,(-1)):luaK_jump(fs);
+enterblock(fs,&bl,0);
+adjustlocalvars(ls,nvars);
+luaK_reserveregs(fs,nvars);
+block(ls);
+leaveblock(fs);
+luaK_patchtohere(fs,prep);
+endfor=(isnum)?luaK_codeAsBx(fs,OP_FORLOOP,base,(-1)):
+luaK_codeABC(fs,OP_TFORLOOP,base,0,nvars);
+luaK_fixline(fs,line);
+luaK_patchlist(fs,(isnum?endfor:luaK_jump(fs)),prep+1);
+}
+static void fornum(LexState*ls,TString*varname,int line){
+FuncState*fs=ls->fs;
+int base=fs->freereg;
+new_localvarliteral(ls,"(for index)",0);
+new_localvarliteral(ls,"(for limit)",1);
+new_localvarliteral(ls,"(for step)",2);
+new_localvar(ls,varname,3);
+checknext(ls,'=');
+exp1(ls);
+checknext(ls,',');
+exp1(ls);
+if(testnext(ls,','))
+exp1(ls);
+else{
+luaK_codeABx(fs,OP_LOADK,fs->freereg,luaK_numberK(fs,1));
+luaK_reserveregs(fs,1);
+}
+forbody(ls,base,line,1,1);
+}
+static void forlist(LexState*ls,TString*indexname){
+FuncState*fs=ls->fs;
+expdesc e;
+int nvars=0;
+int line;
+int base=fs->freereg;
+new_localvarliteral(ls,"(for generator)",nvars++);
+new_localvarliteral(ls,"(for state)",nvars++);
+new_localvarliteral(ls,"(for control)",nvars++);
+new_localvar(ls,indexname,nvars++);
+while(testnext(ls,','))
+new_localvar(ls,str_checkname(ls),nvars++);
+checknext(ls,TK_IN);
+line=ls->linenumber;
+adjust_assign(ls,3,explist1(ls,&e),&e);
+luaK_checkstack(fs,3);
+forbody(ls,base,line,nvars-3,0);
+}
+static void forstat(LexState*ls,int line){
+FuncState*fs=ls->fs;
+TString*varname;
+BlockCnt bl;
+enterblock(fs,&bl,1);
+luaX_next(ls);
+varname=str_checkname(ls);
+switch(ls->t.token){
+case'=':fornum(ls,varname,line);break;
+case',':case TK_IN:forlist(ls,varname);break;
+default:luaX_syntaxerror(ls,LUA_QL("=")" or "LUA_QL("in")" expected");
+}
+check_match(ls,TK_END,TK_FOR,line);
+leaveblock(fs);
+}
+static int test_then_block(LexState*ls){
+int condexit;
+luaX_next(ls);
+condexit=cond(ls);
+checknext(ls,TK_THEN);
+block(ls);
+return condexit;
+}
+static void ifstat(LexState*ls,int line){
+FuncState*fs=ls->fs;
+int flist;
+int escapelist=(-1);
+flist=test_then_block(ls);
+while(ls->t.token==TK_ELSEIF){
+luaK_concat(fs,&escapelist,luaK_jump(fs));
+luaK_patchtohere(fs,flist);
+flist=test_then_block(ls);
+}
+if(ls->t.token==TK_ELSE){
+luaK_concat(fs,&escapelist,luaK_jump(fs));
+luaK_patchtohere(fs,flist);
+luaX_next(ls);
+block(ls);
+}
+else
+luaK_concat(fs,&escapelist,flist);
+luaK_patchtohere(fs,escapelist);
+check_match(ls,TK_END,TK_IF,line);
+}
+static void localfunc(LexState*ls){
+expdesc v,b;
+FuncState*fs=ls->fs;
+new_localvar(ls,str_checkname(ls),0);
+init_exp(&v,VLOCAL,fs->freereg);
+luaK_reserveregs(fs,1);
+adjustlocalvars(ls,1);
+body(ls,&b,0,ls->linenumber);
+luaK_storevar(fs,&v,&b);
+getlocvar(fs,fs->nactvar-1).startpc=fs->pc;
+}
+static void localstat(LexState*ls){
+int nvars=0;
+int nexps;
+expdesc e;
+do{
+new_localvar(ls,str_checkname(ls),nvars++);
+}while(testnext(ls,','));
+if(testnext(ls,'='))
+nexps=explist1(ls,&e);
+else{
+e.k=VVOID;
+nexps=0;
+}
+adjust_assign(ls,nvars,nexps,&e);
+adjustlocalvars(ls,nvars);
+}
+static int funcname(LexState*ls,expdesc*v){
+int needself=0;
+singlevar(ls,v);
+while(ls->t.token=='.')
+field(ls,v);
+if(ls->t.token==':'){
+needself=1;
+field(ls,v);
+}
+return needself;
+}
+static void funcstat(LexState*ls,int line){
+int needself;
+expdesc v,b;
+luaX_next(ls);
+needself=funcname(ls,&v);
+body(ls,&b,needself,line);
+luaK_storevar(ls->fs,&v,&b);
+luaK_fixline(ls->fs,line);
+}
+static void exprstat(LexState*ls){
+FuncState*fs=ls->fs;
+struct LHS_assign v;
+primaryexp(ls,&v.v);
+if(v.v.k==VCALL)
+SETARG_C(getcode(fs,&v.v),1);
+else{
+v.prev=NULL;
+assignment(ls,&v,1);
+}
+}
+static void retstat(LexState*ls){
+FuncState*fs=ls->fs;
+expdesc e;
+int first,nret;
+luaX_next(ls);
+if(block_follow(ls->t.token)||ls->t.token==';')
+first=nret=0;
+else{
+nret=explist1(ls,&e);
+if(hasmultret(e.k)){
+luaK_setmultret(fs,&e);
+if(e.k==VCALL&&nret==1){
+SET_OPCODE(getcode(fs,&e),OP_TAILCALL);
+}
+first=fs->nactvar;
+nret=(-1);
+}
+else{
+if(nret==1)
+first=luaK_exp2anyreg(fs,&e);
+else{
+luaK_exp2nextreg(fs,&e);
+first=fs->nactvar;
+}
+}
+}
+luaK_ret(fs,first,nret);
+}
+static int statement(LexState*ls){
+int line=ls->linenumber;
+switch(ls->t.token){
+case TK_IF:{
+ifstat(ls,line);
+return 0;
+}
+case TK_WHILE:{
+whilestat(ls,line);
+return 0;
+}
+case TK_DO:{
+luaX_next(ls);
+block(ls);
+check_match(ls,TK_END,TK_DO,line);
+return 0;
+}
+case TK_FOR:{
+forstat(ls,line);
+return 0;
+}
+case TK_REPEAT:{
+repeatstat(ls,line);
+return 0;
+}
+case TK_FUNCTION:{
+funcstat(ls,line);
+return 0;
+}
+case TK_LOCAL:{
+luaX_next(ls);
+if(testnext(ls,TK_FUNCTION))
+localfunc(ls);
+else
+localstat(ls);
+return 0;
+}
+case TK_RETURN:{
+retstat(ls);
+return 1;
+}
+case TK_BREAK:{
+luaX_next(ls);
+breakstat(ls);
+return 1;
+}
+default:{
+exprstat(ls);
+return 0;
+}
+}
+}
+static void chunk(LexState*ls){
+int islast=0;
+enterlevel(ls);
+while(!islast&&!block_follow(ls->t.token)){
+islast=statement(ls);
+testnext(ls,';');
+ls->fs->freereg=ls->fs->nactvar;
+}
+leavelevel(ls);
+}
+static const TValue*luaV_tonumber(const TValue*obj,TValue*n){
+lua_Number num;
+if(ttisnumber(obj))return obj;
+if(ttisstring(obj)&&luaO_str2d(svalue(obj),&num)){
+setnvalue(n,num);
+return n;
+}
+else
+return NULL;
+}
+static int luaV_tostring(lua_State*L,StkId obj){
+if(!ttisnumber(obj))
+return 0;
+else{
+char s[32];
+lua_Number n=nvalue(obj);
+lua_number2str(s,n);
+setsvalue(L,obj,luaS_new(L,s));
+return 1;
+}
+}
+static void callTMres(lua_State*L,StkId res,const TValue*f,
+const TValue*p1,const TValue*p2){
+ptrdiff_t result=savestack(L,res);
+setobj(L,L->top,f);
+setobj(L,L->top+1,p1);
+setobj(L,L->top+2,p2);
+luaD_checkstack(L,3);
+L->top+=3;
+luaD_call(L,L->top-3,1);
+res=restorestack(L,result);
+L->top--;
+setobj(L,res,L->top);
+}
+static void callTM(lua_State*L,const TValue*f,const TValue*p1,
+const TValue*p2,const TValue*p3){
+setobj(L,L->top,f);
+setobj(L,L->top+1,p1);
+setobj(L,L->top+2,p2);
+setobj(L,L->top+3,p3);
+luaD_checkstack(L,4);
+L->top+=4;
+luaD_call(L,L->top-4,0);
+}
+static void luaV_gettable(lua_State*L,const TValue*t,TValue*key,StkId val){
+int loop;
+for(loop=0;loop<100;loop++){
+const TValue*tm;
+if(ttistable(t)){
+Table*h=hvalue(t);
+const TValue*res=luaH_get(h,key);
+if(!ttisnil(res)||
+(tm=fasttm(L,h->metatable,TM_INDEX))==NULL){
+setobj(L,val,res);
+return;
+}
+}
+else if(ttisnil(tm=luaT_gettmbyobj(L,t,TM_INDEX)))
+luaG_typeerror(L,t,"index");
+if(ttisfunction(tm)){
+callTMres(L,val,tm,t,key);
+return;
+}
+t=tm;
+}
+luaG_runerror(L,"loop in gettable");
+}
+static void luaV_settable(lua_State*L,const TValue*t,TValue*key,StkId val){
+int loop;
+TValue temp;
+for(loop=0;loop<100;loop++){
+const TValue*tm;
+if(ttistable(t)){
+Table*h=hvalue(t);
+TValue*oldval=luaH_set(L,h,key);
+if(!ttisnil(oldval)||
+(tm=fasttm(L,h->metatable,TM_NEWINDEX))==NULL){
+setobj(L,oldval,val);
+h->flags=0;
+luaC_barriert(L,h,val);
+return;
+}
+}
+else if(ttisnil(tm=luaT_gettmbyobj(L,t,TM_NEWINDEX)))
+luaG_typeerror(L,t,"index");
+if(ttisfunction(tm)){
+callTM(L,tm,t,key,val);
+return;
+}
+setobj(L,&temp,tm);
+t=&temp;
+}
+luaG_runerror(L,"loop in settable");
+}
+static int call_binTM(lua_State*L,const TValue*p1,const TValue*p2,
+StkId res,TMS event){
+const TValue*tm=luaT_gettmbyobj(L,p1,event);
+if(ttisnil(tm))
+tm=luaT_gettmbyobj(L,p2,event);
+if(ttisnil(tm))return 0;
+callTMres(L,res,tm,p1,p2);
+return 1;
+}
+static const TValue*get_compTM(lua_State*L,Table*mt1,Table*mt2,
+TMS event){
+const TValue*tm1=fasttm(L,mt1,event);
+const TValue*tm2;
+if(tm1==NULL)return NULL;
+if(mt1==mt2)return tm1;
+tm2=fasttm(L,mt2,event);
+if(tm2==NULL)return NULL;
+if(luaO_rawequalObj(tm1,tm2))
+return tm1;
+return NULL;
+}
+static int call_orderTM(lua_State*L,const TValue*p1,const TValue*p2,
+TMS event){
+const TValue*tm1=luaT_gettmbyobj(L,p1,event);
+const TValue*tm2;
+if(ttisnil(tm1))return-1;
+tm2=luaT_gettmbyobj(L,p2,event);
+if(!luaO_rawequalObj(tm1,tm2))
+return-1;
+callTMres(L,L->top,tm1,p1,p2);
+return!l_isfalse(L->top);
+}
+static int l_strcmp(const TString*ls,const TString*rs){
+const char*l=getstr(ls);
+size_t ll=ls->tsv.len;
+const char*r=getstr(rs);
+size_t lr=rs->tsv.len;
+for(;;){
+int temp=strcoll(l,r);
+if(temp!=0)return temp;
+else{
+size_t len=strlen(l);
+if(len==lr)
+return(len==ll)?0:1;
+else if(len==ll)
+return-1;
+len++;
+l+=len;ll-=len;r+=len;lr-=len;
+}
+}
+}
+static int luaV_lessthan(lua_State*L,const TValue*l,const TValue*r){
+int res;
+if(ttype(l)!=ttype(r))
+return luaG_ordererror(L,l,r);
+else if(ttisnumber(l))
+return luai_numlt(nvalue(l),nvalue(r));
+else if(ttisstring(l))
+return l_strcmp(rawtsvalue(l),rawtsvalue(r))<0;
+else if((res=call_orderTM(L,l,r,TM_LT))!=-1)
+return res;
+return luaG_ordererror(L,l,r);
+}
+static int lessequal(lua_State*L,const TValue*l,const TValue*r){
+int res;
+if(ttype(l)!=ttype(r))
+return luaG_ordererror(L,l,r);
+else if(ttisnumber(l))
+return luai_numle(nvalue(l),nvalue(r));
+else if(ttisstring(l))
+return l_strcmp(rawtsvalue(l),rawtsvalue(r))<=0;
+else if((res=call_orderTM(L,l,r,TM_LE))!=-1)
+return res;
+else if((res=call_orderTM(L,r,l,TM_LT))!=-1)
+return!res;
+return luaG_ordererror(L,l,r);
+}
+static int luaV_equalval(lua_State*L,const TValue*t1,const TValue*t2){
+const TValue*tm;
+switch(ttype(t1)){
+case 0:return 1;
+case 3:return luai_numeq(nvalue(t1),nvalue(t2));
+case 1:return bvalue(t1)==bvalue(t2);
+case 2:return pvalue(t1)==pvalue(t2);
+case 7:{
+if(uvalue(t1)==uvalue(t2))return 1;
+tm=get_compTM(L,uvalue(t1)->metatable,uvalue(t2)->metatable,
+TM_EQ);
+break;
+}
+case 5:{
+if(hvalue(t1)==hvalue(t2))return 1;
+tm=get_compTM(L,hvalue(t1)->metatable,hvalue(t2)->metatable,TM_EQ);
+break;
+}
+default:return gcvalue(t1)==gcvalue(t2);
+}
+if(tm==NULL)return 0;
+callTMres(L,L->top,tm,t1,t2);
+return!l_isfalse(L->top);
+}
+static void luaV_concat(lua_State*L,int total,int last){
+do{
+StkId top=L->base+last+1;
+int n=2;
+if(!(ttisstring(top-2)||ttisnumber(top-2))||!tostring(L,top-1)){
+if(!call_binTM(L,top-2,top-1,top-2,TM_CONCAT))
+luaG_concaterror(L,top-2,top-1);
+}else if(tsvalue(top-1)->len==0)
+(void)tostring(L,top-2);
+else{
+size_t tl=tsvalue(top-1)->len;
+char*buffer;
+int i;
+for(n=1;n<total&&tostring(L,top-n-1);n++){
+size_t l=tsvalue(top-n-1)->len;
+if(l>=((size_t)(~(size_t)0)-2)-tl)luaG_runerror(L,"string length overflow");
+tl+=l;
+}
+buffer=luaZ_openspace(L,&G(L)->buff,tl);
+tl=0;
+for(i=n;i>0;i--){
+size_t l=tsvalue(top-i)->len;
+memcpy(buffer+tl,svalue(top-i),l);
+tl+=l;
+}
+setsvalue(L,top-n,luaS_newlstr(L,buffer,tl));
+}
+total-=n-1;
+last-=n-1;
+}while(total>1);
+}
+static void Arith(lua_State*L,StkId ra,const TValue*rb,
+const TValue*rc,TMS op){
+TValue tempb,tempc;
+const TValue*b,*c;
+if((b=luaV_tonumber(rb,&tempb))!=NULL&&
+(c=luaV_tonumber(rc,&tempc))!=NULL){
+lua_Number nb=nvalue(b),nc=nvalue(c);
+switch(op){
+case TM_ADD:setnvalue(ra,luai_numadd(nb,nc));break;
+case TM_SUB:setnvalue(ra,luai_numsub(nb,nc));break;
+case TM_MUL:setnvalue(ra,luai_nummul(nb,nc));break;
+case TM_DIV:setnvalue(ra,luai_numdiv(nb,nc));break;
+case TM_MOD:setnvalue(ra,luai_nummod(nb,nc));break;
+case TM_POW:setnvalue(ra,luai_numpow(nb,nc));break;
+case TM_UNM:setnvalue(ra,luai_numunm(nb));break;
+default:break;
+}
+}
+else if(!call_binTM(L,rb,rc,ra,op))
+luaG_aritherror(L,rb,rc);
+}
+#define runtime_check(L,c){if(!(c))break;}
+#define RA(i)(base+GETARG_A(i))
+#define RB(i)check_exp(getBMode(GET_OPCODE(i))==OpArgR,base+GETARG_B(i))
+#define RKB(i)check_exp(getBMode(GET_OPCODE(i))==OpArgK,ISK(GETARG_B(i))?k+INDEXK(GETARG_B(i)):base+GETARG_B(i))
+#define RKC(i)check_exp(getCMode(GET_OPCODE(i))==OpArgK,ISK(GETARG_C(i))?k+INDEXK(GETARG_C(i)):base+GETARG_C(i))
+#define KBx(i)check_exp(getBMode(GET_OPCODE(i))==OpArgK,k+GETARG_Bx(i))
+#define dojump(L,pc,i){(pc)+=(i);}
+#define Protect(x){L->savedpc=pc;{x;};base=L->base;}
+#define arith_op(op,tm){TValue*rb=RKB(i);TValue*rc=RKC(i);if(ttisnumber(rb)&&ttisnumber(rc)){lua_Number nb=nvalue(rb),nc=nvalue(rc);setnvalue(ra,op(nb,nc));}else Protect(Arith(L,ra,rb,rc,tm));}
+static void luaV_execute(lua_State*L,int nexeccalls){
+LClosure*cl;
+StkId base;
+TValue*k;
+const Instruction*pc;
+reentry:
+pc=L->savedpc;
+cl=&clvalue(L->ci->func)->l;
+base=L->base;
+k=cl->p->k;
+for(;;){
+const Instruction i=*pc++;
+StkId ra;
+ra=RA(i);
+switch(GET_OPCODE(i)){
+case OP_MOVE:{
+setobj(L,ra,RB(i));
+continue;
+}
+case OP_LOADK:{
+setobj(L,ra,KBx(i));
+continue;
+}
+case OP_LOADBOOL:{
+setbvalue(ra,GETARG_B(i));
+if(GETARG_C(i))pc++;
+continue;
+}
+case OP_LOADNIL:{
+TValue*rb=RB(i);
+do{
+setnilvalue(rb--);
+}while(rb>=ra);
+continue;
+}
+case OP_GETUPVAL:{
+int b=GETARG_B(i);
+setobj(L,ra,cl->upvals[b]->v);
+continue;
+}
+case OP_GETGLOBAL:{
+TValue g;
+TValue*rb=KBx(i);
+sethvalue(L,&g,cl->env);
+Protect(luaV_gettable(L,&g,rb,ra));
+continue;
+}
+case OP_GETTABLE:{
+Protect(luaV_gettable(L,RB(i),RKC(i),ra));
+continue;
+}
+case OP_SETGLOBAL:{
+TValue g;
+sethvalue(L,&g,cl->env);
+Protect(luaV_settable(L,&g,KBx(i),ra));
+continue;
+}
+case OP_SETUPVAL:{
+UpVal*uv=cl->upvals[GETARG_B(i)];
+setobj(L,uv->v,ra);
+luaC_barrier(L,uv,ra);
+continue;
+}
+case OP_SETTABLE:{
+Protect(luaV_settable(L,ra,RKB(i),RKC(i)));
+continue;
+}
+case OP_NEWTABLE:{
+int b=GETARG_B(i);
+int c=GETARG_C(i);
+sethvalue(L,ra,luaH_new(L,luaO_fb2int(b),luaO_fb2int(c)));
+Protect(luaC_checkGC(L));
+continue;
+}
+case OP_SELF:{
+StkId rb=RB(i);
+setobj(L,ra+1,rb);
+Protect(luaV_gettable(L,rb,RKC(i),ra));
+continue;
+}
+case OP_ADD:{
+arith_op(luai_numadd,TM_ADD);
+continue;
+}
+case OP_SUB:{
+arith_op(luai_numsub,TM_SUB);
+continue;
+}
+case OP_MUL:{
+arith_op(luai_nummul,TM_MUL);
+continue;
+}
+case OP_DIV:{
+arith_op(luai_numdiv,TM_DIV);
+continue;
+}
+case OP_MOD:{
+arith_op(luai_nummod,TM_MOD);
+continue;
+}
+case OP_POW:{
+arith_op(luai_numpow,TM_POW);
+continue;
+}
+case OP_UNM:{
+TValue*rb=RB(i);
+if(ttisnumber(rb)){
+lua_Number nb=nvalue(rb);
+setnvalue(ra,luai_numunm(nb));
+}
+else{
+Protect(Arith(L,ra,rb,rb,TM_UNM));
+}
+continue;
+}
+case OP_NOT:{
+int res=l_isfalse(RB(i));
+setbvalue(ra,res);
+continue;
+}
+case OP_LEN:{
+const TValue*rb=RB(i);
+switch(ttype(rb)){
+case 5:{
+setnvalue(ra,cast_num(luaH_getn(hvalue(rb))));
+break;
+}
+case 4:{
+setnvalue(ra,cast_num(tsvalue(rb)->len));
+break;
+}
+default:{
+Protect(
+if(!call_binTM(L,rb,(&luaO_nilobject_),ra,TM_LEN))
+luaG_typeerror(L,rb,"get length of");
+)
+}
+}
+continue;
+}
+case OP_CONCAT:{
+int b=GETARG_B(i);
+int c=GETARG_C(i);
+Protect(luaV_concat(L,c-b+1,c);luaC_checkGC(L));
+setobj(L,RA(i),base+b);
+continue;
+}
+case OP_JMP:{
+dojump(L,pc,GETARG_sBx(i));
+continue;
+}
+case OP_EQ:{
+TValue*rb=RKB(i);
+TValue*rc=RKC(i);
+Protect(
+if(equalobj(L,rb,rc)==GETARG_A(i))
+dojump(L,pc,GETARG_sBx(*pc));
+)
+pc++;
+continue;
+}
+case OP_LT:{
+Protect(
+if(luaV_lessthan(L,RKB(i),RKC(i))==GETARG_A(i))
+dojump(L,pc,GETARG_sBx(*pc));
+)
+pc++;
+continue;
+}
+case OP_LE:{
+Protect(
+if(lessequal(L,RKB(i),RKC(i))==GETARG_A(i))
+dojump(L,pc,GETARG_sBx(*pc));
+)
+pc++;
+continue;
+}
+case OP_TEST:{
+if(l_isfalse(ra)!=GETARG_C(i))
+dojump(L,pc,GETARG_sBx(*pc));
+pc++;
+continue;
+}
+case OP_TESTSET:{
+TValue*rb=RB(i);
+if(l_isfalse(rb)!=GETARG_C(i)){
+setobj(L,ra,rb);
+dojump(L,pc,GETARG_sBx(*pc));
+}
+pc++;
+continue;
+}
+case OP_CALL:{
+int b=GETARG_B(i);
+int nresults=GETARG_C(i)-1;
+if(b!=0)L->top=ra+b;
+L->savedpc=pc;
+switch(luaD_precall(L,ra,nresults)){
+case 0:{
+nexeccalls++;
+goto reentry;
+}
+case 1:{
+if(nresults>=0)L->top=L->ci->top;
+base=L->base;
+continue;
+}
+default:{
+return;
+}
+}
+}
+case OP_TAILCALL:{
+int b=GETARG_B(i);
+if(b!=0)L->top=ra+b;
+L->savedpc=pc;
+switch(luaD_precall(L,ra,(-1))){
+case 0:{
+CallInfo*ci=L->ci-1;
+int aux;
+StkId func=ci->func;
+StkId pfunc=(ci+1)->func;
+if(L->openupval)luaF_close(L,ci->base);
+L->base=ci->base=ci->func+((ci+1)->base-pfunc);
+for(aux=0;pfunc+aux<L->top;aux++)
+setobj(L,func+aux,pfunc+aux);
+ci->top=L->top=func+aux;
+ci->savedpc=L->savedpc;
+ci->tailcalls++;
+L->ci--;
+goto reentry;
+}
+case 1:{
+base=L->base;
+continue;
+}
+default:{
+return;
+}
+}
+}
+case OP_RETURN:{
+int b=GETARG_B(i);
+if(b!=0)L->top=ra+b-1;
+if(L->openupval)luaF_close(L,base);
+L->savedpc=pc;
+b=luaD_poscall(L,ra);
+if(--nexeccalls==0)
+return;
+else{
+if(b)L->top=L->ci->top;
+goto reentry;
+}
+}
+case OP_FORLOOP:{
+lua_Number step=nvalue(ra+2);
+lua_Number idx=luai_numadd(nvalue(ra),step);
+lua_Number limit=nvalue(ra+1);
+if(luai_numlt(0,step)?luai_numle(idx,limit)
+:luai_numle(limit,idx)){
+dojump(L,pc,GETARG_sBx(i));
+setnvalue(ra,idx);
+setnvalue(ra+3,idx);
+}
+continue;
+}
+case OP_FORPREP:{
+const TValue*init=ra;
+const TValue*plimit=ra+1;
+const TValue*pstep=ra+2;
+L->savedpc=pc;
+if(!tonumber(init,ra))
+luaG_runerror(L,LUA_QL("for")" initial value must be a number");
+else if(!tonumber(plimit,ra+1))
+luaG_runerror(L,LUA_QL("for")" limit must be a number");
+else if(!tonumber(pstep,ra+2))
+luaG_runerror(L,LUA_QL("for")" step must be a number");
+setnvalue(ra,luai_numsub(nvalue(ra),nvalue(pstep)));
+dojump(L,pc,GETARG_sBx(i));
+continue;
+}
+case OP_TFORLOOP:{
+StkId cb=ra+3;
+setobj(L,cb+2,ra+2);
+setobj(L,cb+1,ra+1);
+setobj(L,cb,ra);
+L->top=cb+3;
+Protect(luaD_call(L,cb,GETARG_C(i)));
+L->top=L->ci->top;
+cb=RA(i)+3;
+if(!ttisnil(cb)){
+setobj(L,cb-1,cb);
+dojump(L,pc,GETARG_sBx(*pc));
+}
+pc++;
+continue;
+}
+case OP_SETLIST:{
+int n=GETARG_B(i);
+int c=GETARG_C(i);
+int last;
+Table*h;
+if(n==0){
+n=cast_int(L->top-ra)-1;
+L->top=L->ci->top;
+}
+if(c==0)c=cast_int(*pc++);
+runtime_check(L,ttistable(ra));
+h=hvalue(ra);
+last=((c-1)*50)+n;
+if(last>h->sizearray)
+luaH_resizearray(L,h,last);
+for(;n>0;n--){
+TValue*val=ra+n;
+setobj(L,luaH_setnum(L,h,last--),val);
+luaC_barriert(L,h,val);
+}
+continue;
+}
+case OP_CLOSE:{
+luaF_close(L,ra);
+continue;
+}
+case OP_CLOSURE:{
+Proto*p;
+Closure*ncl;
+int nup,j;
+p=cl->p->p[GETARG_Bx(i)];
+nup=p->nups;
+ncl=luaF_newLclosure(L,nup,cl->env);
+ncl->l.p=p;
+for(j=0;j<nup;j++,pc++){
+if(GET_OPCODE(*pc)==OP_GETUPVAL)
+ncl->l.upvals[j]=cl->upvals[GETARG_B(*pc)];
+else{
+ncl->l.upvals[j]=luaF_findupval(L,base+GETARG_B(*pc));
+}
+}
+setclvalue(L,ra,ncl);
+Protect(luaC_checkGC(L));
+continue;
+}
+case OP_VARARG:{
+int b=GETARG_B(i)-1;
+int j;
+CallInfo*ci=L->ci;
+int n=cast_int(ci->base-ci->func)-cl->p->numparams-1;
+if(b==(-1)){
+Protect(luaD_checkstack(L,n));
+ra=RA(i);
+b=n;
+L->top=ra+n;
+}
+for(j=0;j<b;j++){
+if(j<n){
+setobj(L,ra+j,ci->base-n+j);
+}
+else{
+setnilvalue(ra+j);
+}
+}
+continue;
+}
+}
+}
+}
+#define api_checknelems(L,n)luai_apicheck(L,(n)<=(L->top-L->base))
+#define api_checkvalidindex(L,i)luai_apicheck(L,(i)!=(&luaO_nilobject_))
+#define api_incr_top(L){luai_apicheck(L,L->top<L->ci->top);L->top++;}
+static TValue*index2adr(lua_State*L,int idx){
+if(idx>0){
+TValue*o=L->base+(idx-1);
+luai_apicheck(L,idx<=L->ci->top-L->base);
+if(o>=L->top)return cast(TValue*,(&luaO_nilobject_));
+else return o;
+}
+else if(idx>(-10000)){
+luai_apicheck(L,idx!=0&&-idx<=L->top-L->base);
+return L->top+idx;
+}
+else switch(idx){
+case(-10000):return registry(L);
+case(-10001):{
+Closure*func=curr_func(L);
+sethvalue(L,&L->env,func->c.env);
+return&L->env;
+}
+case(-10002):return gt(L);
+default:{
+Closure*func=curr_func(L);
+idx=(-10002)-idx;
+return(idx<=func->c.nupvalues)
+?&func->c.upvalue[idx-1]
+:cast(TValue*,(&luaO_nilobject_));
+}
+}
+}
+static Table*getcurrenv(lua_State*L){
+if(L->ci==L->base_ci)
+return hvalue(gt(L));
+else{
+Closure*func=curr_func(L);
+return func->c.env;
+}
+}
+static int lua_checkstack(lua_State*L,int size){
+int res=1;
+if(size>8000||(L->top-L->base+size)>8000)
+res=0;
+else if(size>0){
+luaD_checkstack(L,size);
+if(L->ci->top<L->top+size)
+L->ci->top=L->top+size;
+}
+return res;
+}
+static lua_CFunction lua_atpanic(lua_State*L,lua_CFunction panicf){
+lua_CFunction old;
+old=G(L)->panic;
+G(L)->panic=panicf;
+return old;
+}
+static int lua_gettop(lua_State*L){
+return cast_int(L->top-L->base);
+}
+static void lua_settop(lua_State*L,int idx){
+if(idx>=0){
+luai_apicheck(L,idx<=L->stack_last-L->base);
+while(L->top<L->base+idx)
+setnilvalue(L->top++);
+L->top=L->base+idx;
+}
+else{
+luai_apicheck(L,-(idx+1)<=(L->top-L->base));
+L->top+=idx+1;
+}
+}
+static void lua_remove(lua_State*L,int idx){
+StkId p;
+p=index2adr(L,idx);
+api_checkvalidindex(L,p);
+while(++p<L->top)setobj(L,p-1,p);
+L->top--;
+}
+static void lua_insert(lua_State*L,int idx){
+StkId p;
+StkId q;
+p=index2adr(L,idx);
+api_checkvalidindex(L,p);
+for(q=L->top;q>p;q--)setobj(L,q,q-1);
+setobj(L,p,L->top);
+}
+static void lua_replace(lua_State*L,int idx){
+StkId o;
+if(idx==(-10001)&&L->ci==L->base_ci)
+luaG_runerror(L,"no calling environment");
+api_checknelems(L,1);
+o=index2adr(L,idx);
+api_checkvalidindex(L,o);
+if(idx==(-10001)){
+Closure*func=curr_func(L);
+luai_apicheck(L,ttistable(L->top-1));
+func->c.env=hvalue(L->top-1);
+luaC_barrier(L,func,L->top-1);
+}
+else{
+setobj(L,o,L->top-1);
+if(idx<(-10002))
+luaC_barrier(L,curr_func(L),L->top-1);
+}
+L->top--;
+}
+static void lua_pushvalue(lua_State*L,int idx){
+setobj(L,L->top,index2adr(L,idx));
+api_incr_top(L);
+}
+static int lua_type(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+return(o==(&luaO_nilobject_))?(-1):ttype(o);
+}
+static const char*lua_typename(lua_State*L,int t){
+UNUSED(L);
+return(t==(-1))?"no value":luaT_typenames[t];
+}
+static int lua_iscfunction(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+return iscfunction(o);
+}
+static int lua_isnumber(lua_State*L,int idx){
+TValue n;
+const TValue*o=index2adr(L,idx);
+return tonumber(o,&n);
+}
+static int lua_isstring(lua_State*L,int idx){
+int t=lua_type(L,idx);
+return(t==4||t==3);
+}
+static int lua_rawequal(lua_State*L,int index1,int index2){
+StkId o1=index2adr(L,index1);
+StkId o2=index2adr(L,index2);
+return(o1==(&luaO_nilobject_)||o2==(&luaO_nilobject_))?0
+:luaO_rawequalObj(o1,o2);
+}
+static int lua_lessthan(lua_State*L,int index1,int index2){
+StkId o1,o2;
+int i;
+o1=index2adr(L,index1);
+o2=index2adr(L,index2);
+i=(o1==(&luaO_nilobject_)||o2==(&luaO_nilobject_))?0
+:luaV_lessthan(L,o1,o2);
+return i;
+}
+static lua_Number lua_tonumber(lua_State*L,int idx){
+TValue n;
+const TValue*o=index2adr(L,idx);
+if(tonumber(o,&n))
+return nvalue(o);
+else
+return 0;
+}
+static lua_Integer lua_tointeger(lua_State*L,int idx){
+TValue n;
+const TValue*o=index2adr(L,idx);
+if(tonumber(o,&n)){
+lua_Integer res;
+lua_Number num=nvalue(o);
+lua_number2integer(res,num);
+return res;
+}
+else
+return 0;
+}
+static int lua_toboolean(lua_State*L,int idx){
+const TValue*o=index2adr(L,idx);
+return!l_isfalse(o);
+}
+static const char*lua_tolstring(lua_State*L,int idx,size_t*len){
+StkId o=index2adr(L,idx);
+if(!ttisstring(o)){
+if(!luaV_tostring(L,o)){
+if(len!=NULL)*len=0;
+return NULL;
+}
+luaC_checkGC(L);
+o=index2adr(L,idx);
+}
+if(len!=NULL)*len=tsvalue(o)->len;
+return svalue(o);
+}
+static size_t lua_objlen(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+switch(ttype(o)){
+case 4:return tsvalue(o)->len;
+case 7:return uvalue(o)->len;
+case 5:return luaH_getn(hvalue(o));
+case 3:{
+size_t l;
+l=(luaV_tostring(L,o)?tsvalue(o)->len:0);
+return l;
+}
+default:return 0;
+}
+}
+static lua_CFunction lua_tocfunction(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+return(!iscfunction(o))?NULL:clvalue(o)->c.f;
+}
+static void*lua_touserdata(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+switch(ttype(o)){
+case 7:return(rawuvalue(o)+1);
+case 2:return pvalue(o);
+default:return NULL;
+}
+}
+static void lua_pushnil(lua_State*L){
+setnilvalue(L->top);
+api_incr_top(L);
+}
+static void lua_pushnumber(lua_State*L,lua_Number n){
+setnvalue(L->top,n);
+api_incr_top(L);
+}
+static void lua_pushinteger(lua_State*L,lua_Integer n){
+setnvalue(L->top,cast_num(n));
+api_incr_top(L);
+}
+static void lua_pushlstring(lua_State*L,const char*s,size_t len){
+luaC_checkGC(L);
+setsvalue(L,L->top,luaS_newlstr(L,s,len));
+api_incr_top(L);
+}
+static void lua_pushstring(lua_State*L,const char*s){
+if(s==NULL)
+lua_pushnil(L);
+else
+lua_pushlstring(L,s,strlen(s));
+}
+static const char*lua_pushvfstring(lua_State*L,const char*fmt,
+va_list argp){
+const char*ret;
+luaC_checkGC(L);
+ret=luaO_pushvfstring(L,fmt,argp);
+return ret;
+}
+static const char*lua_pushfstring(lua_State*L,const char*fmt,...){
+const char*ret;
+va_list argp;
+luaC_checkGC(L);
+va_start(argp,fmt);
+ret=luaO_pushvfstring(L,fmt,argp);
+va_end(argp);
+return ret;
+}
+static void lua_pushcclosure(lua_State*L,lua_CFunction fn,int n){
+Closure*cl;
+luaC_checkGC(L);
+api_checknelems(L,n);
+cl=luaF_newCclosure(L,n,getcurrenv(L));
+cl->c.f=fn;
+L->top-=n;
+while(n--)
+setobj(L,&cl->c.upvalue[n],L->top+n);
+setclvalue(L,L->top,cl);
+api_incr_top(L);
+}
+static void lua_pushboolean(lua_State*L,int b){
+setbvalue(L->top,(b!=0));
+api_incr_top(L);
+}
+static int lua_pushthread(lua_State*L){
+setthvalue(L,L->top,L);
+api_incr_top(L);
+return(G(L)->mainthread==L);
+}
+static void lua_gettable(lua_State*L,int idx){
+StkId t;
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+luaV_gettable(L,t,L->top-1,L->top-1);
+}
+static void lua_getfield(lua_State*L,int idx,const char*k){
+StkId t;
+TValue key;
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+setsvalue(L,&key,luaS_new(L,k));
+luaV_gettable(L,t,&key,L->top);
+api_incr_top(L);
+}
+static void lua_rawget(lua_State*L,int idx){
+StkId t;
+t=index2adr(L,idx);
+luai_apicheck(L,ttistable(t));
+setobj(L,L->top-1,luaH_get(hvalue(t),L->top-1));
+}
+static void lua_rawgeti(lua_State*L,int idx,int n){
+StkId o;
+o=index2adr(L,idx);
+luai_apicheck(L,ttistable(o));
+setobj(L,L->top,luaH_getnum(hvalue(o),n));
+api_incr_top(L);
+}
+static void lua_createtable(lua_State*L,int narray,int nrec){
+luaC_checkGC(L);
+sethvalue(L,L->top,luaH_new(L,narray,nrec));
+api_incr_top(L);
+}
+static int lua_getmetatable(lua_State*L,int objindex){
+const TValue*obj;
+Table*mt=NULL;
+int res;
+obj=index2adr(L,objindex);
+switch(ttype(obj)){
+case 5:
+mt=hvalue(obj)->metatable;
+break;
+case 7:
+mt=uvalue(obj)->metatable;
+break;
+default:
+mt=G(L)->mt[ttype(obj)];
+break;
+}
+if(mt==NULL)
+res=0;
+else{
+sethvalue(L,L->top,mt);
+api_incr_top(L);
+res=1;
+}
+return res;
+}
+static void lua_getfenv(lua_State*L,int idx){
+StkId o;
+o=index2adr(L,idx);
+api_checkvalidindex(L,o);
+switch(ttype(o)){
+case 6:
+sethvalue(L,L->top,clvalue(o)->c.env);
+break;
+case 7:
+sethvalue(L,L->top,uvalue(o)->env);
+break;
+case 8:
+setobj(L,L->top,gt(thvalue(o)));
+break;
+default:
+setnilvalue(L->top);
+break;
+}
+api_incr_top(L);
+}
+static void lua_settable(lua_State*L,int idx){
+StkId t;
+api_checknelems(L,2);
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+luaV_settable(L,t,L->top-2,L->top-1);
+L->top-=2;
+}
+static void lua_setfield(lua_State*L,int idx,const char*k){
+StkId t;
+TValue key;
+api_checknelems(L,1);
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+setsvalue(L,&key,luaS_new(L,k));
+luaV_settable(L,t,&key,L->top-1);
+L->top--;
+}
+static void lua_rawset(lua_State*L,int idx){
+StkId t;
+api_checknelems(L,2);
+t=index2adr(L,idx);
+luai_apicheck(L,ttistable(t));
+setobj(L,luaH_set(L,hvalue(t),L->top-2),L->top-1);
+luaC_barriert(L,hvalue(t),L->top-1);
+L->top-=2;
+}
+static void lua_rawseti(lua_State*L,int idx,int n){
+StkId o;
+api_checknelems(L,1);
+o=index2adr(L,idx);
+luai_apicheck(L,ttistable(o));
+setobj(L,luaH_setnum(L,hvalue(o),n),L->top-1);
+luaC_barriert(L,hvalue(o),L->top-1);
+L->top--;
+}
+static int lua_setmetatable(lua_State*L,int objindex){
+TValue*obj;
+Table*mt;
+api_checknelems(L,1);
+obj=index2adr(L,objindex);
+api_checkvalidindex(L,obj);
+if(ttisnil(L->top-1))
+mt=NULL;
+else{
+luai_apicheck(L,ttistable(L->top-1));
+mt=hvalue(L->top-1);
+}
+switch(ttype(obj)){
+case 5:{
+hvalue(obj)->metatable=mt;
+if(mt)
+luaC_objbarriert(L,hvalue(obj),mt);
+break;
+}
+case 7:{
+uvalue(obj)->metatable=mt;
+if(mt)
+luaC_objbarrier(L,rawuvalue(obj),mt);
+break;
+}
+default:{
+G(L)->mt[ttype(obj)]=mt;
+break;
+}
+}
+L->top--;
+return 1;
+}
+static int lua_setfenv(lua_State*L,int idx){
+StkId o;
+int res=1;
+api_checknelems(L,1);
+o=index2adr(L,idx);
+api_checkvalidindex(L,o);
+luai_apicheck(L,ttistable(L->top-1));
+switch(ttype(o)){
+case 6:
+clvalue(o)->c.env=hvalue(L->top-1);
+break;
+case 7:
+uvalue(o)->env=hvalue(L->top-1);
+break;
+case 8:
+sethvalue(L,gt(thvalue(o)),hvalue(L->top-1));
+break;
+default:
+res=0;
+break;
+}
+if(res)luaC_objbarrier(L,gcvalue(o),hvalue(L->top-1));
+L->top--;
+return res;
+}
+#define adjustresults(L,nres){if(nres==(-1)&&L->top>=L->ci->top)L->ci->top=L->top;}
+#define checkresults(L,na,nr)luai_apicheck(L,(nr)==(-1)||(L->ci->top-L->top>=(nr)-(na)))
+static void lua_call(lua_State*L,int nargs,int nresults){
+StkId func;
+api_checknelems(L,nargs+1);
+checkresults(L,nargs,nresults);
+func=L->top-(nargs+1);
+luaD_call(L,func,nresults);
+adjustresults(L,nresults);
+}
+struct CallS{
+StkId func;
+int nresults;
+};
+static void f_call(lua_State*L,void*ud){
+struct CallS*c=cast(struct CallS*,ud);
+luaD_call(L,c->func,c->nresults);
+}
+static int lua_pcall(lua_State*L,int nargs,int nresults,int errfunc){
+struct CallS c;
+int status;
+ptrdiff_t func;
+api_checknelems(L,nargs+1);
+checkresults(L,nargs,nresults);
+if(errfunc==0)
+func=0;
+else{
+StkId o=index2adr(L,errfunc);
+api_checkvalidindex(L,o);
+func=savestack(L,o);
+}
+c.func=L->top-(nargs+1);
+c.nresults=nresults;
+status=luaD_pcall(L,f_call,&c,savestack(L,c.func),func);
+adjustresults(L,nresults);
+return status;
+}
+static int lua_load(lua_State*L,lua_Reader reader,void*data,
+const char*chunkname){
+ZIO z;
+int status;
+if(!chunkname)chunkname="?";
+luaZ_init(L,&z,reader,data);
+status=luaD_protectedparser(L,&z,chunkname);
+return status;
+}
+static int lua_error(lua_State*L){
+api_checknelems(L,1);
+luaG_errormsg(L);
+return 0;
+}
+static int lua_next(lua_State*L,int idx){
+StkId t;
+int more;
+t=index2adr(L,idx);
+luai_apicheck(L,ttistable(t));
+more=luaH_next(L,hvalue(t),L->top-1);
+if(more){
+api_incr_top(L);
+}
+else
+L->top-=1;
+return more;
+}
+static void lua_concat(lua_State*L,int n){
+api_checknelems(L,n);
+if(n>=2){
+luaC_checkGC(L);
+luaV_concat(L,n,cast_int(L->top-L->base)-1);
+L->top-=(n-1);
+}
+else if(n==0){
+setsvalue(L,L->top,luaS_newlstr(L,"",0));
+api_incr_top(L);
+}
+}
+static void*lua_newuserdata(lua_State*L,size_t size){
+Udata*u;
+luaC_checkGC(L);
+u=luaS_newudata(L,size,getcurrenv(L));
+setuvalue(L,L->top,u);
+api_incr_top(L);
+return u+1;
+}
+#define luaL_getn(L,i)((int)lua_objlen(L,i))
+#define luaL_setn(L,i,j)((void)0)
+typedef struct luaL_Reg{
+const char*name;
+lua_CFunction func;
+}luaL_Reg;
+static void luaI_openlib(lua_State*L,const char*libname,
+const luaL_Reg*l,int nup);
+static int luaL_argerror(lua_State*L,int numarg,const char*extramsg);
+static const char* luaL_checklstring(lua_State*L,int numArg,
+size_t*l);
+static const char* luaL_optlstring(lua_State*L,int numArg,
+const char*def,size_t*l);
+static lua_Integer luaL_checkinteger(lua_State*L,int numArg);
+static lua_Integer luaL_optinteger(lua_State*L,int nArg,
+lua_Integer def);
+static int luaL_error(lua_State*L,const char*fmt,...);
+static const char* luaL_findtable(lua_State*L,int idx,
+const char*fname,int szhint);
+#define luaL_argcheck(L,cond,numarg,extramsg)((void)((cond)||luaL_argerror(L,(numarg),(extramsg))))
+#define luaL_checkstring(L,n)(luaL_checklstring(L,(n),NULL))
+#define luaL_optstring(L,n,d)(luaL_optlstring(L,(n),(d),NULL))
+#define luaL_checkint(L,n)((int)luaL_checkinteger(L,(n)))
+#define luaL_optint(L,n,d)((int)luaL_optinteger(L,(n),(d)))
+#define luaL_typename(L,i)lua_typename(L,lua_type(L,(i)))
+#define luaL_getmetatable(L,n)(lua_getfield(L,(-10000),(n)))
+#define luaL_opt(L,f,n,d)(lua_isnoneornil(L,(n))?(d):f(L,(n)))
+typedef struct luaL_Buffer{
+char*p;
+int lvl;
+lua_State*L;
+char buffer[BUFSIZ];
+}luaL_Buffer;
+#define luaL_addchar(B,c)((void)((B)->p<((B)->buffer+BUFSIZ)||luaL_prepbuffer(B)),(*(B)->p++=(char)(c)))
+#define luaL_addsize(B,n)((B)->p+=(n))
+static char* luaL_prepbuffer(luaL_Buffer*B);
+static int luaL_argerror(lua_State*L,int narg,const char*extramsg){
+lua_Debug ar;
+if(!lua_getstack(L,0,&ar))
+return luaL_error(L,"bad argument #%d (%s)",narg,extramsg);
+lua_getinfo(L,"n",&ar);
+if(strcmp(ar.namewhat,"method")==0){
+narg--;
+if(narg==0)
+return luaL_error(L,"calling "LUA_QL("%s")" on bad self (%s)",
+ar.name,extramsg);
+}
+if(ar.name==NULL)
+ar.name="?";
+return luaL_error(L,"bad argument #%d to "LUA_QL("%s")" (%s)",
+narg,ar.name,extramsg);
+}
+static int luaL_typerror(lua_State*L,int narg,const char*tname){
+const char*msg=lua_pushfstring(L,"%s expected, got %s",
+tname,luaL_typename(L,narg));
+return luaL_argerror(L,narg,msg);
+}
+static void tag_error(lua_State*L,int narg,int tag){
+luaL_typerror(L,narg,lua_typename(L,tag));
+}
+static void luaL_where(lua_State*L,int level){
+lua_Debug ar;
+if(lua_getstack(L,level,&ar)){
+lua_getinfo(L,"Sl",&ar);
+if(ar.currentline>0){
+lua_pushfstring(L,"%s:%d: ",ar.short_src,ar.currentline);
+return;
+}
+}
+lua_pushliteral(L,"");
+}
+static int luaL_error(lua_State*L,const char*fmt,...){
+va_list argp;
+va_start(argp,fmt);
+luaL_where(L,1);
+lua_pushvfstring(L,fmt,argp);
+va_end(argp);
+lua_concat(L,2);
+return lua_error(L);
+}
+static int luaL_newmetatable(lua_State*L,const char*tname){
+lua_getfield(L,(-10000),tname);
+if(!lua_isnil(L,-1))
+return 0;
+lua_pop(L,1);
+lua_newtable(L);
+lua_pushvalue(L,-1);
+lua_setfield(L,(-10000),tname);
+return 1;
+}
+static void*luaL_checkudata(lua_State*L,int ud,const char*tname){
+void*p=lua_touserdata(L,ud);
+if(p!=NULL){
+if(lua_getmetatable(L,ud)){
+lua_getfield(L,(-10000),tname);
+if(lua_rawequal(L,-1,-2)){
+lua_pop(L,2);
+return p;
+}
+}
+}
+luaL_typerror(L,ud,tname);
+return NULL;
+}
+static void luaL_checkstack(lua_State*L,int space,const char*mes){
+if(!lua_checkstack(L,space))
+luaL_error(L,"stack overflow (%s)",mes);
+}
+static void luaL_checktype(lua_State*L,int narg,int t){
+if(lua_type(L,narg)!=t)
+tag_error(L,narg,t);
+}
+static void luaL_checkany(lua_State*L,int narg){
+if(lua_type(L,narg)==(-1))
+luaL_argerror(L,narg,"value expected");
+}
+static const char*luaL_checklstring(lua_State*L,int narg,size_t*len){
+const char*s=lua_tolstring(L,narg,len);
+if(!s)tag_error(L,narg,4);
+return s;
+}
+static const char*luaL_optlstring(lua_State*L,int narg,
+const char*def,size_t*len){
+if(lua_isnoneornil(L,narg)){
+if(len)
+*len=(def?strlen(def):0);
+return def;
+}
+else return luaL_checklstring(L,narg,len);
+}
+static lua_Number luaL_checknumber(lua_State*L,int narg){
+lua_Number d=lua_tonumber(L,narg);
+if(d==0&&!lua_isnumber(L,narg))
+tag_error(L,narg,3);
+return d;
+}
+static lua_Integer luaL_checkinteger(lua_State*L,int narg){
+lua_Integer d=lua_tointeger(L,narg);
+if(d==0&&!lua_isnumber(L,narg))
+tag_error(L,narg,3);
+return d;
+}
+static lua_Integer luaL_optinteger(lua_State*L,int narg,
+lua_Integer def){
+return luaL_opt(L,luaL_checkinteger,narg,def);
+}
+static int luaL_getmetafield(lua_State*L,int obj,const char*event){
+if(!lua_getmetatable(L,obj))
+return 0;
+lua_pushstring(L,event);
+lua_rawget(L,-2);
+if(lua_isnil(L,-1)){
+lua_pop(L,2);
+return 0;
+}
+else{
+lua_remove(L,-2);
+return 1;
+}
+}
+static void luaL_register(lua_State*L,const char*libname,
+const luaL_Reg*l){
+luaI_openlib(L,libname,l,0);
+}
+static int libsize(const luaL_Reg*l){
+int size=0;
+for(;l->name;l++)size++;
+return size;
+}
+static void luaI_openlib(lua_State*L,const char*libname,
+const luaL_Reg*l,int nup){
+if(libname){
+int size=libsize(l);
+luaL_findtable(L,(-10000),"_LOADED",1);
+lua_getfield(L,-1,libname);
+if(!lua_istable(L,-1)){
+lua_pop(L,1);
+if(luaL_findtable(L,(-10002),libname,size)!=NULL)
+luaL_error(L,"name conflict for module "LUA_QL("%s"),libname);
+lua_pushvalue(L,-1);
+lua_setfield(L,-3,libname);
+}
+lua_remove(L,-2);
+lua_insert(L,-(nup+1));
+}
+for(;l->name;l++){
+int i;
+for(i=0;i<nup;i++)
+lua_pushvalue(L,-nup);
+lua_pushcclosure(L,l->func,nup);
+lua_setfield(L,-(nup+2),l->name);
+}
+lua_pop(L,nup);
+}
+static const char*luaL_findtable(lua_State*L,int idx,
+const char*fname,int szhint){
+const char*e;
+lua_pushvalue(L,idx);
+do{
+e=strchr(fname,'.');
+if(e==NULL)e=fname+strlen(fname);
+lua_pushlstring(L,fname,e-fname);
+lua_rawget(L,-2);
+if(lua_isnil(L,-1)){
+lua_pop(L,1);
+lua_createtable(L,0,(*e=='.'?1:szhint));
+lua_pushlstring(L,fname,e-fname);
+lua_pushvalue(L,-2);
+lua_settable(L,-4);
+}
+else if(!lua_istable(L,-1)){
+lua_pop(L,2);
+return fname;
+}
+lua_remove(L,-2);
+fname=e+1;
+}while(*e=='.');
+return NULL;
+}
+#define bufflen(B)((B)->p-(B)->buffer)
+#define bufffree(B)((size_t)(BUFSIZ-bufflen(B)))
+static int emptybuffer(luaL_Buffer*B){
+size_t l=bufflen(B);
+if(l==0)return 0;
+else{
+lua_pushlstring(B->L,B->buffer,l);
+B->p=B->buffer;
+B->lvl++;
+return 1;
+}
+}
+static void adjuststack(luaL_Buffer*B){
+if(B->lvl>1){
+lua_State*L=B->L;
+int toget=1;
+size_t toplen=lua_strlen(L,-1);
+do{
+size_t l=lua_strlen(L,-(toget+1));
+if(B->lvl-toget+1>=(20/2)||toplen>l){
+toplen+=l;
+toget++;
+}
+else break;
+}while(toget<B->lvl);
+lua_concat(L,toget);
+B->lvl=B->lvl-toget+1;
+}
+}
+static char*luaL_prepbuffer(luaL_Buffer*B){
+if(emptybuffer(B))
+adjuststack(B);
+return B->buffer;
+}
+static void luaL_addlstring(luaL_Buffer*B,const char*s,size_t l){
+while(l--)
+luaL_addchar(B,*s++);
+}
+static void luaL_pushresult(luaL_Buffer*B){
+emptybuffer(B);
+lua_concat(B->L,B->lvl);
+B->lvl=1;
+}
+static void luaL_addvalue(luaL_Buffer*B){
+lua_State*L=B->L;
+size_t vl;
+const char*s=lua_tolstring(L,-1,&vl);
+if(vl<=bufffree(B)){
+memcpy(B->p,s,vl);
+B->p+=vl;
+lua_pop(L,1);
+}
+else{
+if(emptybuffer(B))
+lua_insert(L,-2);
+B->lvl++;
+adjuststack(B);
+}
+}
+static void luaL_buffinit(lua_State*L,luaL_Buffer*B){
+B->L=L;
+B->p=B->buffer;
+B->lvl=0;
+}
+typedef struct LoadF{
+int extraline;
+FILE*f;
+char buff[BUFSIZ];
+}LoadF;
+static const char*getF(lua_State*L,void*ud,size_t*size){
+LoadF*lf=(LoadF*)ud;
+(void)L;
+if(lf->extraline){
+lf->extraline=0;
+*size=1;
+return"\n";
+}
+if(feof(lf->f))return NULL;
+*size=fread(lf->buff,1,sizeof(lf->buff),lf->f);
+return(*size>0)?lf->buff:NULL;
+}
+static int errfile(lua_State*L,const char*what,int fnameindex){
+const char*serr=strerror(errno);
+const char*filename=lua_tostring(L,fnameindex)+1;
+lua_pushfstring(L,"cannot %s %s: %s",what,filename,serr);
+lua_remove(L,fnameindex);
+return(5+1);
+}
+static int luaL_loadfile(lua_State*L,const char*filename){
+LoadF lf;
+int status,readstatus;
+int c;
+int fnameindex=lua_gettop(L)+1;
+lf.extraline=0;
+if(filename==NULL){
+lua_pushliteral(L,"=stdin");
+lf.f=stdin;
+}
+else{
+lua_pushfstring(L,"@%s",filename);
+lf.f=fopen(filename,"r");
+if(lf.f==NULL)return errfile(L,"open",fnameindex);
+}
+c=getc(lf.f);
+if(c=='#'){
+lf.extraline=1;
+while((c=getc(lf.f))!=EOF&&c!='\n');
+if(c=='\n')c=getc(lf.f);
+}
+if(c=="\033Lua"[0]&&filename){
+lf.f=freopen(filename,"rb",lf.f);
+if(lf.f==NULL)return errfile(L,"reopen",fnameindex);
+while((c=getc(lf.f))!=EOF&&c!="\033Lua"[0]);
+lf.extraline=0;
+}
+ungetc(c,lf.f);
+status=lua_load(L,getF,&lf,lua_tostring(L,-1));
+readstatus=ferror(lf.f);
+if(filename)fclose(lf.f);
+if(readstatus){
+lua_settop(L,fnameindex);
+return errfile(L,"read",fnameindex);
+}
+lua_remove(L,fnameindex);
+return status;
+}
+typedef struct LoadS{
+const char*s;
+size_t size;
+}LoadS;
+static const char*getS(lua_State*L,void*ud,size_t*size){
+LoadS*ls=(LoadS*)ud;
+(void)L;
+if(ls->size==0)return NULL;
+*size=ls->size;
+ls->size=0;
+return ls->s;
+}
+static int luaL_loadbuffer(lua_State*L,const char*buff,size_t size,
+const char*name){
+LoadS ls;
+ls.s=buff;
+ls.size=size;
+return lua_load(L,getS,&ls,name);
+}
+static void*l_alloc(void*ud,void*ptr,size_t osize,size_t nsize){
+(void)ud;
+(void)osize;
+if(nsize==0){
+free(ptr);
+return NULL;
+}
+else
+return realloc(ptr,nsize);
+}
+static int panic(lua_State*L){
+(void)L;
+fprintf(stderr,"PANIC: unprotected error in call to Lua API (%s)\n",
+lua_tostring(L,-1));
+return 0;
+}
+static lua_State*luaL_newstate(void){
+lua_State*L=lua_newstate(l_alloc,NULL);
+if(L)lua_atpanic(L,&panic);
+return L;
+}
+static int luaB_tonumber(lua_State*L){
+int base=luaL_optint(L,2,10);
+if(base==10){
+luaL_checkany(L,1);
+if(lua_isnumber(L,1)){
+lua_pushnumber(L,lua_tonumber(L,1));
+return 1;
+}
+}
+else{
+const char*s1=luaL_checkstring(L,1);
+char*s2;
+unsigned long n;
+luaL_argcheck(L,2<=base&&base<=36,2,"base out of range");
+n=strtoul(s1,&s2,base);
+if(s1!=s2){
+while(isspace((unsigned char)(*s2)))s2++;
+if(*s2=='\0'){
+lua_pushnumber(L,(lua_Number)n);
+return 1;
+}
+}
+}
+lua_pushnil(L);
+return 1;
+}
+static int luaB_error(lua_State*L){
+int level=luaL_optint(L,2,1);
+lua_settop(L,1);
+if(lua_isstring(L,1)&&level>0){
+luaL_where(L,level);
+lua_pushvalue(L,1);
+lua_concat(L,2);
+}
+return lua_error(L);
+}
+static int luaB_setmetatable(lua_State*L){
+int t=lua_type(L,2);
+luaL_checktype(L,1,5);
+luaL_argcheck(L,t==0||t==5,2,
+"nil or table expected");
+if(luaL_getmetafield(L,1,"__metatable"))
+luaL_error(L,"cannot change a protected metatable");
+lua_settop(L,2);
+lua_setmetatable(L,1);
+return 1;
+}
+static void getfunc(lua_State*L,int opt){
+if(lua_isfunction(L,1))lua_pushvalue(L,1);
+else{
+lua_Debug ar;
+int level=opt?luaL_optint(L,1,1):luaL_checkint(L,1);
+luaL_argcheck(L,level>=0,1,"level must be non-negative");
+if(lua_getstack(L,level,&ar)==0)
+luaL_argerror(L,1,"invalid level");
+lua_getinfo(L,"f",&ar);
+if(lua_isnil(L,-1))
+luaL_error(L,"no function environment for tail call at level %d",
+level);
+}
+}
+static int luaB_setfenv(lua_State*L){
+luaL_checktype(L,2,5);
+getfunc(L,0);
+lua_pushvalue(L,2);
+if(lua_isnumber(L,1)&&lua_tonumber(L,1)==0){
+lua_pushthread(L);
+lua_insert(L,-2);
+lua_setfenv(L,-2);
+return 0;
+}
+else if(lua_iscfunction(L,-2)||lua_setfenv(L,-2)==0)
+luaL_error(L,
+LUA_QL("setfenv")" cannot change environment of given object");
+return 1;
+}
+static int luaB_rawget(lua_State*L){
+luaL_checktype(L,1,5);
+luaL_checkany(L,2);
+lua_settop(L,2);
+lua_rawget(L,1);
+return 1;
+}
+static int luaB_type(lua_State*L){
+luaL_checkany(L,1);
+lua_pushstring(L,luaL_typename(L,1));
+return 1;
+}
+static int luaB_next(lua_State*L){
+luaL_checktype(L,1,5);
+lua_settop(L,2);
+if(lua_next(L,1))
+return 2;
+else{
+lua_pushnil(L);
+return 1;
+}
+}
+static int luaB_pairs(lua_State*L){
+luaL_checktype(L,1,5);
+lua_pushvalue(L,lua_upvalueindex(1));
+lua_pushvalue(L,1);
+lua_pushnil(L);
+return 3;
+}
+static int ipairsaux(lua_State*L){
+int i=luaL_checkint(L,2);
+luaL_checktype(L,1,5);
+i++;
+lua_pushinteger(L,i);
+lua_rawgeti(L,1,i);
+return(lua_isnil(L,-1))?0:2;
+}
+static int luaB_ipairs(lua_State*L){
+luaL_checktype(L,1,5);
+lua_pushvalue(L,lua_upvalueindex(1));
+lua_pushvalue(L,1);
+lua_pushinteger(L,0);
+return 3;
+}
+static int load_aux(lua_State*L,int status){
+if(status==0)
+return 1;
+else{
+lua_pushnil(L);
+lua_insert(L,-2);
+return 2;
+}
+}
+static int luaB_loadstring(lua_State*L){
+size_t l;
+const char*s=luaL_checklstring(L,1,&l);
+const char*chunkname=luaL_optstring(L,2,s);
+return load_aux(L,luaL_loadbuffer(L,s,l,chunkname));
+}
+static int luaB_loadfile(lua_State*L){
+const char*fname=luaL_optstring(L,1,NULL);
+return load_aux(L,luaL_loadfile(L,fname));
+}
+static int luaB_assert(lua_State*L){
+luaL_checkany(L,1);
+if(!lua_toboolean(L,1))
+return luaL_error(L,"%s",luaL_optstring(L,2,"assertion failed!"));
+return lua_gettop(L);
+}
+static int luaB_unpack(lua_State*L){
+int i,e,n;
+luaL_checktype(L,1,5);
+i=luaL_optint(L,2,1);
+e=luaL_opt(L,luaL_checkint,3,luaL_getn(L,1));
+if(i>e)return 0;
+n=e-i+1;
+if(n<=0||!lua_checkstack(L,n))
+return luaL_error(L,"too many results to unpack");
+lua_rawgeti(L,1,i);
+while(i++<e)
+lua_rawgeti(L,1,i);
+return n;
+}
+static int luaB_pcall(lua_State*L){
+int status;
+luaL_checkany(L,1);
+status=lua_pcall(L,lua_gettop(L)-1,(-1),0);
+lua_pushboolean(L,(status==0));
+lua_insert(L,1);
+return lua_gettop(L);
+}
+static int luaB_newproxy(lua_State*L){
+lua_settop(L,1);
+lua_newuserdata(L,0);
+if(lua_toboolean(L,1)==0)
+return 1;
+else if(lua_isboolean(L,1)){
+lua_newtable(L);
+lua_pushvalue(L,-1);
+lua_pushboolean(L,1);
+lua_rawset(L,lua_upvalueindex(1));
+}
+else{
+int validproxy=0;
+if(lua_getmetatable(L,1)){
+lua_rawget(L,lua_upvalueindex(1));
+validproxy=lua_toboolean(L,-1);
+lua_pop(L,1);
+}
+luaL_argcheck(L,validproxy,1,"boolean or proxy expected");
+lua_getmetatable(L,1);
+}
+lua_setmetatable(L,2);
+return 1;
+}
+static const luaL_Reg base_funcs[]={
+{"assert",luaB_assert},
+{"error",luaB_error},
+{"loadfile",luaB_loadfile},
+{"loadstring",luaB_loadstring},
+{"next",luaB_next},
+{"pcall",luaB_pcall},
+{"rawget",luaB_rawget},
+{"setfenv",luaB_setfenv},
+{"setmetatable",luaB_setmetatable},
+{"tonumber",luaB_tonumber},
+{"type",luaB_type},
+{"unpack",luaB_unpack},
+{NULL,NULL}
+};
+static void auxopen(lua_State*L,const char*name,
+lua_CFunction f,lua_CFunction u){
+lua_pushcfunction(L,u);
+lua_pushcclosure(L,f,1);
+lua_setfield(L,-2,name);
+}
+static void base_open(lua_State*L){
+lua_pushvalue(L,(-10002));
+lua_setglobal(L,"_G");
+luaL_register(L,"_G",base_funcs);
+lua_pushliteral(L,"Lua 5.1");
+lua_setglobal(L,"_VERSION");
+auxopen(L,"ipairs",luaB_ipairs,ipairsaux);
+auxopen(L,"pairs",luaB_pairs,luaB_next);
+lua_createtable(L,0,1);
+lua_pushvalue(L,-1);
+lua_setmetatable(L,-2);
+lua_pushliteral(L,"kv");
+lua_setfield(L,-2,"__mode");
+lua_pushcclosure(L,luaB_newproxy,1);
+lua_setglobal(L,"newproxy");
+}
+static int luaopen_base(lua_State*L){
+base_open(L);
+return 1;
+}
+#define aux_getn(L,n)(luaL_checktype(L,n,5),luaL_getn(L,n))
+static int tinsert(lua_State*L){
+int e=aux_getn(L,1)+1;
+int pos;
+switch(lua_gettop(L)){
+case 2:{
+pos=e;
+break;
+}
+case 3:{
+int i;
+pos=luaL_checkint(L,2);
+if(pos>e)e=pos;
+for(i=e;i>pos;i--){
+lua_rawgeti(L,1,i-1);
+lua_rawseti(L,1,i);
+}
+break;
+}
+default:{
+return luaL_error(L,"wrong number of arguments to "LUA_QL("insert"));
+}
+}
+luaL_setn(L,1,e);
+lua_rawseti(L,1,pos);
+return 0;
+}
+static int tremove(lua_State*L){
+int e=aux_getn(L,1);
+int pos=luaL_optint(L,2,e);
+if(!(1<=pos&&pos<=e))
+return 0;
+luaL_setn(L,1,e-1);
+lua_rawgeti(L,1,pos);
+for(;pos<e;pos++){
+lua_rawgeti(L,1,pos+1);
+lua_rawseti(L,1,pos);
+}
+lua_pushnil(L);
+lua_rawseti(L,1,e);
+return 1;
+}
+static void addfield(lua_State*L,luaL_Buffer*b,int i){
+lua_rawgeti(L,1,i);
+if(!lua_isstring(L,-1))
+luaL_error(L,"invalid value (%s) at index %d in table for "
+LUA_QL("concat"),luaL_typename(L,-1),i);
+luaL_addvalue(b);
+}
+static int tconcat(lua_State*L){
+luaL_Buffer b;
+size_t lsep;
+int i,last;
+const char*sep=luaL_optlstring(L,2,"",&lsep);
+luaL_checktype(L,1,5);
+i=luaL_optint(L,3,1);
+last=luaL_opt(L,luaL_checkint,4,luaL_getn(L,1));
+luaL_buffinit(L,&b);
+for(;i<last;i++){
+addfield(L,&b,i);
+luaL_addlstring(&b,sep,lsep);
+}
+if(i==last)
+addfield(L,&b,i);
+luaL_pushresult(&b);
+return 1;
+}
+static void set2(lua_State*L,int i,int j){
+lua_rawseti(L,1,i);
+lua_rawseti(L,1,j);
+}
+static int sort_comp(lua_State*L,int a,int b){
+if(!lua_isnil(L,2)){
+int res;
+lua_pushvalue(L,2);
+lua_pushvalue(L,a-1);
+lua_pushvalue(L,b-2);
+lua_call(L,2,1);
+res=lua_toboolean(L,-1);
+lua_pop(L,1);
+return res;
+}
+else
+return lua_lessthan(L,a,b);
+}
+static void auxsort(lua_State*L,int l,int u){
+while(l<u){
+int i,j;
+lua_rawgeti(L,1,l);
+lua_rawgeti(L,1,u);
+if(sort_comp(L,-1,-2))
+set2(L,l,u);
+else
+lua_pop(L,2);
+if(u-l==1)break;
+i=(l+u)/2;
+lua_rawgeti(L,1,i);
+lua_rawgeti(L,1,l);
+if(sort_comp(L,-2,-1))
+set2(L,i,l);
+else{
+lua_pop(L,1);
+lua_rawgeti(L,1,u);
+if(sort_comp(L,-1,-2))
+set2(L,i,u);
+else
+lua_pop(L,2);
+}
+if(u-l==2)break;
+lua_rawgeti(L,1,i);
+lua_pushvalue(L,-1);
+lua_rawgeti(L,1,u-1);
+set2(L,i,u-1);
+i=l;j=u-1;
+for(;;){
+while(lua_rawgeti(L,1,++i),sort_comp(L,-1,-2)){
+if(i>u)luaL_error(L,"invalid order function for sorting");
+lua_pop(L,1);
+}
+while(lua_rawgeti(L,1,--j),sort_comp(L,-3,-1)){
+if(j<l)luaL_error(L,"invalid order function for sorting");
+lua_pop(L,1);
+}
+if(j<i){
+lua_pop(L,3);
+break;
+}
+set2(L,i,j);
+}
+lua_rawgeti(L,1,u-1);
+lua_rawgeti(L,1,i);
+set2(L,u-1,i);
+if(i-l<u-i){
+j=l;i=i-1;l=i+2;
+}
+else{
+j=i+1;i=u;u=j-2;
+}
+auxsort(L,j,i);
+}
+}
+static int sort(lua_State*L){
+int n=aux_getn(L,1);
+luaL_checkstack(L,40,"");
+if(!lua_isnoneornil(L,2))
+luaL_checktype(L,2,6);
+lua_settop(L,2);
+auxsort(L,1,n);
+return 0;
+}
+static const luaL_Reg tab_funcs[]={
+{"concat",tconcat},
+{"insert",tinsert},
+{"remove",tremove},
+{"sort",sort},
+{NULL,NULL}
+};
+static int luaopen_table(lua_State*L){
+luaL_register(L,"table",tab_funcs);
+return 1;
+}
+static const char*const fnames[]={"input","output"};
+static int pushresult(lua_State*L,int i,const char*filename){
+int en=errno;
+if(i){
+lua_pushboolean(L,1);
+return 1;
+}
+else{
+lua_pushnil(L);
+if(filename)
+lua_pushfstring(L,"%s: %s",filename,strerror(en));
+else
+lua_pushfstring(L,"%s",strerror(en));
+lua_pushinteger(L,en);
+return 3;
+}
+}
+static void fileerror(lua_State*L,int arg,const char*filename){
+lua_pushfstring(L,"%s: %s",filename,strerror(errno));
+luaL_argerror(L,arg,lua_tostring(L,-1));
+}
+#define tofilep(L)((FILE**)luaL_checkudata(L,1,"FILE*"))
+static int io_type(lua_State*L){
+void*ud;
+luaL_checkany(L,1);
+ud=lua_touserdata(L,1);
+lua_getfield(L,(-10000),"FILE*");
+if(ud==NULL||!lua_getmetatable(L,1)||!lua_rawequal(L,-2,-1))
+lua_pushnil(L);
+else if(*((FILE**)ud)==NULL)
+lua_pushliteral(L,"closed file");
+else
+lua_pushliteral(L,"file");
+return 1;
+}
+static FILE*tofile(lua_State*L){
+FILE**f=tofilep(L);
+if(*f==NULL)
+luaL_error(L,"attempt to use a closed file");
+return*f;
+}
+static FILE**newfile(lua_State*L){
+FILE**pf=(FILE**)lua_newuserdata(L,sizeof(FILE*));
+*pf=NULL;
+luaL_getmetatable(L,"FILE*");
+lua_setmetatable(L,-2);
+return pf;
+}
+static int io_noclose(lua_State*L){
+lua_pushnil(L);
+lua_pushliteral(L,"cannot close standard file");
+return 2;
+}
+static int io_pclose(lua_State*L){
+FILE**p=tofilep(L);
+int ok=lua_pclose(L,*p);
+*p=NULL;
+return pushresult(L,ok,NULL);
+}
+static int io_fclose(lua_State*L){
+FILE**p=tofilep(L);
+int ok=(fclose(*p)==0);
+*p=NULL;
+return pushresult(L,ok,NULL);
+}
+static int aux_close(lua_State*L){
+lua_getfenv(L,1);
+lua_getfield(L,-1,"__close");
+return(lua_tocfunction(L,-1))(L);
+}
+static int io_close(lua_State*L){
+if(lua_isnone(L,1))
+lua_rawgeti(L,(-10001),2);
+tofile(L);
+return aux_close(L);
+}
+static int io_gc(lua_State*L){
+FILE*f=*tofilep(L);
+if(f!=NULL)
+aux_close(L);
+return 0;
+}
+static int io_open(lua_State*L){
+const char*filename=luaL_checkstring(L,1);
+const char*mode=luaL_optstring(L,2,"r");
+FILE**pf=newfile(L);
+*pf=fopen(filename,mode);
+return(*pf==NULL)?pushresult(L,0,filename):1;
+}
+static FILE*getiofile(lua_State*L,int findex){
+FILE*f;
+lua_rawgeti(L,(-10001),findex);
+f=*(FILE**)lua_touserdata(L,-1);
+if(f==NULL)
+luaL_error(L,"standard %s file is closed",fnames[findex-1]);
+return f;
+}
+static int g_iofile(lua_State*L,int f,const char*mode){
+if(!lua_isnoneornil(L,1)){
+const char*filename=lua_tostring(L,1);
+if(filename){
+FILE**pf=newfile(L);
+*pf=fopen(filename,mode);
+if(*pf==NULL)
+fileerror(L,1,filename);
+}
+else{
+tofile(L);
+lua_pushvalue(L,1);
+}
+lua_rawseti(L,(-10001),f);
+}
+lua_rawgeti(L,(-10001),f);
+return 1;
+}
+static int io_input(lua_State*L){
+return g_iofile(L,1,"r");
+}
+static int io_output(lua_State*L){
+return g_iofile(L,2,"w");
+}
+static int io_readline(lua_State*L);
+static void aux_lines(lua_State*L,int idx,int toclose){
+lua_pushvalue(L,idx);
+lua_pushboolean(L,toclose);
+lua_pushcclosure(L,io_readline,2);
+}
+static int f_lines(lua_State*L){
+tofile(L);
+aux_lines(L,1,0);
+return 1;
+}
+static int io_lines(lua_State*L){
+if(lua_isnoneornil(L,1)){
+lua_rawgeti(L,(-10001),1);
+return f_lines(L);
+}
+else{
+const char*filename=luaL_checkstring(L,1);
+FILE**pf=newfile(L);
+*pf=fopen(filename,"r");
+if(*pf==NULL)
+fileerror(L,1,filename);
+aux_lines(L,lua_gettop(L),1);
+return 1;
+}
+}
+static int read_number(lua_State*L,FILE*f){
+lua_Number d;
+if(fscanf(f,"%lf",&d)==1){
+lua_pushnumber(L,d);
+return 1;
+}
+else{
+lua_pushnil(L);
+return 0;
+}
+}
+static int test_eof(lua_State*L,FILE*f){
+int c=getc(f);
+ungetc(c,f);
+lua_pushlstring(L,NULL,0);
+return(c!=EOF);
+}
+static int read_line(lua_State*L,FILE*f){
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+for(;;){
+size_t l;
+char*p=luaL_prepbuffer(&b);
+if(fgets(p,BUFSIZ,f)==NULL){
+luaL_pushresult(&b);
+return(lua_objlen(L,-1)>0);
+}
+l=strlen(p);
+if(l==0||p[l-1]!='\n')
+luaL_addsize(&b,l);
+else{
+luaL_addsize(&b,l-1);
+luaL_pushresult(&b);
+return 1;
+}
+}
+}
+static int read_chars(lua_State*L,FILE*f,size_t n){
+size_t rlen;
+size_t nr;
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+rlen=BUFSIZ;
+do{
+char*p=luaL_prepbuffer(&b);
+if(rlen>n)rlen=n;
+nr=fread(p,sizeof(char),rlen,f);
+luaL_addsize(&b,nr);
+n-=nr;
+}while(n>0&&nr==rlen);
+luaL_pushresult(&b);
+return(n==0||lua_objlen(L,-1)>0);
+}
+static int g_read(lua_State*L,FILE*f,int first){
+int nargs=lua_gettop(L)-1;
+int success;
+int n;
+clearerr(f);
+if(nargs==0){
+success=read_line(L,f);
+n=first+1;
+}
+else{
+luaL_checkstack(L,nargs+20,"too many arguments");
+success=1;
+for(n=first;nargs--&&success;n++){
+if(lua_type(L,n)==3){
+size_t l=(size_t)lua_tointeger(L,n);
+success=(l==0)?test_eof(L,f):read_chars(L,f,l);
+}
+else{
+const char*p=lua_tostring(L,n);
+luaL_argcheck(L,p&&p[0]=='*',n,"invalid option");
+switch(p[1]){
+case'n':
+success=read_number(L,f);
+break;
+case'l':
+success=read_line(L,f);
+break;
+case'a':
+read_chars(L,f,~((size_t)0));
+success=1;
+break;
+default:
+return luaL_argerror(L,n,"invalid format");
+}
+}
+}
+}
+if(ferror(f))
+return pushresult(L,0,NULL);
+if(!success){
+lua_pop(L,1);
+lua_pushnil(L);
+}
+return n-first;
+}
+static int io_read(lua_State*L){
+return g_read(L,getiofile(L,1),1);
+}
+static int f_read(lua_State*L){
+return g_read(L,tofile(L),2);
+}
+static int io_readline(lua_State*L){
+FILE*f=*(FILE**)lua_touserdata(L,lua_upvalueindex(1));
+int sucess;
+if(f==NULL)
+luaL_error(L,"file is already closed");
+sucess=read_line(L,f);
+if(ferror(f))
+return luaL_error(L,"%s",strerror(errno));
+if(sucess)return 1;
+else{
+if(lua_toboolean(L,lua_upvalueindex(2))){
+lua_settop(L,0);
+lua_pushvalue(L,lua_upvalueindex(1));
+aux_close(L);
+}
+return 0;
+}
+}
+static int g_write(lua_State*L,FILE*f,int arg){
+int nargs=lua_gettop(L)-1;
+int status=1;
+for(;nargs--;arg++){
+if(lua_type(L,arg)==3){
+status=status&&
+fprintf(f,"%.14g",lua_tonumber(L,arg))>0;
+}
+else{
+size_t l;
+const char*s=luaL_checklstring(L,arg,&l);
+status=status&&(fwrite(s,sizeof(char),l,f)==l);
+}
+}
+return pushresult(L,status,NULL);
+}
+static int io_write(lua_State*L){
+return g_write(L,getiofile(L,2),1);
+}
+static int f_write(lua_State*L){
+return g_write(L,tofile(L),2);
+}
+static int io_flush(lua_State*L){
+return pushresult(L,fflush(getiofile(L,2))==0,NULL);
+}
+static int f_flush(lua_State*L){
+return pushresult(L,fflush(tofile(L))==0,NULL);
+}
+static const luaL_Reg iolib[]={
+{"close",io_close},
+{"flush",io_flush},
+{"input",io_input},
+{"lines",io_lines},
+{"open",io_open},
+{"output",io_output},
+{"read",io_read},
+{"type",io_type},
+{"write",io_write},
+{NULL,NULL}
+};
+static const luaL_Reg flib[]={
+{"close",io_close},
+{"flush",f_flush},
+{"lines",f_lines},
+{"read",f_read},
+{"write",f_write},
+{"__gc",io_gc},
+{NULL,NULL}
+};
+static void createmeta(lua_State*L){
+luaL_newmetatable(L,"FILE*");
+lua_pushvalue(L,-1);
+lua_setfield(L,-2,"__index");
+luaL_register(L,NULL,flib);
+}
+static void createstdfile(lua_State*L,FILE*f,int k,const char*fname){
+*newfile(L)=f;
+if(k>0){
+lua_pushvalue(L,-1);
+lua_rawseti(L,(-10001),k);
+}
+lua_pushvalue(L,-2);
+lua_setfenv(L,-2);
+lua_setfield(L,-3,fname);
+}
+static void newfenv(lua_State*L,lua_CFunction cls){
+lua_createtable(L,0,1);
+lua_pushcfunction(L,cls);
+lua_setfield(L,-2,"__close");
+}
+static int luaopen_io(lua_State*L){
+createmeta(L);
+newfenv(L,io_fclose);
+lua_replace(L,(-10001));
+luaL_register(L,"io",iolib);
+newfenv(L,io_noclose);
+createstdfile(L,stdin,1,"stdin");
+createstdfile(L,stdout,2,"stdout");
+createstdfile(L,stderr,0,"stderr");
+lua_pop(L,1);
+lua_getfield(L,-1,"popen");
+newfenv(L,io_pclose);
+lua_setfenv(L,-2);
+lua_pop(L,1);
+return 1;
+}
+static int os_pushresult(lua_State*L,int i,const char*filename){
+int en=errno;
+if(i){
+lua_pushboolean(L,1);
+return 1;
+}
+else{
+lua_pushnil(L);
+lua_pushfstring(L,"%s: %s",filename,strerror(en));
+lua_pushinteger(L,en);
+return 3;
+}
+}
+static int os_remove(lua_State*L){
+const char*filename=luaL_checkstring(L,1);
+return os_pushresult(L,remove(filename)==0,filename);
+}
+static int os_exit(lua_State*L){
+exit(luaL_optint(L,1,EXIT_SUCCESS));
+}
+static const luaL_Reg syslib[]={
+{"exit",os_exit},
+{"remove",os_remove},
+{NULL,NULL}
+};
+static int luaopen_os(lua_State*L){
+luaL_register(L,"os",syslib);
+return 1;
+}
+#define uchar(c)((unsigned char)(c))
+static ptrdiff_t posrelat(ptrdiff_t pos,size_t len){
+if(pos<0)pos+=(ptrdiff_t)len+1;
+return(pos>=0)?pos:0;
+}
+static int str_sub(lua_State*L){
+size_t l;
+const char*s=luaL_checklstring(L,1,&l);
+ptrdiff_t start=posrelat(luaL_checkinteger(L,2),l);
+ptrdiff_t end=posrelat(luaL_optinteger(L,3,-1),l);
+if(start<1)start=1;
+if(end>(ptrdiff_t)l)end=(ptrdiff_t)l;
+if(start<=end)
+lua_pushlstring(L,s+start-1,end-start+1);
+else lua_pushliteral(L,"");
+return 1;
+}
+static int str_lower(lua_State*L){
+size_t l;
+size_t i;
+luaL_Buffer b;
+const char*s=luaL_checklstring(L,1,&l);
+luaL_buffinit(L,&b);
+for(i=0;i<l;i++)
+luaL_addchar(&b,tolower(uchar(s[i])));
+luaL_pushresult(&b);
+return 1;
+}
+static int str_upper(lua_State*L){
+size_t l;
+size_t i;
+luaL_Buffer b;
+const char*s=luaL_checklstring(L,1,&l);
+luaL_buffinit(L,&b);
+for(i=0;i<l;i++)
+luaL_addchar(&b,toupper(uchar(s[i])));
+luaL_pushresult(&b);
+return 1;
+}
+static int str_rep(lua_State*L){
+size_t l;
+luaL_Buffer b;
+const char*s=luaL_checklstring(L,1,&l);
+int n=luaL_checkint(L,2);
+luaL_buffinit(L,&b);
+while(n-->0)
+luaL_addlstring(&b,s,l);
+luaL_pushresult(&b);
+return 1;
+}
+static int str_byte(lua_State*L){
+size_t l;
+const char*s=luaL_checklstring(L,1,&l);
+ptrdiff_t posi=posrelat(luaL_optinteger(L,2,1),l);
+ptrdiff_t pose=posrelat(luaL_optinteger(L,3,posi),l);
+int n,i;
+if(posi<=0)posi=1;
+if((size_t)pose>l)pose=l;
+if(posi>pose)return 0;
+n=(int)(pose-posi+1);
+if(posi+n<=pose)
+luaL_error(L,"string slice too long");
+luaL_checkstack(L,n,"string slice too long");
+for(i=0;i<n;i++)
+lua_pushinteger(L,uchar(s[posi+i-1]));
+return n;
+}
+static int str_char(lua_State*L){
+int n=lua_gettop(L);
+int i;
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+for(i=1;i<=n;i++){
+int c=luaL_checkint(L,i);
+luaL_argcheck(L,uchar(c)==c,i,"invalid value");
+luaL_addchar(&b,uchar(c));
+}
+luaL_pushresult(&b);
+return 1;
+}
+typedef struct MatchState{
+const char*src_init;
+const char*src_end;
+lua_State*L;
+int level;
+struct{
+const char*init;
+ptrdiff_t len;
+}capture[32];
+}MatchState;
+static int check_capture(MatchState*ms,int l){
+l-='1';
+if(l<0||l>=ms->level||ms->capture[l].len==(-1))
+return luaL_error(ms->L,"invalid capture index");
+return l;
+}
+static int capture_to_close(MatchState*ms){
+int level=ms->level;
+for(level--;level>=0;level--)
+if(ms->capture[level].len==(-1))return level;
+return luaL_error(ms->L,"invalid pattern capture");
+}
+static const char*classend(MatchState*ms,const char*p){
+switch(*p++){
+case'%':{
+if(*p=='\0')
+luaL_error(ms->L,"malformed pattern (ends with "LUA_QL("%%")")");
+return p+1;
+}
+case'[':{
+if(*p=='^')p++;
+do{
+if(*p=='\0')
+luaL_error(ms->L,"malformed pattern (missing "LUA_QL("]")")");
+if(*(p++)=='%'&&*p!='\0')
+p++;
+}while(*p!=']');
+return p+1;
+}
+default:{
+return p;
+}
+}
+}
+static int match_class(int c,int cl){
+int res;
+switch(tolower(cl)){
+case'a':res=isalpha(c);break;
+case'c':res=iscntrl(c);break;
+case'd':res=isdigit(c);break;
+case'l':res=islower(c);break;
+case'p':res=ispunct(c);break;
+case's':res=isspace(c);break;
+case'u':res=isupper(c);break;
+case'w':res=isalnum(c);break;
+case'x':res=isxdigit(c);break;
+case'z':res=(c==0);break;
+default:return(cl==c);
+}
+return(islower(cl)?res:!res);
+}
+static int matchbracketclass(int c,const char*p,const char*ec){
+int sig=1;
+if(*(p+1)=='^'){
+sig=0;
+p++;
+}
+while(++p<ec){
+if(*p=='%'){
+p++;
+if(match_class(c,uchar(*p)))
+return sig;
+}
+else if((*(p+1)=='-')&&(p+2<ec)){
+p+=2;
+if(uchar(*(p-2))<=c&&c<=uchar(*p))
+return sig;
+}
+else if(uchar(*p)==c)return sig;
+}
+return!sig;
+}
+static int singlematch(int c,const char*p,const char*ep){
+switch(*p){
+case'.':return 1;
+case'%':return match_class(c,uchar(*(p+1)));
+case'[':return matchbracketclass(c,p,ep-1);
+default:return(uchar(*p)==c);
+}
+}
+static const char*match(MatchState*ms,const char*s,const char*p);
+static const char*matchbalance(MatchState*ms,const char*s,
+const char*p){
+if(*p==0||*(p+1)==0)
+luaL_error(ms->L,"unbalanced pattern");
+if(*s!=*p)return NULL;
+else{
+int b=*p;
+int e=*(p+1);
+int cont=1;
+while(++s<ms->src_end){
+if(*s==e){
+if(--cont==0)return s+1;
+}
+else if(*s==b)cont++;
+}
+}
+return NULL;
+}
+static const char*max_expand(MatchState*ms,const char*s,
+const char*p,const char*ep){
+ptrdiff_t i=0;
+while((s+i)<ms->src_end&&singlematch(uchar(*(s+i)),p,ep))
+i++;
+while(i>=0){
+const char*res=match(ms,(s+i),ep+1);
+if(res)return res;
+i--;
+}
+return NULL;
+}
+static const char*min_expand(MatchState*ms,const char*s,
+const char*p,const char*ep){
+for(;;){
+const char*res=match(ms,s,ep+1);
+if(res!=NULL)
+return res;
+else if(s<ms->src_end&&singlematch(uchar(*s),p,ep))
+s++;
+else return NULL;
+}
+}
+static const char*start_capture(MatchState*ms,const char*s,
+const char*p,int what){
+const char*res;
+int level=ms->level;
+if(level>=32)luaL_error(ms->L,"too many captures");
+ms->capture[level].init=s;
+ms->capture[level].len=what;
+ms->level=level+1;
+if((res=match(ms,s,p))==NULL)
+ms->level--;
+return res;
+}
+static const char*end_capture(MatchState*ms,const char*s,
+const char*p){
+int l=capture_to_close(ms);
+const char*res;
+ms->capture[l].len=s-ms->capture[l].init;
+if((res=match(ms,s,p))==NULL)
+ms->capture[l].len=(-1);
+return res;
+}
+static const char*match_capture(MatchState*ms,const char*s,int l){
+size_t len;
+l=check_capture(ms,l);
+len=ms->capture[l].len;
+if((size_t)(ms->src_end-s)>=len&&
+memcmp(ms->capture[l].init,s,len)==0)
+return s+len;
+else return NULL;
+}
+static const char*match(MatchState*ms,const char*s,const char*p){
+init:
+switch(*p){
+case'(':{
+if(*(p+1)==')')
+return start_capture(ms,s,p+2,(-2));
+else
+return start_capture(ms,s,p+1,(-1));
+}
+case')':{
+return end_capture(ms,s,p+1);
+}
+case'%':{
+switch(*(p+1)){
+case'b':{
+s=matchbalance(ms,s,p+2);
+if(s==NULL)return NULL;
+p+=4;goto init;
+}
+case'f':{
+const char*ep;char previous;
+p+=2;
+if(*p!='[')
+luaL_error(ms->L,"missing "LUA_QL("[")" after "
+LUA_QL("%%f")" in pattern");
+ep=classend(ms,p);
+previous=(s==ms->src_init)?'\0':*(s-1);
+if(matchbracketclass(uchar(previous),p,ep-1)||
+!matchbracketclass(uchar(*s),p,ep-1))return NULL;
+p=ep;goto init;
+}
+default:{
+if(isdigit(uchar(*(p+1)))){
+s=match_capture(ms,s,uchar(*(p+1)));
+if(s==NULL)return NULL;
+p+=2;goto init;
+}
+goto dflt;
+}
+}
+}
+case'\0':{
+return s;
+}
+case'$':{
+if(*(p+1)=='\0')
+return(s==ms->src_end)?s:NULL;
+else goto dflt;
+}
+default:dflt:{
+const char*ep=classend(ms,p);
+int m=s<ms->src_end&&singlematch(uchar(*s),p,ep);
+switch(*ep){
+case'?':{
+const char*res;
+if(m&&((res=match(ms,s+1,ep+1))!=NULL))
+return res;
+p=ep+1;goto init;
+}
+case'*':{
+return max_expand(ms,s,p,ep);
+}
+case'+':{
+return(m?max_expand(ms,s+1,p,ep):NULL);
+}
+case'-':{
+return min_expand(ms,s,p,ep);
+}
+default:{
+if(!m)return NULL;
+s++;p=ep;goto init;
+}
+}
+}
+}
+}
+static const char*lmemfind(const char*s1,size_t l1,
+const char*s2,size_t l2){
+if(l2==0)return s1;
+else if(l2>l1)return NULL;
+else{
+const char*init;
+l2--;
+l1=l1-l2;
+while(l1>0&&(init=(const char*)memchr(s1,*s2,l1))!=NULL){
+init++;
+if(memcmp(init,s2+1,l2)==0)
+return init-1;
+else{
+l1-=init-s1;
+s1=init;
+}
+}
+return NULL;
+}
+}
+static void push_onecapture(MatchState*ms,int i,const char*s,
+const char*e){
+if(i>=ms->level){
+if(i==0)
+lua_pushlstring(ms->L,s,e-s);
+else
+luaL_error(ms->L,"invalid capture index");
+}
+else{
+ptrdiff_t l=ms->capture[i].len;
+if(l==(-1))luaL_error(ms->L,"unfinished capture");
+if(l==(-2))
+lua_pushinteger(ms->L,ms->capture[i].init-ms->src_init+1);
+else
+lua_pushlstring(ms->L,ms->capture[i].init,l);
+}
+}
+static int push_captures(MatchState*ms,const char*s,const char*e){
+int i;
+int nlevels=(ms->level==0&&s)?1:ms->level;
+luaL_checkstack(ms->L,nlevels,"too many captures");
+for(i=0;i<nlevels;i++)
+push_onecapture(ms,i,s,e);
+return nlevels;
+}
+static int str_find_aux(lua_State*L,int find){
+size_t l1,l2;
+const char*s=luaL_checklstring(L,1,&l1);
+const char*p=luaL_checklstring(L,2,&l2);
+ptrdiff_t init=posrelat(luaL_optinteger(L,3,1),l1)-1;
+if(init<0)init=0;
+else if((size_t)(init)>l1)init=(ptrdiff_t)l1;
+if(find&&(lua_toboolean(L,4)||
+strpbrk(p,"^$*+?.([%-")==NULL)){
+const char*s2=lmemfind(s+init,l1-init,p,l2);
+if(s2){
+lua_pushinteger(L,s2-s+1);
+lua_pushinteger(L,s2-s+l2);
+return 2;
+}
+}
+else{
+MatchState ms;
+int anchor=(*p=='^')?(p++,1):0;
+const char*s1=s+init;
+ms.L=L;
+ms.src_init=s;
+ms.src_end=s+l1;
+do{
+const char*res;
+ms.level=0;
+if((res=match(&ms,s1,p))!=NULL){
+if(find){
+lua_pushinteger(L,s1-s+1);
+lua_pushinteger(L,res-s);
+return push_captures(&ms,NULL,0)+2;
+}
+else
+return push_captures(&ms,s1,res);
+}
+}while(s1++<ms.src_end&&!anchor);
+}
+lua_pushnil(L);
+return 1;
+}
+static int str_find(lua_State*L){
+return str_find_aux(L,1);
+}
+static int str_match(lua_State*L){
+return str_find_aux(L,0);
+}
+static int gmatch_aux(lua_State*L){
+MatchState ms;
+size_t ls;
+const char*s=lua_tolstring(L,lua_upvalueindex(1),&ls);
+const char*p=lua_tostring(L,lua_upvalueindex(2));
+const char*src;
+ms.L=L;
+ms.src_init=s;
+ms.src_end=s+ls;
+for(src=s+(size_t)lua_tointeger(L,lua_upvalueindex(3));
+src<=ms.src_end;
+src++){
+const char*e;
+ms.level=0;
+if((e=match(&ms,src,p))!=NULL){
+lua_Integer newstart=e-s;
+if(e==src)newstart++;
+lua_pushinteger(L,newstart);
+lua_replace(L,lua_upvalueindex(3));
+return push_captures(&ms,src,e);
+}
+}
+return 0;
+}
+static int gmatch(lua_State*L){
+luaL_checkstring(L,1);
+luaL_checkstring(L,2);
+lua_settop(L,2);
+lua_pushinteger(L,0);
+lua_pushcclosure(L,gmatch_aux,3);
+return 1;
+}
+static void add_s(MatchState*ms,luaL_Buffer*b,const char*s,
+const char*e){
+size_t l,i;
+const char*news=lua_tolstring(ms->L,3,&l);
+for(i=0;i<l;i++){
+if(news[i]!='%')
+luaL_addchar(b,news[i]);
+else{
+i++;
+if(!isdigit(uchar(news[i])))
+luaL_addchar(b,news[i]);
+else if(news[i]=='0')
+luaL_addlstring(b,s,e-s);
+else{
+push_onecapture(ms,news[i]-'1',s,e);
+luaL_addvalue(b);
+}
+}
+}
+}
+static void add_value(MatchState*ms,luaL_Buffer*b,const char*s,
+const char*e){
+lua_State*L=ms->L;
+switch(lua_type(L,3)){
+case 3:
+case 4:{
+add_s(ms,b,s,e);
+return;
+}
+case 6:{
+int n;
+lua_pushvalue(L,3);
+n=push_captures(ms,s,e);
+lua_call(L,n,1);
+break;
+}
+case 5:{
+push_onecapture(ms,0,s,e);
+lua_gettable(L,3);
+break;
+}
+}
+if(!lua_toboolean(L,-1)){
+lua_pop(L,1);
+lua_pushlstring(L,s,e-s);
+}
+else if(!lua_isstring(L,-1))
+luaL_error(L,"invalid replacement value (a %s)",luaL_typename(L,-1));
+luaL_addvalue(b);
+}
+static int str_gsub(lua_State*L){
+size_t srcl;
+const char*src=luaL_checklstring(L,1,&srcl);
+const char*p=luaL_checkstring(L,2);
+int tr=lua_type(L,3);
+int max_s=luaL_optint(L,4,srcl+1);
+int anchor=(*p=='^')?(p++,1):0;
+int n=0;
+MatchState ms;
+luaL_Buffer b;
+luaL_argcheck(L,tr==3||tr==4||
+tr==6||tr==5,3,
+"string/function/table expected");
+luaL_buffinit(L,&b);
+ms.L=L;
+ms.src_init=src;
+ms.src_end=src+srcl;
+while(n<max_s){
+const char*e;
+ms.level=0;
+e=match(&ms,src,p);
+if(e){
+n++;
+add_value(&ms,&b,src,e);
+}
+if(e&&e>src)
+src=e;
+else if(src<ms.src_end)
+luaL_addchar(&b,*src++);
+else break;
+if(anchor)break;
+}
+luaL_addlstring(&b,src,ms.src_end-src);
+luaL_pushresult(&b);
+lua_pushinteger(L,n);
+return 2;
+}
+static void addquoted(lua_State*L,luaL_Buffer*b,int arg){
+size_t l;
+const char*s=luaL_checklstring(L,arg,&l);
+luaL_addchar(b,'"');
+while(l--){
+switch(*s){
+case'"':case'\\':case'\n':{
+luaL_addchar(b,'\\');
+luaL_addchar(b,*s);
+break;
+}
+case'\r':{
+luaL_addlstring(b,"\\r",2);
+break;
+}
+case'\0':{
+luaL_addlstring(b,"\\000",4);
+break;
+}
+default:{
+luaL_addchar(b,*s);
+break;
+}
+}
+s++;
+}
+luaL_addchar(b,'"');
+}
+static const char*scanformat(lua_State*L,const char*strfrmt,char*form){
+const char*p=strfrmt;
+while(*p!='\0'&&strchr("-+ #0",*p)!=NULL)p++;
+if((size_t)(p-strfrmt)>=sizeof("-+ #0"))
+luaL_error(L,"invalid format (repeated flags)");
+if(isdigit(uchar(*p)))p++;
+if(isdigit(uchar(*p)))p++;
+if(*p=='.'){
+p++;
+if(isdigit(uchar(*p)))p++;
+if(isdigit(uchar(*p)))p++;
+}
+if(isdigit(uchar(*p)))
+luaL_error(L,"invalid format (width or precision too long)");
+*(form++)='%';
+strncpy(form,strfrmt,p-strfrmt+1);
+form+=p-strfrmt+1;
+*form='\0';
+return p;
+}
+static void addintlen(char*form){
+size_t l=strlen(form);
+char spec=form[l-1];
+strcpy(form+l-1,"l");
+form[l+sizeof("l")-2]=spec;
+form[l+sizeof("l")-1]='\0';
+}
+static int str_format(lua_State*L){
+int top=lua_gettop(L);
+int arg=1;
+size_t sfl;
+const char*strfrmt=luaL_checklstring(L,arg,&sfl);
+const char*strfrmt_end=strfrmt+sfl;
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+while(strfrmt<strfrmt_end){
+if(*strfrmt!='%')
+luaL_addchar(&b,*strfrmt++);
+else if(*++strfrmt=='%')
+luaL_addchar(&b,*strfrmt++);
+else{
+char form[(sizeof("-+ #0")+sizeof("l")+10)];
+char buff[512];
+if(++arg>top)
+luaL_argerror(L,arg,"no value");
+strfrmt=scanformat(L,strfrmt,form);
+switch(*strfrmt++){
+case'c':{
+sprintf(buff,form,(int)luaL_checknumber(L,arg));
+break;
+}
+case'd':case'i':{
+addintlen(form);
+sprintf(buff,form,(long)luaL_checknumber(L,arg));
+break;
+}
+case'o':case'u':case'x':case'X':{
+addintlen(form);
+sprintf(buff,form,(unsigned long)luaL_checknumber(L,arg));
+break;
+}
+case'e':case'E':case'f':
+case'g':case'G':{
+sprintf(buff,form,(double)luaL_checknumber(L,arg));
+break;
+}
+case'q':{
+addquoted(L,&b,arg);
+continue;
+}
+case's':{
+size_t l;
+const char*s=luaL_checklstring(L,arg,&l);
+if(!strchr(form,'.')&&l>=100){
+lua_pushvalue(L,arg);
+luaL_addvalue(&b);
+continue;
+}
+else{
+sprintf(buff,form,s);
+break;
+}
+}
+default:{
+return luaL_error(L,"invalid option "LUA_QL("%%%c")" to "
+LUA_QL("format"),*(strfrmt-1));
+}
+}
+luaL_addlstring(&b,buff,strlen(buff));
+}
+}
+luaL_pushresult(&b);
+return 1;
+}
+static const luaL_Reg strlib[]={
+{"byte",str_byte},
+{"char",str_char},
+{"find",str_find},
+{"format",str_format},
+{"gmatch",gmatch},
+{"gsub",str_gsub},
+{"lower",str_lower},
+{"match",str_match},
+{"rep",str_rep},
+{"sub",str_sub},
+{"upper",str_upper},
+{NULL,NULL}
+};
+static void createmetatable(lua_State*L){
+lua_createtable(L,0,1);
+lua_pushliteral(L,"");
+lua_pushvalue(L,-2);
+lua_setmetatable(L,-2);
+lua_pop(L,1);
+lua_pushvalue(L,-2);
+lua_setfield(L,-2,"__index");
+lua_pop(L,1);
+}
+static int luaopen_string(lua_State*L){
+luaL_register(L,"string",strlib);
+createmetatable(L);
+return 1;
+}
+static const luaL_Reg lualibs[]={
+{"",luaopen_base},
+{"table",luaopen_table},
+{"io",luaopen_io},
+{"os",luaopen_os},
+{"string",luaopen_string},
+{NULL,NULL}
+};
+static void luaL_openlibs(lua_State*L){
+const luaL_Reg*lib=lualibs;
+for(;lib->func;lib++){
+lua_pushcfunction(L,lib->func);
+lua_pushstring(L,lib->name);
+lua_call(L,1,0);
+}
+}
+typedef unsigned int UB;
+static UB barg(lua_State*L,int idx){
+union{lua_Number n;U64 b;}bn;
+bn.n=lua_tonumber(L,idx)+6755399441055744.0;
+if(bn.n==0.0&&!lua_isnumber(L,idx))luaL_typerror(L,idx,"number");
+return(UB)bn.b;
+}
+#define BRET(b)lua_pushnumber(L,(lua_Number)(int)(b));return 1;
+static int tobit(lua_State*L){
+BRET(barg(L,1))}
+static int bnot(lua_State*L){
+BRET(~barg(L,1))}
+static int band(lua_State*L){
+int i;UB b=barg(L,1);for(i=lua_gettop(L);i>1;i--)b&=barg(L,i);BRET(b)}
+static int bor(lua_State*L){
+int i;UB b=barg(L,1);for(i=lua_gettop(L);i>1;i--)b|=barg(L,i);BRET(b)}
+static int bxor(lua_State*L){
+int i;UB b=barg(L,1);for(i=lua_gettop(L);i>1;i--)b^=barg(L,i);BRET(b)}
+static int lshift(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET(b<<n)}
+static int rshift(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET(b>>n)}
+static int arshift(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET((int)b>>n)}
+static int rol(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET((b<<n)|(b>>(32-n)))}
+static int ror(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET((b>>n)|(b<<(32-n)))}
+static int bswap(lua_State*L){
+UB b=barg(L,1);b=(b>>24)|((b>>8)&0xff00)|((b&0xff00)<<8)|(b<<24);BRET(b)}
+static int tohex(lua_State*L){
+UB b=barg(L,1);
+int n=lua_isnone(L,2)?8:(int)barg(L,2);
+const char*hexdigits="0123456789abcdef";
+char buf[8];
+int i;
+if(n<0){n=-n;hexdigits="0123456789ABCDEF";}
+if(n>8)n=8;
+for(i=(int)n;--i>=0;){buf[i]=hexdigits[b&15];b>>=4;}
+lua_pushlstring(L,buf,(size_t)n);
+return 1;
+}
+static const struct luaL_Reg bitlib[]={
+{"tobit",tobit},
+{"bnot",bnot},
+{"band",band},
+{"bor",bor},
+{"bxor",bxor},
+{"lshift",lshift},
+{"rshift",rshift},
+{"arshift",arshift},
+{"rol",rol},
+{"ror",ror},
+{"bswap",bswap},
+{"tohex",tohex},
+{NULL,NULL}
+};
+int main(int argc,char**argv){
+lua_State*L=luaL_newstate();
+int i;
+luaL_openlibs(L);
+luaL_register(L,"bit",bitlib);
+if(argc<2)return sizeof(void*);
+lua_createtable(L,0,1);
+lua_pushstring(L,argv[1]);
+lua_rawseti(L,-2,0);
+lua_setglobal(L,"arg");
+if(luaL_loadfile(L,argv[1]))
+goto err;
+for(i=2;i<argc;i++)
+lua_pushstring(L,argv[i]);
+if(lua_pcall(L,argc-2,0,0)){
+err:
+fprintf(stderr,"Error: %s\n",lua_tostring(L,-1));
+return 1;
+}
+lua_close(L);
+return 0;
+}
diff --git a/ext/opcache/jit/libudis86/LICENSE b/ext/opcache/jit/libudis86/LICENSE
new file mode 100644
index 0000000000..580f35987f
--- /dev/null
+++ b/ext/opcache/jit/libudis86/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2002-2012, Vivek Thampi <vivek.mt@gmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/ext/opcache/jit/libudis86/decode.c b/ext/opcache/jit/libudis86/decode.c
new file mode 100644
index 0000000000..036b9ed012
--- /dev/null
+++ b/ext/opcache/jit/libudis86/decode.c
@@ -0,0 +1,1266 @@
+/* udis86 - libudis86/decode.c
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "udint.h"
+#include "types.h"
+#include "extern.h"
+#include "decode.h"
+
+#ifndef __UD_STANDALONE__
+# include <string.h>
+#endif /* __UD_STANDALONE__ */
+
+/* The max number of prefixes to an instruction */
+#define MAX_PREFIXES 15
+
+/* rex prefix bits */
+#define REX_W(r) ( ( 0xF & ( r ) ) >> 3 )
+#define REX_R(r) ( ( 0x7 & ( r ) ) >> 2 )
+#define REX_X(r) ( ( 0x3 & ( r ) ) >> 1 )
+#define REX_B(r) ( ( 0x1 & ( r ) ) >> 0 )
+#define REX_PFX_MASK(n) ( ( P_REXW(n) << 3 ) | \
+ ( P_REXR(n) << 2 ) | \
+ ( P_REXX(n) << 1 ) | \
+ ( P_REXB(n) << 0 ) )
+
+/* scable-index-base bits */
+#define SIB_S(b) ( ( b ) >> 6 )
+#define SIB_I(b) ( ( ( b ) >> 3 ) & 7 )
+#define SIB_B(b) ( ( b ) & 7 )
+
+/* modrm bits */
+#define MODRM_REG(b) ( ( ( b ) >> 3 ) & 7 )
+#define MODRM_NNN(b) ( ( ( b ) >> 3 ) & 7 )
+#define MODRM_MOD(b) ( ( ( b ) >> 6 ) & 3 )
+#define MODRM_RM(b) ( ( b ) & 7 )
+
+static int decode_ext(struct ud *u, uint16_t ptr);
+static int decode_opcode(struct ud *u);
+
+enum reg_class { /* register classes */
+ REGCLASS_GPR,
+ REGCLASS_MMX,
+ REGCLASS_CR,
+ REGCLASS_DB,
+ REGCLASS_SEG,
+ REGCLASS_XMM
+};
+
+ /*
+ * inp_start
+ * Should be called before each de-code operation.
+ */
+static void
+inp_start(struct ud *u)
+{
+ u->inp_ctr = 0;
+}
+
+static uint8_t
+inp_peek(struct ud *u)
+{
+ if (u->inp_end == 0) {
+ if (u->inp_buf != NULL) {
+ if (u->inp_buf_index < u->inp_buf_size) {
+ return u->inp_buf[u->inp_buf_index];
+ }
+ } else if (u->inp_peek != UD_EOI) {
+ return u->inp_peek;
+ } else {
+ int c;
+ if ((c = u->inp_hook(u)) != UD_EOI) {
+ u->inp_peek = c;
+ return u->inp_peek;
+ }
+ }
+ }
+ u->inp_end = 1;
+ UDERR(u, "byte expected, eoi received\n");
+ return 0;
+}
+
+static uint8_t
+inp_next(struct ud *u)
+{
+ if (u->inp_end == 0) {
+ if (u->inp_buf != NULL) {
+ if (u->inp_buf_index < u->inp_buf_size) {
+ u->inp_ctr++;
+ return (u->inp_curr = u->inp_buf[u->inp_buf_index++]);
+ }
+ } else {
+ int c = u->inp_peek;
+ if (c != UD_EOI || (c = u->inp_hook(u)) != UD_EOI) {
+ u->inp_peek = UD_EOI;
+ u->inp_curr = c;
+ u->inp_sess[u->inp_ctr++] = u->inp_curr;
+ return u->inp_curr;
+ }
+ }
+ }
+ u->inp_end = 1;
+ UDERR(u, "byte expected, eoi received\n");
+ return 0;
+}
+
+static uint8_t
+inp_curr(struct ud *u)
+{
+ return u->inp_curr;
+}
+
+
+/*
+ * inp_uint8
+ * int_uint16
+ * int_uint32
+ * int_uint64
+ * Load little-endian values from input
+ */
+static uint8_t
+inp_uint8(struct ud* u)
+{
+ return inp_next(u);
+}
+
+static uint16_t
+inp_uint16(struct ud* u)
+{
+ uint16_t r, ret;
+
+ ret = inp_next(u);
+ r = inp_next(u);
+ return ret | (r << 8);
+}
+
+static uint32_t
+inp_uint32(struct ud* u)
+{
+ uint32_t r, ret;
+
+ ret = inp_next(u);
+ r = inp_next(u);
+ ret = ret | (r << 8);
+ r = inp_next(u);
+ ret = ret | (r << 16);
+ r = inp_next(u);
+ return ret | (r << 24);
+}
+
+static uint64_t
+inp_uint64(struct ud* u)
+{
+ uint64_t r, ret;
+
+ ret = inp_next(u);
+ r = inp_next(u);
+ ret = ret | (r << 8);
+ r = inp_next(u);
+ ret = ret | (r << 16);
+ r = inp_next(u);
+ ret = ret | (r << 24);
+ r = inp_next(u);
+ ret = ret | (r << 32);
+ r = inp_next(u);
+ ret = ret | (r << 40);
+ r = inp_next(u);
+ ret = ret | (r << 48);
+ r = inp_next(u);
+ return ret | (r << 56);
+}
+
+
+static UD_INLINE int
+eff_opr_mode(int dis_mode, int rex_w, int pfx_opr)
+{
+ if (dis_mode == 64) {
+ return rex_w ? 64 : (pfx_opr ? 16 : 32);
+ } else if (dis_mode == 32) {
+ return pfx_opr ? 16 : 32;
+ } else {
+ UD_ASSERT(dis_mode == 16);
+ return pfx_opr ? 32 : 16;
+ }
+}
+
+
+static UD_INLINE int
+eff_adr_mode(int dis_mode, int pfx_adr)
+{
+ if (dis_mode == 64) {
+ return pfx_adr ? 32 : 64;
+ } else if (dis_mode == 32) {
+ return pfx_adr ? 16 : 32;
+ } else {
+ UD_ASSERT(dis_mode == 16);
+ return pfx_adr ? 32 : 16;
+ }
+}
+
+
+/*
+ * decode_prefixes
+ *
+ * Extracts instruction prefixes.
+ */
+static int
+decode_prefixes(struct ud *u)
+{
+ int done = 0;
+ uint8_t curr = 0, last = 0;
+ UD_RETURN_ON_ERROR(u);
+
+ do {
+ last = curr;
+ curr = inp_next(u);
+ UD_RETURN_ON_ERROR(u);
+ if (u->inp_ctr == MAX_INSN_LENGTH) {
+ UD_RETURN_WITH_ERROR(u, "max instruction length");
+ }
+
+ switch (curr)
+ {
+ case 0x2E:
+ u->pfx_seg = UD_R_CS;
+ break;
+ case 0x36:
+ u->pfx_seg = UD_R_SS;
+ break;
+ case 0x3E:
+ u->pfx_seg = UD_R_DS;
+ break;
+ case 0x26:
+ u->pfx_seg = UD_R_ES;
+ break;
+ case 0x64:
+ u->pfx_seg = UD_R_FS;
+ break;
+ case 0x65:
+ u->pfx_seg = UD_R_GS;
+ break;
+ case 0x67: /* adress-size override prefix */
+ u->pfx_adr = 0x67;
+ break;
+ case 0xF0:
+ u->pfx_lock = 0xF0;
+ break;
+ case 0x66:
+ u->pfx_opr = 0x66;
+ break;
+ case 0xF2:
+ u->pfx_str = 0xf2;
+ break;
+ case 0xF3:
+ u->pfx_str = 0xf3;
+ break;
+ default:
+ /* consume if rex */
+ done = (u->dis_mode == 64 && (curr & 0xF0) == 0x40) ? 0 : 1;
+ break;
+ }
+ } while (!done);
+ /* rex prefixes in 64bit mode, must be the last prefix */
+ if (u->dis_mode == 64 && (last & 0xF0) == 0x40) {
+ u->pfx_rex = last;
+ }
+ return 0;
+}
+
+
+/*
+ * vex_l, vex_w
+ * Return the vex.L and vex.W bits
+ */
+static UD_INLINE uint8_t
+vex_l(const struct ud *u)
+{
+ UD_ASSERT(u->vex_op != 0);
+ return ((u->vex_op == 0xc4 ? u->vex_b2 : u->vex_b1) >> 2) & 1;
+}
+
+static UD_INLINE uint8_t
+vex_w(const struct ud *u)
+{
+ UD_ASSERT(u->vex_op != 0);
+ return u->vex_op == 0xc4 ? ((u->vex_b2 >> 7) & 1) : 0;
+}
+
+
+static UD_INLINE uint8_t
+modrm(struct ud * u)
+{
+ if ( !u->have_modrm ) {
+ u->modrm = inp_next( u );
+ u->modrm_offset = (uint8_t) (u->inp_ctr - 1);
+ u->have_modrm = 1;
+ }
+ return u->modrm;
+}
+
+
+static unsigned int
+resolve_operand_size(const struct ud* u, ud_operand_size_t osize)
+{
+ switch (osize) {
+ case SZ_V:
+ return u->opr_mode;
+ case SZ_Z:
+ return u->opr_mode == 16 ? 16 : 32;
+ case SZ_Y:
+ return u->opr_mode == 16 ? 32 : u->opr_mode;
+ case SZ_RDQ:
+ return u->dis_mode == 64 ? 64 : 32;
+ case SZ_X:
+ UD_ASSERT(u->vex_op != 0);
+ return (P_VEXL(u->itab_entry->prefix) && vex_l(u)) ? SZ_QQ : SZ_DQ;
+ default:
+ return osize;
+ }
+}
+
+
+static int resolve_mnemonic( struct ud* u )
+{
+ /* resolve 3dnow weirdness. */
+ if ( u->mnemonic == UD_I3dnow ) {
+ u->mnemonic = ud_itab[ u->le->table[ inp_curr( u ) ] ].mnemonic;
+ }
+ /* SWAPGS is only valid in 64bits mode */
+ if ( u->mnemonic == UD_Iswapgs && u->dis_mode != 64 ) {
+ UDERR(u, "swapgs invalid in 64bits mode\n");
+ return -1;
+ }
+
+ if (u->mnemonic == UD_Ixchg) {
+ if ((u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_AX &&
+ u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_AX) ||
+ (u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_EAX &&
+ u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_EAX)) {
+ u->operand[0].type = UD_NONE;
+ u->operand[1].type = UD_NONE;
+ u->mnemonic = UD_Inop;
+ }
+ }
+
+ if (u->mnemonic == UD_Inop && u->pfx_repe) {
+ u->pfx_repe = 0;
+ u->mnemonic = UD_Ipause;
+ }
+ return 0;
+}
+
+
+/* -----------------------------------------------------------------------------
+ * decode_a()- Decodes operands of the type seg:offset
+ * -----------------------------------------------------------------------------
+ */
+static void
+decode_a(struct ud* u, struct ud_operand *op)
+{
+ if (u->opr_mode == 16) {
+ /* seg16:off16 */
+ op->type = UD_OP_PTR;
+ op->size = 32;
+ op->lval.ptr.off = inp_uint16(u);
+ op->lval.ptr.seg = inp_uint16(u);
+ } else {
+ /* seg16:off32 */
+ op->type = UD_OP_PTR;
+ op->size = 48;
+ op->lval.ptr.off = inp_uint32(u);
+ op->lval.ptr.seg = inp_uint16(u);
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * decode_gpr() - Returns decoded General Purpose Register
+ * -----------------------------------------------------------------------------
+ */
+static enum ud_type
+decode_gpr(register struct ud* u, unsigned int s, unsigned char rm)
+{
+ switch (s) {
+ case 64:
+ return UD_R_RAX + rm;
+ case 32:
+ return UD_R_EAX + rm;
+ case 16:
+ return UD_R_AX + rm;
+ case 8:
+ if (u->dis_mode == 64 && u->pfx_rex) {
+ if (rm >= 4)
+ return UD_R_SPL + (rm-4);
+ return UD_R_AL + rm;
+ } else return UD_R_AL + rm;
+ case 0:
+ /* invalid size in case of a decode error */
+ UD_ASSERT(u->error);
+ return UD_NONE;
+ default:
+ UD_ASSERT(!"invalid operand size");
+ return UD_NONE;
+ }
+}
+
+static void
+decode_reg(struct ud *u,
+ struct ud_operand *opr,
+ int type,
+ int num,
+ int size)
+{
+ int reg;
+ size = resolve_operand_size(u, size);
+ switch (type) {
+ case REGCLASS_GPR : reg = decode_gpr(u, size, num); break;
+ case REGCLASS_MMX : reg = UD_R_MM0 + (num & 7); break;
+ case REGCLASS_XMM :
+ reg = num + (size == SZ_QQ ? UD_R_YMM0 : UD_R_XMM0);
+ break;
+ case REGCLASS_CR : reg = UD_R_CR0 + num; break;
+ case REGCLASS_DB : reg = UD_R_DR0 + num; break;
+ case REGCLASS_SEG : {
+ /*
+ * Only 6 segment registers, anything else is an error.
+ */
+ if ((num & 7) > 5) {
+ UDERR(u, "invalid segment register value\n");
+ return;
+ } else {
+ reg = UD_R_ES + (num & 7);
+ }
+ break;
+ }
+ default:
+ UD_ASSERT(!"invalid register type");
+ return;
+ }
+ opr->type = UD_OP_REG;
+ opr->base = reg;
+ opr->size = size;
+}
+
+
+/*
+ * decode_imm
+ *
+ * Decode Immediate values.
+ */
+static void
+decode_imm(struct ud* u, unsigned int size, struct ud_operand *op)
+{
+ op->size = resolve_operand_size(u, size);
+ op->type = UD_OP_IMM;
+
+ switch (op->size) {
+ case 8: op->lval.sbyte = inp_uint8(u); break;
+ case 16: op->lval.uword = inp_uint16(u); break;
+ case 32: op->lval.udword = inp_uint32(u); break;
+ case 64: op->lval.uqword = inp_uint64(u); break;
+ default: return;
+ }
+}
+
+
+/*
+ * decode_mem_disp
+ *
+ * Decode mem address displacement.
+ */
+static void
+decode_mem_disp(struct ud* u, unsigned int size, struct ud_operand *op)
+{
+ switch (size) {
+ case 8:
+ op->offset = 8;
+ op->lval.ubyte = inp_uint8(u);
+ break;
+ case 16:
+ op->offset = 16;
+ op->lval.uword = inp_uint16(u);
+ break;
+ case 32:
+ op->offset = 32;
+ op->lval.udword = inp_uint32(u);
+ break;
+ case 64:
+ op->offset = 64;
+ op->lval.uqword = inp_uint64(u);
+ break;
+ default:
+ return;
+ }
+}
+
+
+/*
+ * decode_modrm_reg
+ *
+ * Decodes reg field of mod/rm byte
+ *
+ */
+static UD_INLINE void
+decode_modrm_reg(struct ud *u,
+ struct ud_operand *operand,
+ unsigned int type,
+ unsigned int size)
+{
+ uint8_t reg = (REX_R(u->_rex) << 3) | MODRM_REG(modrm(u));
+ decode_reg(u, operand, type, reg, size);
+}
+
+
+/*
+ * decode_modrm_rm
+ *
+ * Decodes rm field of mod/rm byte
+ *
+ */
+static void
+decode_modrm_rm(struct ud *u,
+ struct ud_operand *op,
+ unsigned char type, /* register type */
+ unsigned int size) /* operand size */
+
+{
+ size_t offset = 0;
+ unsigned char mod, rm;
+
+ /* get mod, r/m and reg fields */
+ mod = MODRM_MOD(modrm(u));
+ rm = (REX_B(u->_rex) << 3) | MODRM_RM(modrm(u));
+
+ /*
+ * If mod is 11b, then the modrm.rm specifies a register.
+ *
+ */
+ if (mod == 3) {
+ decode_reg(u, op, type, rm, size);
+ return;
+ }
+
+ /*
+ * !11b => Memory Address
+ */
+ op->type = UD_OP_MEM;
+ op->size = resolve_operand_size(u, size);
+
+ if (u->adr_mode == 64) {
+ op->base = UD_R_RAX + rm;
+ if (mod == 1) {
+ offset = 8;
+ } else if (mod == 2) {
+ offset = 32;
+ } else if (mod == 0 && (rm & 7) == 5) {
+ op->base = UD_R_RIP;
+ offset = 32;
+ } else {
+ offset = 0;
+ }
+ /*
+ * Scale-Index-Base (SIB)
+ */
+ if ((rm & 7) == 4) {
+ inp_next(u);
+
+ op->base = UD_R_RAX + (SIB_B(inp_curr(u)) | (REX_B(u->_rex) << 3));
+ op->index = UD_R_RAX + (SIB_I(inp_curr(u)) | (REX_X(u->_rex) << 3));
+ /* special conditions for base reference */
+ if (op->index == UD_R_RSP) {
+ op->index = UD_NONE;
+ op->scale = UD_NONE;
+ } else {
+ op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
+ }
+
+ if (op->base == UD_R_RBP || op->base == UD_R_R13) {
+ if (mod == 0) {
+ op->base = UD_NONE;
+ }
+ if (mod == 1) {
+ offset = 8;
+ } else {
+ offset = 32;
+ }
+ }
+ } else {
+ op->scale = UD_NONE;
+ op->index = UD_NONE;
+ }
+ } else if (u->adr_mode == 32) {
+ op->base = UD_R_EAX + rm;
+ if (mod == 1) {
+ offset = 8;
+ } else if (mod == 2) {
+ offset = 32;
+ } else if (mod == 0 && rm == 5) {
+ op->base = UD_NONE;
+ offset = 32;
+ } else {
+ offset = 0;
+ }
+
+ /* Scale-Index-Base (SIB) */
+ if ((rm & 7) == 4) {
+ inp_next(u);
+
+ op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
+ op->index = UD_R_EAX + (SIB_I(inp_curr(u)) | (REX_X(u->pfx_rex) << 3));
+ op->base = UD_R_EAX + (SIB_B(inp_curr(u)) | (REX_B(u->pfx_rex) << 3));
+
+ if (op->index == UD_R_ESP) {
+ op->index = UD_NONE;
+ op->scale = UD_NONE;
+ }
+
+ /* special condition for base reference */
+ if (op->base == UD_R_EBP) {
+ if (mod == 0) {
+ op->base = UD_NONE;
+ }
+ if (mod == 1) {
+ offset = 8;
+ } else {
+ offset = 32;
+ }
+ }
+ } else {
+ op->scale = UD_NONE;
+ op->index = UD_NONE;
+ }
+ } else {
+ const unsigned int bases[] = { UD_R_BX, UD_R_BX, UD_R_BP, UD_R_BP,
+ UD_R_SI, UD_R_DI, UD_R_BP, UD_R_BX };
+ const unsigned int indices[] = { UD_R_SI, UD_R_DI, UD_R_SI, UD_R_DI,
+ UD_NONE, UD_NONE, UD_NONE, UD_NONE };
+ op->base = bases[rm & 7];
+ op->index = indices[rm & 7];
+ op->scale = UD_NONE;
+ if (mod == 0 && rm == 6) {
+ offset = 16;
+ op->base = UD_NONE;
+ } else if (mod == 1) {
+ offset = 8;
+ } else if (mod == 2) {
+ offset = 16;
+ }
+ }
+
+ if (offset) {
+ decode_mem_disp(u, offset, op);
+ } else {
+ op->offset = 0;
+ }
+}
+
+
+/*
+ * decode_moffset
+ * Decode offset-only memory operand
+ */
+static void
+decode_moffset(struct ud *u, unsigned int size, struct ud_operand *opr)
+{
+ opr->type = UD_OP_MEM;
+ opr->base = UD_NONE;
+ opr->index = UD_NONE;
+ opr->scale = UD_NONE;
+ opr->size = resolve_operand_size(u, size);
+ decode_mem_disp(u, u->adr_mode, opr);
+}
+
+
+static void
+decode_vex_vvvv(struct ud *u, struct ud_operand *opr, unsigned size)
+{
+ uint8_t vvvv;
+ UD_ASSERT(u->vex_op != 0);
+ vvvv = ((u->vex_op == 0xc4 ? u->vex_b2 : u->vex_b1) >> 3) & 0xf;
+ decode_reg(u, opr, REGCLASS_XMM, (0xf & ~vvvv), size);
+}
+
+
+/*
+ * decode_vex_immreg
+ * Decode source operand encoded in immediate byte [7:4]
+ */
+static int
+decode_vex_immreg(struct ud *u, struct ud_operand *opr, unsigned size)
+{
+ uint8_t imm = inp_next(u);
+ uint8_t mask = u->dis_mode == 64 ? 0xf : 0x7;
+ UD_RETURN_ON_ERROR(u);
+ UD_ASSERT(u->vex_op != 0);
+ decode_reg(u, opr, REGCLASS_XMM, mask & (imm >> 4), size);
+ return 0;
+}
+
+
+/*
+ * decode_operand
+ *
+ * Decodes a single operand.
+ * Returns the type of the operand (UD_NONE if none)
+ */
+static int
+decode_operand(struct ud *u,
+ struct ud_operand *operand,
+ enum ud_operand_code type,
+ unsigned int size)
+{
+ operand->type = UD_NONE;
+ operand->_oprcode = type;
+
+ switch (type) {
+ case OP_A :
+ decode_a(u, operand);
+ break;
+ case OP_MR:
+ decode_modrm_rm(u, operand, REGCLASS_GPR,
+ MODRM_MOD(modrm(u)) == 3 ?
+ Mx_reg_size(size) : Mx_mem_size(size));
+ break;
+ case OP_F:
+ u->br_far = 1;
+ /* intended fall through */
+ case OP_M:
+ if (MODRM_MOD(modrm(u)) == 3) {
+ UDERR(u, "expected modrm.mod != 3\n");
+ }
+ /* intended fall through */
+ case OP_E:
+ decode_modrm_rm(u, operand, REGCLASS_GPR, size);
+ break;
+ case OP_G:
+ decode_modrm_reg(u, operand, REGCLASS_GPR, size);
+ break;
+ case OP_sI:
+ case OP_I:
+ decode_imm(u, size, operand);
+ break;
+ case OP_I1:
+ operand->type = UD_OP_CONST;
+ operand->lval.udword = 1;
+ break;
+ case OP_N:
+ if (MODRM_MOD(modrm(u)) != 3) {
+ UDERR(u, "expected modrm.mod == 3\n");
+ }
+ /* intended fall through */
+ case OP_Q:
+ decode_modrm_rm(u, operand, REGCLASS_MMX, size);
+ break;
+ case OP_P:
+ decode_modrm_reg(u, operand, REGCLASS_MMX, size);
+ break;
+ case OP_U:
+ if (MODRM_MOD(modrm(u)) != 3) {
+ UDERR(u, "expected modrm.mod == 3\n");
+ }
+ /* intended fall through */
+ case OP_W:
+ decode_modrm_rm(u, operand, REGCLASS_XMM, size);
+ break;
+ case OP_V:
+ decode_modrm_reg(u, operand, REGCLASS_XMM, size);
+ break;
+ case OP_H:
+ decode_vex_vvvv(u, operand, size);
+ break;
+ case OP_MU:
+ decode_modrm_rm(u, operand, REGCLASS_XMM,
+ MODRM_MOD(modrm(u)) == 3 ?
+ Mx_reg_size(size) : Mx_mem_size(size));
+ break;
+ case OP_S:
+ decode_modrm_reg(u, operand, REGCLASS_SEG, size);
+ break;
+ case OP_O:
+ decode_moffset(u, size, operand);
+ break;
+ case OP_R0:
+ case OP_R1:
+ case OP_R2:
+ case OP_R3:
+ case OP_R4:
+ case OP_R5:
+ case OP_R6:
+ case OP_R7:
+ decode_reg(u, operand, REGCLASS_GPR,
+ (REX_B(u->_rex) << 3) | (type - OP_R0), size);
+ break;
+ case OP_AL:
+ case OP_AX:
+ case OP_eAX:
+ case OP_rAX:
+ decode_reg(u, operand, REGCLASS_GPR, 0, size);
+ break;
+ case OP_CL:
+ case OP_CX:
+ case OP_eCX:
+ decode_reg(u, operand, REGCLASS_GPR, 1, size);
+ break;
+ case OP_DL:
+ case OP_DX:
+ case OP_eDX:
+ decode_reg(u, operand, REGCLASS_GPR, 2, size);
+ break;
+ case OP_ES:
+ case OP_CS:
+ case OP_DS:
+ case OP_SS:
+ case OP_FS:
+ case OP_GS:
+ /* in 64bits mode, only fs and gs are allowed */
+ if (u->dis_mode == 64) {
+ if (type != OP_FS && type != OP_GS) {
+ UDERR(u, "invalid segment register in 64bits\n");
+ }
+ }
+ operand->type = UD_OP_REG;
+ operand->base = (type - OP_ES) + UD_R_ES;
+ operand->size = 16;
+ break;
+ case OP_J :
+ decode_imm(u, size, operand);
+ operand->type = UD_OP_JIMM;
+ break ;
+ case OP_R :
+ if (MODRM_MOD(modrm(u)) != 3) {
+ UDERR(u, "expected modrm.mod == 3\n");
+ }
+ decode_modrm_rm(u, operand, REGCLASS_GPR, size);
+ break;
+ case OP_C:
+ decode_modrm_reg(u, operand, REGCLASS_CR, size);
+ break;
+ case OP_D:
+ decode_modrm_reg(u, operand, REGCLASS_DB, size);
+ break;
+ case OP_I3 :
+ operand->type = UD_OP_CONST;
+ operand->lval.sbyte = 3;
+ break;
+ case OP_ST0:
+ case OP_ST1:
+ case OP_ST2:
+ case OP_ST3:
+ case OP_ST4:
+ case OP_ST5:
+ case OP_ST6:
+ case OP_ST7:
+ operand->type = UD_OP_REG;
+ operand->base = (type - OP_ST0) + UD_R_ST0;
+ operand->size = 80;
+ break;
+ case OP_L:
+ decode_vex_immreg(u, operand, size);
+ break;
+ default :
+ operand->type = UD_NONE;
+ break;
+ }
+ return operand->type;
+}
+
+
+/*
+ * decode_operands
+ *
+ * Disassemble upto 3 operands of the current instruction being
+ * disassembled. By the end of the function, the operand fields
+ * of the ud structure will have been filled.
+ */
+static int
+decode_operands(struct ud* u)
+{
+ decode_operand(u, &u->operand[0],
+ u->itab_entry->operand1.type,
+ u->itab_entry->operand1.size);
+ if (u->operand[0].type != UD_NONE) {
+ decode_operand(u, &u->operand[1],
+ u->itab_entry->operand2.type,
+ u->itab_entry->operand2.size);
+ }
+ if (u->operand[1].type != UD_NONE) {
+ decode_operand(u, &u->operand[2],
+ u->itab_entry->operand3.type,
+ u->itab_entry->operand3.size);
+ }
+ if (u->operand[2].type != UD_NONE) {
+ decode_operand(u, &u->operand[3],
+ u->itab_entry->operand4.type,
+ u->itab_entry->operand4.size);
+ }
+ return 0;
+}
+
+/* -----------------------------------------------------------------------------
+ * clear_insn() - clear instruction structure
+ * -----------------------------------------------------------------------------
+ */
+static void
+clear_insn(register struct ud* u)
+{
+ u->error = 0;
+ u->pfx_seg = 0;
+ u->pfx_opr = 0;
+ u->pfx_adr = 0;
+ u->pfx_lock = 0;
+ u->pfx_repne = 0;
+ u->pfx_rep = 0;
+ u->pfx_repe = 0;
+ u->pfx_rex = 0;
+ u->pfx_str = 0;
+ u->mnemonic = UD_Inone;
+ u->itab_entry = NULL;
+ u->have_modrm = 0;
+ u->br_far = 0;
+ u->vex_op = 0;
+ u->_rex = 0;
+ u->operand[0].type = UD_NONE;
+ u->operand[1].type = UD_NONE;
+ u->operand[2].type = UD_NONE;
+ u->operand[3].type = UD_NONE;
+}
+
+
+static UD_INLINE int
+resolve_pfx_str(struct ud* u)
+{
+ if (u->pfx_str == 0xf3) {
+ if (P_STR(u->itab_entry->prefix)) {
+ u->pfx_rep = 0xf3;
+ } else {
+ u->pfx_repe = 0xf3;
+ }
+ } else if (u->pfx_str == 0xf2) {
+ u->pfx_repne = 0xf3;
+ }
+ return 0;
+}
+
+
+static int
+resolve_mode( struct ud* u )
+{
+ int default64;
+ /* if in error state, bail out */
+ if ( u->error ) return -1;
+
+ /* propagate prefix effects */
+ if ( u->dis_mode == 64 ) { /* set 64bit-mode flags */
+
+ /* Check validity of instruction m64 */
+ if ( P_INV64( u->itab_entry->prefix ) ) {
+ UDERR(u, "instruction invalid in 64bits\n");
+ return -1;
+ }
+
+ /* compute effective rex based on,
+ * - vex prefix (if any)
+ * - rex prefix (if any, and not vex)
+ * - allowed prefixes specified by the opcode map
+ */
+ if (u->vex_op == 0xc4) {
+ /* vex has rex.rxb in 1's complement */
+ u->_rex = ((~(u->vex_b1 >> 5) & 0x7) /* rex.0rxb */ |
+ ((u->vex_b2 >> 4) & 0x8) /* rex.w000 */);
+ } else if (u->vex_op == 0xc5) {
+ /* vex has rex.r in 1's complement */
+ u->_rex = (~(u->vex_b1 >> 5)) & 4;
+ } else {
+ UD_ASSERT(u->vex_op == 0);
+ u->_rex = u->pfx_rex;
+ }
+ u->_rex &= REX_PFX_MASK(u->itab_entry->prefix);
+
+ /* whether this instruction has a default operand size of
+ * 64bit, also hardcoded into the opcode map.
+ */
+ default64 = P_DEF64( u->itab_entry->prefix );
+ /* calculate effective operand size */
+ if (REX_W(u->_rex)) {
+ u->opr_mode = 64;
+ } else if ( u->pfx_opr ) {
+ u->opr_mode = 16;
+ } else {
+ /* unless the default opr size of instruction is 64,
+ * the effective operand size in the absence of rex.w
+ * prefix is 32.
+ */
+ u->opr_mode = default64 ? 64 : 32;
+ }
+
+ /* calculate effective address size */
+ u->adr_mode = (u->pfx_adr) ? 32 : 64;
+ } else if ( u->dis_mode == 32 ) { /* set 32bit-mode flags */
+ u->opr_mode = ( u->pfx_opr ) ? 16 : 32;
+ u->adr_mode = ( u->pfx_adr ) ? 16 : 32;
+ } else if ( u->dis_mode == 16 ) { /* set 16bit-mode flags */
+ u->opr_mode = ( u->pfx_opr ) ? 32 : 16;
+ u->adr_mode = ( u->pfx_adr ) ? 32 : 16;
+ }
+
+ return 0;
+}
+
+
+static UD_INLINE int
+decode_insn(struct ud *u, uint16_t ptr)
+{
+ UD_ASSERT((ptr & 0x8000) == 0);
+ u->itab_entry = &ud_itab[ ptr ];
+ u->mnemonic = u->itab_entry->mnemonic;
+ return (resolve_pfx_str(u) == 0 &&
+ resolve_mode(u) == 0 &&
+ decode_operands(u) == 0 &&
+ resolve_mnemonic(u) == 0) ? 0 : -1;
+}
+
+
+/*
+ * decode_3dnow()
+ *
+ * Decoding 3dnow is a little tricky because of its strange opcode
+ * structure. The final opcode disambiguation depends on the last
+ * byte that comes after the operands have been decoded. Fortunately,
+ * all 3dnow instructions have the same set of operand types. So we
+ * go ahead and decode the instruction by picking an arbitrarily chosen
+ * valid entry in the table, decode the operands, and read the final
+ * byte to resolve the menmonic.
+ */
+static UD_INLINE int
+decode_3dnow(struct ud* u)
+{
+ uint16_t ptr;
+ UD_ASSERT(u->le->type == UD_TAB__OPC_3DNOW);
+ UD_ASSERT(u->le->table[0xc] != 0);
+ decode_insn(u, u->le->table[0xc]);
+ inp_next(u);
+ if (u->error) {
+ return -1;
+ }
+ ptr = u->le->table[inp_curr(u)];
+ UD_ASSERT((ptr & 0x8000) == 0);
+ u->mnemonic = ud_itab[ptr].mnemonic;
+ return 0;
+}
+
+
+static int
+decode_ssepfx(struct ud *u)
+{
+ uint8_t idx;
+ uint8_t pfx;
+
+ /*
+ * String prefixes (f2, f3) take precedence over operand
+ * size prefix (66).
+ */
+ pfx = u->pfx_str;
+ if (pfx == 0) {
+ pfx = u->pfx_opr;
+ }
+ idx = ((pfx & 0xf) + 1) / 2;
+ if (u->le->table[idx] == 0) {
+ idx = 0;
+ }
+ if (idx && u->le->table[idx] != 0) {
+ /*
+ * "Consume" the prefix as a part of the opcode, so it is no
+ * longer exported as an instruction prefix.
+ */
+ u->pfx_str = 0;
+ if (pfx == 0x66) {
+ /*
+ * consume "66" only if it was used for decoding, leaving
+ * it to be used as an operands size override for some
+ * simd instructions.
+ */
+ u->pfx_opr = 0;
+ }
+ }
+ return decode_ext(u, u->le->table[idx]);
+}
+
+
+static int
+decode_vex(struct ud *u)
+{
+ uint8_t index;
+ if (u->dis_mode != 64 && MODRM_MOD(inp_peek(u)) != 0x3) {
+ index = 0;
+ } else {
+ u->vex_op = inp_curr(u);
+ u->vex_b1 = inp_next(u);
+ if (u->vex_op == 0xc4) {
+ uint8_t pp, m;
+ /* 3-byte vex */
+ u->vex_b2 = inp_next(u);
+ UD_RETURN_ON_ERROR(u);
+ m = u->vex_b1 & 0x1f;
+ if (m == 0 || m > 3) {
+ UD_RETURN_WITH_ERROR(u, "reserved vex.m-mmmm value");
+ }
+ pp = u->vex_b2 & 0x3;
+ index = (pp << 2) | m;
+ } else {
+ /* 2-byte vex */
+ UD_ASSERT(u->vex_op == 0xc5);
+ index = 0x1 | ((u->vex_b1 & 0x3) << 2);
+ }
+ }
+ return decode_ext(u, u->le->table[index]);
+}
+
+
+/*
+ * decode_ext()
+ *
+ * Decode opcode extensions (if any)
+ */
+static int
+decode_ext(struct ud *u, uint16_t ptr)
+{
+ uint8_t idx = 0;
+ if ((ptr & 0x8000) == 0) {
+ return decode_insn(u, ptr);
+ }
+ u->le = &ud_lookup_table_list[(~0x8000 & ptr)];
+ if (u->le->type == UD_TAB__OPC_3DNOW) {
+ return decode_3dnow(u);
+ }
+
+ switch (u->le->type) {
+ case UD_TAB__OPC_MOD:
+ /* !11 = 0, 11 = 1 */
+ idx = (MODRM_MOD(modrm(u)) + 1) / 4;
+ break;
+ /* disassembly mode/operand size/address size based tables.
+ * 16 = 0,, 32 = 1, 64 = 2
+ */
+ case UD_TAB__OPC_MODE:
+ idx = u->dis_mode != 64 ? 0 : 1;
+ break;
+ case UD_TAB__OPC_OSIZE:
+ idx = eff_opr_mode(u->dis_mode, REX_W(u->pfx_rex), u->pfx_opr) / 32;
+ break;
+ case UD_TAB__OPC_ASIZE:
+ idx = eff_adr_mode(u->dis_mode, u->pfx_adr) / 32;
+ break;
+ case UD_TAB__OPC_X87:
+ idx = modrm(u) - 0xC0;
+ break;
+ case UD_TAB__OPC_VENDOR:
+ if (u->vendor == UD_VENDOR_ANY) {
+ /* choose a valid entry */
+ idx = (u->le->table[idx] != 0) ? 0 : 1;
+ } else if (u->vendor == UD_VENDOR_AMD) {
+ idx = 0;
+ } else {
+ idx = 1;
+ }
+ break;
+ case UD_TAB__OPC_RM:
+ idx = MODRM_RM(modrm(u));
+ break;
+ case UD_TAB__OPC_REG:
+ idx = MODRM_REG(modrm(u));
+ break;
+ case UD_TAB__OPC_SSE:
+ return decode_ssepfx(u);
+ case UD_TAB__OPC_VEX:
+ return decode_vex(u);
+ case UD_TAB__OPC_VEX_W:
+ idx = vex_w(u);
+ break;
+ case UD_TAB__OPC_VEX_L:
+ idx = vex_l(u);
+ break;
+ case UD_TAB__OPC_TABLE:
+ inp_next(u);
+ return decode_opcode(u);
+ default:
+ UD_ASSERT(!"not reached");
+ break;
+ }
+
+ return decode_ext(u, u->le->table[idx]);
+}
+
+
+static int
+decode_opcode(struct ud *u)
+{
+ uint16_t ptr;
+ UD_ASSERT(u->le->type == UD_TAB__OPC_TABLE);
+ UD_RETURN_ON_ERROR(u);
+ ptr = u->le->table[inp_curr(u)];
+ return decode_ext(u, ptr);
+}
+
+
+/* =============================================================================
+ * ud_decode() - Instruction decoder. Returns the number of bytes decoded.
+ * =============================================================================
+ */
+unsigned int
+ud_decode(struct ud *u)
+{
+ inp_start(u);
+ clear_insn(u);
+ u->le = &ud_lookup_table_list[0];
+ u->error = decode_prefixes(u) == -1 ||
+ decode_opcode(u) == -1 ||
+ u->error;
+ /* Handle decode error. */
+ if (u->error) {
+ /* clear out the decode data. */
+ clear_insn(u);
+ /* mark the sequence of bytes as invalid. */
+ u->itab_entry = &ud_itab[0]; /* entry 0 is invalid */
+ u->mnemonic = u->itab_entry->mnemonic;
+ }
+
+ /* maybe this stray segment override byte
+ * should be spewed out?
+ */
+ if ( !P_SEG( u->itab_entry->prefix ) &&
+ u->operand[0].type != UD_OP_MEM &&
+ u->operand[1].type != UD_OP_MEM )
+ u->pfx_seg = 0;
+
+ u->insn_offset = u->pc; /* set offset of instruction */
+ u->asm_buf_fill = 0; /* set translation buffer index to 0 */
+ u->pc += u->inp_ctr; /* move program counter by bytes decoded */
+
+ /* return number of bytes disassembled. */
+ return u->inp_ctr;
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/decode.h b/ext/opcache/jit/libudis86/decode.h
new file mode 100644
index 0000000000..3949c4e269
--- /dev/null
+++ b/ext/opcache/jit/libudis86/decode.h
@@ -0,0 +1,197 @@
+/* udis86 - libudis86/decode.h
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_DECODE_H
+#define UD_DECODE_H
+
+#include "types.h"
+#include "udint.h"
+#include "itab.h"
+
+#define MAX_INSN_LENGTH 15
+
+/* itab prefix bits */
+#define P_none ( 0 )
+
+#define P_inv64 ( 1 << 0 )
+#define P_INV64(n) ( ( n >> 0 ) & 1 )
+#define P_def64 ( 1 << 1 )
+#define P_DEF64(n) ( ( n >> 1 ) & 1 )
+
+#define P_oso ( 1 << 2 )
+#define P_OSO(n) ( ( n >> 2 ) & 1 )
+#define P_aso ( 1 << 3 )
+#define P_ASO(n) ( ( n >> 3 ) & 1 )
+
+#define P_rexb ( 1 << 4 )
+#define P_REXB(n) ( ( n >> 4 ) & 1 )
+#define P_rexw ( 1 << 5 )
+#define P_REXW(n) ( ( n >> 5 ) & 1 )
+#define P_rexr ( 1 << 6 )
+#define P_REXR(n) ( ( n >> 6 ) & 1 )
+#define P_rexx ( 1 << 7 )
+#define P_REXX(n) ( ( n >> 7 ) & 1 )
+
+#define P_seg ( 1 << 8 )
+#define P_SEG(n) ( ( n >> 8 ) & 1 )
+
+#define P_vexl ( 1 << 9 )
+#define P_VEXL(n) ( ( n >> 9 ) & 1 )
+#define P_vexw ( 1 << 10 )
+#define P_VEXW(n) ( ( n >> 10 ) & 1 )
+
+#define P_str ( 1 << 11 )
+#define P_STR(n) ( ( n >> 11 ) & 1 )
+#define P_strz ( 1 << 12 )
+#define P_STR_ZF(n) ( ( n >> 12 ) & 1 )
+
+/* operand type constants -- order is important! */
+
+enum ud_operand_code {
+ OP_NONE,
+
+ OP_A, OP_E, OP_M, OP_G,
+ OP_I, OP_F,
+
+ OP_R0, OP_R1, OP_R2, OP_R3,
+ OP_R4, OP_R5, OP_R6, OP_R7,
+
+ OP_AL, OP_CL, OP_DL,
+ OP_AX, OP_CX, OP_DX,
+ OP_eAX, OP_eCX, OP_eDX,
+ OP_rAX, OP_rCX, OP_rDX,
+
+ OP_ES, OP_CS, OP_SS, OP_DS,
+ OP_FS, OP_GS,
+
+ OP_ST0, OP_ST1, OP_ST2, OP_ST3,
+ OP_ST4, OP_ST5, OP_ST6, OP_ST7,
+
+ OP_J, OP_S, OP_O,
+ OP_I1, OP_I3, OP_sI,
+
+ OP_V, OP_W, OP_Q, OP_P,
+ OP_U, OP_N, OP_MU, OP_H,
+ OP_L,
+
+ OP_R, OP_C, OP_D,
+
+ OP_MR
+} UD_ATTR_PACKED;
+
+
+/*
+ * Operand size constants
+ *
+ * Symbolic constants for various operand sizes. Some of these constants
+ * are given a value equal to the width of the data (SZ_B == 8), such
+ * that they maybe used interchangeably in the internals. Modifying them
+ * will most certainly break things!
+ */
+typedef uint16_t ud_operand_size_t;
+
+#define SZ_NA 0
+#define SZ_Z 1
+#define SZ_V 2
+#define SZ_Y 3
+#define SZ_X 4
+#define SZ_RDQ 7
+#define SZ_B 8
+#define SZ_W 16
+#define SZ_D 32
+#define SZ_Q 64
+#define SZ_T 80
+#define SZ_O 12
+#define SZ_DQ 128 /* double quad */
+#define SZ_QQ 256 /* quad quad */
+
+/*
+ * Complex size types; that encode sizes for operands of type MR (memory or
+ * register); for internal use only. Id space above 256.
+ */
+#define SZ_BD ((SZ_B << 8) | SZ_D)
+#define SZ_BV ((SZ_B << 8) | SZ_V)
+#define SZ_WD ((SZ_W << 8) | SZ_D)
+#define SZ_WV ((SZ_W << 8) | SZ_V)
+#define SZ_WY ((SZ_W << 8) | SZ_Y)
+#define SZ_DY ((SZ_D << 8) | SZ_Y)
+#define SZ_WO ((SZ_W << 8) | SZ_O)
+#define SZ_DO ((SZ_D << 8) | SZ_O)
+#define SZ_QO ((SZ_Q << 8) | SZ_O)
+
+
+/* resolve complex size type.
+ */
+static UD_INLINE ud_operand_size_t
+Mx_mem_size(ud_operand_size_t size)
+{
+ return (size >> 8) & 0xff;
+}
+
+static UD_INLINE ud_operand_size_t
+Mx_reg_size(ud_operand_size_t size)
+{
+ return size & 0xff;
+}
+
+/* A single operand of an entry in the instruction table.
+ * (internal use only)
+ */
+struct ud_itab_entry_operand
+{
+ enum ud_operand_code type;
+ ud_operand_size_t size;
+};
+
+
+/* A single entry in an instruction table.
+ *(internal use only)
+ */
+struct ud_itab_entry
+{
+ enum ud_mnemonic_code mnemonic;
+ struct ud_itab_entry_operand operand1;
+ struct ud_itab_entry_operand operand2;
+ struct ud_itab_entry_operand operand3;
+ struct ud_itab_entry_operand operand4;
+ uint32_t prefix;
+};
+
+struct ud_lookup_table_list_entry {
+ const uint16_t *table;
+ enum ud_table_type type;
+ const char *meta;
+};
+
+extern struct ud_itab_entry ud_itab[];
+extern struct ud_lookup_table_list_entry ud_lookup_table_list[];
+
+#endif /* UD_DECODE_H */
+
+/* vim:cindent
+ * vim:expandtab
+ * vim:ts=4
+ * vim:sw=4
+ */
diff --git a/ext/opcache/jit/libudis86/extern.h b/ext/opcache/jit/libudis86/extern.h
new file mode 100644
index 0000000000..71a01fd9b4
--- /dev/null
+++ b/ext/opcache/jit/libudis86/extern.h
@@ -0,0 +1,113 @@
+/* udis86 - libudis86/extern.h
+ *
+ * Copyright (c) 2002-2009, 2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_EXTERN_H
+#define UD_EXTERN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "types.h"
+
+#if defined(_MSC_VER) && defined(_USRDLL)
+# ifdef LIBUDIS86_EXPORTS
+# define LIBUDIS86_DLLEXTERN __declspec(dllexport)
+# else
+# define LIBUDIS86_DLLEXTERN __declspec(dllimport)
+# endif
+#else
+# define LIBUDIS86_DLLEXTERN
+#endif
+
+/* ============================= PUBLIC API ================================= */
+
+extern LIBUDIS86_DLLEXTERN void ud_init(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_mode(struct ud*, uint8_t);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_pc(struct ud*, uint64_t);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_input_hook(struct ud*, int (*)(struct ud*));
+
+extern LIBUDIS86_DLLEXTERN void ud_set_input_buffer(struct ud*, const uint8_t*, size_t);
+
+#ifndef __UD_STANDALONE__
+extern LIBUDIS86_DLLEXTERN void ud_set_input_file(struct ud*, FILE*);
+#endif /* __UD_STANDALONE__ */
+
+extern LIBUDIS86_DLLEXTERN void ud_set_vendor(struct ud*, unsigned);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_syntax(struct ud*, void (*)(struct ud*));
+
+extern LIBUDIS86_DLLEXTERN void ud_input_skip(struct ud*, size_t);
+
+extern LIBUDIS86_DLLEXTERN int ud_input_end(const struct ud*);
+
+extern LIBUDIS86_DLLEXTERN unsigned int ud_decode(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN unsigned int ud_disassemble(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_translate_intel(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_translate_att(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN const char* ud_insn_asm(const struct ud* u);
+
+extern LIBUDIS86_DLLEXTERN const uint8_t* ud_insn_ptr(const struct ud* u);
+
+extern LIBUDIS86_DLLEXTERN uint64_t ud_insn_off(const struct ud*);
+
+extern LIBUDIS86_DLLEXTERN const char* ud_insn_hex(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN unsigned int ud_insn_len(const struct ud* u);
+
+extern LIBUDIS86_DLLEXTERN const struct ud_operand* ud_insn_opr(const struct ud *u, unsigned int n);
+
+extern LIBUDIS86_DLLEXTERN int ud_opr_is_sreg(const struct ud_operand *opr);
+
+extern LIBUDIS86_DLLEXTERN int ud_opr_is_gpr(const struct ud_operand *opr);
+
+extern LIBUDIS86_DLLEXTERN enum ud_mnemonic_code ud_insn_mnemonic(const struct ud *u);
+
+extern LIBUDIS86_DLLEXTERN const char* ud_lookup_mnemonic(enum ud_mnemonic_code c);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_user_opaque_data(struct ud*, void*);
+
+extern LIBUDIS86_DLLEXTERN void* ud_get_user_opaque_data(const struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_asm_buffer(struct ud *u, char *buf, size_t size);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_sym_resolver(struct ud *u,
+ const char* (*resolver)(struct ud*,
+ uint64_t addr,
+ int64_t *offset));
+
+/* ========================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UD_EXTERN_H */
diff --git a/ext/opcache/jit/libudis86/itab.c b/ext/opcache/jit/libudis86/itab.c
new file mode 100644
index 0000000000..953f3e5227
--- /dev/null
+++ b/ext/opcache/jit/libudis86/itab.c
@@ -0,0 +1,5946 @@
+/* itab.c -- generated by udis86:scripts/ud_itab.py, do no edit */
+#include "decode.h"
+
+#define GROUP(n) (0x8000 | (n))
+#define INVALID 0
+
+
+const uint16_t ud_itab__0[] = {
+ /* 0 */ 15, 16, 17, 18,
+ /* 4 */ 19, 20, GROUP(1), GROUP(2),
+ /* 8 */ 964, 965, 966, 967,
+ /* c */ 968, 969, GROUP(3), GROUP(4),
+ /* 10 */ 5, 6, 7, 8,
+ /* 14 */ 9, 10, GROUP(284), GROUP(285),
+ /* 18 */ 1336, 1337, 1338, 1339,
+ /* 1c */ 1340, 1341, GROUP(286), GROUP(287),
+ /* 20 */ 49, 50, 51, 52,
+ /* 24 */ 53, 54, INVALID, GROUP(288),
+ /* 28 */ 1407, 1408, 1409, 1410,
+ /* 2c */ 1411, 1412, INVALID, GROUP(289),
+ /* 30 */ 1487, 1488, 1489, 1490,
+ /* 34 */ 1491, 1492, INVALID, GROUP(290),
+ /* 38 */ 100, 101, 102, 103,
+ /* 3c */ 104, 105, INVALID, GROUP(291),
+ /* 40 */ 699, 700, 701, 702,
+ /* 44 */ 703, 704, 705, 706,
+ /* 48 */ 175, 176, 177, 178,
+ /* 4c */ 179, 180, 181, 182,
+ /* 50 */ 1246, 1247, 1248, 1249,
+ /* 54 */ 1250, 1251, 1252, 1253,
+ /* 58 */ 1101, 1102, 1103, 1104,
+ /* 5c */ 1105, 1106, 1107, 1108,
+ /* 60 */ GROUP(292), GROUP(295), GROUP(298), GROUP(299),
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ 1254, 697, 1256, 698,
+ /* 6c */ 709, GROUP(300), 982, GROUP(301),
+ /* 70 */ 726, 728, 730, 732,
+ /* 74 */ 734, 736, 738, 740,
+ /* 78 */ 742, 744, 746, 748,
+ /* 7c */ 750, 752, 754, 756,
+ /* 80 */ GROUP(302), GROUP(303), GROUP(304), GROUP(313),
+ /* 84 */ 1433, 1434, 1475, 1476,
+ /* 88 */ 828, 829, 830, 831,
+ /* 8c */ 832, 770, 833, GROUP(314),
+ /* 90 */ 1477, 1478, 1479, 1480,
+ /* 94 */ 1481, 1482, 1483, 1484,
+ /* 98 */ GROUP(315), GROUP(316), GROUP(317), 1470,
+ /* 9c */ GROUP(318), GROUP(322), 1310, 766,
+ /* a0 */ 834, 835, 836, 837,
+ /* a4 */ 922, GROUP(326), 114, GROUP(327),
+ /* a8 */ 1435, 1436, 1402, GROUP(328),
+ /* ac */ 790, GROUP(329), 1346, GROUP(330),
+ /* b0 */ 838, 839, 840, 841,
+ /* b4 */ 842, 843, 844, 845,
+ /* b8 */ 846, 847, 848, 849,
+ /* bc */ 850, 851, 852, 853,
+ /* c0 */ GROUP(331), GROUP(332), 1301, 1302,
+ /* c4 */ GROUP(333), GROUP(403), GROUP(405), GROUP(406),
+ /* c8 */ 200, 776, 1303, 1304,
+ /* cc */ 713, 714, GROUP(407), GROUP(408),
+ /* d0 */ GROUP(409), GROUP(410), GROUP(411), GROUP(412),
+ /* d4 */ GROUP(413), GROUP(414), GROUP(415), 1486,
+ /* d8 */ GROUP(416), GROUP(419), GROUP(422), GROUP(425),
+ /* dc */ GROUP(428), GROUP(431), GROUP(434), GROUP(437),
+ /* e0 */ 794, 795, 796, GROUP(440),
+ /* e4 */ 690, 691, 978, 979,
+ /* e8 */ 72, 763, GROUP(441), 765,
+ /* ec */ 692, 693, 980, 981,
+ /* f0 */ 789, 712, 1299, 1300,
+ /* f4 */ 687, 83, GROUP(442), GROUP(443),
+ /* f8 */ 77, 1395, 81, 1398,
+ /* fc */ 78, 1396, GROUP(444), GROUP(445),
+};
+
+static const uint16_t ud_itab__1[] = {
+ /* 0 */ 1240, INVALID,
+};
+
+static const uint16_t ud_itab__2[] = {
+ /* 0 */ 1096, INVALID,
+};
+
+static const uint16_t ud_itab__3[] = {
+ /* 0 */ 1241, INVALID,
+};
+
+static const uint16_t ud_itab__4[] = {
+ /* 0 */ GROUP(5), GROUP(6), 767, 797,
+ /* 4 */ INVALID, 1426, 82, 1431,
+ /* 8 */ 716, 1471, INVALID, 1444,
+ /* c */ INVALID, GROUP(27), 430, GROUP(28),
+ /* 10 */ GROUP(29), GROUP(30), GROUP(31), GROUP(34),
+ /* 14 */ GROUP(35), GROUP(36), GROUP(37), GROUP(40),
+ /* 18 */ GROUP(41), 955, 956, 957,
+ /* 1c */ 958, 959, 960, 961,
+ /* 20 */ 854, 855, 856, 857,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ GROUP(42), GROUP(43), GROUP(44), GROUP(45),
+ /* 2c */ GROUP(46), GROUP(47), GROUP(48), GROUP(49),
+ /* 30 */ 1472, 1297, 1295, 1296,
+ /* 34 */ GROUP(50), GROUP(52), INVALID, 1514,
+ /* 38 */ GROUP(54), INVALID, GROUP(116), INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ 84, 85, 86, 87,
+ /* 44 */ 88, 89, 90, 91,
+ /* 48 */ 92, 93, 94, 95,
+ /* 4c */ 96, 97, 98, 99,
+ /* 50 */ GROUP(143), GROUP(144), GROUP(145), GROUP(146),
+ /* 54 */ GROUP(147), GROUP(148), GROUP(149), GROUP(150),
+ /* 58 */ GROUP(151), GROUP(152), GROUP(153), GROUP(154),
+ /* 5c */ GROUP(155), GROUP(156), GROUP(157), GROUP(158),
+ /* 60 */ GROUP(159), GROUP(160), GROUP(161), GROUP(162),
+ /* 64 */ GROUP(163), GROUP(164), GROUP(165), GROUP(166),
+ /* 68 */ GROUP(167), GROUP(168), GROUP(169), GROUP(170),
+ /* 6c */ GROUP(171), GROUP(172), GROUP(173), GROUP(176),
+ /* 70 */ GROUP(177), GROUP(178), GROUP(182), GROUP(186),
+ /* 74 */ GROUP(191), GROUP(192), GROUP(193), 199,
+ /* 78 */ GROUP(194), GROUP(195), INVALID, INVALID,
+ /* 7c */ GROUP(196), GROUP(197), GROUP(198), GROUP(201),
+ /* 80 */ 727, 729, 731, 733,
+ /* 84 */ 735, 737, 739, 741,
+ /* 88 */ 743, 745, 747, 749,
+ /* 8c */ 751, 753, 755, 757,
+ /* 90 */ 1350, 1351, 1352, 1353,
+ /* 94 */ 1354, 1355, 1356, 1357,
+ /* 98 */ 1358, 1359, 1360, 1361,
+ /* 9c */ 1362, 1363, 1364, 1365,
+ /* a0 */ 1245, 1100, 131, 1670,
+ /* a4 */ 1375, 1376, GROUP(202), GROUP(207),
+ /* a8 */ 1244, 1099, 1305, 1675,
+ /* ac */ 1377, 1378, GROUP(215), 694,
+ /* b0 */ 122, 123, 775, 1673,
+ /* b4 */ 772, 773, 940, 941,
+ /* b8 */ GROUP(221), INVALID, GROUP(222), 1671,
+ /* bc */ 1659, 1660, 930, 931,
+ /* c0 */ 1473, 1474, GROUP(223), 904,
+ /* c4 */ GROUP(224), GROUP(225), GROUP(226), GROUP(227),
+ /* c8 */ 1661, 1662, 1663, 1664,
+ /* cc */ 1665, 1666, 1667, 1668,
+ /* d0 */ GROUP(236), GROUP(237), GROUP(238), GROUP(239),
+ /* d4 */ GROUP(240), GROUP(241), GROUP(242), GROUP(243),
+ /* d8 */ GROUP(244), GROUP(245), GROUP(246), GROUP(247),
+ /* dc */ GROUP(248), GROUP(249), GROUP(250), GROUP(251),
+ /* e0 */ GROUP(252), GROUP(253), GROUP(254), GROUP(255),
+ /* e4 */ GROUP(256), GROUP(257), GROUP(258), GROUP(259),
+ /* e8 */ GROUP(260), GROUP(261), GROUP(262), GROUP(263),
+ /* ec */ GROUP(264), GROUP(265), GROUP(266), GROUP(267),
+ /* f0 */ GROUP(268), GROUP(269), GROUP(270), GROUP(271),
+ /* f4 */ GROUP(272), GROUP(273), GROUP(274), GROUP(275),
+ /* f8 */ GROUP(277), GROUP(278), GROUP(279), GROUP(280),
+ /* fc */ GROUP(281), GROUP(282), GROUP(283), INVALID,
+};
+
+static const uint16_t ud_itab__5[] = {
+ /* 0 */ 1384, 1406, 786, 798,
+ /* 4 */ 1453, 1454, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__6[] = {
+ /* 0 */ GROUP(7), GROUP(8),
+};
+
+static const uint16_t ud_itab__7[] = {
+ /* 0 */ 1374, 1383, 785, 774,
+ /* 4 */ 1385, INVALID, 787, 719,
+};
+
+static const uint16_t ud_itab__8[] = {
+ /* 0 */ GROUP(9), GROUP(14), GROUP(15), GROUP(16),
+ /* 4 */ 1386, INVALID, 788, GROUP(25),
+};
+
+static const uint16_t ud_itab__9[] = {
+ /* 0 */ INVALID, GROUP(10), GROUP(11), GROUP(12),
+ /* 4 */ GROUP(13), INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__10[] = {
+ /* 0 */ INVALID, 1455, INVALID,
+};
+
+static const uint16_t ud_itab__11[] = {
+ /* 0 */ INVALID, 1461, INVALID,
+};
+
+static const uint16_t ud_itab__12[] = {
+ /* 0 */ INVALID, 1462, INVALID,
+};
+
+static const uint16_t ud_itab__13[] = {
+ /* 0 */ INVALID, 1463, INVALID,
+};
+
+static const uint16_t ud_itab__14[] = {
+ /* 0 */ 824, 952, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__15[] = {
+ /* 0 */ 1485, 1508, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__16[] = {
+ /* 0 */ GROUP(17), GROUP(18), GROUP(19), GROUP(20),
+ /* 4 */ GROUP(21), GROUP(22), GROUP(23), GROUP(24),
+};
+
+static const uint16_t ud_itab__17[] = {
+ /* 0 */ 1466, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__18[] = {
+ /* 0 */ 1467, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__19[] = {
+ /* 0 */ 1468, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__20[] = {
+ /* 0 */ 1469, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__21[] = {
+ /* 0 */ 1397, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__22[] = {
+ /* 0 */ 80, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__23[] = {
+ /* 0 */ 1399, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__24[] = {
+ /* 0 */ 720, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__25[] = {
+ /* 0 */ 1425, GROUP(26), INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__26[] = {
+ /* 0 */ 1298, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__27[] = {
+ /* 0 */ 1119, 1120, 1121, 1122,
+ /* 4 */ 1123, 1124, 1125, 1126,
+};
+
+static const uint16_t ud_itab__28[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ 1216, 1217, INVALID, INVALID,
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, INVALID,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ 1218, 1219, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, 1220, INVALID,
+ /* 8c */ INVALID, INVALID, 1221, INVALID,
+ /* 90 */ 1222, INVALID, INVALID, INVALID,
+ /* 94 */ 1223, INVALID, 1224, 1225,
+ /* 98 */ INVALID, INVALID, 1226, INVALID,
+ /* 9c */ INVALID, INVALID, 1227, INVALID,
+ /* a0 */ 1228, INVALID, INVALID, INVALID,
+ /* a4 */ 1229, INVALID, 1230, 1231,
+ /* a8 */ INVALID, INVALID, 1232, INVALID,
+ /* ac */ INVALID, INVALID, 1233, INVALID,
+ /* b0 */ 1234, INVALID, INVALID, INVALID,
+ /* b4 */ 1235, INVALID, 1236, 1237,
+ /* b8 */ INVALID, INVALID, INVALID, 1238,
+ /* bc */ INVALID, INVALID, INVALID, 1239,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__29[] = {
+ /* 0 */ 936, 925, 928, 932,
+};
+
+static const uint16_t ud_itab__30[] = {
+ /* 0 */ 938, 926, 929, 934,
+};
+
+static const uint16_t ud_itab__31[] = {
+ /* 0 */ GROUP(32), GROUP(33),
+};
+
+static const uint16_t ud_itab__32[] = {
+ /* 0 */ 892, 1563, 1571, 888,
+};
+
+static const uint16_t ud_itab__33[] = {
+ /* 0 */ 896, 1561, 1569, INVALID,
+};
+
+static const uint16_t ud_itab__34[] = {
+ /* 0 */ 894, INVALID, INVALID, 890,
+};
+
+static const uint16_t ud_itab__35[] = {
+ /* 0 */ 1449, INVALID, INVALID, 1451,
+};
+
+static const uint16_t ud_itab__36[] = {
+ /* 0 */ 1447, INVALID, INVALID, 1445,
+};
+
+static const uint16_t ud_itab__37[] = {
+ /* 0 */ GROUP(38), GROUP(39),
+};
+
+static const uint16_t ud_itab__38[] = {
+ /* 0 */ 882, INVALID, 1567, 878,
+};
+
+static const uint16_t ud_itab__39[] = {
+ /* 0 */ 886, INVALID, 1565, INVALID,
+};
+
+static const uint16_t ud_itab__40[] = {
+ /* 0 */ 884, INVALID, INVALID, 880,
+};
+
+static const uint16_t ud_itab__41[] = {
+ /* 0 */ 1127, 1128, 1129, 1130,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__42[] = {
+ /* 0 */ 862, INVALID, INVALID, 858,
+};
+
+static const uint16_t ud_itab__43[] = {
+ /* 0 */ 864, INVALID, INVALID, 860,
+};
+
+static const uint16_t ud_itab__44[] = {
+ /* 0 */ 141, 152, 154, 142,
+};
+
+static const uint16_t ud_itab__45[] = {
+ /* 0 */ 907, INVALID, INVALID, 905,
+};
+
+static const uint16_t ud_itab__46[] = {
+ /* 0 */ 165, 166, 168, 162,
+};
+
+static const uint16_t ud_itab__47[] = {
+ /* 0 */ 147, 148, 158, 138,
+};
+
+static const uint16_t ud_itab__48[] = {
+ /* 0 */ 1442, INVALID, INVALID, 1440,
+};
+
+static const uint16_t ud_itab__49[] = {
+ /* 0 */ 129, INVALID, INVALID, 127,
+};
+
+static const uint16_t ud_itab__50[] = {
+ /* 0 */ 1427, GROUP(51),
+};
+
+static const uint16_t ud_itab__51[] = {
+ /* 0 */ INVALID, 1428, INVALID,
+};
+
+static const uint16_t ud_itab__52[] = {
+ /* 0 */ 1429, GROUP(53),
+};
+
+static const uint16_t ud_itab__53[] = {
+ /* 0 */ INVALID, 1430, INVALID,
+};
+
+static const uint16_t ud_itab__54[] = {
+ /* 0 */ GROUP(67), GROUP(68), GROUP(63), GROUP(64),
+ /* 4 */ GROUP(65), GROUP(66), GROUP(86), GROUP(90),
+ /* 8 */ GROUP(69), GROUP(70), GROUP(71), GROUP(72),
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ GROUP(73), INVALID, INVALID, INVALID,
+ /* 14 */ GROUP(75), GROUP(76), INVALID, GROUP(77),
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ GROUP(78), GROUP(79), GROUP(80), INVALID,
+ /* 20 */ GROUP(81), GROUP(82), GROUP(83), GROUP(84),
+ /* 24 */ GROUP(85), GROUP(108), INVALID, INVALID,
+ /* 28 */ GROUP(87), GROUP(88), GROUP(89), GROUP(74),
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ GROUP(91), GROUP(92), GROUP(93), GROUP(94),
+ /* 34 */ GROUP(95), GROUP(96), INVALID, GROUP(97),
+ /* 38 */ GROUP(98), GROUP(99), GROUP(100), GROUP(101),
+ /* 3c */ GROUP(102), GROUP(103), GROUP(104), GROUP(105),
+ /* 40 */ GROUP(106), GROUP(107), INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ GROUP(55), GROUP(59), INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, GROUP(109),
+ /* dc */ GROUP(110), GROUP(111), GROUP(112), GROUP(113),
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ GROUP(114), GROUP(115), INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__55[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(56),
+};
+
+static const uint16_t ud_itab__56[] = {
+ /* 0 */ GROUP(57), GROUP(58),
+};
+
+static const uint16_t ud_itab__57[] = {
+ /* 0 */ INVALID, 717, INVALID,
+};
+
+static const uint16_t ud_itab__58[] = {
+ /* 0 */ INVALID, 718, INVALID,
+};
+
+static const uint16_t ud_itab__59[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(60),
+};
+
+static const uint16_t ud_itab__60[] = {
+ /* 0 */ GROUP(61), GROUP(62),
+};
+
+static const uint16_t ud_itab__61[] = {
+ /* 0 */ INVALID, 721, INVALID,
+};
+
+static const uint16_t ud_itab__62[] = {
+ /* 0 */ INVALID, 722, INVALID,
+};
+
+static const uint16_t ud_itab__63[] = {
+ /* 0 */ 1588, INVALID, INVALID, 1589,
+};
+
+static const uint16_t ud_itab__64[] = {
+ /* 0 */ 1591, INVALID, INVALID, 1592,
+};
+
+static const uint16_t ud_itab__65[] = {
+ /* 0 */ 1594, INVALID, INVALID, 1595,
+};
+
+static const uint16_t ud_itab__66[] = {
+ /* 0 */ 1597, INVALID, INVALID, 1598,
+};
+
+static const uint16_t ud_itab__67[] = {
+ /* 0 */ 1582, INVALID, INVALID, 1583,
+};
+
+static const uint16_t ud_itab__68[] = {
+ /* 0 */ 1585, INVALID, INVALID, 1586,
+};
+
+static const uint16_t ud_itab__69[] = {
+ /* 0 */ 1606, INVALID, INVALID, 1607,
+};
+
+static const uint16_t ud_itab__70[] = {
+ /* 0 */ 1612, INVALID, INVALID, 1613,
+};
+
+static const uint16_t ud_itab__71[] = {
+ /* 0 */ 1609, INVALID, INVALID, 1610,
+};
+
+static const uint16_t ud_itab__72[] = {
+ /* 0 */ 1615, INVALID, INVALID, 1616,
+};
+
+static const uint16_t ud_itab__73[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1621,
+};
+
+static const uint16_t ud_itab__74[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1683,
+};
+
+static const uint16_t ud_itab__75[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1657,
+};
+
+static const uint16_t ud_itab__76[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1656,
+};
+
+static const uint16_t ud_itab__77[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1711,
+};
+
+static const uint16_t ud_itab__78[] = {
+ /* 0 */ 1573, INVALID, INVALID, 1574,
+};
+
+static const uint16_t ud_itab__79[] = {
+ /* 0 */ 1576, INVALID, INVALID, 1577,
+};
+
+static const uint16_t ud_itab__80[] = {
+ /* 0 */ 1579, INVALID, INVALID, 1580,
+};
+
+static const uint16_t ud_itab__81[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1685,
+};
+
+static const uint16_t ud_itab__82[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1687,
+};
+
+static const uint16_t ud_itab__83[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1689,
+};
+
+static const uint16_t ud_itab__84[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1691,
+};
+
+static const uint16_t ud_itab__85[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1693,
+};
+
+static const uint16_t ud_itab__86[] = {
+ /* 0 */ 1600, INVALID, INVALID, 1601,
+};
+
+static const uint16_t ud_itab__87[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1622,
+};
+
+static const uint16_t ud_itab__88[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1708,
+};
+
+static const uint16_t ud_itab__89[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1681,
+};
+
+static const uint16_t ud_itab__90[] = {
+ /* 0 */ 1603, INVALID, INVALID, 1604,
+};
+
+static const uint16_t ud_itab__91[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1696,
+};
+
+static const uint16_t ud_itab__92[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1698,
+};
+
+static const uint16_t ud_itab__93[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1700,
+};
+
+static const uint16_t ud_itab__94[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1702,
+};
+
+static const uint16_t ud_itab__95[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1704,
+};
+
+static const uint16_t ud_itab__96[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1706,
+};
+
+static const uint16_t ud_itab__97[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1717,
+};
+
+static const uint16_t ud_itab__98[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1624,
+};
+
+static const uint16_t ud_itab__99[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1626,
+};
+
+static const uint16_t ud_itab__100[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1628,
+};
+
+static const uint16_t ud_itab__101[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1630,
+};
+
+static const uint16_t ud_itab__102[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1632,
+};
+
+static const uint16_t ud_itab__103[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1634,
+};
+
+static const uint16_t ud_itab__104[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1638,
+};
+
+static const uint16_t ud_itab__105[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1636,
+};
+
+static const uint16_t ud_itab__106[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1640,
+};
+
+static const uint16_t ud_itab__107[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1642,
+};
+
+static const uint16_t ud_itab__108[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1695,
+};
+
+static const uint16_t ud_itab__109[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 45,
+};
+
+static const uint16_t ud_itab__110[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 41,
+};
+
+static const uint16_t ud_itab__111[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 43,
+};
+
+static const uint16_t ud_itab__112[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 37,
+};
+
+static const uint16_t ud_itab__113[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 39,
+};
+
+static const uint16_t ud_itab__114[] = {
+ /* 0 */ 1723, 1725, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__115[] = {
+ /* 0 */ 1724, 1726, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__116[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ GROUP(117), GROUP(118), GROUP(119), GROUP(120),
+ /* c */ GROUP(121), GROUP(122), GROUP(123), GROUP(124),
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ GROUP(125), GROUP(126), GROUP(127), GROUP(129),
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ GROUP(130), GROUP(131), GROUP(132), INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ GROUP(134), GROUP(135), GROUP(136), INVALID,
+ /* 44 */ GROUP(137), INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ GROUP(139), GROUP(140), GROUP(141), GROUP(142),
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, GROUP(138),
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__117[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1644,
+};
+
+static const uint16_t ud_itab__118[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1646,
+};
+
+static const uint16_t ud_itab__119[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1648,
+};
+
+static const uint16_t ud_itab__120[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1650,
+};
+
+static const uint16_t ud_itab__121[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1654,
+};
+
+static const uint16_t ud_itab__122[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1652,
+};
+
+static const uint16_t ud_itab__123[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1677,
+};
+
+static const uint16_t ud_itab__124[] = {
+ /* 0 */ 1618, INVALID, INVALID, 1619,
+};
+
+static const uint16_t ud_itab__125[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1045,
+};
+
+static const uint16_t ud_itab__126[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1056,
+};
+
+static const uint16_t ud_itab__127[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(128),
+};
+
+static const uint16_t ud_itab__128[] = {
+ /* 0 */ 1047, 1049, 1051,
+};
+
+static const uint16_t ud_itab__129[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 201,
+};
+
+static const uint16_t ud_itab__130[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1058,
+};
+
+static const uint16_t ud_itab__131[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1557,
+};
+
+static const uint16_t ud_itab__132[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(133),
+};
+
+static const uint16_t ud_itab__133[] = {
+ /* 0 */ 1062, 1063, 1064,
+};
+
+static const uint16_t ud_itab__134[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 197,
+};
+
+static const uint16_t ud_itab__135[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 195,
+};
+
+static const uint16_t ud_itab__136[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1679,
+};
+
+static const uint16_t ud_itab__137[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1512,
+};
+
+static const uint16_t ud_itab__138[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 47,
+};
+
+static const uint16_t ud_itab__139[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1715,
+};
+
+static const uint16_t ud_itab__140[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1713,
+};
+
+static const uint16_t ud_itab__141[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1721,
+};
+
+static const uint16_t ud_itab__142[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1719,
+};
+
+static const uint16_t ud_itab__143[] = {
+ /* 0 */ 900, INVALID, INVALID, 898,
+};
+
+static const uint16_t ud_itab__144[] = {
+ /* 0 */ 1387, 1391, 1393, 1389,
+};
+
+static const uint16_t ud_itab__145[] = {
+ /* 0 */ 1306, INVALID, 1308, INVALID,
+};
+
+static const uint16_t ud_itab__146[] = {
+ /* 0 */ 1291, INVALID, 1293, INVALID,
+};
+
+static const uint16_t ud_itab__147[] = {
+ /* 0 */ 61, INVALID, INVALID, 59,
+};
+
+static const uint16_t ud_itab__148[] = {
+ /* 0 */ 65, INVALID, INVALID, 63,
+};
+
+static const uint16_t ud_itab__149[] = {
+ /* 0 */ 976, INVALID, INVALID, 974,
+};
+
+static const uint16_t ud_itab__150[] = {
+ /* 0 */ 1499, INVALID, INVALID, 1497,
+};
+
+static const uint16_t ud_itab__151[] = {
+ /* 0 */ 27, 29, 31, 25,
+};
+
+static const uint16_t ud_itab__152[] = {
+ /* 0 */ 946, 948, 950, 944,
+};
+
+static const uint16_t ud_itab__153[] = {
+ /* 0 */ 145, 150, 156, 139,
+};
+
+static const uint16_t ud_itab__154[] = {
+ /* 0 */ 134, INVALID, 163, 143,
+};
+
+static const uint16_t ud_itab__155[] = {
+ /* 0 */ 1419, 1421, 1423, 1417,
+};
+
+static const uint16_t ud_itab__156[] = {
+ /* 0 */ 818, 820, 822, 816,
+};
+
+static const uint16_t ud_itab__157[] = {
+ /* 0 */ 189, 191, 193, 187,
+};
+
+static const uint16_t ud_itab__158[] = {
+ /* 0 */ 802, 804, 806, 800,
+};
+
+static const uint16_t ud_itab__159[] = {
+ /* 0 */ 1209, INVALID, INVALID, 1207,
+};
+
+static const uint16_t ud_itab__160[] = {
+ /* 0 */ 1212, INVALID, INVALID, 1210,
+};
+
+static const uint16_t ud_itab__161[] = {
+ /* 0 */ 1215, INVALID, INVALID, 1213,
+};
+
+static const uint16_t ud_itab__162[] = {
+ /* 0 */ 987, INVALID, INVALID, 985,
+};
+
+static const uint16_t ud_itab__163[] = {
+ /* 0 */ 1038, INVALID, INVALID, 1036,
+};
+
+static const uint16_t ud_itab__164[] = {
+ /* 0 */ 1041, INVALID, INVALID, 1039,
+};
+
+static const uint16_t ud_itab__165[] = {
+ /* 0 */ 1044, INVALID, INVALID, 1042,
+};
+
+static const uint16_t ud_itab__166[] = {
+ /* 0 */ 993, INVALID, INVALID, 991,
+};
+
+static const uint16_t ud_itab__167[] = {
+ /* 0 */ 1200, INVALID, INVALID, 1198,
+};
+
+static const uint16_t ud_itab__168[] = {
+ /* 0 */ 1203, INVALID, INVALID, 1201,
+};
+
+static const uint16_t ud_itab__169[] = {
+ /* 0 */ 1206, INVALID, INVALID, 1204,
+};
+
+static const uint16_t ud_itab__170[] = {
+ /* 0 */ 990, INVALID, INVALID, 988,
+};
+
+static const uint16_t ud_itab__171[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1547,
+};
+
+static const uint16_t ud_itab__172[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1545,
+};
+
+static const uint16_t ud_itab__173[] = {
+ /* 0 */ GROUP(174), INVALID, INVALID, GROUP(175),
+};
+
+static const uint16_t ud_itab__174[] = {
+ /* 0 */ 866, 867, 910,
+};
+
+static const uint16_t ud_itab__175[] = {
+ /* 0 */ 868, 870, 911,
+};
+
+static const uint16_t ud_itab__176[] = {
+ /* 0 */ 920, INVALID, 1522, 1517,
+};
+
+static const uint16_t ud_itab__177[] = {
+ /* 0 */ 1134, 1537, 1535, 1539,
+};
+
+static const uint16_t ud_itab__178[] = {
+ /* 0 */ INVALID, INVALID, GROUP(179), INVALID,
+ /* 4 */ GROUP(180), INVALID, GROUP(181), INVALID,
+};
+
+static const uint16_t ud_itab__179[] = {
+ /* 0 */ 1159, INVALID, INVALID, 1163,
+};
+
+static const uint16_t ud_itab__180[] = {
+ /* 0 */ 1152, INVALID, INVALID, 1150,
+};
+
+static const uint16_t ud_itab__181[] = {
+ /* 0 */ 1138, INVALID, INVALID, 1137,
+};
+
+static const uint16_t ud_itab__182[] = {
+ /* 0 */ INVALID, INVALID, GROUP(183), INVALID,
+ /* 4 */ GROUP(184), INVALID, GROUP(185), INVALID,
+};
+
+static const uint16_t ud_itab__183[] = {
+ /* 0 */ 1165, INVALID, INVALID, 1169,
+};
+
+static const uint16_t ud_itab__184[] = {
+ /* 0 */ 1153, INVALID, INVALID, 1157,
+};
+
+static const uint16_t ud_itab__185[] = {
+ /* 0 */ 1142, INVALID, INVALID, 1141,
+};
+
+static const uint16_t ud_itab__186[] = {
+ /* 0 */ INVALID, INVALID, GROUP(187), GROUP(188),
+ /* 4 */ INVALID, INVALID, GROUP(189), GROUP(190),
+};
+
+static const uint16_t ud_itab__187[] = {
+ /* 0 */ 1171, INVALID, INVALID, 1175,
+};
+
+static const uint16_t ud_itab__188[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1543,
+};
+
+static const uint16_t ud_itab__189[] = {
+ /* 0 */ 1146, INVALID, INVALID, 1145,
+};
+
+static const uint16_t ud_itab__190[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1541,
+};
+
+static const uint16_t ud_itab__191[] = {
+ /* 0 */ 1027, INVALID, INVALID, 1028,
+};
+
+static const uint16_t ud_itab__192[] = {
+ /* 0 */ 1030, INVALID, INVALID, 1031,
+};
+
+static const uint16_t ud_itab__193[] = {
+ /* 0 */ 1033, INVALID, INVALID, 1034,
+};
+
+static const uint16_t ud_itab__194[] = {
+ /* 0 */ INVALID, 1464, INVALID,
+};
+
+static const uint16_t ud_itab__195[] = {
+ /* 0 */ INVALID, 1465, INVALID,
+};
+
+static const uint16_t ud_itab__196[] = {
+ /* 0 */ INVALID, 1551, INVALID, 1549,
+};
+
+static const uint16_t ud_itab__197[] = {
+ /* 0 */ INVALID, 1555, INVALID, 1553,
+};
+
+static const uint16_t ud_itab__198[] = {
+ /* 0 */ GROUP(199), INVALID, 916, GROUP(200),
+};
+
+static const uint16_t ud_itab__199[] = {
+ /* 0 */ 872, 873, 913,
+};
+
+static const uint16_t ud_itab__200[] = {
+ /* 0 */ 874, 876, 914,
+};
+
+static const uint16_t ud_itab__201[] = {
+ /* 0 */ 921, INVALID, 1524, 1515,
+};
+
+static const uint16_t ud_itab__202[] = {
+ /* 0 */ INVALID, GROUP(203),
+};
+
+static const uint16_t ud_itab__203[] = {
+ /* 0 */ GROUP(204), GROUP(205), GROUP(206), INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__204[] = {
+ /* 0 */ 825, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__205[] = {
+ /* 0 */ 1509, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__206[] = {
+ /* 0 */ 1510, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__207[] = {
+ /* 0 */ INVALID, GROUP(208),
+};
+
+static const uint16_t ud_itab__208[] = {
+ /* 0 */ GROUP(209), GROUP(210), GROUP(211), GROUP(212),
+ /* 4 */ GROUP(213), GROUP(214), INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__209[] = {
+ /* 0 */ 1511, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__210[] = {
+ /* 0 */ 1501, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__211[] = {
+ /* 0 */ 1502, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__212[] = {
+ /* 0 */ 1503, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__213[] = {
+ /* 0 */ 1504, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__214[] = {
+ /* 0 */ 1505, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__215[] = {
+ /* 0 */ GROUP(216), GROUP(217),
+};
+
+static const uint16_t ud_itab__216[] = {
+ /* 0 */ 683, 682, 768, 1400,
+ /* 4 */ 1507, 1506, INVALID, 79,
+};
+
+static const uint16_t ud_itab__217[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, GROUP(218), GROUP(219), GROUP(220),
+};
+
+static const uint16_t ud_itab__218[] = {
+ /* 0 */ 777, 778, 779, 780,
+ /* 4 */ 781, 782, 783, 784,
+};
+
+static const uint16_t ud_itab__219[] = {
+ /* 0 */ 808, 809, 810, 811,
+ /* 4 */ 812, 813, 814, 815,
+};
+
+static const uint16_t ud_itab__220[] = {
+ /* 0 */ 1366, 1367, 1368, 1369,
+ /* 4 */ 1370, 1371, 1372, 1373,
+};
+
+static const uint16_t ud_itab__221[] = {
+ /* 0 */ INVALID, INVALID, 1710, INVALID,
+};
+
+static const uint16_t ud_itab__222[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ 1669, 1676, 1674, 1672,
+};
+
+static const uint16_t ud_itab__223[] = {
+ /* 0 */ 112, 117, 120, 110,
+};
+
+static const uint16_t ud_itab__224[] = {
+ /* 0 */ 1059, INVALID, INVALID, 1060,
+};
+
+static const uint16_t ud_itab__225[] = {
+ /* 0 */ 1055, INVALID, INVALID, 1053,
+};
+
+static const uint16_t ud_itab__226[] = {
+ /* 0 */ 1381, INVALID, INVALID, 1379,
+};
+
+static const uint16_t ud_itab__227[] = {
+ /* 0 */ GROUP(228), GROUP(235),
+};
+
+static const uint16_t ud_itab__228[] = {
+ /* 0 */ INVALID, GROUP(229), INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, GROUP(230), GROUP(234),
+};
+
+static const uint16_t ud_itab__229[] = {
+ /* 0 */ 124, 125, 126,
+};
+
+static const uint16_t ud_itab__230[] = {
+ /* 0 */ GROUP(231), INVALID, GROUP(232), GROUP(233),
+};
+
+static const uint16_t ud_itab__231[] = {
+ /* 0 */ INVALID, 1459, INVALID,
+};
+
+static const uint16_t ud_itab__232[] = {
+ /* 0 */ INVALID, 1458, INVALID,
+};
+
+static const uint16_t ud_itab__233[] = {
+ /* 0 */ INVALID, 1457, INVALID,
+};
+
+static const uint16_t ud_itab__234[] = {
+ /* 0 */ INVALID, 1460, INVALID,
+};
+
+static const uint16_t ud_itab__235[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, 1456, INVALID,
+};
+
+static const uint16_t ud_itab__236[] = {
+ /* 0 */ INVALID, 35, INVALID, 33,
+};
+
+static const uint16_t ud_itab__237[] = {
+ /* 0 */ 1160, INVALID, INVALID, 1161,
+};
+
+static const uint16_t ud_itab__238[] = {
+ /* 0 */ 1166, INVALID, INVALID, 1167,
+};
+
+static const uint16_t ud_itab__239[] = {
+ /* 0 */ 1172, INVALID, INVALID, 1173,
+};
+
+static const uint16_t ud_itab__240[] = {
+ /* 0 */ 1527, INVALID, INVALID, 1528,
+};
+
+static const uint16_t ud_itab__241[] = {
+ /* 0 */ 1093, INVALID, INVALID, 1094,
+};
+
+static const uint16_t ud_itab__242[] = {
+ /* 0 */ INVALID, 1521, 1526, 918,
+};
+
+static const uint16_t ud_itab__243[] = {
+ /* 0 */ 1086, INVALID, INVALID, 1084,
+};
+
+static const uint16_t ud_itab__244[] = {
+ /* 0 */ 1192, INVALID, INVALID, 1193,
+};
+
+static const uint16_t ud_itab__245[] = {
+ /* 0 */ 1195, INVALID, INVALID, 1196,
+};
+
+static const uint16_t ud_itab__246[] = {
+ /* 0 */ 1083, INVALID, INVALID, 1081,
+};
+
+static const uint16_t ud_itab__247[] = {
+ /* 0 */ 1017, INVALID, INVALID, 1015,
+};
+
+static const uint16_t ud_itab__248[] = {
+ /* 0 */ 1009, INVALID, INVALID, 1010,
+};
+
+static const uint16_t ud_itab__249[] = {
+ /* 0 */ 1012, INVALID, INVALID, 1013,
+};
+
+static const uint16_t ud_itab__250[] = {
+ /* 0 */ 1075, INVALID, INVALID, 1076,
+};
+
+static const uint16_t ud_itab__251[] = {
+ /* 0 */ 1020, INVALID, INVALID, 1018,
+};
+
+static const uint16_t ud_itab__252[] = {
+ /* 0 */ 1023, INVALID, INVALID, 1021,
+};
+
+static const uint16_t ud_itab__253[] = {
+ /* 0 */ 1147, INVALID, INVALID, 1148,
+};
+
+static const uint16_t ud_itab__254[] = {
+ /* 0 */ 1156, INVALID, INVALID, 1154,
+};
+
+static const uint16_t ud_itab__255[] = {
+ /* 0 */ 1026, INVALID, INVALID, 1024,
+};
+
+static const uint16_t ud_itab__256[] = {
+ /* 0 */ 1087, INVALID, INVALID, 1088,
+};
+
+static const uint16_t ud_itab__257[] = {
+ /* 0 */ 1092, INVALID, INVALID, 1090,
+};
+
+static const uint16_t ud_itab__258[] = {
+ /* 0 */ INVALID, 136, 132, 160,
+};
+
+static const uint16_t ud_itab__259[] = {
+ /* 0 */ 909, INVALID, INVALID, 902,
+};
+
+static const uint16_t ud_itab__260[] = {
+ /* 0 */ 1186, INVALID, INVALID, 1187,
+};
+
+static const uint16_t ud_itab__261[] = {
+ /* 0 */ 1189, INVALID, INVALID, 1190,
+};
+
+static const uint16_t ud_itab__262[] = {
+ /* 0 */ 1080, INVALID, INVALID, 1078,
+};
+
+static const uint16_t ud_itab__263[] = {
+ /* 0 */ 1118, INVALID, INVALID, 1116,
+};
+
+static const uint16_t ud_itab__264[] = {
+ /* 0 */ 1003, INVALID, INVALID, 1004,
+};
+
+static const uint16_t ud_itab__265[] = {
+ /* 0 */ 1006, INVALID, INVALID, 1007,
+};
+
+static const uint16_t ud_itab__266[] = {
+ /* 0 */ 1074, INVALID, INVALID, 1072,
+};
+
+static const uint16_t ud_itab__267[] = {
+ /* 0 */ 1266, INVALID, INVALID, 1264,
+};
+
+static const uint16_t ud_itab__268[] = {
+ /* 0 */ INVALID, 1559, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__269[] = {
+ /* 0 */ 1136, INVALID, INVALID, 1135,
+};
+
+static const uint16_t ud_itab__270[] = {
+ /* 0 */ 1140, INVALID, INVALID, 1139,
+};
+
+static const uint16_t ud_itab__271[] = {
+ /* 0 */ 1144, INVALID, INVALID, 1143,
+};
+
+static const uint16_t ud_itab__272[] = {
+ /* 0 */ 1533, INVALID, INVALID, 1534,
+};
+
+static const uint16_t ud_itab__273[] = {
+ /* 0 */ 1069, INVALID, INVALID, 1070,
+};
+
+static const uint16_t ud_itab__274[] = {
+ /* 0 */ 1133, INVALID, INVALID, 1131,
+};
+
+static const uint16_t ud_itab__275[] = {
+ /* 0 */ INVALID, GROUP(276),
+};
+
+static const uint16_t ud_itab__276[] = {
+ /* 0 */ 799, INVALID, INVALID, 1519,
+};
+
+static const uint16_t ud_itab__277[] = {
+ /* 0 */ 1179, INVALID, INVALID, 1177,
+};
+
+static const uint16_t ud_itab__278[] = {
+ /* 0 */ 1182, INVALID, INVALID, 1180,
+};
+
+static const uint16_t ud_itab__279[] = {
+ /* 0 */ 1183, INVALID, INVALID, 1184,
+};
+
+static const uint16_t ud_itab__280[] = {
+ /* 0 */ 1532, INVALID, INVALID, 1530,
+};
+
+static const uint16_t ud_itab__281[] = {
+ /* 0 */ 996, INVALID, INVALID, 994,
+};
+
+static const uint16_t ud_itab__282[] = {
+ /* 0 */ 997, INVALID, INVALID, 998,
+};
+
+static const uint16_t ud_itab__283[] = {
+ /* 0 */ 1000, INVALID, INVALID, 1001,
+};
+
+static const uint16_t ud_itab__284[] = {
+ /* 0 */ 1242, INVALID,
+};
+
+static const uint16_t ud_itab__285[] = {
+ /* 0 */ 1097, INVALID,
+};
+
+static const uint16_t ud_itab__286[] = {
+ /* 0 */ 1243, INVALID,
+};
+
+static const uint16_t ud_itab__287[] = {
+ /* 0 */ 1098, INVALID,
+};
+
+static const uint16_t ud_itab__288[] = {
+ /* 0 */ 173, INVALID,
+};
+
+static const uint16_t ud_itab__289[] = {
+ /* 0 */ 174, INVALID,
+};
+
+static const uint16_t ud_itab__290[] = {
+ /* 0 */ 1, INVALID,
+};
+
+static const uint16_t ud_itab__291[] = {
+ /* 0 */ 4, INVALID,
+};
+
+static const uint16_t ud_itab__292[] = {
+ /* 0 */ GROUP(293), GROUP(294), INVALID,
+};
+
+static const uint16_t ud_itab__293[] = {
+ /* 0 */ 1257, INVALID,
+};
+
+static const uint16_t ud_itab__294[] = {
+ /* 0 */ 1258, INVALID,
+};
+
+static const uint16_t ud_itab__295[] = {
+ /* 0 */ GROUP(296), GROUP(297), INVALID,
+};
+
+static const uint16_t ud_itab__296[] = {
+ /* 0 */ 1110, INVALID,
+};
+
+static const uint16_t ud_itab__297[] = {
+ /* 0 */ 1111, INVALID,
+};
+
+static const uint16_t ud_itab__298[] = {
+ /* 0 */ 1658, INVALID,
+};
+
+static const uint16_t ud_itab__299[] = {
+ /* 0 */ 67, 68,
+};
+
+static const uint16_t ud_itab__300[] = {
+ /* 0 */ 710, 711, INVALID,
+};
+
+static const uint16_t ud_itab__301[] = {
+ /* 0 */ 983, 984, INVALID,
+};
+
+static const uint16_t ud_itab__302[] = {
+ /* 0 */ 21, 970, 11, 1342,
+ /* 4 */ 55, 1413, 1493, 106,
+};
+
+static const uint16_t ud_itab__303[] = {
+ /* 0 */ 23, 971, 13, 1343,
+ /* 4 */ 57, 1414, 1494, 108,
+};
+
+static const uint16_t ud_itab__304[] = {
+ /* 0 */ GROUP(305), GROUP(306), GROUP(307), GROUP(308),
+ /* 4 */ GROUP(309), GROUP(310), GROUP(311), GROUP(312),
+};
+
+static const uint16_t ud_itab__305[] = {
+ /* 0 */ 22, INVALID,
+};
+
+static const uint16_t ud_itab__306[] = {
+ /* 0 */ 972, INVALID,
+};
+
+static const uint16_t ud_itab__307[] = {
+ /* 0 */ 12, INVALID,
+};
+
+static const uint16_t ud_itab__308[] = {
+ /* 0 */ 1344, INVALID,
+};
+
+static const uint16_t ud_itab__309[] = {
+ /* 0 */ 56, INVALID,
+};
+
+static const uint16_t ud_itab__310[] = {
+ /* 0 */ 1415, INVALID,
+};
+
+static const uint16_t ud_itab__311[] = {
+ /* 0 */ 1495, INVALID,
+};
+
+static const uint16_t ud_itab__312[] = {
+ /* 0 */ 107, INVALID,
+};
+
+static const uint16_t ud_itab__313[] = {
+ /* 0 */ 24, 973, 14, 1345,
+ /* 4 */ 58, 1416, 1496, 109,
+};
+
+static const uint16_t ud_itab__314[] = {
+ /* 0 */ 1109, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__315[] = {
+ /* 0 */ 74, 75, 76,
+};
+
+static const uint16_t ud_itab__316[] = {
+ /* 0 */ 170, 171, 172,
+};
+
+static const uint16_t ud_itab__317[] = {
+ /* 0 */ 73, INVALID,
+};
+
+static const uint16_t ud_itab__318[] = {
+ /* 0 */ GROUP(319), GROUP(320), GROUP(321),
+};
+
+static const uint16_t ud_itab__319[] = {
+ /* 0 */ 1259, 1260,
+};
+
+static const uint16_t ud_itab__320[] = {
+ /* 0 */ 1261, 1262,
+};
+
+static const uint16_t ud_itab__321[] = {
+ /* 0 */ INVALID, 1263,
+};
+
+static const uint16_t ud_itab__322[] = {
+ /* 0 */ GROUP(323), GROUP(324), GROUP(325),
+};
+
+static const uint16_t ud_itab__323[] = {
+ /* 0 */ 1112, INVALID,
+};
+
+static const uint16_t ud_itab__324[] = {
+ /* 0 */ 1113, 1114,
+};
+
+static const uint16_t ud_itab__325[] = {
+ /* 0 */ INVALID, 1115,
+};
+
+static const uint16_t ud_itab__326[] = {
+ /* 0 */ 923, 924, 927,
+};
+
+static const uint16_t ud_itab__327[] = {
+ /* 0 */ 115, 116, 119,
+};
+
+static const uint16_t ud_itab__328[] = {
+ /* 0 */ 1403, 1404, 1405,
+};
+
+static const uint16_t ud_itab__329[] = {
+ /* 0 */ 791, 792, 793,
+};
+
+static const uint16_t ud_itab__330[] = {
+ /* 0 */ 1347, 1348, 1349,
+};
+
+static const uint16_t ud_itab__331[] = {
+ /* 0 */ 1279, 1286, 1267, 1275,
+ /* 4 */ 1327, 1334, 1318, 1313,
+};
+
+static const uint16_t ud_itab__332[] = {
+ /* 0 */ 1284, 1287, 1268, 1274,
+ /* 4 */ 1323, 1330, 1319, 1315,
+};
+
+static const uint16_t ud_itab__333[] = {
+ /* 0 */ GROUP(334), GROUP(335), INVALID, INVALID,
+ /* 4 */ INVALID, GROUP(341), GROUP(357), GROUP(369),
+ /* 8 */ INVALID, GROUP(394), INVALID, INVALID,
+ /* c */ INVALID, GROUP(399), INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__334[] = {
+ /* 0 */ 771, INVALID,
+};
+
+static const uint16_t ud_itab__335[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ 937, 939, GROUP(336), 895,
+ /* 14 */ 1450, 1448, GROUP(337), 885,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ 863, 865, INVALID, 908,
+ /* 2c */ INVALID, INVALID, 1443, 130,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ 901, 1388, 1307, 1292,
+ /* 54 */ 62, 66, 977, 1500,
+ /* 58 */ 28, 947, 146, 135,
+ /* 5c */ 1420, 819, 190, 803,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, GROUP(340),
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, GROUP(338), INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 113, INVALID,
+ /* c4 */ INVALID, INVALID, 1382, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__336[] = {
+ /* 0 */ 893, 897,
+};
+
+static const uint16_t ud_itab__337[] = {
+ /* 0 */ 883, 887,
+};
+
+static const uint16_t ud_itab__338[] = {
+ /* 0 */ GROUP(339), INVALID,
+};
+
+static const uint16_t ud_itab__339[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1401,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__340[] = {
+ /* 0 */ 1742, 1743,
+};
+
+static const uint16_t ud_itab__341[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ 933, 935, GROUP(342), 891,
+ /* 14 */ 1452, 1446, GROUP(343), 881,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ 859, 861, INVALID, 906,
+ /* 2c */ INVALID, INVALID, 1441, 128,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ 899, 1390, INVALID, INVALID,
+ /* 54 */ 60, 64, 975, 1498,
+ /* 58 */ 26, 945, 140, 144,
+ /* 5c */ 1418, 817, 188, 801,
+ /* 60 */ 1208, 1211, 1214, 986,
+ /* 64 */ 1037, 1040, 1043, 992,
+ /* 68 */ 1199, 1202, 1205, 989,
+ /* 6c */ 1548, 1546, GROUP(344), 1518,
+ /* 70 */ 1540, GROUP(345), GROUP(347), GROUP(349),
+ /* 74 */ 1029, 1032, 1035, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ 1550, 1554, GROUP(351), 1516,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 111, INVALID,
+ /* c4 */ 1061, 1054, 1380, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ 34, 1162, 1168, 1174,
+ /* d4 */ 1529, 1095, 919, GROUP(352),
+ /* d8 */ 1194, 1197, 1082, 1016,
+ /* dc */ 1011, 1014, 1077, 1019,
+ /* e0 */ 1022, 1149, 1155, 1025,
+ /* e4 */ 1089, 1091, 161, 903,
+ /* e8 */ 1188, 1191, 1079, 1117,
+ /* ec */ 1005, 1008, 1073, 1265,
+ /* f0 */ INVALID, GROUP(353), GROUP(354), GROUP(355),
+ /* f4 */ INVALID, 1071, 1132, GROUP(356),
+ /* f8 */ 1178, 1181, 1185, 1531,
+ /* fc */ 995, 999, 1002, INVALID,
+};
+
+static const uint16_t ud_itab__342[] = {
+ /* 0 */ 889, INVALID,
+};
+
+static const uint16_t ud_itab__343[] = {
+ /* 0 */ 879, INVALID,
+};
+
+static const uint16_t ud_itab__344[] = {
+ /* 0 */ 869, 871, 912,
+};
+
+static const uint16_t ud_itab__345[] = {
+ /* 0 */ INVALID, INVALID, 1164, INVALID,
+ /* 4 */ 1151, INVALID, GROUP(346), INVALID,
+};
+
+static const uint16_t ud_itab__346[] = {
+ /* 0 */ 1756, INVALID,
+};
+
+static const uint16_t ud_itab__347[] = {
+ /* 0 */ INVALID, INVALID, 1170, INVALID,
+ /* 4 */ 1158, INVALID, GROUP(348), INVALID,
+};
+
+static const uint16_t ud_itab__348[] = {
+ /* 0 */ 1758, INVALID,
+};
+
+static const uint16_t ud_itab__349[] = {
+ /* 0 */ INVALID, INVALID, 1176, 1544,
+ /* 4 */ INVALID, INVALID, GROUP(350), 1542,
+};
+
+static const uint16_t ud_itab__350[] = {
+ /* 0 */ 1760, INVALID,
+};
+
+static const uint16_t ud_itab__351[] = {
+ /* 0 */ 875, 877, 915,
+};
+
+static const uint16_t ud_itab__352[] = {
+ /* 0 */ 1085, INVALID,
+};
+
+static const uint16_t ud_itab__353[] = {
+ /* 0 */ 1755, INVALID,
+};
+
+static const uint16_t ud_itab__354[] = {
+ /* 0 */ 1757, INVALID,
+};
+
+static const uint16_t ud_itab__355[] = {
+ /* 0 */ 1759, INVALID,
+};
+
+static const uint16_t ud_itab__356[] = {
+ /* 0 */ INVALID, 1520,
+};
+
+static const uint16_t ud_itab__357[] = {
+ /* 0 */ 1584, 1587, 1590, 1593,
+ /* 4 */ 1596, 1599, 1602, 1605,
+ /* 8 */ 1608, 1614, 1611, 1617,
+ /* c */ GROUP(358), GROUP(359), GROUP(360), GROUP(361),
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, 1712,
+ /* 18 */ GROUP(362), GROUP(363), INVALID, INVALID,
+ /* 1c */ 1575, 1578, 1581, INVALID,
+ /* 20 */ 1686, 1688, 1690, 1692,
+ /* 24 */ 1694, INVALID, INVALID, INVALID,
+ /* 28 */ 1623, 1709, 1682, 1684,
+ /* 2c */ GROUP(365), GROUP(366), GROUP(367), GROUP(368),
+ /* 30 */ 1697, 1699, 1701, 1703,
+ /* 34 */ 1705, 1707, INVALID, 1718,
+ /* 38 */ 1625, 1627, 1629, 1631,
+ /* 3c */ 1633, 1635, 1639, 1637,
+ /* 40 */ 1641, 1643, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, 46,
+ /* dc */ 42, 44, 38, 40,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__358[] = {
+ /* 0 */ 1737, INVALID,
+};
+
+static const uint16_t ud_itab__359[] = {
+ /* 0 */ 1735, INVALID,
+};
+
+static const uint16_t ud_itab__360[] = {
+ /* 0 */ 1740, INVALID,
+};
+
+static const uint16_t ud_itab__361[] = {
+ /* 0 */ 1741, INVALID,
+};
+
+static const uint16_t ud_itab__362[] = {
+ /* 0 */ 1727, INVALID,
+};
+
+static const uint16_t ud_itab__363[] = {
+ /* 0 */ GROUP(364), INVALID,
+};
+
+static const uint16_t ud_itab__364[] = {
+ /* 0 */ INVALID, 1728,
+};
+
+static const uint16_t ud_itab__365[] = {
+ /* 0 */ 1731, INVALID,
+};
+
+static const uint16_t ud_itab__366[] = {
+ /* 0 */ 1733, INVALID,
+};
+
+static const uint16_t ud_itab__367[] = {
+ /* 0 */ 1732, INVALID,
+};
+
+static const uint16_t ud_itab__368[] = {
+ /* 0 */ 1734, INVALID,
+};
+
+static const uint16_t ud_itab__369[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ GROUP(370), GROUP(371), GROUP(372), INVALID,
+ /* 8 */ 1645, 1647, 1649, 1651,
+ /* c */ 1655, 1653, 1678, 1620,
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ GROUP(374), 1057, GROUP(375), 202,
+ /* 18 */ GROUP(379), GROUP(381), INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ GROUP(383), 1558, GROUP(385), INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ 198, 196, 1680, INVALID,
+ /* 44 */ 1513, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, GROUP(391), GROUP(392),
+ /* 4c */ GROUP(393), INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ 1716, 1714, 1722, 1720,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, 48,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__370[] = {
+ /* 0 */ 1738, INVALID,
+};
+
+static const uint16_t ud_itab__371[] = {
+ /* 0 */ 1736, INVALID,
+};
+
+static const uint16_t ud_itab__372[] = {
+ /* 0 */ GROUP(373), INVALID,
+};
+
+static const uint16_t ud_itab__373[] = {
+ /* 0 */ INVALID, 1739,
+};
+
+static const uint16_t ud_itab__374[] = {
+ /* 0 */ 1046, INVALID,
+};
+
+static const uint16_t ud_itab__375[] = {
+ /* 0 */ GROUP(376), GROUP(377), GROUP(378),
+};
+
+static const uint16_t ud_itab__376[] = {
+ /* 0 */ 1048, INVALID,
+};
+
+static const uint16_t ud_itab__377[] = {
+ /* 0 */ 1050, INVALID,
+};
+
+static const uint16_t ud_itab__378[] = {
+ /* 0 */ INVALID, 1052,
+};
+
+static const uint16_t ud_itab__379[] = {
+ /* 0 */ GROUP(380), INVALID,
+};
+
+static const uint16_t ud_itab__380[] = {
+ /* 0 */ INVALID, 1730,
+};
+
+static const uint16_t ud_itab__381[] = {
+ /* 0 */ GROUP(382), INVALID,
+};
+
+static const uint16_t ud_itab__382[] = {
+ /* 0 */ INVALID, 1729,
+};
+
+static const uint16_t ud_itab__383[] = {
+ /* 0 */ GROUP(384), INVALID,
+};
+
+static const uint16_t ud_itab__384[] = {
+ /* 0 */ 1065, INVALID,
+};
+
+static const uint16_t ud_itab__385[] = {
+ /* 0 */ GROUP(386), GROUP(388),
+};
+
+static const uint16_t ud_itab__386[] = {
+ /* 0 */ GROUP(387), INVALID,
+};
+
+static const uint16_t ud_itab__387[] = {
+ /* 0 */ 1066, INVALID,
+};
+
+static const uint16_t ud_itab__388[] = {
+ /* 0 */ GROUP(389), GROUP(390),
+};
+
+static const uint16_t ud_itab__389[] = {
+ /* 0 */ 1067, INVALID,
+};
+
+static const uint16_t ud_itab__390[] = {
+ /* 0 */ 1068, INVALID,
+};
+
+static const uint16_t ud_itab__391[] = {
+ /* 0 */ 1745, INVALID,
+};
+
+static const uint16_t ud_itab__392[] = {
+ /* 0 */ 1744, INVALID,
+};
+
+static const uint16_t ud_itab__393[] = {
+ /* 0 */ 1754, INVALID,
+};
+
+static const uint16_t ud_itab__394[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ GROUP(395), GROUP(396), GROUP(397), INVALID,
+ /* 14 */ INVALID, INVALID, GROUP(398), INVALID,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, 155, INVALID,
+ /* 2c */ 169, 159, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, 1394, 1309, 1294,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ 32, 951, 157, 164,
+ /* 5c */ 1424, 823, 194, 807,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, 1523,
+ /* 70 */ 1536, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, 917, 1525,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 121, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, 133, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__395[] = {
+ /* 0 */ 1751, 1750,
+};
+
+static const uint16_t ud_itab__396[] = {
+ /* 0 */ 1753, 1752,
+};
+
+static const uint16_t ud_itab__397[] = {
+ /* 0 */ 1572, 1570,
+};
+
+static const uint16_t ud_itab__398[] = {
+ /* 0 */ 1568, 1566,
+};
+
+static const uint16_t ud_itab__399[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ GROUP(402), GROUP(400), GROUP(401), INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, INVALID,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, 153, INVALID,
+ /* 2c */ 167, 149, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, 1392, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ 30, 949, 151, INVALID,
+ /* 5c */ 1422, 821, 192, 805,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ 1538, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ 1552, 1556, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 118, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ 36, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, 137, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ 1560, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__400[] = {
+ /* 0 */ 1749, 1748,
+};
+
+static const uint16_t ud_itab__401[] = {
+ /* 0 */ 1564, 1562,
+};
+
+static const uint16_t ud_itab__402[] = {
+ /* 0 */ 1747, 1746,
+};
+
+static const uint16_t ud_itab__403[] = {
+ /* 0 */ GROUP(404), GROUP(335), INVALID, INVALID,
+ /* 4 */ INVALID, GROUP(341), GROUP(357), GROUP(369),
+ /* 8 */ INVALID, GROUP(394), INVALID, INVALID,
+ /* c */ INVALID, GROUP(399), INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__404[] = {
+ /* 0 */ 769, INVALID,
+};
+
+static const uint16_t ud_itab__405[] = {
+ /* 0 */ 826, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__406[] = {
+ /* 0 */ 827, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__407[] = {
+ /* 0 */ 715, INVALID,
+};
+
+static const uint16_t ud_itab__408[] = {
+ /* 0 */ 723, 724, 725,
+};
+
+static const uint16_t ud_itab__409[] = {
+ /* 0 */ 1280, 1285, 1269, 1273,
+ /* 4 */ 1326, 1333, 1320, 1314,
+};
+
+static const uint16_t ud_itab__410[] = {
+ /* 0 */ 1281, 1288, 1272, 1276,
+ /* 4 */ 1325, 1332, 1329, 1312,
+};
+
+static const uint16_t ud_itab__411[] = {
+ /* 0 */ 1282, 1289, 1270, 1277,
+ /* 4 */ 1324, 1331, 1321, 1316,
+};
+
+static const uint16_t ud_itab__412[] = {
+ /* 0 */ 1283, 1290, 1271, 1278,
+ /* 4 */ 1328, 1335, 1322, 1317,
+};
+
+static const uint16_t ud_itab__413[] = {
+ /* 0 */ 3, INVALID,
+};
+
+static const uint16_t ud_itab__414[] = {
+ /* 0 */ 2, INVALID,
+};
+
+static const uint16_t ud_itab__415[] = {
+ /* 0 */ 1311, INVALID,
+};
+
+static const uint16_t ud_itab__416[] = {
+ /* 0 */ GROUP(417), GROUP(418),
+};
+
+static const uint16_t ud_itab__417[] = {
+ /* 0 */ 206, 503, 307, 357,
+ /* 4 */ 587, 630, 387, 413,
+};
+
+static const uint16_t ud_itab__418[] = {
+ /* 0 */ 215, 216, 217, 218,
+ /* 4 */ 219, 220, 221, 222,
+ /* 8 */ 504, 505, 506, 507,
+ /* c */ 508, 509, 510, 511,
+ /* 10 */ 309, 310, 311, 312,
+ /* 14 */ 313, 314, 315, 316,
+ /* 18 */ 359, 360, 361, 362,
+ /* 1c */ 363, 364, 365, 366,
+ /* 20 */ 589, 590, 591, 592,
+ /* 24 */ 593, 594, 595, 596,
+ /* 28 */ 614, 615, 616, 617,
+ /* 2c */ 618, 619, 620, 621,
+ /* 30 */ 388, 389, 390, 391,
+ /* 34 */ 392, 393, 394, 395,
+ /* 38 */ 414, 415, 416, 417,
+ /* 3c */ 418, 419, 420, 421,
+};
+
+static const uint16_t ud_itab__419[] = {
+ /* 0 */ GROUP(420), GROUP(421),
+};
+
+static const uint16_t ud_itab__420[] = {
+ /* 0 */ 476, INVALID, 573, 540,
+ /* 4 */ 493, 492, 584, 583,
+};
+
+static const uint16_t ud_itab__421[] = {
+ /* 0 */ 477, 478, 479, 480,
+ /* 4 */ 481, 482, 483, 484,
+ /* 8 */ 658, 659, 660, 661,
+ /* c */ 662, 663, 664, 665,
+ /* 10 */ 522, INVALID, INVALID, INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, INVALID,
+ /* 18 */ 549, 550, 551, 552,
+ /* 1c */ 553, 554, 555, 556,
+ /* 20 */ 233, 204, INVALID, INVALID,
+ /* 24 */ 639, 657, INVALID, INVALID,
+ /* 28 */ 485, 486, 487, 488,
+ /* 2c */ 489, 490, 491, INVALID,
+ /* 30 */ 203, 685, 529, 526,
+ /* 34 */ 684, 528, 377, 454,
+ /* 38 */ 527, 686, 537, 536,
+ /* 3c */ 530, 534, 535, 376,
+};
+
+static const uint16_t ud_itab__422[] = {
+ /* 0 */ GROUP(423), GROUP(424),
+};
+
+static const uint16_t ud_itab__423[] = {
+ /* 0 */ 456, 520, 448, 450,
+ /* 4 */ 462, 464, 460, 458,
+};
+
+static const uint16_t ud_itab__424[] = {
+ /* 0 */ 235, 236, 237, 238,
+ /* 4 */ 239, 240, 241, 242,
+ /* 8 */ 243, 244, 245, 246,
+ /* c */ 247, 248, 249, 250,
+ /* 10 */ 251, 252, 253, 254,
+ /* 14 */ 255, 256, 257, 258,
+ /* 18 */ 259, 260, 261, 262,
+ /* 1c */ 263, 264, 265, 266,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, 656, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__425[] = {
+ /* 0 */ GROUP(426), GROUP(427),
+};
+
+static const uint16_t ud_itab__426[] = {
+ /* 0 */ 453, 471, 467, 470,
+ /* 4 */ INVALID, 474, INVALID, 538,
+};
+
+static const uint16_t ud_itab__427[] = {
+ /* 0 */ 267, 268, 269, 270,
+ /* 4 */ 271, 272, 273, 274,
+ /* 8 */ 275, 276, 277, 278,
+ /* c */ 279, 280, 281, 282,
+ /* 10 */ 283, 284, 285, 286,
+ /* 14 */ 287, 288, 289, 290,
+ /* 18 */ 291, 292, 293, 294,
+ /* 1c */ 295, 296, 297, 298,
+ /* 20 */ 524, 523, 234, 455,
+ /* 24 */ 525, 532, INVALID, INVALID,
+ /* 28 */ 299, 300, 301, 302,
+ /* 2c */ 303, 304, 305, 306,
+ /* 30 */ 333, 334, 335, 336,
+ /* 34 */ 337, 338, 339, 340,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__428[] = {
+ /* 0 */ GROUP(429), GROUP(430),
+};
+
+static const uint16_t ud_itab__429[] = {
+ /* 0 */ 205, 494, 308, 358,
+ /* 4 */ 588, 613, 378, 404,
+};
+
+static const uint16_t ud_itab__430[] = {
+ /* 0 */ 207, 208, 209, 210,
+ /* 4 */ 211, 212, 213, 214,
+ /* 8 */ 495, 496, 497, 498,
+ /* c */ 499, 500, 501, 502,
+ /* 10 */ 317, 318, 319, 320,
+ /* 14 */ 321, 322, 323, 324,
+ /* 18 */ 325, 326, 327, 328,
+ /* 1c */ 329, 330, 331, 332,
+ /* 20 */ 622, 623, 624, 625,
+ /* 24 */ 626, 627, 628, 629,
+ /* 28 */ 597, 598, 599, 600,
+ /* 2c */ 601, 602, 603, 604,
+ /* 30 */ 405, 406, 407, 408,
+ /* 34 */ 409, 410, 411, 412,
+ /* 38 */ 379, 380, 381, 382,
+ /* 3c */ 383, 384, 385, 386,
+};
+
+static const uint16_t ud_itab__431[] = {
+ /* 0 */ GROUP(432), GROUP(433),
+};
+
+static const uint16_t ud_itab__432[] = {
+ /* 0 */ 475, 472, 574, 539,
+ /* 4 */ 531, INVALID, 533, 585,
+};
+
+static const uint16_t ud_itab__433[] = {
+ /* 0 */ 431, 432, 433, 434,
+ /* 4 */ 435, 436, 437, 438,
+ /* 8 */ 666, 667, 668, 669,
+ /* c */ 670, 671, 672, 673,
+ /* 10 */ 575, 576, 577, 578,
+ /* 14 */ 579, 580, 581, 582,
+ /* 18 */ 541, 542, 543, 544,
+ /* 1c */ 545, 546, 547, 548,
+ /* 20 */ 640, 641, 642, 643,
+ /* 24 */ 644, 645, 646, 647,
+ /* 28 */ 648, 649, 650, 651,
+ /* 2c */ 652, 653, 654, 655,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__434[] = {
+ /* 0 */ GROUP(435), GROUP(436),
+};
+
+static const uint16_t ud_itab__435[] = {
+ /* 0 */ 457, 521, 447, 449,
+ /* 4 */ 463, 465, 461, 459,
+};
+
+static const uint16_t ud_itab__436[] = {
+ /* 0 */ 223, 224, 225, 226,
+ /* 4 */ 227, 228, 229, 230,
+ /* 8 */ 512, 513, 514, 515,
+ /* c */ 516, 517, 518, 519,
+ /* 10 */ 367, 368, 369, 370,
+ /* 14 */ 371, 372, 373, 374,
+ /* 18 */ INVALID, 375, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ 631, 632, 633, 634,
+ /* 24 */ 635, 636, 637, 638,
+ /* 28 */ 605, 606, 607, 608,
+ /* 2c */ 609, 610, 611, 612,
+ /* 30 */ 422, 423, 424, 425,
+ /* 34 */ 426, 427, 428, 429,
+ /* 38 */ 396, 397, 398, 399,
+ /* 3c */ 400, 401, 402, 403,
+};
+
+static const uint16_t ud_itab__437[] = {
+ /* 0 */ GROUP(438), GROUP(439),
+};
+
+static const uint16_t ud_itab__438[] = {
+ /* 0 */ 451, 473, 466, 468,
+ /* 4 */ 231, 452, 232, 469,
+};
+
+static const uint16_t ud_itab__439[] = {
+ /* 0 */ 439, 440, 441, 442,
+ /* 4 */ 443, 444, 445, 446,
+ /* 8 */ 674, 675, 676, 677,
+ /* c */ 678, 679, 680, 681,
+ /* 10 */ 557, 558, 559, 560,
+ /* 14 */ 561, 562, 563, 564,
+ /* 18 */ 565, 566, 567, 568,
+ /* 1c */ 569, 570, 571, 572,
+ /* 20 */ 586, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ 341, 342, 343, 344,
+ /* 2c */ 345, 346, 347, 348,
+ /* 30 */ 349, 350, 351, 352,
+ /* 34 */ 353, 354, 355, 356,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__440[] = {
+ /* 0 */ 758, 759, 760,
+};
+
+static const uint16_t ud_itab__441[] = {
+ /* 0 */ 764, INVALID,
+};
+
+static const uint16_t ud_itab__442[] = {
+ /* 0 */ 1432, 1437, 962, 953,
+ /* 4 */ 942, 695, 186, 689,
+};
+
+static const uint16_t ud_itab__443[] = {
+ /* 0 */ 1438, 1439, 963, 954,
+ /* 4 */ 943, 696, 185, 688,
+};
+
+static const uint16_t ud_itab__444[] = {
+ /* 0 */ 708, 183, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__445[] = {
+ /* 0 */ 707, 184, GROUP(446), 71,
+ /* 4 */ 761, 762, 1255, INVALID,
+};
+
+static const uint16_t ud_itab__446[] = {
+ /* 0 */ 69, 70,
+};
+
+
+struct ud_lookup_table_list_entry ud_lookup_table_list[] = {
+ /* 000 */ { ud_itab__0, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 001 */ { ud_itab__1, UD_TAB__OPC_MODE, "/m" },
+ /* 002 */ { ud_itab__2, UD_TAB__OPC_MODE, "/m" },
+ /* 003 */ { ud_itab__3, UD_TAB__OPC_MODE, "/m" },
+ /* 004 */ { ud_itab__4, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 005 */ { ud_itab__5, UD_TAB__OPC_REG, "/reg" },
+ /* 006 */ { ud_itab__6, UD_TAB__OPC_MOD, "/mod" },
+ /* 007 */ { ud_itab__7, UD_TAB__OPC_REG, "/reg" },
+ /* 008 */ { ud_itab__8, UD_TAB__OPC_REG, "/reg" },
+ /* 009 */ { ud_itab__9, UD_TAB__OPC_RM, "/rm" },
+ /* 010 */ { ud_itab__10, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 011 */ { ud_itab__11, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 012 */ { ud_itab__12, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 013 */ { ud_itab__13, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 014 */ { ud_itab__14, UD_TAB__OPC_RM, "/rm" },
+ /* 015 */ { ud_itab__15, UD_TAB__OPC_RM, "/rm" },
+ /* 016 */ { ud_itab__16, UD_TAB__OPC_RM, "/rm" },
+ /* 017 */ { ud_itab__17, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 018 */ { ud_itab__18, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 019 */ { ud_itab__19, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 020 */ { ud_itab__20, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 021 */ { ud_itab__21, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 022 */ { ud_itab__22, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 023 */ { ud_itab__23, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 024 */ { ud_itab__24, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 025 */ { ud_itab__25, UD_TAB__OPC_RM, "/rm" },
+ /* 026 */ { ud_itab__26, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 027 */ { ud_itab__27, UD_TAB__OPC_REG, "/reg" },
+ /* 028 */ { ud_itab__28, UD_TAB__OPC_3DNOW, "/3dnow" },
+ /* 029 */ { ud_itab__29, UD_TAB__OPC_SSE, "/sse" },
+ /* 030 */ { ud_itab__30, UD_TAB__OPC_SSE, "/sse" },
+ /* 031 */ { ud_itab__31, UD_TAB__OPC_MOD, "/mod" },
+ /* 032 */ { ud_itab__32, UD_TAB__OPC_SSE, "/sse" },
+ /* 033 */ { ud_itab__33, UD_TAB__OPC_SSE, "/sse" },
+ /* 034 */ { ud_itab__34, UD_TAB__OPC_SSE, "/sse" },
+ /* 035 */ { ud_itab__35, UD_TAB__OPC_SSE, "/sse" },
+ /* 036 */ { ud_itab__36, UD_TAB__OPC_SSE, "/sse" },
+ /* 037 */ { ud_itab__37, UD_TAB__OPC_MOD, "/mod" },
+ /* 038 */ { ud_itab__38, UD_TAB__OPC_SSE, "/sse" },
+ /* 039 */ { ud_itab__39, UD_TAB__OPC_SSE, "/sse" },
+ /* 040 */ { ud_itab__40, UD_TAB__OPC_SSE, "/sse" },
+ /* 041 */ { ud_itab__41, UD_TAB__OPC_REG, "/reg" },
+ /* 042 */ { ud_itab__42, UD_TAB__OPC_SSE, "/sse" },
+ /* 043 */ { ud_itab__43, UD_TAB__OPC_SSE, "/sse" },
+ /* 044 */ { ud_itab__44, UD_TAB__OPC_SSE, "/sse" },
+ /* 045 */ { ud_itab__45, UD_TAB__OPC_SSE, "/sse" },
+ /* 046 */ { ud_itab__46, UD_TAB__OPC_SSE, "/sse" },
+ /* 047 */ { ud_itab__47, UD_TAB__OPC_SSE, "/sse" },
+ /* 048 */ { ud_itab__48, UD_TAB__OPC_SSE, "/sse" },
+ /* 049 */ { ud_itab__49, UD_TAB__OPC_SSE, "/sse" },
+ /* 050 */ { ud_itab__50, UD_TAB__OPC_MODE, "/m" },
+ /* 051 */ { ud_itab__51, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 052 */ { ud_itab__52, UD_TAB__OPC_MODE, "/m" },
+ /* 053 */ { ud_itab__53, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 054 */ { ud_itab__54, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 055 */ { ud_itab__55, UD_TAB__OPC_SSE, "/sse" },
+ /* 056 */ { ud_itab__56, UD_TAB__OPC_MODE, "/m" },
+ /* 057 */ { ud_itab__57, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 058 */ { ud_itab__58, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 059 */ { ud_itab__59, UD_TAB__OPC_SSE, "/sse" },
+ /* 060 */ { ud_itab__60, UD_TAB__OPC_MODE, "/m" },
+ /* 061 */ { ud_itab__61, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 062 */ { ud_itab__62, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 063 */ { ud_itab__63, UD_TAB__OPC_SSE, "/sse" },
+ /* 064 */ { ud_itab__64, UD_TAB__OPC_SSE, "/sse" },
+ /* 065 */ { ud_itab__65, UD_TAB__OPC_SSE, "/sse" },
+ /* 066 */ { ud_itab__66, UD_TAB__OPC_SSE, "/sse" },
+ /* 067 */ { ud_itab__67, UD_TAB__OPC_SSE, "/sse" },
+ /* 068 */ { ud_itab__68, UD_TAB__OPC_SSE, "/sse" },
+ /* 069 */ { ud_itab__69, UD_TAB__OPC_SSE, "/sse" },
+ /* 070 */ { ud_itab__70, UD_TAB__OPC_SSE, "/sse" },
+ /* 071 */ { ud_itab__71, UD_TAB__OPC_SSE, "/sse" },
+ /* 072 */ { ud_itab__72, UD_TAB__OPC_SSE, "/sse" },
+ /* 073 */ { ud_itab__73, UD_TAB__OPC_SSE, "/sse" },
+ /* 074 */ { ud_itab__74, UD_TAB__OPC_SSE, "/sse" },
+ /* 075 */ { ud_itab__75, UD_TAB__OPC_SSE, "/sse" },
+ /* 076 */ { ud_itab__76, UD_TAB__OPC_SSE, "/sse" },
+ /* 077 */ { ud_itab__77, UD_TAB__OPC_SSE, "/sse" },
+ /* 078 */ { ud_itab__78, UD_TAB__OPC_SSE, "/sse" },
+ /* 079 */ { ud_itab__79, UD_TAB__OPC_SSE, "/sse" },
+ /* 080 */ { ud_itab__80, UD_TAB__OPC_SSE, "/sse" },
+ /* 081 */ { ud_itab__81, UD_TAB__OPC_SSE, "/sse" },
+ /* 082 */ { ud_itab__82, UD_TAB__OPC_SSE, "/sse" },
+ /* 083 */ { ud_itab__83, UD_TAB__OPC_SSE, "/sse" },
+ /* 084 */ { ud_itab__84, UD_TAB__OPC_SSE, "/sse" },
+ /* 085 */ { ud_itab__85, UD_TAB__OPC_SSE, "/sse" },
+ /* 086 */ { ud_itab__86, UD_TAB__OPC_SSE, "/sse" },
+ /* 087 */ { ud_itab__87, UD_TAB__OPC_SSE, "/sse" },
+ /* 088 */ { ud_itab__88, UD_TAB__OPC_SSE, "/sse" },
+ /* 089 */ { ud_itab__89, UD_TAB__OPC_SSE, "/sse" },
+ /* 090 */ { ud_itab__90, UD_TAB__OPC_SSE, "/sse" },
+ /* 091 */ { ud_itab__91, UD_TAB__OPC_SSE, "/sse" },
+ /* 092 */ { ud_itab__92, UD_TAB__OPC_SSE, "/sse" },
+ /* 093 */ { ud_itab__93, UD_TAB__OPC_SSE, "/sse" },
+ /* 094 */ { ud_itab__94, UD_TAB__OPC_SSE, "/sse" },
+ /* 095 */ { ud_itab__95, UD_TAB__OPC_SSE, "/sse" },
+ /* 096 */ { ud_itab__96, UD_TAB__OPC_SSE, "/sse" },
+ /* 097 */ { ud_itab__97, UD_TAB__OPC_SSE, "/sse" },
+ /* 098 */ { ud_itab__98, UD_TAB__OPC_SSE, "/sse" },
+ /* 099 */ { ud_itab__99, UD_TAB__OPC_SSE, "/sse" },
+ /* 100 */ { ud_itab__100, UD_TAB__OPC_SSE, "/sse" },
+ /* 101 */ { ud_itab__101, UD_TAB__OPC_SSE, "/sse" },
+ /* 102 */ { ud_itab__102, UD_TAB__OPC_SSE, "/sse" },
+ /* 103 */ { ud_itab__103, UD_TAB__OPC_SSE, "/sse" },
+ /* 104 */ { ud_itab__104, UD_TAB__OPC_SSE, "/sse" },
+ /* 105 */ { ud_itab__105, UD_TAB__OPC_SSE, "/sse" },
+ /* 106 */ { ud_itab__106, UD_TAB__OPC_SSE, "/sse" },
+ /* 107 */ { ud_itab__107, UD_TAB__OPC_SSE, "/sse" },
+ /* 108 */ { ud_itab__108, UD_TAB__OPC_SSE, "/sse" },
+ /* 109 */ { ud_itab__109, UD_TAB__OPC_SSE, "/sse" },
+ /* 110 */ { ud_itab__110, UD_TAB__OPC_SSE, "/sse" },
+ /* 111 */ { ud_itab__111, UD_TAB__OPC_SSE, "/sse" },
+ /* 112 */ { ud_itab__112, UD_TAB__OPC_SSE, "/sse" },
+ /* 113 */ { ud_itab__113, UD_TAB__OPC_SSE, "/sse" },
+ /* 114 */ { ud_itab__114, UD_TAB__OPC_SSE, "/sse" },
+ /* 115 */ { ud_itab__115, UD_TAB__OPC_SSE, "/sse" },
+ /* 116 */ { ud_itab__116, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 117 */ { ud_itab__117, UD_TAB__OPC_SSE, "/sse" },
+ /* 118 */ { ud_itab__118, UD_TAB__OPC_SSE, "/sse" },
+ /* 119 */ { ud_itab__119, UD_TAB__OPC_SSE, "/sse" },
+ /* 120 */ { ud_itab__120, UD_TAB__OPC_SSE, "/sse" },
+ /* 121 */ { ud_itab__121, UD_TAB__OPC_SSE, "/sse" },
+ /* 122 */ { ud_itab__122, UD_TAB__OPC_SSE, "/sse" },
+ /* 123 */ { ud_itab__123, UD_TAB__OPC_SSE, "/sse" },
+ /* 124 */ { ud_itab__124, UD_TAB__OPC_SSE, "/sse" },
+ /* 125 */ { ud_itab__125, UD_TAB__OPC_SSE, "/sse" },
+ /* 126 */ { ud_itab__126, UD_TAB__OPC_SSE, "/sse" },
+ /* 127 */ { ud_itab__127, UD_TAB__OPC_SSE, "/sse" },
+ /* 128 */ { ud_itab__128, UD_TAB__OPC_OSIZE, "/o" },
+ /* 129 */ { ud_itab__129, UD_TAB__OPC_SSE, "/sse" },
+ /* 130 */ { ud_itab__130, UD_TAB__OPC_SSE, "/sse" },
+ /* 131 */ { ud_itab__131, UD_TAB__OPC_SSE, "/sse" },
+ /* 132 */ { ud_itab__132, UD_TAB__OPC_SSE, "/sse" },
+ /* 133 */ { ud_itab__133, UD_TAB__OPC_OSIZE, "/o" },
+ /* 134 */ { ud_itab__134, UD_TAB__OPC_SSE, "/sse" },
+ /* 135 */ { ud_itab__135, UD_TAB__OPC_SSE, "/sse" },
+ /* 136 */ { ud_itab__136, UD_TAB__OPC_SSE, "/sse" },
+ /* 137 */ { ud_itab__137, UD_TAB__OPC_SSE, "/sse" },
+ /* 138 */ { ud_itab__138, UD_TAB__OPC_SSE, "/sse" },
+ /* 139 */ { ud_itab__139, UD_TAB__OPC_SSE, "/sse" },
+ /* 140 */ { ud_itab__140, UD_TAB__OPC_SSE, "/sse" },
+ /* 141 */ { ud_itab__141, UD_TAB__OPC_SSE, "/sse" },
+ /* 142 */ { ud_itab__142, UD_TAB__OPC_SSE, "/sse" },
+ /* 143 */ { ud_itab__143, UD_TAB__OPC_SSE, "/sse" },
+ /* 144 */ { ud_itab__144, UD_TAB__OPC_SSE, "/sse" },
+ /* 145 */ { ud_itab__145, UD_TAB__OPC_SSE, "/sse" },
+ /* 146 */ { ud_itab__146, UD_TAB__OPC_SSE, "/sse" },
+ /* 147 */ { ud_itab__147, UD_TAB__OPC_SSE, "/sse" },
+ /* 148 */ { ud_itab__148, UD_TAB__OPC_SSE, "/sse" },
+ /* 149 */ { ud_itab__149, UD_TAB__OPC_SSE, "/sse" },
+ /* 150 */ { ud_itab__150, UD_TAB__OPC_SSE, "/sse" },
+ /* 151 */ { ud_itab__151, UD_TAB__OPC_SSE, "/sse" },
+ /* 152 */ { ud_itab__152, UD_TAB__OPC_SSE, "/sse" },
+ /* 153 */ { ud_itab__153, UD_TAB__OPC_SSE, "/sse" },
+ /* 154 */ { ud_itab__154, UD_TAB__OPC_SSE, "/sse" },
+ /* 155 */ { ud_itab__155, UD_TAB__OPC_SSE, "/sse" },
+ /* 156 */ { ud_itab__156, UD_TAB__OPC_SSE, "/sse" },
+ /* 157 */ { ud_itab__157, UD_TAB__OPC_SSE, "/sse" },
+ /* 158 */ { ud_itab__158, UD_TAB__OPC_SSE, "/sse" },
+ /* 159 */ { ud_itab__159, UD_TAB__OPC_SSE, "/sse" },
+ /* 160 */ { ud_itab__160, UD_TAB__OPC_SSE, "/sse" },
+ /* 161 */ { ud_itab__161, UD_TAB__OPC_SSE, "/sse" },
+ /* 162 */ { ud_itab__162, UD_TAB__OPC_SSE, "/sse" },
+ /* 163 */ { ud_itab__163, UD_TAB__OPC_SSE, "/sse" },
+ /* 164 */ { ud_itab__164, UD_TAB__OPC_SSE, "/sse" },
+ /* 165 */ { ud_itab__165, UD_TAB__OPC_SSE, "/sse" },
+ /* 166 */ { ud_itab__166, UD_TAB__OPC_SSE, "/sse" },
+ /* 167 */ { ud_itab__167, UD_TAB__OPC_SSE, "/sse" },
+ /* 168 */ { ud_itab__168, UD_TAB__OPC_SSE, "/sse" },
+ /* 169 */ { ud_itab__169, UD_TAB__OPC_SSE, "/sse" },
+ /* 170 */ { ud_itab__170, UD_TAB__OPC_SSE, "/sse" },
+ /* 171 */ { ud_itab__171, UD_TAB__OPC_SSE, "/sse" },
+ /* 172 */ { ud_itab__172, UD_TAB__OPC_SSE, "/sse" },
+ /* 173 */ { ud_itab__173, UD_TAB__OPC_SSE, "/sse" },
+ /* 174 */ { ud_itab__174, UD_TAB__OPC_OSIZE, "/o" },
+ /* 175 */ { ud_itab__175, UD_TAB__OPC_OSIZE, "/o" },
+ /* 176 */ { ud_itab__176, UD_TAB__OPC_SSE, "/sse" },
+ /* 177 */ { ud_itab__177, UD_TAB__OPC_SSE, "/sse" },
+ /* 178 */ { ud_itab__178, UD_TAB__OPC_REG, "/reg" },
+ /* 179 */ { ud_itab__179, UD_TAB__OPC_SSE, "/sse" },
+ /* 180 */ { ud_itab__180, UD_TAB__OPC_SSE, "/sse" },
+ /* 181 */ { ud_itab__181, UD_TAB__OPC_SSE, "/sse" },
+ /* 182 */ { ud_itab__182, UD_TAB__OPC_REG, "/reg" },
+ /* 183 */ { ud_itab__183, UD_TAB__OPC_SSE, "/sse" },
+ /* 184 */ { ud_itab__184, UD_TAB__OPC_SSE, "/sse" },
+ /* 185 */ { ud_itab__185, UD_TAB__OPC_SSE, "/sse" },
+ /* 186 */ { ud_itab__186, UD_TAB__OPC_REG, "/reg" },
+ /* 187 */ { ud_itab__187, UD_TAB__OPC_SSE, "/sse" },
+ /* 188 */ { ud_itab__188, UD_TAB__OPC_SSE, "/sse" },
+ /* 189 */ { ud_itab__189, UD_TAB__OPC_SSE, "/sse" },
+ /* 190 */ { ud_itab__190, UD_TAB__OPC_SSE, "/sse" },
+ /* 191 */ { ud_itab__191, UD_TAB__OPC_SSE, "/sse" },
+ /* 192 */ { ud_itab__192, UD_TAB__OPC_SSE, "/sse" },
+ /* 193 */ { ud_itab__193, UD_TAB__OPC_SSE, "/sse" },
+ /* 194 */ { ud_itab__194, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 195 */ { ud_itab__195, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 196 */ { ud_itab__196, UD_TAB__OPC_SSE, "/sse" },
+ /* 197 */ { ud_itab__197, UD_TAB__OPC_SSE, "/sse" },
+ /* 198 */ { ud_itab__198, UD_TAB__OPC_SSE, "/sse" },
+ /* 199 */ { ud_itab__199, UD_TAB__OPC_OSIZE, "/o" },
+ /* 200 */ { ud_itab__200, UD_TAB__OPC_OSIZE, "/o" },
+ /* 201 */ { ud_itab__201, UD_TAB__OPC_SSE, "/sse" },
+ /* 202 */ { ud_itab__202, UD_TAB__OPC_MOD, "/mod" },
+ /* 203 */ { ud_itab__203, UD_TAB__OPC_REG, "/reg" },
+ /* 204 */ { ud_itab__204, UD_TAB__OPC_RM, "/rm" },
+ /* 205 */ { ud_itab__205, UD_TAB__OPC_RM, "/rm" },
+ /* 206 */ { ud_itab__206, UD_TAB__OPC_RM, "/rm" },
+ /* 207 */ { ud_itab__207, UD_TAB__OPC_MOD, "/mod" },
+ /* 208 */ { ud_itab__208, UD_TAB__OPC_REG, "/reg" },
+ /* 209 */ { ud_itab__209, UD_TAB__OPC_RM, "/rm" },
+ /* 210 */ { ud_itab__210, UD_TAB__OPC_RM, "/rm" },
+ /* 211 */ { ud_itab__211, UD_TAB__OPC_RM, "/rm" },
+ /* 212 */ { ud_itab__212, UD_TAB__OPC_RM, "/rm" },
+ /* 213 */ { ud_itab__213, UD_TAB__OPC_RM, "/rm" },
+ /* 214 */ { ud_itab__214, UD_TAB__OPC_RM, "/rm" },
+ /* 215 */ { ud_itab__215, UD_TAB__OPC_MOD, "/mod" },
+ /* 216 */ { ud_itab__216, UD_TAB__OPC_REG, "/reg" },
+ /* 217 */ { ud_itab__217, UD_TAB__OPC_REG, "/reg" },
+ /* 218 */ { ud_itab__218, UD_TAB__OPC_RM, "/rm" },
+ /* 219 */ { ud_itab__219, UD_TAB__OPC_RM, "/rm" },
+ /* 220 */ { ud_itab__220, UD_TAB__OPC_RM, "/rm" },
+ /* 221 */ { ud_itab__221, UD_TAB__OPC_SSE, "/sse" },
+ /* 222 */ { ud_itab__222, UD_TAB__OPC_REG, "/reg" },
+ /* 223 */ { ud_itab__223, UD_TAB__OPC_SSE, "/sse" },
+ /* 224 */ { ud_itab__224, UD_TAB__OPC_SSE, "/sse" },
+ /* 225 */ { ud_itab__225, UD_TAB__OPC_SSE, "/sse" },
+ /* 226 */ { ud_itab__226, UD_TAB__OPC_SSE, "/sse" },
+ /* 227 */ { ud_itab__227, UD_TAB__OPC_MOD, "/mod" },
+ /* 228 */ { ud_itab__228, UD_TAB__OPC_REG, "/reg" },
+ /* 229 */ { ud_itab__229, UD_TAB__OPC_OSIZE, "/o" },
+ /* 230 */ { ud_itab__230, UD_TAB__OPC_SSE, "/sse" },
+ /* 231 */ { ud_itab__231, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 232 */ { ud_itab__232, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 233 */ { ud_itab__233, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 234 */ { ud_itab__234, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 235 */ { ud_itab__235, UD_TAB__OPC_REG, "/reg" },
+ /* 236 */ { ud_itab__236, UD_TAB__OPC_SSE, "/sse" },
+ /* 237 */ { ud_itab__237, UD_TAB__OPC_SSE, "/sse" },
+ /* 238 */ { ud_itab__238, UD_TAB__OPC_SSE, "/sse" },
+ /* 239 */ { ud_itab__239, UD_TAB__OPC_SSE, "/sse" },
+ /* 240 */ { ud_itab__240, UD_TAB__OPC_SSE, "/sse" },
+ /* 241 */ { ud_itab__241, UD_TAB__OPC_SSE, "/sse" },
+ /* 242 */ { ud_itab__242, UD_TAB__OPC_SSE, "/sse" },
+ /* 243 */ { ud_itab__243, UD_TAB__OPC_SSE, "/sse" },
+ /* 244 */ { ud_itab__244, UD_TAB__OPC_SSE, "/sse" },
+ /* 245 */ { ud_itab__245, UD_TAB__OPC_SSE, "/sse" },
+ /* 246 */ { ud_itab__246, UD_TAB__OPC_SSE, "/sse" },
+ /* 247 */ { ud_itab__247, UD_TAB__OPC_SSE, "/sse" },
+ /* 248 */ { ud_itab__248, UD_TAB__OPC_SSE, "/sse" },
+ /* 249 */ { ud_itab__249, UD_TAB__OPC_SSE, "/sse" },
+ /* 250 */ { ud_itab__250, UD_TAB__OPC_SSE, "/sse" },
+ /* 251 */ { ud_itab__251, UD_TAB__OPC_SSE, "/sse" },
+ /* 252 */ { ud_itab__252, UD_TAB__OPC_SSE, "/sse" },
+ /* 253 */ { ud_itab__253, UD_TAB__OPC_SSE, "/sse" },
+ /* 254 */ { ud_itab__254, UD_TAB__OPC_SSE, "/sse" },
+ /* 255 */ { ud_itab__255, UD_TAB__OPC_SSE, "/sse" },
+ /* 256 */ { ud_itab__256, UD_TAB__OPC_SSE, "/sse" },
+ /* 257 */ { ud_itab__257, UD_TAB__OPC_SSE, "/sse" },
+ /* 258 */ { ud_itab__258, UD_TAB__OPC_SSE, "/sse" },
+ /* 259 */ { ud_itab__259, UD_TAB__OPC_SSE, "/sse" },
+ /* 260 */ { ud_itab__260, UD_TAB__OPC_SSE, "/sse" },
+ /* 261 */ { ud_itab__261, UD_TAB__OPC_SSE, "/sse" },
+ /* 262 */ { ud_itab__262, UD_TAB__OPC_SSE, "/sse" },
+ /* 263 */ { ud_itab__263, UD_TAB__OPC_SSE, "/sse" },
+ /* 264 */ { ud_itab__264, UD_TAB__OPC_SSE, "/sse" },
+ /* 265 */ { ud_itab__265, UD_TAB__OPC_SSE, "/sse" },
+ /* 266 */ { ud_itab__266, UD_TAB__OPC_SSE, "/sse" },
+ /* 267 */ { ud_itab__267, UD_TAB__OPC_SSE, "/sse" },
+ /* 268 */ { ud_itab__268, UD_TAB__OPC_SSE, "/sse" },
+ /* 269 */ { ud_itab__269, UD_TAB__OPC_SSE, "/sse" },
+ /* 270 */ { ud_itab__270, UD_TAB__OPC_SSE, "/sse" },
+ /* 271 */ { ud_itab__271, UD_TAB__OPC_SSE, "/sse" },
+ /* 272 */ { ud_itab__272, UD_TAB__OPC_SSE, "/sse" },
+ /* 273 */ { ud_itab__273, UD_TAB__OPC_SSE, "/sse" },
+ /* 274 */ { ud_itab__274, UD_TAB__OPC_SSE, "/sse" },
+ /* 275 */ { ud_itab__275, UD_TAB__OPC_MOD, "/mod" },
+ /* 276 */ { ud_itab__276, UD_TAB__OPC_SSE, "/sse" },
+ /* 277 */ { ud_itab__277, UD_TAB__OPC_SSE, "/sse" },
+ /* 278 */ { ud_itab__278, UD_TAB__OPC_SSE, "/sse" },
+ /* 279 */ { ud_itab__279, UD_TAB__OPC_SSE, "/sse" },
+ /* 280 */ { ud_itab__280, UD_TAB__OPC_SSE, "/sse" },
+ /* 281 */ { ud_itab__281, UD_TAB__OPC_SSE, "/sse" },
+ /* 282 */ { ud_itab__282, UD_TAB__OPC_SSE, "/sse" },
+ /* 283 */ { ud_itab__283, UD_TAB__OPC_SSE, "/sse" },
+ /* 284 */ { ud_itab__284, UD_TAB__OPC_MODE, "/m" },
+ /* 285 */ { ud_itab__285, UD_TAB__OPC_MODE, "/m" },
+ /* 286 */ { ud_itab__286, UD_TAB__OPC_MODE, "/m" },
+ /* 287 */ { ud_itab__287, UD_TAB__OPC_MODE, "/m" },
+ /* 288 */ { ud_itab__288, UD_TAB__OPC_MODE, "/m" },
+ /* 289 */ { ud_itab__289, UD_TAB__OPC_MODE, "/m" },
+ /* 290 */ { ud_itab__290, UD_TAB__OPC_MODE, "/m" },
+ /* 291 */ { ud_itab__291, UD_TAB__OPC_MODE, "/m" },
+ /* 292 */ { ud_itab__292, UD_TAB__OPC_OSIZE, "/o" },
+ /* 293 */ { ud_itab__293, UD_TAB__OPC_MODE, "/m" },
+ /* 294 */ { ud_itab__294, UD_TAB__OPC_MODE, "/m" },
+ /* 295 */ { ud_itab__295, UD_TAB__OPC_OSIZE, "/o" },
+ /* 296 */ { ud_itab__296, UD_TAB__OPC_MODE, "/m" },
+ /* 297 */ { ud_itab__297, UD_TAB__OPC_MODE, "/m" },
+ /* 298 */ { ud_itab__298, UD_TAB__OPC_MODE, "/m" },
+ /* 299 */ { ud_itab__299, UD_TAB__OPC_MODE, "/m" },
+ /* 300 */ { ud_itab__300, UD_TAB__OPC_OSIZE, "/o" },
+ /* 301 */ { ud_itab__301, UD_TAB__OPC_OSIZE, "/o" },
+ /* 302 */ { ud_itab__302, UD_TAB__OPC_REG, "/reg" },
+ /* 303 */ { ud_itab__303, UD_TAB__OPC_REG, "/reg" },
+ /* 304 */ { ud_itab__304, UD_TAB__OPC_REG, "/reg" },
+ /* 305 */ { ud_itab__305, UD_TAB__OPC_MODE, "/m" },
+ /* 306 */ { ud_itab__306, UD_TAB__OPC_MODE, "/m" },
+ /* 307 */ { ud_itab__307, UD_TAB__OPC_MODE, "/m" },
+ /* 308 */ { ud_itab__308, UD_TAB__OPC_MODE, "/m" },
+ /* 309 */ { ud_itab__309, UD_TAB__OPC_MODE, "/m" },
+ /* 310 */ { ud_itab__310, UD_TAB__OPC_MODE, "/m" },
+ /* 311 */ { ud_itab__311, UD_TAB__OPC_MODE, "/m" },
+ /* 312 */ { ud_itab__312, UD_TAB__OPC_MODE, "/m" },
+ /* 313 */ { ud_itab__313, UD_TAB__OPC_REG, "/reg" },
+ /* 314 */ { ud_itab__314, UD_TAB__OPC_REG, "/reg" },
+ /* 315 */ { ud_itab__315, UD_TAB__OPC_OSIZE, "/o" },
+ /* 316 */ { ud_itab__316, UD_TAB__OPC_OSIZE, "/o" },
+ /* 317 */ { ud_itab__317, UD_TAB__OPC_MODE, "/m" },
+ /* 318 */ { ud_itab__318, UD_TAB__OPC_OSIZE, "/o" },
+ /* 319 */ { ud_itab__319, UD_TAB__OPC_MODE, "/m" },
+ /* 320 */ { ud_itab__320, UD_TAB__OPC_MODE, "/m" },
+ /* 321 */ { ud_itab__321, UD_TAB__OPC_MODE, "/m" },
+ /* 322 */ { ud_itab__322, UD_TAB__OPC_OSIZE, "/o" },
+ /* 323 */ { ud_itab__323, UD_TAB__OPC_MODE, "/m" },
+ /* 324 */ { ud_itab__324, UD_TAB__OPC_MODE, "/m" },
+ /* 325 */ { ud_itab__325, UD_TAB__OPC_MODE, "/m" },
+ /* 326 */ { ud_itab__326, UD_TAB__OPC_OSIZE, "/o" },
+ /* 327 */ { ud_itab__327, UD_TAB__OPC_OSIZE, "/o" },
+ /* 328 */ { ud_itab__328, UD_TAB__OPC_OSIZE, "/o" },
+ /* 329 */ { ud_itab__329, UD_TAB__OPC_OSIZE, "/o" },
+ /* 330 */ { ud_itab__330, UD_TAB__OPC_OSIZE, "/o" },
+ /* 331 */ { ud_itab__331, UD_TAB__OPC_REG, "/reg" },
+ /* 332 */ { ud_itab__332, UD_TAB__OPC_REG, "/reg" },
+ /* 333 */ { ud_itab__333, UD_TAB__OPC_VEX, "/vex" },
+ /* 334 */ { ud_itab__334, UD_TAB__OPC_MODE, "/m" },
+ /* 335 */ { ud_itab__335, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 336 */ { ud_itab__336, UD_TAB__OPC_MOD, "/mod" },
+ /* 337 */ { ud_itab__337, UD_TAB__OPC_MOD, "/mod" },
+ /* 338 */ { ud_itab__338, UD_TAB__OPC_MOD, "/mod" },
+ /* 339 */ { ud_itab__339, UD_TAB__OPC_REG, "/reg" },
+ /* 340 */ { ud_itab__340, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 341 */ { ud_itab__341, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 342 */ { ud_itab__342, UD_TAB__OPC_MOD, "/mod" },
+ /* 343 */ { ud_itab__343, UD_TAB__OPC_MOD, "/mod" },
+ /* 344 */ { ud_itab__344, UD_TAB__OPC_OSIZE, "/o" },
+ /* 345 */ { ud_itab__345, UD_TAB__OPC_REG, "/reg" },
+ /* 346 */ { ud_itab__346, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 347 */ { ud_itab__347, UD_TAB__OPC_REG, "/reg" },
+ /* 348 */ { ud_itab__348, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 349 */ { ud_itab__349, UD_TAB__OPC_REG, "/reg" },
+ /* 350 */ { ud_itab__350, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 351 */ { ud_itab__351, UD_TAB__OPC_OSIZE, "/o" },
+ /* 352 */ { ud_itab__352, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 353 */ { ud_itab__353, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 354 */ { ud_itab__354, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 355 */ { ud_itab__355, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 356 */ { ud_itab__356, UD_TAB__OPC_MOD, "/mod" },
+ /* 357 */ { ud_itab__357, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 358 */ { ud_itab__358, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 359 */ { ud_itab__359, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 360 */ { ud_itab__360, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 361 */ { ud_itab__361, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 362 */ { ud_itab__362, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 363 */ { ud_itab__363, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 364 */ { ud_itab__364, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 365 */ { ud_itab__365, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 366 */ { ud_itab__366, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 367 */ { ud_itab__367, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 368 */ { ud_itab__368, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 369 */ { ud_itab__369, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 370 */ { ud_itab__370, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 371 */ { ud_itab__371, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 372 */ { ud_itab__372, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 373 */ { ud_itab__373, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 374 */ { ud_itab__374, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 375 */ { ud_itab__375, UD_TAB__OPC_OSIZE, "/o" },
+ /* 376 */ { ud_itab__376, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 377 */ { ud_itab__377, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 378 */ { ud_itab__378, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 379 */ { ud_itab__379, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 380 */ { ud_itab__380, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 381 */ { ud_itab__381, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 382 */ { ud_itab__382, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 383 */ { ud_itab__383, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 384 */ { ud_itab__384, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 385 */ { ud_itab__385, UD_TAB__OPC_MODE, "/m" },
+ /* 386 */ { ud_itab__386, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 387 */ { ud_itab__387, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 388 */ { ud_itab__388, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 389 */ { ud_itab__389, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 390 */ { ud_itab__390, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 391 */ { ud_itab__391, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 392 */ { ud_itab__392, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 393 */ { ud_itab__393, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 394 */ { ud_itab__394, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 395 */ { ud_itab__395, UD_TAB__OPC_MOD, "/mod" },
+ /* 396 */ { ud_itab__396, UD_TAB__OPC_MOD, "/mod" },
+ /* 397 */ { ud_itab__397, UD_TAB__OPC_MOD, "/mod" },
+ /* 398 */ { ud_itab__398, UD_TAB__OPC_MOD, "/mod" },
+ /* 399 */ { ud_itab__399, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 400 */ { ud_itab__400, UD_TAB__OPC_MOD, "/mod" },
+ /* 401 */ { ud_itab__401, UD_TAB__OPC_MOD, "/mod" },
+ /* 402 */ { ud_itab__402, UD_TAB__OPC_MOD, "/mod" },
+ /* 403 */ { ud_itab__403, UD_TAB__OPC_VEX, "/vex" },
+ /* 404 */ { ud_itab__404, UD_TAB__OPC_MODE, "/m" },
+ /* 405 */ { ud_itab__405, UD_TAB__OPC_REG, "/reg" },
+ /* 406 */ { ud_itab__406, UD_TAB__OPC_REG, "/reg" },
+ /* 407 */ { ud_itab__407, UD_TAB__OPC_MODE, "/m" },
+ /* 408 */ { ud_itab__408, UD_TAB__OPC_OSIZE, "/o" },
+ /* 409 */ { ud_itab__409, UD_TAB__OPC_REG, "/reg" },
+ /* 410 */ { ud_itab__410, UD_TAB__OPC_REG, "/reg" },
+ /* 411 */ { ud_itab__411, UD_TAB__OPC_REG, "/reg" },
+ /* 412 */ { ud_itab__412, UD_TAB__OPC_REG, "/reg" },
+ /* 413 */ { ud_itab__413, UD_TAB__OPC_MODE, "/m" },
+ /* 414 */ { ud_itab__414, UD_TAB__OPC_MODE, "/m" },
+ /* 415 */ { ud_itab__415, UD_TAB__OPC_MODE, "/m" },
+ /* 416 */ { ud_itab__416, UD_TAB__OPC_MOD, "/mod" },
+ /* 417 */ { ud_itab__417, UD_TAB__OPC_REG, "/reg" },
+ /* 418 */ { ud_itab__418, UD_TAB__OPC_X87, "/x87" },
+ /* 419 */ { ud_itab__419, UD_TAB__OPC_MOD, "/mod" },
+ /* 420 */ { ud_itab__420, UD_TAB__OPC_REG, "/reg" },
+ /* 421 */ { ud_itab__421, UD_TAB__OPC_X87, "/x87" },
+ /* 422 */ { ud_itab__422, UD_TAB__OPC_MOD, "/mod" },
+ /* 423 */ { ud_itab__423, UD_TAB__OPC_REG, "/reg" },
+ /* 424 */ { ud_itab__424, UD_TAB__OPC_X87, "/x87" },
+ /* 425 */ { ud_itab__425, UD_TAB__OPC_MOD, "/mod" },
+ /* 426 */ { ud_itab__426, UD_TAB__OPC_REG, "/reg" },
+ /* 427 */ { ud_itab__427, UD_TAB__OPC_X87, "/x87" },
+ /* 428 */ { ud_itab__428, UD_TAB__OPC_MOD, "/mod" },
+ /* 429 */ { ud_itab__429, UD_TAB__OPC_REG, "/reg" },
+ /* 430 */ { ud_itab__430, UD_TAB__OPC_X87, "/x87" },
+ /* 431 */ { ud_itab__431, UD_TAB__OPC_MOD, "/mod" },
+ /* 432 */ { ud_itab__432, UD_TAB__OPC_REG, "/reg" },
+ /* 433 */ { ud_itab__433, UD_TAB__OPC_X87, "/x87" },
+ /* 434 */ { ud_itab__434, UD_TAB__OPC_MOD, "/mod" },
+ /* 435 */ { ud_itab__435, UD_TAB__OPC_REG, "/reg" },
+ /* 436 */ { ud_itab__436, UD_TAB__OPC_X87, "/x87" },
+ /* 437 */ { ud_itab__437, UD_TAB__OPC_MOD, "/mod" },
+ /* 438 */ { ud_itab__438, UD_TAB__OPC_REG, "/reg" },
+ /* 439 */ { ud_itab__439, UD_TAB__OPC_X87, "/x87" },
+ /* 440 */ { ud_itab__440, UD_TAB__OPC_ASIZE, "/a" },
+ /* 441 */ { ud_itab__441, UD_TAB__OPC_MODE, "/m" },
+ /* 442 */ { ud_itab__442, UD_TAB__OPC_REG, "/reg" },
+ /* 443 */ { ud_itab__443, UD_TAB__OPC_REG, "/reg" },
+ /* 444 */ { ud_itab__444, UD_TAB__OPC_REG, "/reg" },
+ /* 445 */ { ud_itab__445, UD_TAB__OPC_REG, "/reg" },
+ /* 446 */ { ud_itab__446, UD_TAB__OPC_MODE, "/m" },
+};
+
+/* itab entry operand definitions (for readability) */
+#define O_AL { OP_AL, SZ_B }
+#define O_AX { OP_AX, SZ_W }
+#define O_Av { OP_A, SZ_V }
+#define O_C { OP_C, SZ_NA }
+#define O_CL { OP_CL, SZ_B }
+#define O_CS { OP_CS, SZ_NA }
+#define O_CX { OP_CX, SZ_W }
+#define O_D { OP_D, SZ_NA }
+#define O_DL { OP_DL, SZ_B }
+#define O_DS { OP_DS, SZ_NA }
+#define O_DX { OP_DX, SZ_W }
+#define O_E { OP_E, SZ_NA }
+#define O_ES { OP_ES, SZ_NA }
+#define O_Eb { OP_E, SZ_B }
+#define O_Ed { OP_E, SZ_D }
+#define O_Eq { OP_E, SZ_Q }
+#define O_Ev { OP_E, SZ_V }
+#define O_Ew { OP_E, SZ_W }
+#define O_Ey { OP_E, SZ_Y }
+#define O_Ez { OP_E, SZ_Z }
+#define O_FS { OP_FS, SZ_NA }
+#define O_Fv { OP_F, SZ_V }
+#define O_G { OP_G, SZ_NA }
+#define O_GS { OP_GS, SZ_NA }
+#define O_Gb { OP_G, SZ_B }
+#define O_Gd { OP_G, SZ_D }
+#define O_Gq { OP_G, SZ_Q }
+#define O_Gv { OP_G, SZ_V }
+#define O_Gw { OP_G, SZ_W }
+#define O_Gy { OP_G, SZ_Y }
+#define O_Gz { OP_G, SZ_Z }
+#define O_H { OP_H, SZ_X }
+#define O_Hqq { OP_H, SZ_QQ }
+#define O_Hx { OP_H, SZ_X }
+#define O_I1 { OP_I1, SZ_NA }
+#define O_I3 { OP_I3, SZ_NA }
+#define O_Ib { OP_I, SZ_B }
+#define O_Iv { OP_I, SZ_V }
+#define O_Iw { OP_I, SZ_W }
+#define O_Iz { OP_I, SZ_Z }
+#define O_Jb { OP_J, SZ_B }
+#define O_Jv { OP_J, SZ_V }
+#define O_Jz { OP_J, SZ_Z }
+#define O_L { OP_L, SZ_O }
+#define O_Lx { OP_L, SZ_X }
+#define O_M { OP_M, SZ_NA }
+#define O_Mb { OP_M, SZ_B }
+#define O_MbRd { OP_MR, SZ_BD }
+#define O_MbRv { OP_MR, SZ_BV }
+#define O_Md { OP_M, SZ_D }
+#define O_MdRy { OP_MR, SZ_DY }
+#define O_MdU { OP_MU, SZ_DO }
+#define O_Mdq { OP_M, SZ_DQ }
+#define O_Mo { OP_M, SZ_O }
+#define O_Mq { OP_M, SZ_Q }
+#define O_MqU { OP_MU, SZ_QO }
+#define O_Ms { OP_M, SZ_W }
+#define O_Mt { OP_M, SZ_T }
+#define O_Mv { OP_M, SZ_V }
+#define O_Mw { OP_M, SZ_W }
+#define O_MwRd { OP_MR, SZ_WD }
+#define O_MwRv { OP_MR, SZ_WV }
+#define O_MwRy { OP_MR, SZ_WY }
+#define O_MwU { OP_MU, SZ_WO }
+#define O_N { OP_N, SZ_Q }
+#define O_NONE { OP_NONE, SZ_NA }
+#define O_Ob { OP_O, SZ_B }
+#define O_Ov { OP_O, SZ_V }
+#define O_Ow { OP_O, SZ_W }
+#define O_P { OP_P, SZ_Q }
+#define O_Q { OP_Q, SZ_Q }
+#define O_R { OP_R, SZ_RDQ }
+#define O_R0b { OP_R0, SZ_B }
+#define O_R0v { OP_R0, SZ_V }
+#define O_R0w { OP_R0, SZ_W }
+#define O_R0y { OP_R0, SZ_Y }
+#define O_R0z { OP_R0, SZ_Z }
+#define O_R1b { OP_R1, SZ_B }
+#define O_R1v { OP_R1, SZ_V }
+#define O_R1w { OP_R1, SZ_W }
+#define O_R1y { OP_R1, SZ_Y }
+#define O_R1z { OP_R1, SZ_Z }
+#define O_R2b { OP_R2, SZ_B }
+#define O_R2v { OP_R2, SZ_V }
+#define O_R2w { OP_R2, SZ_W }
+#define O_R2y { OP_R2, SZ_Y }
+#define O_R2z { OP_R2, SZ_Z }
+#define O_R3b { OP_R3, SZ_B }
+#define O_R3v { OP_R3, SZ_V }
+#define O_R3w { OP_R3, SZ_W }
+#define O_R3y { OP_R3, SZ_Y }
+#define O_R3z { OP_R3, SZ_Z }
+#define O_R4b { OP_R4, SZ_B }
+#define O_R4v { OP_R4, SZ_V }
+#define O_R4w { OP_R4, SZ_W }
+#define O_R4y { OP_R4, SZ_Y }
+#define O_R4z { OP_R4, SZ_Z }
+#define O_R5b { OP_R5, SZ_B }
+#define O_R5v { OP_R5, SZ_V }
+#define O_R5w { OP_R5, SZ_W }
+#define O_R5y { OP_R5, SZ_Y }
+#define O_R5z { OP_R5, SZ_Z }
+#define O_R6b { OP_R6, SZ_B }
+#define O_R6v { OP_R6, SZ_V }
+#define O_R6w { OP_R6, SZ_W }
+#define O_R6y { OP_R6, SZ_Y }
+#define O_R6z { OP_R6, SZ_Z }
+#define O_R7b { OP_R7, SZ_B }
+#define O_R7v { OP_R7, SZ_V }
+#define O_R7w { OP_R7, SZ_W }
+#define O_R7y { OP_R7, SZ_Y }
+#define O_R7z { OP_R7, SZ_Z }
+#define O_S { OP_S, SZ_W }
+#define O_SS { OP_SS, SZ_NA }
+#define O_ST0 { OP_ST0, SZ_NA }
+#define O_ST1 { OP_ST1, SZ_NA }
+#define O_ST2 { OP_ST2, SZ_NA }
+#define O_ST3 { OP_ST3, SZ_NA }
+#define O_ST4 { OP_ST4, SZ_NA }
+#define O_ST5 { OP_ST5, SZ_NA }
+#define O_ST6 { OP_ST6, SZ_NA }
+#define O_ST7 { OP_ST7, SZ_NA }
+#define O_U { OP_U, SZ_O }
+#define O_Ux { OP_U, SZ_X }
+#define O_V { OP_V, SZ_DQ }
+#define O_Vdq { OP_V, SZ_DQ }
+#define O_Vqq { OP_V, SZ_QQ }
+#define O_Vsd { OP_V, SZ_Q }
+#define O_Vx { OP_V, SZ_X }
+#define O_W { OP_W, SZ_DQ }
+#define O_Wdq { OP_W, SZ_DQ }
+#define O_Wqq { OP_W, SZ_QQ }
+#define O_Wsd { OP_W, SZ_Q }
+#define O_Wx { OP_W, SZ_X }
+#define O_eAX { OP_eAX, SZ_Z }
+#define O_eCX { OP_eCX, SZ_Z }
+#define O_eDX { OP_eDX, SZ_Z }
+#define O_rAX { OP_rAX, SZ_V }
+#define O_rCX { OP_rCX, SZ_V }
+#define O_rDX { OP_rDX, SZ_V }
+#define O_sIb { OP_sI, SZ_B }
+#define O_sIv { OP_sI, SZ_V }
+#define O_sIz { OP_sI, SZ_Z }
+
+struct ud_itab_entry ud_itab[] = {
+ /* 0000 */ { UD_Iinvalid, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0001 */ { UD_Iaaa, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0002 */ { UD_Iaad, O_Ib, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0003 */ { UD_Iaam, O_Ib, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0004 */ { UD_Iaas, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0005 */ { UD_Iadc, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0006 */ { UD_Iadc, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0007 */ { UD_Iadc, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0008 */ { UD_Iadc, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0009 */ { UD_Iadc, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0010 */ { UD_Iadc, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0011 */ { UD_Iadc, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0012 */ { UD_Iadc, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0013 */ { UD_Iadc, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0014 */ { UD_Iadc, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0015 */ { UD_Iadd, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0016 */ { UD_Iadd, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0017 */ { UD_Iadd, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0018 */ { UD_Iadd, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0019 */ { UD_Iadd, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0020 */ { UD_Iadd, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0021 */ { UD_Iadd, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0022 */ { UD_Iadd, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0023 */ { UD_Iadd, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0024 */ { UD_Iadd, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0025 */ { UD_Iaddpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0026 */ { UD_Ivaddpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0027 */ { UD_Iaddps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0028 */ { UD_Ivaddps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0029 */ { UD_Iaddsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0030 */ { UD_Ivaddsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0031 */ { UD_Iaddss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0032 */ { UD_Ivaddss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0033 */ { UD_Iaddsubpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0034 */ { UD_Ivaddsubpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0035 */ { UD_Iaddsubps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0036 */ { UD_Ivaddsubps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0037 */ { UD_Iaesdec, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0038 */ { UD_Ivaesdec, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0039 */ { UD_Iaesdeclast, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0040 */ { UD_Ivaesdeclast, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0041 */ { UD_Iaesenc, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0042 */ { UD_Ivaesenc, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0043 */ { UD_Iaesenclast, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0044 */ { UD_Ivaesenclast, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0045 */ { UD_Iaesimc, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0046 */ { UD_Ivaesimc, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0047 */ { UD_Iaeskeygenassist, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0048 */ { UD_Ivaeskeygenassist, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0049 */ { UD_Iand, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0050 */ { UD_Iand, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0051 */ { UD_Iand, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0052 */ { UD_Iand, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0053 */ { UD_Iand, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0054 */ { UD_Iand, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0055 */ { UD_Iand, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0056 */ { UD_Iand, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0057 */ { UD_Iand, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0058 */ { UD_Iand, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0059 */ { UD_Iandpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0060 */ { UD_Ivandpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0061 */ { UD_Iandps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0062 */ { UD_Ivandps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0063 */ { UD_Iandnpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0064 */ { UD_Ivandnpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0065 */ { UD_Iandnps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0066 */ { UD_Ivandnps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0067 */ { UD_Iarpl, O_Ew, O_Gw, O_NONE, O_NONE, P_aso },
+ /* 0068 */ { UD_Imovsxd, O_Gq, O_Ed, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexx|P_rexr|P_rexb },
+ /* 0069 */ { UD_Icall, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0070 */ { UD_Icall, O_Eq, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 0071 */ { UD_Icall, O_Fv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0072 */ { UD_Icall, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0073 */ { UD_Icall, O_Av, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0074 */ { UD_Icbw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0075 */ { UD_Icwde, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0076 */ { UD_Icdqe, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0077 */ { UD_Iclc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0078 */ { UD_Icld, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0079 */ { UD_Iclflush, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0080 */ { UD_Iclgi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0081 */ { UD_Icli, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0082 */ { UD_Iclts, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0083 */ { UD_Icmc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0084 */ { UD_Icmovo, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0085 */ { UD_Icmovno, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0086 */ { UD_Icmovb, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0087 */ { UD_Icmovae, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0088 */ { UD_Icmovz, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0089 */ { UD_Icmovnz, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0090 */ { UD_Icmovbe, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0091 */ { UD_Icmova, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0092 */ { UD_Icmovs, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0093 */ { UD_Icmovns, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0094 */ { UD_Icmovp, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0095 */ { UD_Icmovnp, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0096 */ { UD_Icmovl, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0097 */ { UD_Icmovge, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0098 */ { UD_Icmovle, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0099 */ { UD_Icmovg, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0100 */ { UD_Icmp, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0101 */ { UD_Icmp, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0102 */ { UD_Icmp, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0103 */ { UD_Icmp, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0104 */ { UD_Icmp, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0105 */ { UD_Icmp, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0106 */ { UD_Icmp, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0107 */ { UD_Icmp, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0108 */ { UD_Icmp, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0109 */ { UD_Icmp, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0110 */ { UD_Icmppd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0111 */ { UD_Ivcmppd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0112 */ { UD_Icmpps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0113 */ { UD_Ivcmpps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0114 */ { UD_Icmpsb, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_seg },
+ /* 0115 */ { UD_Icmpsw, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw|P_seg },
+ /* 0116 */ { UD_Icmpsd, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw|P_seg },
+ /* 0117 */ { UD_Icmpsd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0118 */ { UD_Ivcmpsd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0119 */ { UD_Icmpsq, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw|P_seg },
+ /* 0120 */ { UD_Icmpss, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0121 */ { UD_Ivcmpss, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0122 */ { UD_Icmpxchg, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0123 */ { UD_Icmpxchg, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0124 */ { UD_Icmpxchg8b, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0125 */ { UD_Icmpxchg8b, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0126 */ { UD_Icmpxchg16b, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0127 */ { UD_Icomisd, O_Vsd, O_Wsd, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0128 */ { UD_Ivcomisd, O_Vsd, O_Wsd, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0129 */ { UD_Icomiss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0130 */ { UD_Ivcomiss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0131 */ { UD_Icpuid, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0132 */ { UD_Icvtdq2pd, O_V, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0133 */ { UD_Ivcvtdq2pd, O_Vx, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0134 */ { UD_Icvtdq2ps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0135 */ { UD_Ivcvtdq2ps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0136 */ { UD_Icvtpd2dq, O_Vdq, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0137 */ { UD_Ivcvtpd2dq, O_Vdq, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0138 */ { UD_Icvtpd2pi, O_P, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0139 */ { UD_Icvtpd2ps, O_Vdq, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0140 */ { UD_Ivcvtpd2ps, O_Vdq, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0141 */ { UD_Icvtpi2ps, O_V, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0142 */ { UD_Icvtpi2pd, O_V, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0143 */ { UD_Icvtps2dq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0144 */ { UD_Ivcvtps2dq, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0145 */ { UD_Icvtps2pd, O_V, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0146 */ { UD_Ivcvtps2pd, O_Vx, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0147 */ { UD_Icvtps2pi, O_P, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0148 */ { UD_Icvtsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0149 */ { UD_Ivcvtsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0150 */ { UD_Icvtsd2ss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0151 */ { UD_Ivcvtsd2ss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0152 */ { UD_Icvtsi2sd, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0153 */ { UD_Ivcvtsi2sd, O_Vx, O_Hx, O_Ey, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0154 */ { UD_Icvtsi2ss, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0155 */ { UD_Ivcvtsi2ss, O_Vx, O_Hx, O_Ey, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0156 */ { UD_Icvtss2sd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0157 */ { UD_Ivcvtss2sd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0158 */ { UD_Icvtss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0159 */ { UD_Ivcvtss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0160 */ { UD_Icvttpd2dq, O_Vdq, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0161 */ { UD_Ivcvttpd2dq, O_Vdq, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0162 */ { UD_Icvttpd2pi, O_P, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0163 */ { UD_Icvttps2dq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0164 */ { UD_Ivcvttps2dq, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0165 */ { UD_Icvttps2pi, O_P, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0166 */ { UD_Icvttsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0167 */ { UD_Ivcvttsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0168 */ { UD_Icvttss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0169 */ { UD_Ivcvttss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0170 */ { UD_Icwd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0171 */ { UD_Icdq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0172 */ { UD_Icqo, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0173 */ { UD_Idaa, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 0174 */ { UD_Idas, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 0175 */ { UD_Idec, O_R0z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0176 */ { UD_Idec, O_R1z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0177 */ { UD_Idec, O_R2z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0178 */ { UD_Idec, O_R3z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0179 */ { UD_Idec, O_R4z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0180 */ { UD_Idec, O_R5z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0181 */ { UD_Idec, O_R6z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0182 */ { UD_Idec, O_R7z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0183 */ { UD_Idec, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0184 */ { UD_Idec, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0185 */ { UD_Idiv, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0186 */ { UD_Idiv, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0187 */ { UD_Idivpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0188 */ { UD_Ivdivpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0189 */ { UD_Idivps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0190 */ { UD_Ivdivps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0191 */ { UD_Idivsd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0192 */ { UD_Ivdivsd, O_Vx, O_Hx, O_MqU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0193 */ { UD_Idivss, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0194 */ { UD_Ivdivss, O_Vx, O_Hx, O_MdU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0195 */ { UD_Idppd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0196 */ { UD_Ivdppd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0197 */ { UD_Idpps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0198 */ { UD_Ivdpps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0199 */ { UD_Iemms, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0200 */ { UD_Ienter, O_Iw, O_Ib, O_NONE, O_NONE, P_def64 },
+ /* 0201 */ { UD_Iextractps, O_MdRy, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 0202 */ { UD_Ivextractps, O_MdRy, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 0203 */ { UD_If2xm1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0204 */ { UD_Ifabs, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0205 */ { UD_Ifadd, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0206 */ { UD_Ifadd, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0207 */ { UD_Ifadd, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0208 */ { UD_Ifadd, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0209 */ { UD_Ifadd, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0210 */ { UD_Ifadd, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0211 */ { UD_Ifadd, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0212 */ { UD_Ifadd, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0213 */ { UD_Ifadd, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0214 */ { UD_Ifadd, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0215 */ { UD_Ifadd, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0216 */ { UD_Ifadd, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0217 */ { UD_Ifadd, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0218 */ { UD_Ifadd, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0219 */ { UD_Ifadd, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0220 */ { UD_Ifadd, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0221 */ { UD_Ifadd, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0222 */ { UD_Ifadd, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0223 */ { UD_Ifaddp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0224 */ { UD_Ifaddp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0225 */ { UD_Ifaddp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0226 */ { UD_Ifaddp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0227 */ { UD_Ifaddp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0228 */ { UD_Ifaddp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0229 */ { UD_Ifaddp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0230 */ { UD_Ifaddp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0231 */ { UD_Ifbld, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0232 */ { UD_Ifbstp, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0233 */ { UD_Ifchs, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0234 */ { UD_Ifclex, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0235 */ { UD_Ifcmovb, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0236 */ { UD_Ifcmovb, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0237 */ { UD_Ifcmovb, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0238 */ { UD_Ifcmovb, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0239 */ { UD_Ifcmovb, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0240 */ { UD_Ifcmovb, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0241 */ { UD_Ifcmovb, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0242 */ { UD_Ifcmovb, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0243 */ { UD_Ifcmove, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0244 */ { UD_Ifcmove, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0245 */ { UD_Ifcmove, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0246 */ { UD_Ifcmove, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0247 */ { UD_Ifcmove, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0248 */ { UD_Ifcmove, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0249 */ { UD_Ifcmove, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0250 */ { UD_Ifcmove, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0251 */ { UD_Ifcmovbe, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0252 */ { UD_Ifcmovbe, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0253 */ { UD_Ifcmovbe, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0254 */ { UD_Ifcmovbe, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0255 */ { UD_Ifcmovbe, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0256 */ { UD_Ifcmovbe, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0257 */ { UD_Ifcmovbe, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0258 */ { UD_Ifcmovbe, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0259 */ { UD_Ifcmovu, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0260 */ { UD_Ifcmovu, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0261 */ { UD_Ifcmovu, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0262 */ { UD_Ifcmovu, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0263 */ { UD_Ifcmovu, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0264 */ { UD_Ifcmovu, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0265 */ { UD_Ifcmovu, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0266 */ { UD_Ifcmovu, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0267 */ { UD_Ifcmovnb, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0268 */ { UD_Ifcmovnb, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0269 */ { UD_Ifcmovnb, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0270 */ { UD_Ifcmovnb, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0271 */ { UD_Ifcmovnb, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0272 */ { UD_Ifcmovnb, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0273 */ { UD_Ifcmovnb, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0274 */ { UD_Ifcmovnb, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0275 */ { UD_Ifcmovne, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0276 */ { UD_Ifcmovne, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0277 */ { UD_Ifcmovne, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0278 */ { UD_Ifcmovne, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0279 */ { UD_Ifcmovne, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0280 */ { UD_Ifcmovne, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0281 */ { UD_Ifcmovne, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0282 */ { UD_Ifcmovne, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0283 */ { UD_Ifcmovnbe, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0284 */ { UD_Ifcmovnbe, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0285 */ { UD_Ifcmovnbe, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0286 */ { UD_Ifcmovnbe, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0287 */ { UD_Ifcmovnbe, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0288 */ { UD_Ifcmovnbe, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0289 */ { UD_Ifcmovnbe, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0290 */ { UD_Ifcmovnbe, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0291 */ { UD_Ifcmovnu, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0292 */ { UD_Ifcmovnu, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0293 */ { UD_Ifcmovnu, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0294 */ { UD_Ifcmovnu, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0295 */ { UD_Ifcmovnu, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0296 */ { UD_Ifcmovnu, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0297 */ { UD_Ifcmovnu, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0298 */ { UD_Ifcmovnu, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0299 */ { UD_Ifucomi, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0300 */ { UD_Ifucomi, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0301 */ { UD_Ifucomi, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0302 */ { UD_Ifucomi, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0303 */ { UD_Ifucomi, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0304 */ { UD_Ifucomi, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0305 */ { UD_Ifucomi, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0306 */ { UD_Ifucomi, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0307 */ { UD_Ifcom, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0308 */ { UD_Ifcom, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0309 */ { UD_Ifcom, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0310 */ { UD_Ifcom, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0311 */ { UD_Ifcom, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0312 */ { UD_Ifcom, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0313 */ { UD_Ifcom, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0314 */ { UD_Ifcom, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0315 */ { UD_Ifcom, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0316 */ { UD_Ifcom, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0317 */ { UD_Ifcom2, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0318 */ { UD_Ifcom2, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0319 */ { UD_Ifcom2, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0320 */ { UD_Ifcom2, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0321 */ { UD_Ifcom2, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0322 */ { UD_Ifcom2, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0323 */ { UD_Ifcom2, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0324 */ { UD_Ifcom2, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0325 */ { UD_Ifcomp3, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0326 */ { UD_Ifcomp3, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0327 */ { UD_Ifcomp3, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0328 */ { UD_Ifcomp3, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0329 */ { UD_Ifcomp3, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0330 */ { UD_Ifcomp3, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0331 */ { UD_Ifcomp3, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0332 */ { UD_Ifcomp3, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0333 */ { UD_Ifcomi, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0334 */ { UD_Ifcomi, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0335 */ { UD_Ifcomi, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0336 */ { UD_Ifcomi, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0337 */ { UD_Ifcomi, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0338 */ { UD_Ifcomi, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0339 */ { UD_Ifcomi, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0340 */ { UD_Ifcomi, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0341 */ { UD_Ifucomip, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0342 */ { UD_Ifucomip, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0343 */ { UD_Ifucomip, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0344 */ { UD_Ifucomip, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0345 */ { UD_Ifucomip, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0346 */ { UD_Ifucomip, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0347 */ { UD_Ifucomip, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0348 */ { UD_Ifucomip, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0349 */ { UD_Ifcomip, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0350 */ { UD_Ifcomip, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0351 */ { UD_Ifcomip, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0352 */ { UD_Ifcomip, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0353 */ { UD_Ifcomip, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0354 */ { UD_Ifcomip, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0355 */ { UD_Ifcomip, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0356 */ { UD_Ifcomip, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0357 */ { UD_Ifcomp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0358 */ { UD_Ifcomp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0359 */ { UD_Ifcomp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0360 */ { UD_Ifcomp, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0361 */ { UD_Ifcomp, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0362 */ { UD_Ifcomp, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0363 */ { UD_Ifcomp, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0364 */ { UD_Ifcomp, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0365 */ { UD_Ifcomp, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0366 */ { UD_Ifcomp, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0367 */ { UD_Ifcomp5, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0368 */ { UD_Ifcomp5, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0369 */ { UD_Ifcomp5, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0370 */ { UD_Ifcomp5, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0371 */ { UD_Ifcomp5, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0372 */ { UD_Ifcomp5, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0373 */ { UD_Ifcomp5, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0374 */ { UD_Ifcomp5, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0375 */ { UD_Ifcompp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0376 */ { UD_Ifcos, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0377 */ { UD_Ifdecstp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0378 */ { UD_Ifdiv, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0379 */ { UD_Ifdiv, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0380 */ { UD_Ifdiv, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0381 */ { UD_Ifdiv, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0382 */ { UD_Ifdiv, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0383 */ { UD_Ifdiv, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0384 */ { UD_Ifdiv, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0385 */ { UD_Ifdiv, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0386 */ { UD_Ifdiv, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0387 */ { UD_Ifdiv, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0388 */ { UD_Ifdiv, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0389 */ { UD_Ifdiv, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0390 */ { UD_Ifdiv, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0391 */ { UD_Ifdiv, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0392 */ { UD_Ifdiv, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0393 */ { UD_Ifdiv, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0394 */ { UD_Ifdiv, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0395 */ { UD_Ifdiv, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0396 */ { UD_Ifdivp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0397 */ { UD_Ifdivp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0398 */ { UD_Ifdivp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0399 */ { UD_Ifdivp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0400 */ { UD_Ifdivp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0401 */ { UD_Ifdivp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0402 */ { UD_Ifdivp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0403 */ { UD_Ifdivp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0404 */ { UD_Ifdivr, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0405 */ { UD_Ifdivr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0406 */ { UD_Ifdivr, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0407 */ { UD_Ifdivr, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0408 */ { UD_Ifdivr, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0409 */ { UD_Ifdivr, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0410 */ { UD_Ifdivr, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0411 */ { UD_Ifdivr, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0412 */ { UD_Ifdivr, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0413 */ { UD_Ifdivr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0414 */ { UD_Ifdivr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0415 */ { UD_Ifdivr, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0416 */ { UD_Ifdivr, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0417 */ { UD_Ifdivr, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0418 */ { UD_Ifdivr, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0419 */ { UD_Ifdivr, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0420 */ { UD_Ifdivr, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0421 */ { UD_Ifdivr, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0422 */ { UD_Ifdivrp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0423 */ { UD_Ifdivrp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0424 */ { UD_Ifdivrp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0425 */ { UD_Ifdivrp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0426 */ { UD_Ifdivrp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0427 */ { UD_Ifdivrp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0428 */ { UD_Ifdivrp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0429 */ { UD_Ifdivrp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0430 */ { UD_Ifemms, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0431 */ { UD_Iffree, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0432 */ { UD_Iffree, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0433 */ { UD_Iffree, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0434 */ { UD_Iffree, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0435 */ { UD_Iffree, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0436 */ { UD_Iffree, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0437 */ { UD_Iffree, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0438 */ { UD_Iffree, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0439 */ { UD_Iffreep, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0440 */ { UD_Iffreep, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0441 */ { UD_Iffreep, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0442 */ { UD_Iffreep, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0443 */ { UD_Iffreep, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0444 */ { UD_Iffreep, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0445 */ { UD_Iffreep, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0446 */ { UD_Iffreep, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0447 */ { UD_Ificom, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0448 */ { UD_Ificom, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0449 */ { UD_Ificomp, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0450 */ { UD_Ificomp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0451 */ { UD_Ifild, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0452 */ { UD_Ifild, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0453 */ { UD_Ifild, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0454 */ { UD_Ifincstp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0455 */ { UD_Ifninit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0456 */ { UD_Ifiadd, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0457 */ { UD_Ifiadd, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0458 */ { UD_Ifidivr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0459 */ { UD_Ifidivr, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0460 */ { UD_Ifidiv, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0461 */ { UD_Ifidiv, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0462 */ { UD_Ifisub, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0463 */ { UD_Ifisub, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0464 */ { UD_Ifisubr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0465 */ { UD_Ifisubr, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0466 */ { UD_Ifist, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0467 */ { UD_Ifist, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0468 */ { UD_Ifistp, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0469 */ { UD_Ifistp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0470 */ { UD_Ifistp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0471 */ { UD_Ifisttp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0472 */ { UD_Ifisttp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0473 */ { UD_Ifisttp, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0474 */ { UD_Ifld, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0475 */ { UD_Ifld, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0476 */ { UD_Ifld, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0477 */ { UD_Ifld, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0478 */ { UD_Ifld, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0479 */ { UD_Ifld, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0480 */ { UD_Ifld, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0481 */ { UD_Ifld, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0482 */ { UD_Ifld, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0483 */ { UD_Ifld, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0484 */ { UD_Ifld, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0485 */ { UD_Ifld1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0486 */ { UD_Ifldl2t, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0487 */ { UD_Ifldl2e, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0488 */ { UD_Ifldpi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0489 */ { UD_Ifldlg2, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0490 */ { UD_Ifldln2, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0491 */ { UD_Ifldz, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0492 */ { UD_Ifldcw, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0493 */ { UD_Ifldenv, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0494 */ { UD_Ifmul, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0495 */ { UD_Ifmul, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0496 */ { UD_Ifmul, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0497 */ { UD_Ifmul, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0498 */ { UD_Ifmul, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0499 */ { UD_Ifmul, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0500 */ { UD_Ifmul, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0501 */ { UD_Ifmul, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0502 */ { UD_Ifmul, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0503 */ { UD_Ifmul, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0504 */ { UD_Ifmul, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0505 */ { UD_Ifmul, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0506 */ { UD_Ifmul, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0507 */ { UD_Ifmul, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0508 */ { UD_Ifmul, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0509 */ { UD_Ifmul, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0510 */ { UD_Ifmul, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0511 */ { UD_Ifmul, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0512 */ { UD_Ifmulp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0513 */ { UD_Ifmulp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0514 */ { UD_Ifmulp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0515 */ { UD_Ifmulp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0516 */ { UD_Ifmulp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0517 */ { UD_Ifmulp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0518 */ { UD_Ifmulp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0519 */ { UD_Ifmulp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0520 */ { UD_Ifimul, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0521 */ { UD_Ifimul, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0522 */ { UD_Ifnop, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0523 */ { UD_Ifndisi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0524 */ { UD_Ifneni, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0525 */ { UD_Ifnsetpm, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0526 */ { UD_Ifpatan, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0527 */ { UD_Ifprem, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0528 */ { UD_Ifprem1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0529 */ { UD_Ifptan, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0530 */ { UD_Ifrndint, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0531 */ { UD_Ifrstor, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0532 */ { UD_Ifrstpm, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0533 */ { UD_Ifnsave, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0534 */ { UD_Ifscale, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0535 */ { UD_Ifsin, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0536 */ { UD_Ifsincos, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0537 */ { UD_Ifsqrt, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0538 */ { UD_Ifstp, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0539 */ { UD_Ifstp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0540 */ { UD_Ifstp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0541 */ { UD_Ifstp, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0542 */ { UD_Ifstp, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0543 */ { UD_Ifstp, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0544 */ { UD_Ifstp, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0545 */ { UD_Ifstp, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0546 */ { UD_Ifstp, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0547 */ { UD_Ifstp, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0548 */ { UD_Ifstp, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0549 */ { UD_Ifstp1, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0550 */ { UD_Ifstp1, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0551 */ { UD_Ifstp1, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0552 */ { UD_Ifstp1, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0553 */ { UD_Ifstp1, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0554 */ { UD_Ifstp1, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0555 */ { UD_Ifstp1, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0556 */ { UD_Ifstp1, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0557 */ { UD_Ifstp8, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0558 */ { UD_Ifstp8, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0559 */ { UD_Ifstp8, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0560 */ { UD_Ifstp8, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0561 */ { UD_Ifstp8, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0562 */ { UD_Ifstp8, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0563 */ { UD_Ifstp8, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0564 */ { UD_Ifstp8, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0565 */ { UD_Ifstp9, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0566 */ { UD_Ifstp9, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0567 */ { UD_Ifstp9, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0568 */ { UD_Ifstp9, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0569 */ { UD_Ifstp9, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0570 */ { UD_Ifstp9, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0571 */ { UD_Ifstp9, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0572 */ { UD_Ifstp9, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0573 */ { UD_Ifst, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0574 */ { UD_Ifst, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0575 */ { UD_Ifst, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0576 */ { UD_Ifst, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0577 */ { UD_Ifst, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0578 */ { UD_Ifst, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0579 */ { UD_Ifst, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0580 */ { UD_Ifst, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0581 */ { UD_Ifst, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0582 */ { UD_Ifst, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0583 */ { UD_Ifnstcw, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0584 */ { UD_Ifnstenv, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0585 */ { UD_Ifnstsw, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0586 */ { UD_Ifnstsw, O_AX, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0587 */ { UD_Ifsub, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0588 */ { UD_Ifsub, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0589 */ { UD_Ifsub, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0590 */ { UD_Ifsub, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0591 */ { UD_Ifsub, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0592 */ { UD_Ifsub, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0593 */ { UD_Ifsub, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0594 */ { UD_Ifsub, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0595 */ { UD_Ifsub, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0596 */ { UD_Ifsub, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0597 */ { UD_Ifsub, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0598 */ { UD_Ifsub, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0599 */ { UD_Ifsub, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0600 */ { UD_Ifsub, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0601 */ { UD_Ifsub, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0602 */ { UD_Ifsub, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0603 */ { UD_Ifsub, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0604 */ { UD_Ifsub, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0605 */ { UD_Ifsubp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0606 */ { UD_Ifsubp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0607 */ { UD_Ifsubp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0608 */ { UD_Ifsubp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0609 */ { UD_Ifsubp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0610 */ { UD_Ifsubp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0611 */ { UD_Ifsubp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0612 */ { UD_Ifsubp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0613 */ { UD_Ifsubr, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0614 */ { UD_Ifsubr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0615 */ { UD_Ifsubr, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0616 */ { UD_Ifsubr, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0617 */ { UD_Ifsubr, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0618 */ { UD_Ifsubr, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0619 */ { UD_Ifsubr, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0620 */ { UD_Ifsubr, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0621 */ { UD_Ifsubr, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0622 */ { UD_Ifsubr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0623 */ { UD_Ifsubr, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0624 */ { UD_Ifsubr, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0625 */ { UD_Ifsubr, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0626 */ { UD_Ifsubr, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0627 */ { UD_Ifsubr, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0628 */ { UD_Ifsubr, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0629 */ { UD_Ifsubr, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0630 */ { UD_Ifsubr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0631 */ { UD_Ifsubrp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0632 */ { UD_Ifsubrp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0633 */ { UD_Ifsubrp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0634 */ { UD_Ifsubrp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0635 */ { UD_Ifsubrp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0636 */ { UD_Ifsubrp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0637 */ { UD_Ifsubrp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0638 */ { UD_Ifsubrp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0639 */ { UD_Iftst, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0640 */ { UD_Ifucom, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0641 */ { UD_Ifucom, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0642 */ { UD_Ifucom, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0643 */ { UD_Ifucom, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0644 */ { UD_Ifucom, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0645 */ { UD_Ifucom, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0646 */ { UD_Ifucom, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0647 */ { UD_Ifucom, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0648 */ { UD_Ifucomp, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0649 */ { UD_Ifucomp, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0650 */ { UD_Ifucomp, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0651 */ { UD_Ifucomp, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0652 */ { UD_Ifucomp, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0653 */ { UD_Ifucomp, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0654 */ { UD_Ifucomp, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0655 */ { UD_Ifucomp, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0656 */ { UD_Ifucompp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0657 */ { UD_Ifxam, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0658 */ { UD_Ifxch, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0659 */ { UD_Ifxch, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0660 */ { UD_Ifxch, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0661 */ { UD_Ifxch, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0662 */ { UD_Ifxch, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0663 */ { UD_Ifxch, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0664 */ { UD_Ifxch, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0665 */ { UD_Ifxch, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0666 */ { UD_Ifxch4, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0667 */ { UD_Ifxch4, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0668 */ { UD_Ifxch4, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0669 */ { UD_Ifxch4, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0670 */ { UD_Ifxch4, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0671 */ { UD_Ifxch4, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0672 */ { UD_Ifxch4, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0673 */ { UD_Ifxch4, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0674 */ { UD_Ifxch7, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0675 */ { UD_Ifxch7, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0676 */ { UD_Ifxch7, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0677 */ { UD_Ifxch7, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0678 */ { UD_Ifxch7, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0679 */ { UD_Ifxch7, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0680 */ { UD_Ifxch7, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0681 */ { UD_Ifxch7, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0682 */ { UD_Ifxrstor, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0683 */ { UD_Ifxsave, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0684 */ { UD_Ifxtract, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0685 */ { UD_Ifyl2x, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0686 */ { UD_Ifyl2xp1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0687 */ { UD_Ihlt, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0688 */ { UD_Iidiv, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0689 */ { UD_Iidiv, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0690 */ { UD_Iin, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0691 */ { UD_Iin, O_eAX, O_Ib, O_NONE, O_NONE, P_oso },
+ /* 0692 */ { UD_Iin, O_AL, O_DX, O_NONE, O_NONE, P_none },
+ /* 0693 */ { UD_Iin, O_eAX, O_DX, O_NONE, O_NONE, P_oso },
+ /* 0694 */ { UD_Iimul, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0695 */ { UD_Iimul, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0696 */ { UD_Iimul, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0697 */ { UD_Iimul, O_Gv, O_Ev, O_Iz, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0698 */ { UD_Iimul, O_Gv, O_Ev, O_sIb, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0699 */ { UD_Iinc, O_R0z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0700 */ { UD_Iinc, O_R1z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0701 */ { UD_Iinc, O_R2z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0702 */ { UD_Iinc, O_R3z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0703 */ { UD_Iinc, O_R4z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0704 */ { UD_Iinc, O_R5z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0705 */ { UD_Iinc, O_R6z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0706 */ { UD_Iinc, O_R7z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0707 */ { UD_Iinc, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0708 */ { UD_Iinc, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0709 */ { UD_Iinsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0710 */ { UD_Iinsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0711 */ { UD_Iinsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0712 */ { UD_Iint1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0713 */ { UD_Iint3, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0714 */ { UD_Iint, O_Ib, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0715 */ { UD_Iinto, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 0716 */ { UD_Iinvd, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0717 */ { UD_Iinvept, O_Gd, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0718 */ { UD_Iinvept, O_Gq, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0719 */ { UD_Iinvlpg, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0720 */ { UD_Iinvlpga, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0721 */ { UD_Iinvvpid, O_Gd, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0722 */ { UD_Iinvvpid, O_Gq, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0723 */ { UD_Iiretw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0724 */ { UD_Iiretd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0725 */ { UD_Iiretq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0726 */ { UD_Ijo, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0727 */ { UD_Ijo, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0728 */ { UD_Ijno, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0729 */ { UD_Ijno, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0730 */ { UD_Ijb, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0731 */ { UD_Ijb, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0732 */ { UD_Ijae, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0733 */ { UD_Ijae, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0734 */ { UD_Ijz, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0735 */ { UD_Ijz, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0736 */ { UD_Ijnz, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0737 */ { UD_Ijnz, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0738 */ { UD_Ijbe, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0739 */ { UD_Ijbe, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0740 */ { UD_Ija, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0741 */ { UD_Ija, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0742 */ { UD_Ijs, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0743 */ { UD_Ijs, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0744 */ { UD_Ijns, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0745 */ { UD_Ijns, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0746 */ { UD_Ijp, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0747 */ { UD_Ijp, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0748 */ { UD_Ijnp, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0749 */ { UD_Ijnp, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0750 */ { UD_Ijl, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0751 */ { UD_Ijl, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0752 */ { UD_Ijge, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0753 */ { UD_Ijge, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0754 */ { UD_Ijle, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0755 */ { UD_Ijle, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0756 */ { UD_Ijg, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0757 */ { UD_Ijg, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0758 */ { UD_Ijcxz, O_Jb, O_NONE, O_NONE, O_NONE, P_aso },
+ /* 0759 */ { UD_Ijecxz, O_Jb, O_NONE, O_NONE, O_NONE, P_aso },
+ /* 0760 */ { UD_Ijrcxz, O_Jb, O_NONE, O_NONE, O_NONE, P_aso },
+ /* 0761 */ { UD_Ijmp, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 0762 */ { UD_Ijmp, O_Fv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0763 */ { UD_Ijmp, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0764 */ { UD_Ijmp, O_Av, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0765 */ { UD_Ijmp, O_Jb, O_NONE, O_NONE, O_NONE, P_def64 },
+ /* 0766 */ { UD_Ilahf, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0767 */ { UD_Ilar, O_Gv, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0768 */ { UD_Ildmxcsr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0769 */ { UD_Ilds, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso },
+ /* 0770 */ { UD_Ilea, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0771 */ { UD_Iles, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso },
+ /* 0772 */ { UD_Ilfs, O_Gz, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0773 */ { UD_Ilgs, O_Gz, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0774 */ { UD_Ilidt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0775 */ { UD_Ilss, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0776 */ { UD_Ileave, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0777 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0778 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0779 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0780 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0781 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0782 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0783 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0784 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0785 */ { UD_Ilgdt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0786 */ { UD_Illdt, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0787 */ { UD_Ilmsw, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0788 */ { UD_Ilmsw, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0789 */ { UD_Ilock, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0790 */ { UD_Ilodsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0791 */ { UD_Ilodsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0792 */ { UD_Ilodsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0793 */ { UD_Ilodsq, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0794 */ { UD_Iloopne, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0795 */ { UD_Iloope, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0796 */ { UD_Iloop, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0797 */ { UD_Ilsl, O_Gv, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0798 */ { UD_Iltr, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0799 */ { UD_Imaskmovq, O_P, O_N, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0800 */ { UD_Imaxpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0801 */ { UD_Ivmaxpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0802 */ { UD_Imaxps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0803 */ { UD_Ivmaxps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0804 */ { UD_Imaxsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0805 */ { UD_Ivmaxsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0806 */ { UD_Imaxss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0807 */ { UD_Ivmaxss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0808 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0809 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0810 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0811 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0812 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0813 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0814 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0815 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0816 */ { UD_Iminpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0817 */ { UD_Ivminpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0818 */ { UD_Iminps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0819 */ { UD_Ivminps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0820 */ { UD_Iminsd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0821 */ { UD_Ivminsd, O_Vx, O_Hx, O_MqU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0822 */ { UD_Iminss, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0823 */ { UD_Ivminss, O_Vx, O_Hx, O_MdU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0824 */ { UD_Imonitor, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0825 */ { UD_Imontmul, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0826 */ { UD_Imov, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0827 */ { UD_Imov, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0828 */ { UD_Imov, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0829 */ { UD_Imov, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0830 */ { UD_Imov, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0831 */ { UD_Imov, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0832 */ { UD_Imov, O_MwRv, O_S, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0833 */ { UD_Imov, O_S, O_MwRv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0834 */ { UD_Imov, O_AL, O_Ob, O_NONE, O_NONE, P_none },
+ /* 0835 */ { UD_Imov, O_rAX, O_Ov, O_NONE, O_NONE, P_aso|P_oso|P_rexw },
+ /* 0836 */ { UD_Imov, O_Ob, O_AL, O_NONE, O_NONE, P_none },
+ /* 0837 */ { UD_Imov, O_Ov, O_rAX, O_NONE, O_NONE, P_aso|P_oso|P_rexw },
+ /* 0838 */ { UD_Imov, O_R0b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0839 */ { UD_Imov, O_R1b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0840 */ { UD_Imov, O_R2b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0841 */ { UD_Imov, O_R3b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0842 */ { UD_Imov, O_R4b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0843 */ { UD_Imov, O_R5b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0844 */ { UD_Imov, O_R6b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0845 */ { UD_Imov, O_R7b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0846 */ { UD_Imov, O_R0v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0847 */ { UD_Imov, O_R1v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0848 */ { UD_Imov, O_R2v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0849 */ { UD_Imov, O_R3v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0850 */ { UD_Imov, O_R4v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0851 */ { UD_Imov, O_R5v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0852 */ { UD_Imov, O_R6v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0853 */ { UD_Imov, O_R7v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0854 */ { UD_Imov, O_R, O_C, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0855 */ { UD_Imov, O_R, O_D, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0856 */ { UD_Imov, O_C, O_R, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0857 */ { UD_Imov, O_D, O_R, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0858 */ { UD_Imovapd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0859 */ { UD_Ivmovapd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0860 */ { UD_Imovapd, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0861 */ { UD_Ivmovapd, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0862 */ { UD_Imovaps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0863 */ { UD_Ivmovaps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0864 */ { UD_Imovaps, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0865 */ { UD_Ivmovaps, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0866 */ { UD_Imovd, O_P, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0867 */ { UD_Imovd, O_P, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0868 */ { UD_Imovd, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0869 */ { UD_Ivmovd, O_Vx, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0870 */ { UD_Imovd, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0871 */ { UD_Ivmovd, O_Vx, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0872 */ { UD_Imovd, O_Ey, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0873 */ { UD_Imovd, O_Ey, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0874 */ { UD_Imovd, O_Ey, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0875 */ { UD_Ivmovd, O_Ey, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0876 */ { UD_Imovd, O_Ey, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0877 */ { UD_Ivmovd, O_Ey, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0878 */ { UD_Imovhpd, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0879 */ { UD_Ivmovhpd, O_Vx, O_Hx, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0880 */ { UD_Imovhpd, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0881 */ { UD_Ivmovhpd, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0882 */ { UD_Imovhps, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0883 */ { UD_Ivmovhps, O_Vx, O_Hx, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0884 */ { UD_Imovhps, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0885 */ { UD_Ivmovhps, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0886 */ { UD_Imovlhps, O_V, O_U, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0887 */ { UD_Ivmovlhps, O_Vx, O_Hx, O_Ux, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0888 */ { UD_Imovlpd, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0889 */ { UD_Ivmovlpd, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0890 */ { UD_Imovlpd, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0891 */ { UD_Ivmovlpd, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0892 */ { UD_Imovlps, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0893 */ { UD_Ivmovlps, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0894 */ { UD_Imovlps, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0895 */ { UD_Ivmovlps, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0896 */ { UD_Imovhlps, O_V, O_U, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0897 */ { UD_Ivmovhlps, O_Vx, O_Ux, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0898 */ { UD_Imovmskpd, O_Gd, O_U, O_NONE, O_NONE, P_oso|P_rexr|P_rexb },
+ /* 0899 */ { UD_Ivmovmskpd, O_Gd, O_Ux, O_NONE, O_NONE, P_oso|P_rexr|P_rexb|P_vexl },
+ /* 0900 */ { UD_Imovmskps, O_Gd, O_U, O_NONE, O_NONE, P_oso|P_rexr|P_rexb },
+ /* 0901 */ { UD_Ivmovmskps, O_Gd, O_Ux, O_NONE, O_NONE, P_oso|P_rexr|P_rexb },
+ /* 0902 */ { UD_Imovntdq, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0903 */ { UD_Ivmovntdq, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0904 */ { UD_Imovnti, O_M, O_Gy, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0905 */ { UD_Imovntpd, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0906 */ { UD_Ivmovntpd, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0907 */ { UD_Imovntps, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0908 */ { UD_Ivmovntps, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0909 */ { UD_Imovntq, O_M, O_P, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0910 */ { UD_Imovq, O_P, O_Eq, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0911 */ { UD_Imovq, O_V, O_Eq, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0912 */ { UD_Ivmovq, O_Vx, O_Eq, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0913 */ { UD_Imovq, O_Eq, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0914 */ { UD_Imovq, O_Eq, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0915 */ { UD_Ivmovq, O_Eq, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0916 */ { UD_Imovq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0917 */ { UD_Ivmovq, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0918 */ { UD_Imovq, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0919 */ { UD_Ivmovq, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0920 */ { UD_Imovq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0921 */ { UD_Imovq, O_Q, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0922 */ { UD_Imovsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0923 */ { UD_Imovsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0924 */ { UD_Imovsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0925 */ { UD_Imovsd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0926 */ { UD_Imovsd, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0927 */ { UD_Imovsq, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0928 */ { UD_Imovss, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0929 */ { UD_Imovss, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0930 */ { UD_Imovsx, O_Gv, O_Eb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0931 */ { UD_Imovsx, O_Gy, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0932 */ { UD_Imovupd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0933 */ { UD_Ivmovupd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0934 */ { UD_Imovupd, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0935 */ { UD_Ivmovupd, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0936 */ { UD_Imovups, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0937 */ { UD_Ivmovups, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0938 */ { UD_Imovups, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0939 */ { UD_Ivmovups, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0940 */ { UD_Imovzx, O_Gv, O_Eb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0941 */ { UD_Imovzx, O_Gy, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0942 */ { UD_Imul, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0943 */ { UD_Imul, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0944 */ { UD_Imulpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0945 */ { UD_Ivmulpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0946 */ { UD_Imulps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0947 */ { UD_Ivmulps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0948 */ { UD_Imulsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0949 */ { UD_Ivmulsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0950 */ { UD_Imulss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0951 */ { UD_Ivmulss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0952 */ { UD_Imwait, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0953 */ { UD_Ineg, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0954 */ { UD_Ineg, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0955 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0956 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0957 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0958 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0959 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0960 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0961 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0962 */ { UD_Inot, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0963 */ { UD_Inot, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0964 */ { UD_Ior, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0965 */ { UD_Ior, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0966 */ { UD_Ior, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0967 */ { UD_Ior, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0968 */ { UD_Ior, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0969 */ { UD_Ior, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0970 */ { UD_Ior, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0971 */ { UD_Ior, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0972 */ { UD_Ior, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0973 */ { UD_Ior, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0974 */ { UD_Iorpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0975 */ { UD_Ivorpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0976 */ { UD_Iorps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0977 */ { UD_Ivorps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0978 */ { UD_Iout, O_Ib, O_AL, O_NONE, O_NONE, P_none },
+ /* 0979 */ { UD_Iout, O_Ib, O_eAX, O_NONE, O_NONE, P_oso },
+ /* 0980 */ { UD_Iout, O_DX, O_AL, O_NONE, O_NONE, P_none },
+ /* 0981 */ { UD_Iout, O_DX, O_eAX, O_NONE, O_NONE, P_oso },
+ /* 0982 */ { UD_Ioutsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0983 */ { UD_Ioutsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0984 */ { UD_Ioutsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0985 */ { UD_Ipacksswb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0986 */ { UD_Ivpacksswb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0987 */ { UD_Ipacksswb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0988 */ { UD_Ipackssdw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0989 */ { UD_Ivpackssdw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0990 */ { UD_Ipackssdw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0991 */ { UD_Ipackuswb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0992 */ { UD_Ivpackuswb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0993 */ { UD_Ipackuswb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0994 */ { UD_Ipaddb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0995 */ { UD_Ivpaddb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0996 */ { UD_Ipaddb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0997 */ { UD_Ipaddw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0998 */ { UD_Ipaddw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0999 */ { UD_Ivpaddw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1000 */ { UD_Ipaddd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1001 */ { UD_Ipaddd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1002 */ { UD_Ivpaddd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1003 */ { UD_Ipaddsb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1004 */ { UD_Ipaddsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1005 */ { UD_Ivpaddsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1006 */ { UD_Ipaddsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1007 */ { UD_Ipaddsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1008 */ { UD_Ivpaddsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1009 */ { UD_Ipaddusb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1010 */ { UD_Ipaddusb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1011 */ { UD_Ivpaddusb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1012 */ { UD_Ipaddusw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1013 */ { UD_Ipaddusw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1014 */ { UD_Ivpaddusw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1015 */ { UD_Ipand, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1016 */ { UD_Ivpand, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1017 */ { UD_Ipand, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1018 */ { UD_Ipandn, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1019 */ { UD_Ivpandn, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1020 */ { UD_Ipandn, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1021 */ { UD_Ipavgb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1022 */ { UD_Ivpavgb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1023 */ { UD_Ipavgb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1024 */ { UD_Ipavgw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1025 */ { UD_Ivpavgw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1026 */ { UD_Ipavgw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1027 */ { UD_Ipcmpeqb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1028 */ { UD_Ipcmpeqb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1029 */ { UD_Ivpcmpeqb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1030 */ { UD_Ipcmpeqw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1031 */ { UD_Ipcmpeqw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1032 */ { UD_Ivpcmpeqw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1033 */ { UD_Ipcmpeqd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1034 */ { UD_Ipcmpeqd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1035 */ { UD_Ivpcmpeqd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1036 */ { UD_Ipcmpgtb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1037 */ { UD_Ivpcmpgtb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1038 */ { UD_Ipcmpgtb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1039 */ { UD_Ipcmpgtw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1040 */ { UD_Ivpcmpgtw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1041 */ { UD_Ipcmpgtw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1042 */ { UD_Ipcmpgtd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1043 */ { UD_Ivpcmpgtd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1044 */ { UD_Ipcmpgtd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1045 */ { UD_Ipextrb, O_MbRv, O_V, O_Ib, O_NONE, P_aso|P_rexx|P_rexr|P_rexb|P_def64 },
+ /* 1046 */ { UD_Ivpextrb, O_MbRv, O_Vx, O_Ib, O_NONE, P_aso|P_rexx|P_rexr|P_rexb|P_def64 },
+ /* 1047 */ { UD_Ipextrd, O_Ed, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1048 */ { UD_Ivpextrd, O_Ed, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1049 */ { UD_Ipextrd, O_Ed, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1050 */ { UD_Ivpextrd, O_Ed, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1051 */ { UD_Ipextrq, O_Eq, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexb|P_def64 },
+ /* 1052 */ { UD_Ivpextrq, O_Eq, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexb|P_def64 },
+ /* 1053 */ { UD_Ipextrw, O_Gd, O_U, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexb },
+ /* 1054 */ { UD_Ivpextrw, O_Gd, O_Ux, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexb },
+ /* 1055 */ { UD_Ipextrw, O_Gd, O_N, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1056 */ { UD_Ipextrw, O_MwRd, O_V, O_Ib, O_NONE, P_aso|P_rexw|P_rexx|P_rexr|P_rexb },
+ /* 1057 */ { UD_Ivpextrw, O_MwRd, O_Vx, O_Ib, O_NONE, P_aso|P_rexw|P_rexx|P_rexr|P_rexb },
+ /* 1058 */ { UD_Ipinsrb, O_V, O_MbRd, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1059 */ { UD_Ipinsrw, O_P, O_MwRy, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1060 */ { UD_Ipinsrw, O_V, O_MwRy, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1061 */ { UD_Ivpinsrw, O_Vx, O_MwRy, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1062 */ { UD_Ipinsrd, O_V, O_Ed, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1063 */ { UD_Ipinsrd, O_V, O_Ed, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1064 */ { UD_Ipinsrq, O_V, O_Eq, O_Ib, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1065 */ { UD_Ivpinsrb, O_V, O_H, O_MbRd, O_Ib, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1066 */ { UD_Ivpinsrd, O_V, O_H, O_Ed, O_Ib, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1067 */ { UD_Ivpinsrd, O_V, O_H, O_Ed, O_Ib, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1068 */ { UD_Ivpinsrq, O_V, O_H, O_Eq, O_Ib, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1069 */ { UD_Ipmaddwd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1070 */ { UD_Ipmaddwd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1071 */ { UD_Ivpmaddwd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1072 */ { UD_Ipmaxsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1073 */ { UD_Ivpmaxsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1074 */ { UD_Ipmaxsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1075 */ { UD_Ipmaxub, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1076 */ { UD_Ipmaxub, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1077 */ { UD_Ivpmaxub, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1078 */ { UD_Ipminsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1079 */ { UD_Ivpminsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1080 */ { UD_Ipminsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1081 */ { UD_Ipminub, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1082 */ { UD_Ivpminub, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1083 */ { UD_Ipminub, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1084 */ { UD_Ipmovmskb, O_Gd, O_U, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexb },
+ /* 1085 */ { UD_Ivpmovmskb, O_Gd, O_Ux, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexb },
+ /* 1086 */ { UD_Ipmovmskb, O_Gd, O_N, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexb },
+ /* 1087 */ { UD_Ipmulhuw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1088 */ { UD_Ipmulhuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1089 */ { UD_Ivpmulhuw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1090 */ { UD_Ipmulhw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1091 */ { UD_Ivpmulhw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1092 */ { UD_Ipmulhw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1093 */ { UD_Ipmullw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1094 */ { UD_Ipmullw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1095 */ { UD_Ivpmullw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1096 */ { UD_Ipop, O_ES, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1097 */ { UD_Ipop, O_SS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1098 */ { UD_Ipop, O_DS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1099 */ { UD_Ipop, O_GS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1100 */ { UD_Ipop, O_FS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1101 */ { UD_Ipop, O_R0v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1102 */ { UD_Ipop, O_R1v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1103 */ { UD_Ipop, O_R2v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1104 */ { UD_Ipop, O_R3v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1105 */ { UD_Ipop, O_R4v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1106 */ { UD_Ipop, O_R5v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1107 */ { UD_Ipop, O_R6v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1108 */ { UD_Ipop, O_R7v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1109 */ { UD_Ipop, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1110 */ { UD_Ipopa, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1111 */ { UD_Ipopad, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1112 */ { UD_Ipopfw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1113 */ { UD_Ipopfd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1114 */ { UD_Ipopfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1115 */ { UD_Ipopfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1116 */ { UD_Ipor, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1117 */ { UD_Ivpor, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1118 */ { UD_Ipor, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1119 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1120 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1121 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1122 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1123 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1124 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1125 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1126 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1127 */ { UD_Iprefetchnta, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1128 */ { UD_Iprefetcht0, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1129 */ { UD_Iprefetcht1, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1130 */ { UD_Iprefetcht2, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1131 */ { UD_Ipsadbw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1132 */ { UD_Ivpsadbw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1133 */ { UD_Ipsadbw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1134 */ { UD_Ipshufw, O_P, O_Q, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1135 */ { UD_Ipsllw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1136 */ { UD_Ipsllw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1137 */ { UD_Ipsllw, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1138 */ { UD_Ipsllw, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1139 */ { UD_Ipslld, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1140 */ { UD_Ipslld, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1141 */ { UD_Ipslld, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1142 */ { UD_Ipslld, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1143 */ { UD_Ipsllq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1144 */ { UD_Ipsllq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1145 */ { UD_Ipsllq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1146 */ { UD_Ipsllq, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1147 */ { UD_Ipsraw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1148 */ { UD_Ipsraw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1149 */ { UD_Ivpsraw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1150 */ { UD_Ipsraw, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1151 */ { UD_Ivpsraw, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1152 */ { UD_Ipsraw, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1153 */ { UD_Ipsrad, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1154 */ { UD_Ipsrad, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1155 */ { UD_Ivpsrad, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1156 */ { UD_Ipsrad, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1157 */ { UD_Ipsrad, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1158 */ { UD_Ivpsrad, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1159 */ { UD_Ipsrlw, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1160 */ { UD_Ipsrlw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1161 */ { UD_Ipsrlw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1162 */ { UD_Ivpsrlw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1163 */ { UD_Ipsrlw, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1164 */ { UD_Ivpsrlw, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1165 */ { UD_Ipsrld, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1166 */ { UD_Ipsrld, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1167 */ { UD_Ipsrld, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1168 */ { UD_Ivpsrld, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1169 */ { UD_Ipsrld, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1170 */ { UD_Ivpsrld, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1171 */ { UD_Ipsrlq, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1172 */ { UD_Ipsrlq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1173 */ { UD_Ipsrlq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1174 */ { UD_Ivpsrlq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1175 */ { UD_Ipsrlq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1176 */ { UD_Ivpsrlq, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1177 */ { UD_Ipsubb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1178 */ { UD_Ivpsubb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1179 */ { UD_Ipsubb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1180 */ { UD_Ipsubw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1181 */ { UD_Ivpsubw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1182 */ { UD_Ipsubw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1183 */ { UD_Ipsubd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1184 */ { UD_Ipsubd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1185 */ { UD_Ivpsubd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1186 */ { UD_Ipsubsb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1187 */ { UD_Ipsubsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1188 */ { UD_Ivpsubsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1189 */ { UD_Ipsubsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1190 */ { UD_Ipsubsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1191 */ { UD_Ivpsubsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1192 */ { UD_Ipsubusb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1193 */ { UD_Ipsubusb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1194 */ { UD_Ivpsubusb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1195 */ { UD_Ipsubusw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1196 */ { UD_Ipsubusw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1197 */ { UD_Ivpsubusw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1198 */ { UD_Ipunpckhbw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1199 */ { UD_Ivpunpckhbw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1200 */ { UD_Ipunpckhbw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1201 */ { UD_Ipunpckhwd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1202 */ { UD_Ivpunpckhwd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1203 */ { UD_Ipunpckhwd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1204 */ { UD_Ipunpckhdq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1205 */ { UD_Ivpunpckhdq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1206 */ { UD_Ipunpckhdq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1207 */ { UD_Ipunpcklbw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1208 */ { UD_Ivpunpcklbw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1209 */ { UD_Ipunpcklbw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1210 */ { UD_Ipunpcklwd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1211 */ { UD_Ivpunpcklwd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1212 */ { UD_Ipunpcklwd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1213 */ { UD_Ipunpckldq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1214 */ { UD_Ivpunpckldq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1215 */ { UD_Ipunpckldq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1216 */ { UD_Ipi2fw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1217 */ { UD_Ipi2fd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1218 */ { UD_Ipf2iw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1219 */ { UD_Ipf2id, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1220 */ { UD_Ipfnacc, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1221 */ { UD_Ipfpnacc, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1222 */ { UD_Ipfcmpge, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1223 */ { UD_Ipfmin, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1224 */ { UD_Ipfrcp, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1225 */ { UD_Ipfrsqrt, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1226 */ { UD_Ipfsub, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1227 */ { UD_Ipfadd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1228 */ { UD_Ipfcmpgt, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1229 */ { UD_Ipfmax, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1230 */ { UD_Ipfrcpit1, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1231 */ { UD_Ipfrsqit1, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1232 */ { UD_Ipfsubr, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1233 */ { UD_Ipfacc, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1234 */ { UD_Ipfcmpeq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1235 */ { UD_Ipfmul, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1236 */ { UD_Ipfrcpit2, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1237 */ { UD_Ipmulhrw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1238 */ { UD_Ipswapd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1239 */ { UD_Ipavgusb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1240 */ { UD_Ipush, O_ES, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1241 */ { UD_Ipush, O_CS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1242 */ { UD_Ipush, O_SS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1243 */ { UD_Ipush, O_DS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1244 */ { UD_Ipush, O_GS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1245 */ { UD_Ipush, O_FS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1246 */ { UD_Ipush, O_R0v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1247 */ { UD_Ipush, O_R1v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1248 */ { UD_Ipush, O_R2v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1249 */ { UD_Ipush, O_R3v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1250 */ { UD_Ipush, O_R4v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1251 */ { UD_Ipush, O_R5v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1252 */ { UD_Ipush, O_R6v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1253 */ { UD_Ipush, O_R7v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1254 */ { UD_Ipush, O_sIz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1255 */ { UD_Ipush, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1256 */ { UD_Ipush, O_sIb, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1257 */ { UD_Ipusha, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1258 */ { UD_Ipushad, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1259 */ { UD_Ipushfw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1260 */ { UD_Ipushfw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_def64 },
+ /* 1261 */ { UD_Ipushfd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1262 */ { UD_Ipushfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_def64 },
+ /* 1263 */ { UD_Ipushfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_def64 },
+ /* 1264 */ { UD_Ipxor, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1265 */ { UD_Ivpxor, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1266 */ { UD_Ipxor, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1267 */ { UD_Ircl, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1268 */ { UD_Ircl, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1269 */ { UD_Ircl, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1270 */ { UD_Ircl, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1271 */ { UD_Ircl, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1272 */ { UD_Ircl, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1273 */ { UD_Ircr, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1274 */ { UD_Ircr, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1275 */ { UD_Ircr, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1276 */ { UD_Ircr, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1277 */ { UD_Ircr, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1278 */ { UD_Ircr, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1279 */ { UD_Irol, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1280 */ { UD_Irol, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1281 */ { UD_Irol, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1282 */ { UD_Irol, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1283 */ { UD_Irol, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1284 */ { UD_Irol, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1285 */ { UD_Iror, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1286 */ { UD_Iror, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1287 */ { UD_Iror, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1288 */ { UD_Iror, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1289 */ { UD_Iror, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1290 */ { UD_Iror, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1291 */ { UD_Ircpps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1292 */ { UD_Ivrcpps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1293 */ { UD_Ircpss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1294 */ { UD_Ivrcpss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1295 */ { UD_Irdmsr, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1296 */ { UD_Irdpmc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1297 */ { UD_Irdtsc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1298 */ { UD_Irdtscp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1299 */ { UD_Irepne, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1300 */ { UD_Irep, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1301 */ { UD_Iret, O_Iw, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1302 */ { UD_Iret, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1303 */ { UD_Iretf, O_Iw, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1304 */ { UD_Iretf, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1305 */ { UD_Irsm, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1306 */ { UD_Irsqrtps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1307 */ { UD_Ivrsqrtps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1308 */ { UD_Irsqrtss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1309 */ { UD_Ivrsqrtss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1310 */ { UD_Isahf, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1311 */ { UD_Isalc, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1312 */ { UD_Isar, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1313 */ { UD_Isar, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1314 */ { UD_Isar, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1315 */ { UD_Isar, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1316 */ { UD_Isar, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1317 */ { UD_Isar, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1318 */ { UD_Ishl, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1319 */ { UD_Ishl, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1320 */ { UD_Ishl, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1321 */ { UD_Ishl, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1322 */ { UD_Ishl, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1323 */ { UD_Ishl, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1324 */ { UD_Ishl, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1325 */ { UD_Ishl, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1326 */ { UD_Ishl, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1327 */ { UD_Ishl, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1328 */ { UD_Ishl, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1329 */ { UD_Ishl, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1330 */ { UD_Ishr, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1331 */ { UD_Ishr, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1332 */ { UD_Ishr, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1333 */ { UD_Ishr, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1334 */ { UD_Ishr, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1335 */ { UD_Ishr, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1336 */ { UD_Isbb, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1337 */ { UD_Isbb, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1338 */ { UD_Isbb, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1339 */ { UD_Isbb, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1340 */ { UD_Isbb, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1341 */ { UD_Isbb, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1342 */ { UD_Isbb, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1343 */ { UD_Isbb, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1344 */ { UD_Isbb, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 1345 */ { UD_Isbb, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1346 */ { UD_Iscasb, O_NONE, O_NONE, O_NONE, O_NONE, P_strz },
+ /* 1347 */ { UD_Iscasw, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw },
+ /* 1348 */ { UD_Iscasd, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw },
+ /* 1349 */ { UD_Iscasq, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw },
+ /* 1350 */ { UD_Iseto, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1351 */ { UD_Isetno, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1352 */ { UD_Isetb, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1353 */ { UD_Isetae, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1354 */ { UD_Isetz, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1355 */ { UD_Isetnz, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1356 */ { UD_Isetbe, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1357 */ { UD_Iseta, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1358 */ { UD_Isets, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1359 */ { UD_Isetns, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1360 */ { UD_Isetp, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1361 */ { UD_Isetnp, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1362 */ { UD_Isetl, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1363 */ { UD_Isetge, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1364 */ { UD_Isetle, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1365 */ { UD_Isetg, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1366 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1367 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1368 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1369 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1370 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1371 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1372 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1373 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1374 */ { UD_Isgdt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1375 */ { UD_Ishld, O_Ev, O_Gv, O_Ib, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1376 */ { UD_Ishld, O_Ev, O_Gv, O_CL, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1377 */ { UD_Ishrd, O_Ev, O_Gv, O_Ib, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1378 */ { UD_Ishrd, O_Ev, O_Gv, O_CL, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1379 */ { UD_Ishufpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1380 */ { UD_Ivshufpd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1381 */ { UD_Ishufps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1382 */ { UD_Ivshufps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1383 */ { UD_Isidt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1384 */ { UD_Isldt, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1385 */ { UD_Ismsw, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1386 */ { UD_Ismsw, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1387 */ { UD_Isqrtps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1388 */ { UD_Ivsqrtps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1389 */ { UD_Isqrtpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1390 */ { UD_Ivsqrtpd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1391 */ { UD_Isqrtsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1392 */ { UD_Ivsqrtsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1393 */ { UD_Isqrtss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1394 */ { UD_Ivsqrtss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1395 */ { UD_Istc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1396 */ { UD_Istd, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1397 */ { UD_Istgi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1398 */ { UD_Isti, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1399 */ { UD_Iskinit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1400 */ { UD_Istmxcsr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1401 */ { UD_Ivstmxcsr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1402 */ { UD_Istosb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 1403 */ { UD_Istosw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 1404 */ { UD_Istosd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 1405 */ { UD_Istosq, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 1406 */ { UD_Istr, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1407 */ { UD_Isub, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1408 */ { UD_Isub, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1409 */ { UD_Isub, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1410 */ { UD_Isub, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1411 */ { UD_Isub, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1412 */ { UD_Isub, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1413 */ { UD_Isub, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1414 */ { UD_Isub, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1415 */ { UD_Isub, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 1416 */ { UD_Isub, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1417 */ { UD_Isubpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1418 */ { UD_Ivsubpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1419 */ { UD_Isubps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1420 */ { UD_Ivsubps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1421 */ { UD_Isubsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1422 */ { UD_Ivsubsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1423 */ { UD_Isubss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1424 */ { UD_Ivsubss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1425 */ { UD_Iswapgs, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1426 */ { UD_Isyscall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1427 */ { UD_Isysenter, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1428 */ { UD_Isysenter, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1429 */ { UD_Isysexit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1430 */ { UD_Isysexit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1431 */ { UD_Isysret, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1432 */ { UD_Itest, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1433 */ { UD_Itest, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1434 */ { UD_Itest, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1435 */ { UD_Itest, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1436 */ { UD_Itest, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1437 */ { UD_Itest, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1438 */ { UD_Itest, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1439 */ { UD_Itest, O_Ev, O_Iz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1440 */ { UD_Iucomisd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1441 */ { UD_Ivucomisd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1442 */ { UD_Iucomiss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1443 */ { UD_Ivucomiss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1444 */ { UD_Iud2, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1445 */ { UD_Iunpckhpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1446 */ { UD_Ivunpckhpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1447 */ { UD_Iunpckhps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1448 */ { UD_Ivunpckhps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1449 */ { UD_Iunpcklps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1450 */ { UD_Ivunpcklps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1451 */ { UD_Iunpcklpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1452 */ { UD_Ivunpcklpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1453 */ { UD_Iverr, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1454 */ { UD_Iverw, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1455 */ { UD_Ivmcall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1456 */ { UD_Irdrand, O_R, O_NONE, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1457 */ { UD_Ivmclear, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1458 */ { UD_Ivmxon, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1459 */ { UD_Ivmptrld, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1460 */ { UD_Ivmptrst, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1461 */ { UD_Ivmlaunch, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1462 */ { UD_Ivmresume, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1463 */ { UD_Ivmxoff, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1464 */ { UD_Ivmread, O_Ey, O_Gy, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1465 */ { UD_Ivmwrite, O_Gy, O_Ey, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1466 */ { UD_Ivmrun, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1467 */ { UD_Ivmmcall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1468 */ { UD_Ivmload, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1469 */ { UD_Ivmsave, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1470 */ { UD_Iwait, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1471 */ { UD_Iwbinvd, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1472 */ { UD_Iwrmsr, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1473 */ { UD_Ixadd, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexx|P_rexb },
+ /* 1474 */ { UD_Ixadd, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1475 */ { UD_Ixchg, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1476 */ { UD_Ixchg, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1477 */ { UD_Ixchg, O_R0v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1478 */ { UD_Ixchg, O_R1v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1479 */ { UD_Ixchg, O_R2v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1480 */ { UD_Ixchg, O_R3v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1481 */ { UD_Ixchg, O_R4v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1482 */ { UD_Ixchg, O_R5v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1483 */ { UD_Ixchg, O_R6v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1484 */ { UD_Ixchg, O_R7v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1485 */ { UD_Ixgetbv, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1486 */ { UD_Ixlatb, O_NONE, O_NONE, O_NONE, O_NONE, P_rexw|P_seg },
+ /* 1487 */ { UD_Ixor, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1488 */ { UD_Ixor, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1489 */ { UD_Ixor, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1490 */ { UD_Ixor, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1491 */ { UD_Ixor, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1492 */ { UD_Ixor, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1493 */ { UD_Ixor, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1494 */ { UD_Ixor, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1495 */ { UD_Ixor, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 1496 */ { UD_Ixor, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1497 */ { UD_Ixorpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1498 */ { UD_Ivxorpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1499 */ { UD_Ixorps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1500 */ { UD_Ivxorps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1501 */ { UD_Ixcryptecb, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1502 */ { UD_Ixcryptcbc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1503 */ { UD_Ixcryptctr, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1504 */ { UD_Ixcryptcfb, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1505 */ { UD_Ixcryptofb, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1506 */ { UD_Ixrstor, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1507 */ { UD_Ixsave, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1508 */ { UD_Ixsetbv, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1509 */ { UD_Ixsha1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1510 */ { UD_Ixsha256, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1511 */ { UD_Ixstore, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1512 */ { UD_Ipclmulqdq, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1513 */ { UD_Ivpclmulqdq, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1514 */ { UD_Igetsec, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1515 */ { UD_Imovdqa, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1516 */ { UD_Ivmovdqa, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1517 */ { UD_Imovdqa, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1518 */ { UD_Ivmovdqa, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1519 */ { UD_Imaskmovdqu, O_V, O_U, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1520 */ { UD_Ivmaskmovdqu, O_Vx, O_Ux, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1521 */ { UD_Imovdq2q, O_P, O_U, O_NONE, O_NONE, P_aso|P_rexb },
+ /* 1522 */ { UD_Imovdqu, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1523 */ { UD_Ivmovdqu, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1524 */ { UD_Imovdqu, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1525 */ { UD_Ivmovdqu, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1526 */ { UD_Imovq2dq, O_V, O_N, O_NONE, O_NONE, P_aso|P_rexr },
+ /* 1527 */ { UD_Ipaddq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1528 */ { UD_Ipaddq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1529 */ { UD_Ivpaddq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1530 */ { UD_Ipsubq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1531 */ { UD_Ivpsubq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1532 */ { UD_Ipsubq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1533 */ { UD_Ipmuludq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1534 */ { UD_Ipmuludq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1535 */ { UD_Ipshufhw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1536 */ { UD_Ivpshufhw, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1537 */ { UD_Ipshuflw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1538 */ { UD_Ivpshuflw, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1539 */ { UD_Ipshufd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1540 */ { UD_Ivpshufd, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1541 */ { UD_Ipslldq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1542 */ { UD_Ivpslldq, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1543 */ { UD_Ipsrldq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1544 */ { UD_Ivpsrldq, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1545 */ { UD_Ipunpckhqdq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1546 */ { UD_Ivpunpckhqdq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1547 */ { UD_Ipunpcklqdq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1548 */ { UD_Ivpunpcklqdq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1549 */ { UD_Ihaddpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1550 */ { UD_Ivhaddpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1551 */ { UD_Ihaddps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1552 */ { UD_Ivhaddps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1553 */ { UD_Ihsubpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1554 */ { UD_Ivhsubpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1555 */ { UD_Ihsubps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1556 */ { UD_Ivhsubps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1557 */ { UD_Iinsertps, O_V, O_Md, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1558 */ { UD_Ivinsertps, O_Vx, O_Hx, O_Md, O_Ib, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1559 */ { UD_Ilddqu, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1560 */ { UD_Ivlddqu, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1561 */ { UD_Imovddup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1562 */ { UD_Ivmovddup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1563 */ { UD_Imovddup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1564 */ { UD_Ivmovddup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1565 */ { UD_Imovshdup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1566 */ { UD_Ivmovshdup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1567 */ { UD_Imovshdup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1568 */ { UD_Ivmovshdup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1569 */ { UD_Imovsldup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1570 */ { UD_Ivmovsldup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1571 */ { UD_Imovsldup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1572 */ { UD_Ivmovsldup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1573 */ { UD_Ipabsb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1574 */ { UD_Ipabsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1575 */ { UD_Ivpabsb, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1576 */ { UD_Ipabsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1577 */ { UD_Ipabsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1578 */ { UD_Ivpabsw, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1579 */ { UD_Ipabsd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1580 */ { UD_Ipabsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1581 */ { UD_Ivpabsd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1582 */ { UD_Ipshufb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1583 */ { UD_Ipshufb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1584 */ { UD_Ivpshufb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1585 */ { UD_Iphaddw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1586 */ { UD_Iphaddw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1587 */ { UD_Ivphaddw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1588 */ { UD_Iphaddd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1589 */ { UD_Iphaddd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1590 */ { UD_Ivphaddd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1591 */ { UD_Iphaddsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1592 */ { UD_Iphaddsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1593 */ { UD_Ivphaddsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1594 */ { UD_Ipmaddubsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1595 */ { UD_Ipmaddubsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1596 */ { UD_Ivpmaddubsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1597 */ { UD_Iphsubw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1598 */ { UD_Iphsubw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1599 */ { UD_Ivphsubw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1600 */ { UD_Iphsubd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1601 */ { UD_Iphsubd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1602 */ { UD_Ivphsubd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1603 */ { UD_Iphsubsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1604 */ { UD_Iphsubsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1605 */ { UD_Ivphsubsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1606 */ { UD_Ipsignb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1607 */ { UD_Ipsignb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1608 */ { UD_Ivpsignb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1609 */ { UD_Ipsignd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1610 */ { UD_Ipsignd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1611 */ { UD_Ivpsignd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1612 */ { UD_Ipsignw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1613 */ { UD_Ipsignw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1614 */ { UD_Ivpsignw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1615 */ { UD_Ipmulhrsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1616 */ { UD_Ipmulhrsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1617 */ { UD_Ivpmulhrsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1618 */ { UD_Ipalignr, O_P, O_Q, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1619 */ { UD_Ipalignr, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1620 */ { UD_Ivpalignr, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1621 */ { UD_Ipblendvb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1622 */ { UD_Ipmuldq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1623 */ { UD_Ivpmuldq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1624 */ { UD_Ipminsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1625 */ { UD_Ivpminsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1626 */ { UD_Ipminsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1627 */ { UD_Ivpminsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1628 */ { UD_Ipminuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1629 */ { UD_Ivpminuw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1630 */ { UD_Ipminud, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1631 */ { UD_Ivpminud, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1632 */ { UD_Ipmaxsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1633 */ { UD_Ivpmaxsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1634 */ { UD_Ipmaxsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1635 */ { UD_Ivpmaxsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1636 */ { UD_Ipmaxud, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1637 */ { UD_Ivpmaxud, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1638 */ { UD_Ipmaxuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1639 */ { UD_Ivpmaxuw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1640 */ { UD_Ipmulld, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1641 */ { UD_Ivpmulld, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1642 */ { UD_Iphminposuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1643 */ { UD_Ivphminposuw, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1644 */ { UD_Iroundps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1645 */ { UD_Ivroundps, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1646 */ { UD_Iroundpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1647 */ { UD_Ivroundpd, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1648 */ { UD_Iroundss, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1649 */ { UD_Ivroundss, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1650 */ { UD_Iroundsd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1651 */ { UD_Ivroundsd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1652 */ { UD_Iblendpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1653 */ { UD_Ivblendpd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1654 */ { UD_Iblendps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1655 */ { UD_Ivblendps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1656 */ { UD_Iblendvpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1657 */ { UD_Iblendvps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1658 */ { UD_Ibound, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso },
+ /* 1659 */ { UD_Ibsf, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1660 */ { UD_Ibsr, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1661 */ { UD_Ibswap, O_R0y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1662 */ { UD_Ibswap, O_R1y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1663 */ { UD_Ibswap, O_R2y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1664 */ { UD_Ibswap, O_R3y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1665 */ { UD_Ibswap, O_R4y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1666 */ { UD_Ibswap, O_R5y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1667 */ { UD_Ibswap, O_R6y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1668 */ { UD_Ibswap, O_R7y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1669 */ { UD_Ibt, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1670 */ { UD_Ibt, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1671 */ { UD_Ibtc, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1672 */ { UD_Ibtc, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1673 */ { UD_Ibtr, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1674 */ { UD_Ibtr, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1675 */ { UD_Ibts, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1676 */ { UD_Ibts, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1677 */ { UD_Ipblendw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1678 */ { UD_Ivpblendw, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1679 */ { UD_Impsadbw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1680 */ { UD_Ivmpsadbw, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1681 */ { UD_Imovntdqa, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1682 */ { UD_Ivmovntdqa, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb|P_vexl },
+ /* 1683 */ { UD_Ipackusdw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1684 */ { UD_Ivpackusdw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb|P_vexl },
+ /* 1685 */ { UD_Ipmovsxbw, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1686 */ { UD_Ivpmovsxbw, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1687 */ { UD_Ipmovsxbd, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1688 */ { UD_Ivpmovsxbd, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1689 */ { UD_Ipmovsxbq, O_V, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1690 */ { UD_Ivpmovsxbq, O_Vx, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1691 */ { UD_Ipmovsxwd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1692 */ { UD_Ivpmovsxwd, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1693 */ { UD_Ipmovsxwq, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1694 */ { UD_Ivpmovsxwq, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1695 */ { UD_Ipmovsxdq, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1696 */ { UD_Ipmovzxbw, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1697 */ { UD_Ivpmovzxbw, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1698 */ { UD_Ipmovzxbd, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1699 */ { UD_Ivpmovzxbd, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1700 */ { UD_Ipmovzxbq, O_V, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1701 */ { UD_Ivpmovzxbq, O_Vx, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1702 */ { UD_Ipmovzxwd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1703 */ { UD_Ivpmovzxwd, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1704 */ { UD_Ipmovzxwq, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1705 */ { UD_Ivpmovzxwq, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1706 */ { UD_Ipmovzxdq, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1707 */ { UD_Ivpmovzxdq, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1708 */ { UD_Ipcmpeqq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1709 */ { UD_Ivpcmpeqq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1710 */ { UD_Ipopcnt, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1711 */ { UD_Iptest, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1712 */ { UD_Ivptest, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb|P_vexl },
+ /* 1713 */ { UD_Ipcmpestri, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1714 */ { UD_Ivpcmpestri, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1715 */ { UD_Ipcmpestrm, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1716 */ { UD_Ivpcmpestrm, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1717 */ { UD_Ipcmpgtq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1718 */ { UD_Ivpcmpgtq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1719 */ { UD_Ipcmpistri, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1720 */ { UD_Ivpcmpistri, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1721 */ { UD_Ipcmpistrm, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1722 */ { UD_Ivpcmpistrm, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1723 */ { UD_Imovbe, O_Gv, O_Mv, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1724 */ { UD_Imovbe, O_Mv, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1725 */ { UD_Icrc32, O_Gy, O_Eb, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1726 */ { UD_Icrc32, O_Gy, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1727 */ { UD_Ivbroadcastss, O_V, O_Md, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1728 */ { UD_Ivbroadcastsd, O_Vqq, O_Mq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1729 */ { UD_Ivextractf128, O_Wdq, O_Vqq, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1730 */ { UD_Ivinsertf128, O_Vqq, O_Hqq, O_Wdq, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1731 */ { UD_Ivmaskmovps, O_V, O_H, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1732 */ { UD_Ivmaskmovps, O_M, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1733 */ { UD_Ivmaskmovpd, O_V, O_H, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1734 */ { UD_Ivmaskmovpd, O_M, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1735 */ { UD_Ivpermilpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1736 */ { UD_Ivpermilpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1737 */ { UD_Ivpermilps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1738 */ { UD_Ivpermilps, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1739 */ { UD_Ivperm2f128, O_Vqq, O_Hqq, O_Wqq, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1740 */ { UD_Ivtestps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1741 */ { UD_Ivtestpd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1742 */ { UD_Ivzeroupper, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1743 */ { UD_Ivzeroall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1744 */ { UD_Ivblendvpd, O_Vx, O_Hx, O_Wx, O_Lx, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1745 */ { UD_Ivblendvps, O_Vx, O_Hx, O_Wx, O_Lx, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1746 */ { UD_Ivmovsd, O_V, O_H, O_U, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1747 */ { UD_Ivmovsd, O_V, O_Mq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1748 */ { UD_Ivmovsd, O_U, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1749 */ { UD_Ivmovsd, O_Mq, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1750 */ { UD_Ivmovss, O_V, O_H, O_U, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1751 */ { UD_Ivmovss, O_V, O_Md, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1752 */ { UD_Ivmovss, O_U, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1753 */ { UD_Ivmovss, O_Md, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1754 */ { UD_Ivpblendvb, O_V, O_H, O_W, O_L, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1755 */ { UD_Ivpsllw, O_V, O_H, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1756 */ { UD_Ivpsllw, O_H, O_V, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1757 */ { UD_Ivpslld, O_V, O_H, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1758 */ { UD_Ivpslld, O_H, O_V, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1759 */ { UD_Ivpsllq, O_V, O_H, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1760 */ { UD_Ivpsllq, O_H, O_V, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+};
+
+
+const char* ud_mnemonics_str[] = {
+ "aaa",
+ "aad",
+ "aam",
+ "aas",
+ "adc",
+ "add",
+ "addpd",
+ "addps",
+ "addsd",
+ "addss",
+ "addsubpd",
+ "addsubps",
+ "aesdec",
+ "aesdeclast",
+ "aesenc",
+ "aesenclast",
+ "aesimc",
+ "aeskeygenassist",
+ "and",
+ "andnpd",
+ "andnps",
+ "andpd",
+ "andps",
+ "arpl",
+ "blendpd",
+ "blendps",
+ "blendvpd",
+ "blendvps",
+ "bound",
+ "bsf",
+ "bsr",
+ "bswap",
+ "bt",
+ "btc",
+ "btr",
+ "bts",
+ "call",
+ "cbw",
+ "cdq",
+ "cdqe",
+ "clc",
+ "cld",
+ "clflush",
+ "clgi",
+ "cli",
+ "clts",
+ "cmc",
+ "cmova",
+ "cmovae",
+ "cmovb",
+ "cmovbe",
+ "cmovg",
+ "cmovge",
+ "cmovl",
+ "cmovle",
+ "cmovno",
+ "cmovnp",
+ "cmovns",
+ "cmovnz",
+ "cmovo",
+ "cmovp",
+ "cmovs",
+ "cmovz",
+ "cmp",
+ "cmppd",
+ "cmpps",
+ "cmpsb",
+ "cmpsd",
+ "cmpsq",
+ "cmpss",
+ "cmpsw",
+ "cmpxchg",
+ "cmpxchg16b",
+ "cmpxchg8b",
+ "comisd",
+ "comiss",
+ "cpuid",
+ "cqo",
+ "crc32",
+ "cvtdq2pd",
+ "cvtdq2ps",
+ "cvtpd2dq",
+ "cvtpd2pi",
+ "cvtpd2ps",
+ "cvtpi2pd",
+ "cvtpi2ps",
+ "cvtps2dq",
+ "cvtps2pd",
+ "cvtps2pi",
+ "cvtsd2si",
+ "cvtsd2ss",
+ "cvtsi2sd",
+ "cvtsi2ss",
+ "cvtss2sd",
+ "cvtss2si",
+ "cvttpd2dq",
+ "cvttpd2pi",
+ "cvttps2dq",
+ "cvttps2pi",
+ "cvttsd2si",
+ "cvttss2si",
+ "cwd",
+ "cwde",
+ "daa",
+ "das",
+ "dec",
+ "div",
+ "divpd",
+ "divps",
+ "divsd",
+ "divss",
+ "dppd",
+ "dpps",
+ "emms",
+ "enter",
+ "extractps",
+ "f2xm1",
+ "fabs",
+ "fadd",
+ "faddp",
+ "fbld",
+ "fbstp",
+ "fchs",
+ "fclex",
+ "fcmovb",
+ "fcmovbe",
+ "fcmove",
+ "fcmovnb",
+ "fcmovnbe",
+ "fcmovne",
+ "fcmovnu",
+ "fcmovu",
+ "fcom",
+ "fcom2",
+ "fcomi",
+ "fcomip",
+ "fcomp",
+ "fcomp3",
+ "fcomp5",
+ "fcompp",
+ "fcos",
+ "fdecstp",
+ "fdiv",
+ "fdivp",
+ "fdivr",
+ "fdivrp",
+ "femms",
+ "ffree",
+ "ffreep",
+ "fiadd",
+ "ficom",
+ "ficomp",
+ "fidiv",
+ "fidivr",
+ "fild",
+ "fimul",
+ "fincstp",
+ "fist",
+ "fistp",
+ "fisttp",
+ "fisub",
+ "fisubr",
+ "fld",
+ "fld1",
+ "fldcw",
+ "fldenv",
+ "fldl2e",
+ "fldl2t",
+ "fldlg2",
+ "fldln2",
+ "fldpi",
+ "fldz",
+ "fmul",
+ "fmulp",
+ "fndisi",
+ "fneni",
+ "fninit",
+ "fnop",
+ "fnsave",
+ "fnsetpm",
+ "fnstcw",
+ "fnstenv",
+ "fnstsw",
+ "fpatan",
+ "fprem",
+ "fprem1",
+ "fptan",
+ "frndint",
+ "frstor",
+ "frstpm",
+ "fscale",
+ "fsin",
+ "fsincos",
+ "fsqrt",
+ "fst",
+ "fstp",
+ "fstp1",
+ "fstp8",
+ "fstp9",
+ "fsub",
+ "fsubp",
+ "fsubr",
+ "fsubrp",
+ "ftst",
+ "fucom",
+ "fucomi",
+ "fucomip",
+ "fucomp",
+ "fucompp",
+ "fxam",
+ "fxch",
+ "fxch4",
+ "fxch7",
+ "fxrstor",
+ "fxsave",
+ "fxtract",
+ "fyl2x",
+ "fyl2xp1",
+ "getsec",
+ "haddpd",
+ "haddps",
+ "hlt",
+ "hsubpd",
+ "hsubps",
+ "idiv",
+ "imul",
+ "in",
+ "inc",
+ "insb",
+ "insd",
+ "insertps",
+ "insw",
+ "int",
+ "int1",
+ "int3",
+ "into",
+ "invd",
+ "invept",
+ "invlpg",
+ "invlpga",
+ "invvpid",
+ "iretd",
+ "iretq",
+ "iretw",
+ "ja",
+ "jae",
+ "jb",
+ "jbe",
+ "jcxz",
+ "jecxz",
+ "jg",
+ "jge",
+ "jl",
+ "jle",
+ "jmp",
+ "jno",
+ "jnp",
+ "jns",
+ "jnz",
+ "jo",
+ "jp",
+ "jrcxz",
+ "js",
+ "jz",
+ "lahf",
+ "lar",
+ "lddqu",
+ "ldmxcsr",
+ "lds",
+ "lea",
+ "leave",
+ "les",
+ "lfence",
+ "lfs",
+ "lgdt",
+ "lgs",
+ "lidt",
+ "lldt",
+ "lmsw",
+ "lock",
+ "lodsb",
+ "lodsd",
+ "lodsq",
+ "lodsw",
+ "loop",
+ "loope",
+ "loopne",
+ "lsl",
+ "lss",
+ "ltr",
+ "maskmovdqu",
+ "maskmovq",
+ "maxpd",
+ "maxps",
+ "maxsd",
+ "maxss",
+ "mfence",
+ "minpd",
+ "minps",
+ "minsd",
+ "minss",
+ "monitor",
+ "montmul",
+ "mov",
+ "movapd",
+ "movaps",
+ "movbe",
+ "movd",
+ "movddup",
+ "movdq2q",
+ "movdqa",
+ "movdqu",
+ "movhlps",
+ "movhpd",
+ "movhps",
+ "movlhps",
+ "movlpd",
+ "movlps",
+ "movmskpd",
+ "movmskps",
+ "movntdq",
+ "movntdqa",
+ "movnti",
+ "movntpd",
+ "movntps",
+ "movntq",
+ "movq",
+ "movq2dq",
+ "movsb",
+ "movsd",
+ "movshdup",
+ "movsldup",
+ "movsq",
+ "movss",
+ "movsw",
+ "movsx",
+ "movsxd",
+ "movupd",
+ "movups",
+ "movzx",
+ "mpsadbw",
+ "mul",
+ "mulpd",
+ "mulps",
+ "mulsd",
+ "mulss",
+ "mwait",
+ "neg",
+ "nop",
+ "not",
+ "or",
+ "orpd",
+ "orps",
+ "out",
+ "outsb",
+ "outsd",
+ "outsw",
+ "pabsb",
+ "pabsd",
+ "pabsw",
+ "packssdw",
+ "packsswb",
+ "packusdw",
+ "packuswb",
+ "paddb",
+ "paddd",
+ "paddq",
+ "paddsb",
+ "paddsw",
+ "paddusb",
+ "paddusw",
+ "paddw",
+ "palignr",
+ "pand",
+ "pandn",
+ "pavgb",
+ "pavgusb",
+ "pavgw",
+ "pblendvb",
+ "pblendw",
+ "pclmulqdq",
+ "pcmpeqb",
+ "pcmpeqd",
+ "pcmpeqq",
+ "pcmpeqw",
+ "pcmpestri",
+ "pcmpestrm",
+ "pcmpgtb",
+ "pcmpgtd",
+ "pcmpgtq",
+ "pcmpgtw",
+ "pcmpistri",
+ "pcmpistrm",
+ "pextrb",
+ "pextrd",
+ "pextrq",
+ "pextrw",
+ "pf2id",
+ "pf2iw",
+ "pfacc",
+ "pfadd",
+ "pfcmpeq",
+ "pfcmpge",
+ "pfcmpgt",
+ "pfmax",
+ "pfmin",
+ "pfmul",
+ "pfnacc",
+ "pfpnacc",
+ "pfrcp",
+ "pfrcpit1",
+ "pfrcpit2",
+ "pfrsqit1",
+ "pfrsqrt",
+ "pfsub",
+ "pfsubr",
+ "phaddd",
+ "phaddsw",
+ "phaddw",
+ "phminposuw",
+ "phsubd",
+ "phsubsw",
+ "phsubw",
+ "pi2fd",
+ "pi2fw",
+ "pinsrb",
+ "pinsrd",
+ "pinsrq",
+ "pinsrw",
+ "pmaddubsw",
+ "pmaddwd",
+ "pmaxsb",
+ "pmaxsd",
+ "pmaxsw",
+ "pmaxub",
+ "pmaxud",
+ "pmaxuw",
+ "pminsb",
+ "pminsd",
+ "pminsw",
+ "pminub",
+ "pminud",
+ "pminuw",
+ "pmovmskb",
+ "pmovsxbd",
+ "pmovsxbq",
+ "pmovsxbw",
+ "pmovsxdq",
+ "pmovsxwd",
+ "pmovsxwq",
+ "pmovzxbd",
+ "pmovzxbq",
+ "pmovzxbw",
+ "pmovzxdq",
+ "pmovzxwd",
+ "pmovzxwq",
+ "pmuldq",
+ "pmulhrsw",
+ "pmulhrw",
+ "pmulhuw",
+ "pmulhw",
+ "pmulld",
+ "pmullw",
+ "pmuludq",
+ "pop",
+ "popa",
+ "popad",
+ "popcnt",
+ "popfd",
+ "popfq",
+ "popfw",
+ "por",
+ "prefetch",
+ "prefetchnta",
+ "prefetcht0",
+ "prefetcht1",
+ "prefetcht2",
+ "psadbw",
+ "pshufb",
+ "pshufd",
+ "pshufhw",
+ "pshuflw",
+ "pshufw",
+ "psignb",
+ "psignd",
+ "psignw",
+ "pslld",
+ "pslldq",
+ "psllq",
+ "psllw",
+ "psrad",
+ "psraw",
+ "psrld",
+ "psrldq",
+ "psrlq",
+ "psrlw",
+ "psubb",
+ "psubd",
+ "psubq",
+ "psubsb",
+ "psubsw",
+ "psubusb",
+ "psubusw",
+ "psubw",
+ "pswapd",
+ "ptest",
+ "punpckhbw",
+ "punpckhdq",
+ "punpckhqdq",
+ "punpckhwd",
+ "punpcklbw",
+ "punpckldq",
+ "punpcklqdq",
+ "punpcklwd",
+ "push",
+ "pusha",
+ "pushad",
+ "pushfd",
+ "pushfq",
+ "pushfw",
+ "pxor",
+ "rcl",
+ "rcpps",
+ "rcpss",
+ "rcr",
+ "rdmsr",
+ "rdpmc",
+ "rdrand",
+ "rdtsc",
+ "rdtscp",
+ "rep",
+ "repne",
+ "ret",
+ "retf",
+ "rol",
+ "ror",
+ "roundpd",
+ "roundps",
+ "roundsd",
+ "roundss",
+ "rsm",
+ "rsqrtps",
+ "rsqrtss",
+ "sahf",
+ "salc",
+ "sar",
+ "sbb",
+ "scasb",
+ "scasd",
+ "scasq",
+ "scasw",
+ "seta",
+ "setae",
+ "setb",
+ "setbe",
+ "setg",
+ "setge",
+ "setl",
+ "setle",
+ "setno",
+ "setnp",
+ "setns",
+ "setnz",
+ "seto",
+ "setp",
+ "sets",
+ "setz",
+ "sfence",
+ "sgdt",
+ "shl",
+ "shld",
+ "shr",
+ "shrd",
+ "shufpd",
+ "shufps",
+ "sidt",
+ "skinit",
+ "sldt",
+ "smsw",
+ "sqrtpd",
+ "sqrtps",
+ "sqrtsd",
+ "sqrtss",
+ "stc",
+ "std",
+ "stgi",
+ "sti",
+ "stmxcsr",
+ "stosb",
+ "stosd",
+ "stosq",
+ "stosw",
+ "str",
+ "sub",
+ "subpd",
+ "subps",
+ "subsd",
+ "subss",
+ "swapgs",
+ "syscall",
+ "sysenter",
+ "sysexit",
+ "sysret",
+ "test",
+ "ucomisd",
+ "ucomiss",
+ "ud2",
+ "unpckhpd",
+ "unpckhps",
+ "unpcklpd",
+ "unpcklps",
+ "vaddpd",
+ "vaddps",
+ "vaddsd",
+ "vaddss",
+ "vaddsubpd",
+ "vaddsubps",
+ "vaesdec",
+ "vaesdeclast",
+ "vaesenc",
+ "vaesenclast",
+ "vaesimc",
+ "vaeskeygenassist",
+ "vandnpd",
+ "vandnps",
+ "vandpd",
+ "vandps",
+ "vblendpd",
+ "vblendps",
+ "vblendvpd",
+ "vblendvps",
+ "vbroadcastsd",
+ "vbroadcastss",
+ "vcmppd",
+ "vcmpps",
+ "vcmpsd",
+ "vcmpss",
+ "vcomisd",
+ "vcomiss",
+ "vcvtdq2pd",
+ "vcvtdq2ps",
+ "vcvtpd2dq",
+ "vcvtpd2ps",
+ "vcvtps2dq",
+ "vcvtps2pd",
+ "vcvtsd2si",
+ "vcvtsd2ss",
+ "vcvtsi2sd",
+ "vcvtsi2ss",
+ "vcvtss2sd",
+ "vcvtss2si",
+ "vcvttpd2dq",
+ "vcvttps2dq",
+ "vcvttsd2si",
+ "vcvttss2si",
+ "vdivpd",
+ "vdivps",
+ "vdivsd",
+ "vdivss",
+ "vdppd",
+ "vdpps",
+ "verr",
+ "verw",
+ "vextractf128",
+ "vextractps",
+ "vhaddpd",
+ "vhaddps",
+ "vhsubpd",
+ "vhsubps",
+ "vinsertf128",
+ "vinsertps",
+ "vlddqu",
+ "vmaskmovdqu",
+ "vmaskmovpd",
+ "vmaskmovps",
+ "vmaxpd",
+ "vmaxps",
+ "vmaxsd",
+ "vmaxss",
+ "vmcall",
+ "vmclear",
+ "vminpd",
+ "vminps",
+ "vminsd",
+ "vminss",
+ "vmlaunch",
+ "vmload",
+ "vmmcall",
+ "vmovapd",
+ "vmovaps",
+ "vmovd",
+ "vmovddup",
+ "vmovdqa",
+ "vmovdqu",
+ "vmovhlps",
+ "vmovhpd",
+ "vmovhps",
+ "vmovlhps",
+ "vmovlpd",
+ "vmovlps",
+ "vmovmskpd",
+ "vmovmskps",
+ "vmovntdq",
+ "vmovntdqa",
+ "vmovntpd",
+ "vmovntps",
+ "vmovq",
+ "vmovsd",
+ "vmovshdup",
+ "vmovsldup",
+ "vmovss",
+ "vmovupd",
+ "vmovups",
+ "vmpsadbw",
+ "vmptrld",
+ "vmptrst",
+ "vmread",
+ "vmresume",
+ "vmrun",
+ "vmsave",
+ "vmulpd",
+ "vmulps",
+ "vmulsd",
+ "vmulss",
+ "vmwrite",
+ "vmxoff",
+ "vmxon",
+ "vorpd",
+ "vorps",
+ "vpabsb",
+ "vpabsd",
+ "vpabsw",
+ "vpackssdw",
+ "vpacksswb",
+ "vpackusdw",
+ "vpackuswb",
+ "vpaddb",
+ "vpaddd",
+ "vpaddq",
+ "vpaddsb",
+ "vpaddsw",
+ "vpaddusb",
+ "vpaddusw",
+ "vpaddw",
+ "vpalignr",
+ "vpand",
+ "vpandn",
+ "vpavgb",
+ "vpavgw",
+ "vpblendvb",
+ "vpblendw",
+ "vpclmulqdq",
+ "vpcmpeqb",
+ "vpcmpeqd",
+ "vpcmpeqq",
+ "vpcmpeqw",
+ "vpcmpestri",
+ "vpcmpestrm",
+ "vpcmpgtb",
+ "vpcmpgtd",
+ "vpcmpgtq",
+ "vpcmpgtw",
+ "vpcmpistri",
+ "vpcmpistrm",
+ "vperm2f128",
+ "vpermilpd",
+ "vpermilps",
+ "vpextrb",
+ "vpextrd",
+ "vpextrq",
+ "vpextrw",
+ "vphaddd",
+ "vphaddsw",
+ "vphaddw",
+ "vphminposuw",
+ "vphsubd",
+ "vphsubsw",
+ "vphsubw",
+ "vpinsrb",
+ "vpinsrd",
+ "vpinsrq",
+ "vpinsrw",
+ "vpmaddubsw",
+ "vpmaddwd",
+ "vpmaxsb",
+ "vpmaxsd",
+ "vpmaxsw",
+ "vpmaxub",
+ "vpmaxud",
+ "vpmaxuw",
+ "vpminsb",
+ "vpminsd",
+ "vpminsw",
+ "vpminub",
+ "vpminud",
+ "vpminuw",
+ "vpmovmskb",
+ "vpmovsxbd",
+ "vpmovsxbq",
+ "vpmovsxbw",
+ "vpmovsxwd",
+ "vpmovsxwq",
+ "vpmovzxbd",
+ "vpmovzxbq",
+ "vpmovzxbw",
+ "vpmovzxdq",
+ "vpmovzxwd",
+ "vpmovzxwq",
+ "vpmuldq",
+ "vpmulhrsw",
+ "vpmulhuw",
+ "vpmulhw",
+ "vpmulld",
+ "vpmullw",
+ "vpor",
+ "vpsadbw",
+ "vpshufb",
+ "vpshufd",
+ "vpshufhw",
+ "vpshuflw",
+ "vpsignb",
+ "vpsignd",
+ "vpsignw",
+ "vpslld",
+ "vpslldq",
+ "vpsllq",
+ "vpsllw",
+ "vpsrad",
+ "vpsraw",
+ "vpsrld",
+ "vpsrldq",
+ "vpsrlq",
+ "vpsrlw",
+ "vpsubb",
+ "vpsubd",
+ "vpsubq",
+ "vpsubsb",
+ "vpsubsw",
+ "vpsubusb",
+ "vpsubusw",
+ "vpsubw",
+ "vptest",
+ "vpunpckhbw",
+ "vpunpckhdq",
+ "vpunpckhqdq",
+ "vpunpckhwd",
+ "vpunpcklbw",
+ "vpunpckldq",
+ "vpunpcklqdq",
+ "vpunpcklwd",
+ "vpxor",
+ "vrcpps",
+ "vrcpss",
+ "vroundpd",
+ "vroundps",
+ "vroundsd",
+ "vroundss",
+ "vrsqrtps",
+ "vrsqrtss",
+ "vshufpd",
+ "vshufps",
+ "vsqrtpd",
+ "vsqrtps",
+ "vsqrtsd",
+ "vsqrtss",
+ "vstmxcsr",
+ "vsubpd",
+ "vsubps",
+ "vsubsd",
+ "vsubss",
+ "vtestpd",
+ "vtestps",
+ "vucomisd",
+ "vucomiss",
+ "vunpckhpd",
+ "vunpckhps",
+ "vunpcklpd",
+ "vunpcklps",
+ "vxorpd",
+ "vxorps",
+ "vzeroall",
+ "vzeroupper",
+ "wait",
+ "wbinvd",
+ "wrmsr",
+ "xadd",
+ "xchg",
+ "xcryptcbc",
+ "xcryptcfb",
+ "xcryptctr",
+ "xcryptecb",
+ "xcryptofb",
+ "xgetbv",
+ "xlatb",
+ "xor",
+ "xorpd",
+ "xorps",
+ "xrstor",
+ "xsave",
+ "xsetbv",
+ "xsha1",
+ "xsha256",
+ "xstore",
+ "invalid",
+ "3dnow",
+ "none",
+ "db",
+ "pause"
+};
diff --git a/ext/opcache/jit/libudis86/itab.h b/ext/opcache/jit/libudis86/itab.h
new file mode 100644
index 0000000000..3d54c43546
--- /dev/null
+++ b/ext/opcache/jit/libudis86/itab.h
@@ -0,0 +1,939 @@
+#ifndef UD_ITAB_H
+#define UD_ITAB_H
+
+/* itab.h -- generated by udis86:scripts/ud_itab.py, do no edit */
+
+/* ud_table_type -- lookup table types (see decode.c) */
+enum ud_table_type {
+ UD_TAB__OPC_VEX,
+ UD_TAB__OPC_TABLE,
+ UD_TAB__OPC_X87,
+ UD_TAB__OPC_MOD,
+ UD_TAB__OPC_RM,
+ UD_TAB__OPC_OSIZE,
+ UD_TAB__OPC_MODE,
+ UD_TAB__OPC_VEX_L,
+ UD_TAB__OPC_3DNOW,
+ UD_TAB__OPC_REG,
+ UD_TAB__OPC_ASIZE,
+ UD_TAB__OPC_VEX_W,
+ UD_TAB__OPC_SSE,
+ UD_TAB__OPC_VENDOR
+};
+
+/* ud_mnemonic -- mnemonic constants */
+enum ud_mnemonic_code {
+ UD_Iaaa,
+ UD_Iaad,
+ UD_Iaam,
+ UD_Iaas,
+ UD_Iadc,
+ UD_Iadd,
+ UD_Iaddpd,
+ UD_Iaddps,
+ UD_Iaddsd,
+ UD_Iaddss,
+ UD_Iaddsubpd,
+ UD_Iaddsubps,
+ UD_Iaesdec,
+ UD_Iaesdeclast,
+ UD_Iaesenc,
+ UD_Iaesenclast,
+ UD_Iaesimc,
+ UD_Iaeskeygenassist,
+ UD_Iand,
+ UD_Iandnpd,
+ UD_Iandnps,
+ UD_Iandpd,
+ UD_Iandps,
+ UD_Iarpl,
+ UD_Iblendpd,
+ UD_Iblendps,
+ UD_Iblendvpd,
+ UD_Iblendvps,
+ UD_Ibound,
+ UD_Ibsf,
+ UD_Ibsr,
+ UD_Ibswap,
+ UD_Ibt,
+ UD_Ibtc,
+ UD_Ibtr,
+ UD_Ibts,
+ UD_Icall,
+ UD_Icbw,
+ UD_Icdq,
+ UD_Icdqe,
+ UD_Iclc,
+ UD_Icld,
+ UD_Iclflush,
+ UD_Iclgi,
+ UD_Icli,
+ UD_Iclts,
+ UD_Icmc,
+ UD_Icmova,
+ UD_Icmovae,
+ UD_Icmovb,
+ UD_Icmovbe,
+ UD_Icmovg,
+ UD_Icmovge,
+ UD_Icmovl,
+ UD_Icmovle,
+ UD_Icmovno,
+ UD_Icmovnp,
+ UD_Icmovns,
+ UD_Icmovnz,
+ UD_Icmovo,
+ UD_Icmovp,
+ UD_Icmovs,
+ UD_Icmovz,
+ UD_Icmp,
+ UD_Icmppd,
+ UD_Icmpps,
+ UD_Icmpsb,
+ UD_Icmpsd,
+ UD_Icmpsq,
+ UD_Icmpss,
+ UD_Icmpsw,
+ UD_Icmpxchg,
+ UD_Icmpxchg16b,
+ UD_Icmpxchg8b,
+ UD_Icomisd,
+ UD_Icomiss,
+ UD_Icpuid,
+ UD_Icqo,
+ UD_Icrc32,
+ UD_Icvtdq2pd,
+ UD_Icvtdq2ps,
+ UD_Icvtpd2dq,
+ UD_Icvtpd2pi,
+ UD_Icvtpd2ps,
+ UD_Icvtpi2pd,
+ UD_Icvtpi2ps,
+ UD_Icvtps2dq,
+ UD_Icvtps2pd,
+ UD_Icvtps2pi,
+ UD_Icvtsd2si,
+ UD_Icvtsd2ss,
+ UD_Icvtsi2sd,
+ UD_Icvtsi2ss,
+ UD_Icvtss2sd,
+ UD_Icvtss2si,
+ UD_Icvttpd2dq,
+ UD_Icvttpd2pi,
+ UD_Icvttps2dq,
+ UD_Icvttps2pi,
+ UD_Icvttsd2si,
+ UD_Icvttss2si,
+ UD_Icwd,
+ UD_Icwde,
+ UD_Idaa,
+ UD_Idas,
+ UD_Idec,
+ UD_Idiv,
+ UD_Idivpd,
+ UD_Idivps,
+ UD_Idivsd,
+ UD_Idivss,
+ UD_Idppd,
+ UD_Idpps,
+ UD_Iemms,
+ UD_Ienter,
+ UD_Iextractps,
+ UD_If2xm1,
+ UD_Ifabs,
+ UD_Ifadd,
+ UD_Ifaddp,
+ UD_Ifbld,
+ UD_Ifbstp,
+ UD_Ifchs,
+ UD_Ifclex,
+ UD_Ifcmovb,
+ UD_Ifcmovbe,
+ UD_Ifcmove,
+ UD_Ifcmovnb,
+ UD_Ifcmovnbe,
+ UD_Ifcmovne,
+ UD_Ifcmovnu,
+ UD_Ifcmovu,
+ UD_Ifcom,
+ UD_Ifcom2,
+ UD_Ifcomi,
+ UD_Ifcomip,
+ UD_Ifcomp,
+ UD_Ifcomp3,
+ UD_Ifcomp5,
+ UD_Ifcompp,
+ UD_Ifcos,
+ UD_Ifdecstp,
+ UD_Ifdiv,
+ UD_Ifdivp,
+ UD_Ifdivr,
+ UD_Ifdivrp,
+ UD_Ifemms,
+ UD_Iffree,
+ UD_Iffreep,
+ UD_Ifiadd,
+ UD_Ificom,
+ UD_Ificomp,
+ UD_Ifidiv,
+ UD_Ifidivr,
+ UD_Ifild,
+ UD_Ifimul,
+ UD_Ifincstp,
+ UD_Ifist,
+ UD_Ifistp,
+ UD_Ifisttp,
+ UD_Ifisub,
+ UD_Ifisubr,
+ UD_Ifld,
+ UD_Ifld1,
+ UD_Ifldcw,
+ UD_Ifldenv,
+ UD_Ifldl2e,
+ UD_Ifldl2t,
+ UD_Ifldlg2,
+ UD_Ifldln2,
+ UD_Ifldpi,
+ UD_Ifldz,
+ UD_Ifmul,
+ UD_Ifmulp,
+ UD_Ifndisi,
+ UD_Ifneni,
+ UD_Ifninit,
+ UD_Ifnop,
+ UD_Ifnsave,
+ UD_Ifnsetpm,
+ UD_Ifnstcw,
+ UD_Ifnstenv,
+ UD_Ifnstsw,
+ UD_Ifpatan,
+ UD_Ifprem,
+ UD_Ifprem1,
+ UD_Ifptan,
+ UD_Ifrndint,
+ UD_Ifrstor,
+ UD_Ifrstpm,
+ UD_Ifscale,
+ UD_Ifsin,
+ UD_Ifsincos,
+ UD_Ifsqrt,
+ UD_Ifst,
+ UD_Ifstp,
+ UD_Ifstp1,
+ UD_Ifstp8,
+ UD_Ifstp9,
+ UD_Ifsub,
+ UD_Ifsubp,
+ UD_Ifsubr,
+ UD_Ifsubrp,
+ UD_Iftst,
+ UD_Ifucom,
+ UD_Ifucomi,
+ UD_Ifucomip,
+ UD_Ifucomp,
+ UD_Ifucompp,
+ UD_Ifxam,
+ UD_Ifxch,
+ UD_Ifxch4,
+ UD_Ifxch7,
+ UD_Ifxrstor,
+ UD_Ifxsave,
+ UD_Ifxtract,
+ UD_Ifyl2x,
+ UD_Ifyl2xp1,
+ UD_Igetsec,
+ UD_Ihaddpd,
+ UD_Ihaddps,
+ UD_Ihlt,
+ UD_Ihsubpd,
+ UD_Ihsubps,
+ UD_Iidiv,
+ UD_Iimul,
+ UD_Iin,
+ UD_Iinc,
+ UD_Iinsb,
+ UD_Iinsd,
+ UD_Iinsertps,
+ UD_Iinsw,
+ UD_Iint,
+ UD_Iint1,
+ UD_Iint3,
+ UD_Iinto,
+ UD_Iinvd,
+ UD_Iinvept,
+ UD_Iinvlpg,
+ UD_Iinvlpga,
+ UD_Iinvvpid,
+ UD_Iiretd,
+ UD_Iiretq,
+ UD_Iiretw,
+ UD_Ija,
+ UD_Ijae,
+ UD_Ijb,
+ UD_Ijbe,
+ UD_Ijcxz,
+ UD_Ijecxz,
+ UD_Ijg,
+ UD_Ijge,
+ UD_Ijl,
+ UD_Ijle,
+ UD_Ijmp,
+ UD_Ijno,
+ UD_Ijnp,
+ UD_Ijns,
+ UD_Ijnz,
+ UD_Ijo,
+ UD_Ijp,
+ UD_Ijrcxz,
+ UD_Ijs,
+ UD_Ijz,
+ UD_Ilahf,
+ UD_Ilar,
+ UD_Ilddqu,
+ UD_Ildmxcsr,
+ UD_Ilds,
+ UD_Ilea,
+ UD_Ileave,
+ UD_Iles,
+ UD_Ilfence,
+ UD_Ilfs,
+ UD_Ilgdt,
+ UD_Ilgs,
+ UD_Ilidt,
+ UD_Illdt,
+ UD_Ilmsw,
+ UD_Ilock,
+ UD_Ilodsb,
+ UD_Ilodsd,
+ UD_Ilodsq,
+ UD_Ilodsw,
+ UD_Iloop,
+ UD_Iloope,
+ UD_Iloopne,
+ UD_Ilsl,
+ UD_Ilss,
+ UD_Iltr,
+ UD_Imaskmovdqu,
+ UD_Imaskmovq,
+ UD_Imaxpd,
+ UD_Imaxps,
+ UD_Imaxsd,
+ UD_Imaxss,
+ UD_Imfence,
+ UD_Iminpd,
+ UD_Iminps,
+ UD_Iminsd,
+ UD_Iminss,
+ UD_Imonitor,
+ UD_Imontmul,
+ UD_Imov,
+ UD_Imovapd,
+ UD_Imovaps,
+ UD_Imovbe,
+ UD_Imovd,
+ UD_Imovddup,
+ UD_Imovdq2q,
+ UD_Imovdqa,
+ UD_Imovdqu,
+ UD_Imovhlps,
+ UD_Imovhpd,
+ UD_Imovhps,
+ UD_Imovlhps,
+ UD_Imovlpd,
+ UD_Imovlps,
+ UD_Imovmskpd,
+ UD_Imovmskps,
+ UD_Imovntdq,
+ UD_Imovntdqa,
+ UD_Imovnti,
+ UD_Imovntpd,
+ UD_Imovntps,
+ UD_Imovntq,
+ UD_Imovq,
+ UD_Imovq2dq,
+ UD_Imovsb,
+ UD_Imovsd,
+ UD_Imovshdup,
+ UD_Imovsldup,
+ UD_Imovsq,
+ UD_Imovss,
+ UD_Imovsw,
+ UD_Imovsx,
+ UD_Imovsxd,
+ UD_Imovupd,
+ UD_Imovups,
+ UD_Imovzx,
+ UD_Impsadbw,
+ UD_Imul,
+ UD_Imulpd,
+ UD_Imulps,
+ UD_Imulsd,
+ UD_Imulss,
+ UD_Imwait,
+ UD_Ineg,
+ UD_Inop,
+ UD_Inot,
+ UD_Ior,
+ UD_Iorpd,
+ UD_Iorps,
+ UD_Iout,
+ UD_Ioutsb,
+ UD_Ioutsd,
+ UD_Ioutsw,
+ UD_Ipabsb,
+ UD_Ipabsd,
+ UD_Ipabsw,
+ UD_Ipackssdw,
+ UD_Ipacksswb,
+ UD_Ipackusdw,
+ UD_Ipackuswb,
+ UD_Ipaddb,
+ UD_Ipaddd,
+ UD_Ipaddq,
+ UD_Ipaddsb,
+ UD_Ipaddsw,
+ UD_Ipaddusb,
+ UD_Ipaddusw,
+ UD_Ipaddw,
+ UD_Ipalignr,
+ UD_Ipand,
+ UD_Ipandn,
+ UD_Ipavgb,
+ UD_Ipavgusb,
+ UD_Ipavgw,
+ UD_Ipblendvb,
+ UD_Ipblendw,
+ UD_Ipclmulqdq,
+ UD_Ipcmpeqb,
+ UD_Ipcmpeqd,
+ UD_Ipcmpeqq,
+ UD_Ipcmpeqw,
+ UD_Ipcmpestri,
+ UD_Ipcmpestrm,
+ UD_Ipcmpgtb,
+ UD_Ipcmpgtd,
+ UD_Ipcmpgtq,
+ UD_Ipcmpgtw,
+ UD_Ipcmpistri,
+ UD_Ipcmpistrm,
+ UD_Ipextrb,
+ UD_Ipextrd,
+ UD_Ipextrq,
+ UD_Ipextrw,
+ UD_Ipf2id,
+ UD_Ipf2iw,
+ UD_Ipfacc,
+ UD_Ipfadd,
+ UD_Ipfcmpeq,
+ UD_Ipfcmpge,
+ UD_Ipfcmpgt,
+ UD_Ipfmax,
+ UD_Ipfmin,
+ UD_Ipfmul,
+ UD_Ipfnacc,
+ UD_Ipfpnacc,
+ UD_Ipfrcp,
+ UD_Ipfrcpit1,
+ UD_Ipfrcpit2,
+ UD_Ipfrsqit1,
+ UD_Ipfrsqrt,
+ UD_Ipfsub,
+ UD_Ipfsubr,
+ UD_Iphaddd,
+ UD_Iphaddsw,
+ UD_Iphaddw,
+ UD_Iphminposuw,
+ UD_Iphsubd,
+ UD_Iphsubsw,
+ UD_Iphsubw,
+ UD_Ipi2fd,
+ UD_Ipi2fw,
+ UD_Ipinsrb,
+ UD_Ipinsrd,
+ UD_Ipinsrq,
+ UD_Ipinsrw,
+ UD_Ipmaddubsw,
+ UD_Ipmaddwd,
+ UD_Ipmaxsb,
+ UD_Ipmaxsd,
+ UD_Ipmaxsw,
+ UD_Ipmaxub,
+ UD_Ipmaxud,
+ UD_Ipmaxuw,
+ UD_Ipminsb,
+ UD_Ipminsd,
+ UD_Ipminsw,
+ UD_Ipminub,
+ UD_Ipminud,
+ UD_Ipminuw,
+ UD_Ipmovmskb,
+ UD_Ipmovsxbd,
+ UD_Ipmovsxbq,
+ UD_Ipmovsxbw,
+ UD_Ipmovsxdq,
+ UD_Ipmovsxwd,
+ UD_Ipmovsxwq,
+ UD_Ipmovzxbd,
+ UD_Ipmovzxbq,
+ UD_Ipmovzxbw,
+ UD_Ipmovzxdq,
+ UD_Ipmovzxwd,
+ UD_Ipmovzxwq,
+ UD_Ipmuldq,
+ UD_Ipmulhrsw,
+ UD_Ipmulhrw,
+ UD_Ipmulhuw,
+ UD_Ipmulhw,
+ UD_Ipmulld,
+ UD_Ipmullw,
+ UD_Ipmuludq,
+ UD_Ipop,
+ UD_Ipopa,
+ UD_Ipopad,
+ UD_Ipopcnt,
+ UD_Ipopfd,
+ UD_Ipopfq,
+ UD_Ipopfw,
+ UD_Ipor,
+ UD_Iprefetch,
+ UD_Iprefetchnta,
+ UD_Iprefetcht0,
+ UD_Iprefetcht1,
+ UD_Iprefetcht2,
+ UD_Ipsadbw,
+ UD_Ipshufb,
+ UD_Ipshufd,
+ UD_Ipshufhw,
+ UD_Ipshuflw,
+ UD_Ipshufw,
+ UD_Ipsignb,
+ UD_Ipsignd,
+ UD_Ipsignw,
+ UD_Ipslld,
+ UD_Ipslldq,
+ UD_Ipsllq,
+ UD_Ipsllw,
+ UD_Ipsrad,
+ UD_Ipsraw,
+ UD_Ipsrld,
+ UD_Ipsrldq,
+ UD_Ipsrlq,
+ UD_Ipsrlw,
+ UD_Ipsubb,
+ UD_Ipsubd,
+ UD_Ipsubq,
+ UD_Ipsubsb,
+ UD_Ipsubsw,
+ UD_Ipsubusb,
+ UD_Ipsubusw,
+ UD_Ipsubw,
+ UD_Ipswapd,
+ UD_Iptest,
+ UD_Ipunpckhbw,
+ UD_Ipunpckhdq,
+ UD_Ipunpckhqdq,
+ UD_Ipunpckhwd,
+ UD_Ipunpcklbw,
+ UD_Ipunpckldq,
+ UD_Ipunpcklqdq,
+ UD_Ipunpcklwd,
+ UD_Ipush,
+ UD_Ipusha,
+ UD_Ipushad,
+ UD_Ipushfd,
+ UD_Ipushfq,
+ UD_Ipushfw,
+ UD_Ipxor,
+ UD_Ircl,
+ UD_Ircpps,
+ UD_Ircpss,
+ UD_Ircr,
+ UD_Irdmsr,
+ UD_Irdpmc,
+ UD_Irdrand,
+ UD_Irdtsc,
+ UD_Irdtscp,
+ UD_Irep,
+ UD_Irepne,
+ UD_Iret,
+ UD_Iretf,
+ UD_Irol,
+ UD_Iror,
+ UD_Iroundpd,
+ UD_Iroundps,
+ UD_Iroundsd,
+ UD_Iroundss,
+ UD_Irsm,
+ UD_Irsqrtps,
+ UD_Irsqrtss,
+ UD_Isahf,
+ UD_Isalc,
+ UD_Isar,
+ UD_Isbb,
+ UD_Iscasb,
+ UD_Iscasd,
+ UD_Iscasq,
+ UD_Iscasw,
+ UD_Iseta,
+ UD_Isetae,
+ UD_Isetb,
+ UD_Isetbe,
+ UD_Isetg,
+ UD_Isetge,
+ UD_Isetl,
+ UD_Isetle,
+ UD_Isetno,
+ UD_Isetnp,
+ UD_Isetns,
+ UD_Isetnz,
+ UD_Iseto,
+ UD_Isetp,
+ UD_Isets,
+ UD_Isetz,
+ UD_Isfence,
+ UD_Isgdt,
+ UD_Ishl,
+ UD_Ishld,
+ UD_Ishr,
+ UD_Ishrd,
+ UD_Ishufpd,
+ UD_Ishufps,
+ UD_Isidt,
+ UD_Iskinit,
+ UD_Isldt,
+ UD_Ismsw,
+ UD_Isqrtpd,
+ UD_Isqrtps,
+ UD_Isqrtsd,
+ UD_Isqrtss,
+ UD_Istc,
+ UD_Istd,
+ UD_Istgi,
+ UD_Isti,
+ UD_Istmxcsr,
+ UD_Istosb,
+ UD_Istosd,
+ UD_Istosq,
+ UD_Istosw,
+ UD_Istr,
+ UD_Isub,
+ UD_Isubpd,
+ UD_Isubps,
+ UD_Isubsd,
+ UD_Isubss,
+ UD_Iswapgs,
+ UD_Isyscall,
+ UD_Isysenter,
+ UD_Isysexit,
+ UD_Isysret,
+ UD_Itest,
+ UD_Iucomisd,
+ UD_Iucomiss,
+ UD_Iud2,
+ UD_Iunpckhpd,
+ UD_Iunpckhps,
+ UD_Iunpcklpd,
+ UD_Iunpcklps,
+ UD_Ivaddpd,
+ UD_Ivaddps,
+ UD_Ivaddsd,
+ UD_Ivaddss,
+ UD_Ivaddsubpd,
+ UD_Ivaddsubps,
+ UD_Ivaesdec,
+ UD_Ivaesdeclast,
+ UD_Ivaesenc,
+ UD_Ivaesenclast,
+ UD_Ivaesimc,
+ UD_Ivaeskeygenassist,
+ UD_Ivandnpd,
+ UD_Ivandnps,
+ UD_Ivandpd,
+ UD_Ivandps,
+ UD_Ivblendpd,
+ UD_Ivblendps,
+ UD_Ivblendvpd,
+ UD_Ivblendvps,
+ UD_Ivbroadcastsd,
+ UD_Ivbroadcastss,
+ UD_Ivcmppd,
+ UD_Ivcmpps,
+ UD_Ivcmpsd,
+ UD_Ivcmpss,
+ UD_Ivcomisd,
+ UD_Ivcomiss,
+ UD_Ivcvtdq2pd,
+ UD_Ivcvtdq2ps,
+ UD_Ivcvtpd2dq,
+ UD_Ivcvtpd2ps,
+ UD_Ivcvtps2dq,
+ UD_Ivcvtps2pd,
+ UD_Ivcvtsd2si,
+ UD_Ivcvtsd2ss,
+ UD_Ivcvtsi2sd,
+ UD_Ivcvtsi2ss,
+ UD_Ivcvtss2sd,
+ UD_Ivcvtss2si,
+ UD_Ivcvttpd2dq,
+ UD_Ivcvttps2dq,
+ UD_Ivcvttsd2si,
+ UD_Ivcvttss2si,
+ UD_Ivdivpd,
+ UD_Ivdivps,
+ UD_Ivdivsd,
+ UD_Ivdivss,
+ UD_Ivdppd,
+ UD_Ivdpps,
+ UD_Iverr,
+ UD_Iverw,
+ UD_Ivextractf128,
+ UD_Ivextractps,
+ UD_Ivhaddpd,
+ UD_Ivhaddps,
+ UD_Ivhsubpd,
+ UD_Ivhsubps,
+ UD_Ivinsertf128,
+ UD_Ivinsertps,
+ UD_Ivlddqu,
+ UD_Ivmaskmovdqu,
+ UD_Ivmaskmovpd,
+ UD_Ivmaskmovps,
+ UD_Ivmaxpd,
+ UD_Ivmaxps,
+ UD_Ivmaxsd,
+ UD_Ivmaxss,
+ UD_Ivmcall,
+ UD_Ivmclear,
+ UD_Ivminpd,
+ UD_Ivminps,
+ UD_Ivminsd,
+ UD_Ivminss,
+ UD_Ivmlaunch,
+ UD_Ivmload,
+ UD_Ivmmcall,
+ UD_Ivmovapd,
+ UD_Ivmovaps,
+ UD_Ivmovd,
+ UD_Ivmovddup,
+ UD_Ivmovdqa,
+ UD_Ivmovdqu,
+ UD_Ivmovhlps,
+ UD_Ivmovhpd,
+ UD_Ivmovhps,
+ UD_Ivmovlhps,
+ UD_Ivmovlpd,
+ UD_Ivmovlps,
+ UD_Ivmovmskpd,
+ UD_Ivmovmskps,
+ UD_Ivmovntdq,
+ UD_Ivmovntdqa,
+ UD_Ivmovntpd,
+ UD_Ivmovntps,
+ UD_Ivmovq,
+ UD_Ivmovsd,
+ UD_Ivmovshdup,
+ UD_Ivmovsldup,
+ UD_Ivmovss,
+ UD_Ivmovupd,
+ UD_Ivmovups,
+ UD_Ivmpsadbw,
+ UD_Ivmptrld,
+ UD_Ivmptrst,
+ UD_Ivmread,
+ UD_Ivmresume,
+ UD_Ivmrun,
+ UD_Ivmsave,
+ UD_Ivmulpd,
+ UD_Ivmulps,
+ UD_Ivmulsd,
+ UD_Ivmulss,
+ UD_Ivmwrite,
+ UD_Ivmxoff,
+ UD_Ivmxon,
+ UD_Ivorpd,
+ UD_Ivorps,
+ UD_Ivpabsb,
+ UD_Ivpabsd,
+ UD_Ivpabsw,
+ UD_Ivpackssdw,
+ UD_Ivpacksswb,
+ UD_Ivpackusdw,
+ UD_Ivpackuswb,
+ UD_Ivpaddb,
+ UD_Ivpaddd,
+ UD_Ivpaddq,
+ UD_Ivpaddsb,
+ UD_Ivpaddsw,
+ UD_Ivpaddusb,
+ UD_Ivpaddusw,
+ UD_Ivpaddw,
+ UD_Ivpalignr,
+ UD_Ivpand,
+ UD_Ivpandn,
+ UD_Ivpavgb,
+ UD_Ivpavgw,
+ UD_Ivpblendvb,
+ UD_Ivpblendw,
+ UD_Ivpclmulqdq,
+ UD_Ivpcmpeqb,
+ UD_Ivpcmpeqd,
+ UD_Ivpcmpeqq,
+ UD_Ivpcmpeqw,
+ UD_Ivpcmpestri,
+ UD_Ivpcmpestrm,
+ UD_Ivpcmpgtb,
+ UD_Ivpcmpgtd,
+ UD_Ivpcmpgtq,
+ UD_Ivpcmpgtw,
+ UD_Ivpcmpistri,
+ UD_Ivpcmpistrm,
+ UD_Ivperm2f128,
+ UD_Ivpermilpd,
+ UD_Ivpermilps,
+ UD_Ivpextrb,
+ UD_Ivpextrd,
+ UD_Ivpextrq,
+ UD_Ivpextrw,
+ UD_Ivphaddd,
+ UD_Ivphaddsw,
+ UD_Ivphaddw,
+ UD_Ivphminposuw,
+ UD_Ivphsubd,
+ UD_Ivphsubsw,
+ UD_Ivphsubw,
+ UD_Ivpinsrb,
+ UD_Ivpinsrd,
+ UD_Ivpinsrq,
+ UD_Ivpinsrw,
+ UD_Ivpmaddubsw,
+ UD_Ivpmaddwd,
+ UD_Ivpmaxsb,
+ UD_Ivpmaxsd,
+ UD_Ivpmaxsw,
+ UD_Ivpmaxub,
+ UD_Ivpmaxud,
+ UD_Ivpmaxuw,
+ UD_Ivpminsb,
+ UD_Ivpminsd,
+ UD_Ivpminsw,
+ UD_Ivpminub,
+ UD_Ivpminud,
+ UD_Ivpminuw,
+ UD_Ivpmovmskb,
+ UD_Ivpmovsxbd,
+ UD_Ivpmovsxbq,
+ UD_Ivpmovsxbw,
+ UD_Ivpmovsxwd,
+ UD_Ivpmovsxwq,
+ UD_Ivpmovzxbd,
+ UD_Ivpmovzxbq,
+ UD_Ivpmovzxbw,
+ UD_Ivpmovzxdq,
+ UD_Ivpmovzxwd,
+ UD_Ivpmovzxwq,
+ UD_Ivpmuldq,
+ UD_Ivpmulhrsw,
+ UD_Ivpmulhuw,
+ UD_Ivpmulhw,
+ UD_Ivpmulld,
+ UD_Ivpmullw,
+ UD_Ivpor,
+ UD_Ivpsadbw,
+ UD_Ivpshufb,
+ UD_Ivpshufd,
+ UD_Ivpshufhw,
+ UD_Ivpshuflw,
+ UD_Ivpsignb,
+ UD_Ivpsignd,
+ UD_Ivpsignw,
+ UD_Ivpslld,
+ UD_Ivpslldq,
+ UD_Ivpsllq,
+ UD_Ivpsllw,
+ UD_Ivpsrad,
+ UD_Ivpsraw,
+ UD_Ivpsrld,
+ UD_Ivpsrldq,
+ UD_Ivpsrlq,
+ UD_Ivpsrlw,
+ UD_Ivpsubb,
+ UD_Ivpsubd,
+ UD_Ivpsubq,
+ UD_Ivpsubsb,
+ UD_Ivpsubsw,
+ UD_Ivpsubusb,
+ UD_Ivpsubusw,
+ UD_Ivpsubw,
+ UD_Ivptest,
+ UD_Ivpunpckhbw,
+ UD_Ivpunpckhdq,
+ UD_Ivpunpckhqdq,
+ UD_Ivpunpckhwd,
+ UD_Ivpunpcklbw,
+ UD_Ivpunpckldq,
+ UD_Ivpunpcklqdq,
+ UD_Ivpunpcklwd,
+ UD_Ivpxor,
+ UD_Ivrcpps,
+ UD_Ivrcpss,
+ UD_Ivroundpd,
+ UD_Ivroundps,
+ UD_Ivroundsd,
+ UD_Ivroundss,
+ UD_Ivrsqrtps,
+ UD_Ivrsqrtss,
+ UD_Ivshufpd,
+ UD_Ivshufps,
+ UD_Ivsqrtpd,
+ UD_Ivsqrtps,
+ UD_Ivsqrtsd,
+ UD_Ivsqrtss,
+ UD_Ivstmxcsr,
+ UD_Ivsubpd,
+ UD_Ivsubps,
+ UD_Ivsubsd,
+ UD_Ivsubss,
+ UD_Ivtestpd,
+ UD_Ivtestps,
+ UD_Ivucomisd,
+ UD_Ivucomiss,
+ UD_Ivunpckhpd,
+ UD_Ivunpckhps,
+ UD_Ivunpcklpd,
+ UD_Ivunpcklps,
+ UD_Ivxorpd,
+ UD_Ivxorps,
+ UD_Ivzeroall,
+ UD_Ivzeroupper,
+ UD_Iwait,
+ UD_Iwbinvd,
+ UD_Iwrmsr,
+ UD_Ixadd,
+ UD_Ixchg,
+ UD_Ixcryptcbc,
+ UD_Ixcryptcfb,
+ UD_Ixcryptctr,
+ UD_Ixcryptecb,
+ UD_Ixcryptofb,
+ UD_Ixgetbv,
+ UD_Ixlatb,
+ UD_Ixor,
+ UD_Ixorpd,
+ UD_Ixorps,
+ UD_Ixrstor,
+ UD_Ixsave,
+ UD_Ixsetbv,
+ UD_Ixsha1,
+ UD_Ixsha256,
+ UD_Ixstore,
+ UD_Iinvalid,
+ UD_I3dnow,
+ UD_Inone,
+ UD_Idb,
+ UD_Ipause,
+ UD_MAX_MNEMONIC_CODE
+};
+
+extern const char * ud_mnemonics_str[];
+
+#endif /* UD_ITAB_H */
diff --git a/ext/opcache/jit/libudis86/syn-att.c b/ext/opcache/jit/libudis86/syn-att.c
new file mode 100644
index 0000000000..d1ba89b7ae
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn-att.c
@@ -0,0 +1,228 @@
+/* udis86 - libudis86/syn-att.c
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "types.h"
+#include "extern.h"
+#include "decode.h"
+#include "itab.h"
+#include "syn.h"
+#include "udint.h"
+
+/* -----------------------------------------------------------------------------
+ * opr_cast() - Prints an operand cast.
+ * -----------------------------------------------------------------------------
+ */
+static void
+opr_cast(struct ud* u, struct ud_operand* op)
+{
+ switch(op->size) {
+ case 16 : case 32 :
+ ud_asmprintf(u, "*"); break;
+ default: break;
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * gen_operand() - Generates assembly output for each operand.
+ * -----------------------------------------------------------------------------
+ */
+static void
+gen_operand(struct ud* u, struct ud_operand* op)
+{
+ switch(op->type) {
+ case UD_OP_CONST:
+ ud_asmprintf(u, "$0x%x", op->lval.udword);
+ break;
+
+ case UD_OP_REG:
+ ud_asmprintf(u, "%%%s", ud_reg_tab[op->base - UD_R_AL]);
+ break;
+
+ case UD_OP_MEM:
+ if (u->br_far) {
+ opr_cast(u, op);
+ }
+ if (u->pfx_seg) {
+ ud_asmprintf(u, "%%%s:", ud_reg_tab[u->pfx_seg - UD_R_AL]);
+ }
+ if (op->offset != 0) {
+ ud_syn_print_mem_disp(u, op, 0);
+ }
+ if (op->base) {
+ ud_asmprintf(u, "(%%%s", ud_reg_tab[op->base - UD_R_AL]);
+ }
+ if (op->index) {
+ if (op->base) {
+ ud_asmprintf(u, ",");
+ } else {
+ ud_asmprintf(u, "(");
+ }
+ ud_asmprintf(u, "%%%s", ud_reg_tab[op->index - UD_R_AL]);
+ }
+ if (op->scale) {
+ ud_asmprintf(u, ",%d", op->scale);
+ }
+ if (op->base || op->index) {
+ ud_asmprintf(u, ")");
+ }
+ break;
+
+ case UD_OP_IMM:
+ ud_asmprintf(u, "$");
+ ud_syn_print_imm(u, op);
+ break;
+
+ case UD_OP_JIMM:
+ ud_syn_print_addr(u, ud_syn_rel_target(u, op));
+ break;
+
+ case UD_OP_PTR:
+ switch (op->size) {
+ case 32:
+ ud_asmprintf(u, "$0x%x, $0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off & 0xFFFF);
+ break;
+ case 48:
+ ud_asmprintf(u, "$0x%x, $0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off);
+ break;
+ }
+ break;
+
+ default: return;
+ }
+}
+
+/* =============================================================================
+ * translates to AT&T syntax
+ * =============================================================================
+ */
+extern void
+ud_translate_att(struct ud *u)
+{
+ int size = 0;
+ int star = 0;
+
+ /* check if P_OSO prefix is used */
+ if (! P_OSO(u->itab_entry->prefix) && u->pfx_opr) {
+ switch (u->dis_mode) {
+ case 16:
+ ud_asmprintf(u, "o32 ");
+ break;
+ case 32:
+ case 64:
+ ud_asmprintf(u, "o16 ");
+ break;
+ }
+ }
+
+ /* check if P_ASO prefix was used */
+ if (! P_ASO(u->itab_entry->prefix) && u->pfx_adr) {
+ switch (u->dis_mode) {
+ case 16:
+ ud_asmprintf(u, "a32 ");
+ break;
+ case 32:
+ ud_asmprintf(u, "a16 ");
+ break;
+ case 64:
+ ud_asmprintf(u, "a32 ");
+ break;
+ }
+ }
+
+ if (u->pfx_lock)
+ ud_asmprintf(u, "lock ");
+ if (u->pfx_rep) {
+ ud_asmprintf(u, "rep ");
+ } else if (u->pfx_repe) {
+ ud_asmprintf(u, "repe ");
+ } else if (u->pfx_repne) {
+ ud_asmprintf(u, "repne ");
+ }
+
+ /* special instructions */
+ switch (u->mnemonic) {
+ case UD_Iretf:
+ ud_asmprintf(u, "lret ");
+ break;
+ case UD_Idb:
+ ud_asmprintf(u, ".byte 0x%x", u->operand[0].lval.ubyte);
+ return;
+ case UD_Ijmp:
+ case UD_Icall:
+ if (u->br_far) ud_asmprintf(u, "l");
+ if (u->operand[0].type == UD_OP_REG) {
+ star = 1;
+ }
+ ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
+ break;
+ case UD_Ibound:
+ case UD_Ienter:
+ if (u->operand[0].type != UD_NONE)
+ gen_operand(u, &u->operand[0]);
+ if (u->operand[1].type != UD_NONE) {
+ ud_asmprintf(u, ",");
+ gen_operand(u, &u->operand[1]);
+ }
+ return;
+ default:
+ ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
+ }
+
+ if (size == 8) {
+ ud_asmprintf(u, "b");
+ } else if (size == 16) {
+ ud_asmprintf(u, "w");
+ } else if (size == 64) {
+ ud_asmprintf(u, "q");
+ }
+
+ if (star) {
+ ud_asmprintf(u, " *");
+ } else {
+ ud_asmprintf(u, " ");
+ }
+
+ if (u->operand[3].type != UD_NONE) {
+ gen_operand(u, &u->operand[3]);
+ ud_asmprintf(u, ", ");
+ }
+ if (u->operand[2].type != UD_NONE) {
+ gen_operand(u, &u->operand[2]);
+ ud_asmprintf(u, ", ");
+ }
+ if (u->operand[1].type != UD_NONE) {
+ gen_operand(u, &u->operand[1]);
+ ud_asmprintf(u, ", ");
+ }
+ if (u->operand[0].type != UD_NONE) {
+ gen_operand(u, &u->operand[0]);
+ }
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/syn-intel.c b/ext/opcache/jit/libudis86/syn-intel.c
new file mode 100644
index 0000000000..0664fea092
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn-intel.c
@@ -0,0 +1,224 @@
+/* udis86 - libudis86/syn-intel.c
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "types.h"
+#include "extern.h"
+#include "decode.h"
+#include "itab.h"
+#include "syn.h"
+#include "udint.h"
+
+/* -----------------------------------------------------------------------------
+ * opr_cast() - Prints an operand cast.
+ * -----------------------------------------------------------------------------
+ */
+static void
+opr_cast(struct ud* u, struct ud_operand* op)
+{
+ if (u->br_far) {
+ ud_asmprintf(u, "far ");
+ }
+ switch(op->size) {
+ case 8: ud_asmprintf(u, "byte " ); break;
+ case 16: ud_asmprintf(u, "word " ); break;
+ case 32: ud_asmprintf(u, "dword "); break;
+ case 64: ud_asmprintf(u, "qword "); break;
+ case 80: ud_asmprintf(u, "tword "); break;
+ case 128: ud_asmprintf(u, "oword "); break;
+ case 256: ud_asmprintf(u, "yword "); break;
+ default: break;
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * gen_operand() - Generates assembly output for each operand.
+ * -----------------------------------------------------------------------------
+ */
+static void gen_operand(struct ud* u, struct ud_operand* op, int syn_cast)
+{
+ switch(op->type) {
+ case UD_OP_REG:
+ ud_asmprintf(u, "%s", ud_reg_tab[op->base - UD_R_AL]);
+ break;
+
+ case UD_OP_MEM:
+ if (syn_cast) {
+ opr_cast(u, op);
+ }
+ ud_asmprintf(u, "[");
+ if (u->pfx_seg) {
+ ud_asmprintf(u, "%s:", ud_reg_tab[u->pfx_seg - UD_R_AL]);
+ }
+ if (op->base) {
+ ud_asmprintf(u, "%s", ud_reg_tab[op->base - UD_R_AL]);
+ }
+ if (op->index) {
+ ud_asmprintf(u, "%s%s", op->base != UD_NONE? "+" : "",
+ ud_reg_tab[op->index - UD_R_AL]);
+ if (op->scale) {
+ ud_asmprintf(u, "*%d", op->scale);
+ }
+ }
+ if (op->offset != 0) {
+ ud_syn_print_mem_disp(u, op, (op->base != UD_NONE ||
+ op->index != UD_NONE) ? 1 : 0);
+ }
+ ud_asmprintf(u, "]");
+ break;
+
+ case UD_OP_IMM:
+ ud_syn_print_imm(u, op);
+ break;
+
+
+ case UD_OP_JIMM:
+ ud_syn_print_addr(u, ud_syn_rel_target(u, op));
+ break;
+
+ case UD_OP_PTR:
+ switch (op->size) {
+ case 32:
+ ud_asmprintf(u, "word 0x%x:0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off & 0xFFFF);
+ break;
+ case 48:
+ ud_asmprintf(u, "dword 0x%x:0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off);
+ break;
+ }
+ break;
+
+ case UD_OP_CONST:
+ if (syn_cast) opr_cast(u, op);
+ ud_asmprintf(u, "%d", op->lval.udword);
+ break;
+
+ default: return;
+ }
+}
+
+/* =============================================================================
+ * translates to intel syntax
+ * =============================================================================
+ */
+extern void
+ud_translate_intel(struct ud* u)
+{
+ /* check if P_OSO prefix is used */
+ if (!P_OSO(u->itab_entry->prefix) && u->pfx_opr) {
+ switch (u->dis_mode) {
+ case 16: ud_asmprintf(u, "o32 "); break;
+ case 32:
+ case 64: ud_asmprintf(u, "o16 "); break;
+ }
+ }
+
+ /* check if P_ASO prefix was used */
+ if (!P_ASO(u->itab_entry->prefix) && u->pfx_adr) {
+ switch (u->dis_mode) {
+ case 16: ud_asmprintf(u, "a32 "); break;
+ case 32: ud_asmprintf(u, "a16 "); break;
+ case 64: ud_asmprintf(u, "a32 "); break;
+ }
+ }
+
+ if (u->pfx_seg &&
+ u->operand[0].type != UD_OP_MEM &&
+ u->operand[1].type != UD_OP_MEM ) {
+ ud_asmprintf(u, "%s ", ud_reg_tab[u->pfx_seg - UD_R_AL]);
+ }
+
+ if (u->pfx_lock) {
+ ud_asmprintf(u, "lock ");
+ }
+ if (u->pfx_rep) {
+ ud_asmprintf(u, "rep ");
+ } else if (u->pfx_repe) {
+ ud_asmprintf(u, "repe ");
+ } else if (u->pfx_repne) {
+ ud_asmprintf(u, "repne ");
+ }
+
+ /* print the instruction mnemonic */
+ ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
+
+ if (u->operand[0].type != UD_NONE) {
+ int cast = 0;
+ ud_asmprintf(u, " ");
+ if (u->operand[0].type == UD_OP_MEM) {
+ if (u->operand[1].type == UD_OP_IMM ||
+ u->operand[1].type == UD_OP_CONST ||
+ u->operand[1].type == UD_NONE ||
+ (u->operand[0].size != u->operand[1].size)) {
+ cast = 1;
+ } else if (u->operand[1].type == UD_OP_REG &&
+ u->operand[1].base == UD_R_CL) {
+ switch (u->mnemonic) {
+ case UD_Ircl:
+ case UD_Irol:
+ case UD_Iror:
+ case UD_Ircr:
+ case UD_Ishl:
+ case UD_Ishr:
+ case UD_Isar:
+ cast = 1;
+ break;
+ default: break;
+ }
+ }
+ }
+ gen_operand(u, &u->operand[0], cast);
+ }
+
+ if (u->operand[1].type != UD_NONE) {
+ int cast = 0;
+ ud_asmprintf(u, ", ");
+ if (u->operand[1].type == UD_OP_MEM &&
+ u->operand[0].size != u->operand[1].size &&
+ !ud_opr_is_sreg(&u->operand[0])) {
+ cast = 1;
+ }
+ gen_operand(u, &u->operand[1], cast);
+ }
+
+ if (u->operand[2].type != UD_NONE) {
+ int cast = 0;
+ ud_asmprintf(u, ", ");
+ if (u->operand[2].type == UD_OP_MEM &&
+ u->operand[2].size != u->operand[1].size) {
+ cast = 1;
+ }
+ gen_operand(u, &u->operand[2], cast);
+ }
+
+ if (u->operand[3].type != UD_NONE) {
+ ud_asmprintf(u, ", ");
+ gen_operand(u, &u->operand[3], 0);
+ }
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/syn.c b/ext/opcache/jit/libudis86/syn.c
new file mode 100644
index 0000000000..c7453d63b7
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn.c
@@ -0,0 +1,258 @@
+/* udis86 - libudis86/syn.c
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "types.h"
+#include "decode.h"
+#include "syn.h"
+#include "udint.h"
+
+/*
+ * Register Table - Order Matters (types.h)!
+ *
+ */
+const char* ud_reg_tab[] =
+{
+ "al", "cl", "dl", "bl",
+ "ah", "ch", "dh", "bh",
+ "spl", "bpl", "sil", "dil",
+ "r8b", "r9b", "r10b", "r11b",
+ "r12b", "r13b", "r14b", "r15b",
+
+ "ax", "cx", "dx", "bx",
+ "sp", "bp", "si", "di",
+ "r8w", "r9w", "r10w", "r11w",
+ "r12w", "r13w", "r14w", "r15w",
+
+ "eax", "ecx", "edx", "ebx",
+ "esp", "ebp", "esi", "edi",
+ "r8d", "r9d", "r10d", "r11d",
+ "r12d", "r13d", "r14d", "r15d",
+
+ "rax", "rcx", "rdx", "rbx",
+ "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
+
+ "es", "cs", "ss", "ds",
+ "fs", "gs",
+
+ "cr0", "cr1", "cr2", "cr3",
+ "cr4", "cr5", "cr6", "cr7",
+ "cr8", "cr9", "cr10", "cr11",
+ "cr12", "cr13", "cr14", "cr15",
+
+ "dr0", "dr1", "dr2", "dr3",
+ "dr4", "dr5", "dr6", "dr7",
+ "dr8", "dr9", "dr10", "dr11",
+ "dr12", "dr13", "dr14", "dr15",
+
+ "mm0", "mm1", "mm2", "mm3",
+ "mm4", "mm5", "mm6", "mm7",
+
+ "st0", "st1", "st2", "st3",
+ "st4", "st5", "st6", "st7",
+
+ "xmm0", "xmm1", "xmm2", "xmm3",
+ "xmm4", "xmm5", "xmm6", "xmm7",
+ "xmm8", "xmm9", "xmm10", "xmm11",
+ "xmm12", "xmm13", "xmm14", "xmm15",
+
+ "ymm0", "ymm1", "ymm2", "ymm3",
+ "ymm4", "ymm5", "ymm6", "ymm7",
+ "ymm8", "ymm9", "ymm10", "ymm11",
+ "ymm12", "ymm13", "ymm14", "ymm15",
+
+ "rip"
+};
+
+
+uint64_t
+ud_syn_rel_target(struct ud *u, struct ud_operand *opr)
+{
+#if 1
+ const uint64_t trunc_mask = 0xffffffffffffffffull >> (64 - u->adr_mode);
+#else
+ const uint64_t trunc_mask = 0xffffffffffffffffull >> (64 - u->opr_mode);
+#endif
+ switch (opr->size) {
+ case 8 : return (u->pc + opr->lval.sbyte) & trunc_mask;
+ case 16: return (u->pc + opr->lval.sword) & trunc_mask;
+ case 32: return (u->pc + opr->lval.sdword) & trunc_mask;
+ default: UD_ASSERT(!"invalid relative offset size.");
+ return 0ull;
+ }
+}
+
+
+/*
+ * asmprintf
+ * Printf style function for printing translated assembly
+ * output. Returns the number of characters written and
+ * moves the buffer pointer forward. On an overflow,
+ * returns a negative number and truncates the output.
+ */
+int
+ud_asmprintf(struct ud *u, const char *fmt, ...)
+{
+ int ret;
+ int avail;
+ va_list ap;
+ va_start(ap, fmt);
+ avail = u->asm_buf_size - u->asm_buf_fill - 1 /* nullchar */;
+ ret = vsnprintf((char*) u->asm_buf + u->asm_buf_fill, avail, fmt, ap);
+ if (ret < 0 || ret > avail) {
+ u->asm_buf_fill = u->asm_buf_size - 1;
+ } else {
+ u->asm_buf_fill += ret;
+ }
+ va_end(ap);
+ return ret;
+}
+
+
+void
+ud_syn_print_addr(struct ud *u, uint64_t addr)
+{
+ const char *name = NULL;
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ name = u->sym_resolver(u, addr, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+ ud_asmprintf(u, "0x%" FMT64 "x", addr);
+}
+
+
+void
+ud_syn_print_imm(struct ud* u, const struct ud_operand *op)
+{
+ uint64_t v;
+ if (op->_oprcode == OP_sI && op->size != u->opr_mode) {
+ if (op->size == 8) {
+ v = (int64_t)op->lval.sbyte;
+ } else {
+ UD_ASSERT(op->size == 32);
+ v = (int64_t)op->lval.sdword;
+ }
+ if (u->opr_mode < 64) {
+ v = v & ((1ull << u->opr_mode) - 1ull);
+ }
+ } else {
+ switch (op->size) {
+ case 8 : v = op->lval.ubyte; break;
+ case 16: v = op->lval.uword; break;
+ case 32: v = op->lval.udword; break;
+ case 64: v = op->lval.uqword; break;
+ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
+ }
+ }
+#if 1
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ const char *name = u->sym_resolver(u, v, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+#endif
+ ud_asmprintf(u, "0x%" FMT64 "x", v);
+}
+
+
+void
+ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *op, int sign)
+{
+ UD_ASSERT(op->offset != 0);
+ if (op->base == UD_NONE && op->index == UD_NONE) {
+ uint64_t v;
+ UD_ASSERT(op->scale == UD_NONE && op->offset != 8);
+ /* unsigned mem-offset */
+ switch (op->offset) {
+ case 16: v = op->lval.uword; break;
+ case 32: v = op->lval.udword; break;
+ case 64: v = op->lval.uqword; break;
+ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
+ }
+#if 1
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ const char *name = u->sym_resolver(u, v, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+#endif
+ ud_asmprintf(u, "0x%" FMT64 "x", v);
+ } else {
+ int64_t v;
+ UD_ASSERT(op->offset != 64);
+ switch (op->offset) {
+ case 8 : v = op->lval.sbyte; break;
+ case 16: v = op->lval.sword; break;
+ case 32: v = op->lval.sdword; break;
+ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
+ }
+#if 1
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ const char *name = u->sym_resolver(u, v, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+#endif
+ if (v < 0) {
+ ud_asmprintf(u, "-0x%" FMT64 "x", -v);
+ } else if (v > 0) {
+ ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v);
+ }
+ }
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/syn.h b/ext/opcache/jit/libudis86/syn.h
new file mode 100644
index 0000000000..d3b1e3fe04
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn.h
@@ -0,0 +1,53 @@
+/* udis86 - libudis86/syn.h
+ *
+ * Copyright (c) 2002-2009
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_SYN_H
+#define UD_SYN_H
+
+#include "types.h"
+#ifndef __UD_STANDALONE__
+# include <stdarg.h>
+#endif /* __UD_STANDALONE__ */
+
+extern const char* ud_reg_tab[];
+
+uint64_t ud_syn_rel_target(struct ud*, struct ud_operand*);
+
+#ifdef __GNUC__
+int ud_asmprintf(struct ud *u, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+#else
+int ud_asmprintf(struct ud *u, const char *fmt, ...);
+#endif
+
+void ud_syn_print_addr(struct ud *u, uint64_t addr);
+void ud_syn_print_imm(struct ud* u, const struct ud_operand *op);
+void ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *, int sign);
+
+#endif /* UD_SYN_H */
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/types.h b/ext/opcache/jit/libudis86/types.h
new file mode 100644
index 0000000000..69072ca480
--- /dev/null
+++ b/ext/opcache/jit/libudis86/types.h
@@ -0,0 +1,260 @@
+/* udis86 - libudis86/types.h
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_TYPES_H
+#define UD_TYPES_H
+
+#ifdef __KERNEL__
+ /*
+ * -D__KERNEL__ is automatically passed on the command line when
+ * building something as part of the Linux kernel. Assume standalone
+ * mode.
+ */
+# include <linux/kernel.h>
+# include <linux/string.h>
+# ifndef __UD_STANDALONE__
+# define __UD_STANDALONE__ 1
+# endif
+#endif /* __KERNEL__ */
+
+#if !defined(__UD_STANDALONE__)
+# include <stdint.h>
+# include <stdio.h>
+#endif
+
+/* gcc specific extensions */
+#ifdef __GNUC__
+# define UD_ATTR_PACKED __attribute__((packed))
+#else
+# define UD_ATTR_PACKED
+#endif /* UD_ATTR_PACKED */
+
+
+/* -----------------------------------------------------------------------------
+ * All possible "types" of objects in udis86. Order is Important!
+ * -----------------------------------------------------------------------------
+ */
+enum ud_type
+{
+ UD_NONE,
+
+ /* 8 bit GPRs */
+ UD_R_AL, UD_R_CL, UD_R_DL, UD_R_BL,
+ UD_R_AH, UD_R_CH, UD_R_DH, UD_R_BH,
+ UD_R_SPL, UD_R_BPL, UD_R_SIL, UD_R_DIL,
+ UD_R_R8B, UD_R_R9B, UD_R_R10B, UD_R_R11B,
+ UD_R_R12B, UD_R_R13B, UD_R_R14B, UD_R_R15B,
+
+ /* 16 bit GPRs */
+ UD_R_AX, UD_R_CX, UD_R_DX, UD_R_BX,
+ UD_R_SP, UD_R_BP, UD_R_SI, UD_R_DI,
+ UD_R_R8W, UD_R_R9W, UD_R_R10W, UD_R_R11W,
+ UD_R_R12W, UD_R_R13W, UD_R_R14W, UD_R_R15W,
+
+ /* 32 bit GPRs */
+ UD_R_EAX, UD_R_ECX, UD_R_EDX, UD_R_EBX,
+ UD_R_ESP, UD_R_EBP, UD_R_ESI, UD_R_EDI,
+ UD_R_R8D, UD_R_R9D, UD_R_R10D, UD_R_R11D,
+ UD_R_R12D, UD_R_R13D, UD_R_R14D, UD_R_R15D,
+
+ /* 64 bit GPRs */
+ UD_R_RAX, UD_R_RCX, UD_R_RDX, UD_R_RBX,
+ UD_R_RSP, UD_R_RBP, UD_R_RSI, UD_R_RDI,
+ UD_R_R8, UD_R_R9, UD_R_R10, UD_R_R11,
+ UD_R_R12, UD_R_R13, UD_R_R14, UD_R_R15,
+
+ /* segment registers */
+ UD_R_ES, UD_R_CS, UD_R_SS, UD_R_DS,
+ UD_R_FS, UD_R_GS,
+
+ /* control registers*/
+ UD_R_CR0, UD_R_CR1, UD_R_CR2, UD_R_CR3,
+ UD_R_CR4, UD_R_CR5, UD_R_CR6, UD_R_CR7,
+ UD_R_CR8, UD_R_CR9, UD_R_CR10, UD_R_CR11,
+ UD_R_CR12, UD_R_CR13, UD_R_CR14, UD_R_CR15,
+
+ /* debug registers */
+ UD_R_DR0, UD_R_DR1, UD_R_DR2, UD_R_DR3,
+ UD_R_DR4, UD_R_DR5, UD_R_DR6, UD_R_DR7,
+ UD_R_DR8, UD_R_DR9, UD_R_DR10, UD_R_DR11,
+ UD_R_DR12, UD_R_DR13, UD_R_DR14, UD_R_DR15,
+
+ /* mmx registers */
+ UD_R_MM0, UD_R_MM1, UD_R_MM2, UD_R_MM3,
+ UD_R_MM4, UD_R_MM5, UD_R_MM6, UD_R_MM7,
+
+ /* x87 registers */
+ UD_R_ST0, UD_R_ST1, UD_R_ST2, UD_R_ST3,
+ UD_R_ST4, UD_R_ST5, UD_R_ST6, UD_R_ST7,
+
+ /* extended multimedia registers */
+ UD_R_XMM0, UD_R_XMM1, UD_R_XMM2, UD_R_XMM3,
+ UD_R_XMM4, UD_R_XMM5, UD_R_XMM6, UD_R_XMM7,
+ UD_R_XMM8, UD_R_XMM9, UD_R_XMM10, UD_R_XMM11,
+ UD_R_XMM12, UD_R_XMM13, UD_R_XMM14, UD_R_XMM15,
+
+ /* 256B multimedia registers */
+ UD_R_YMM0, UD_R_YMM1, UD_R_YMM2, UD_R_YMM3,
+ UD_R_YMM4, UD_R_YMM5, UD_R_YMM6, UD_R_YMM7,
+ UD_R_YMM8, UD_R_YMM9, UD_R_YMM10, UD_R_YMM11,
+ UD_R_YMM12, UD_R_YMM13, UD_R_YMM14, UD_R_YMM15,
+
+ UD_R_RIP,
+
+ /* Operand Types */
+ UD_OP_REG, UD_OP_MEM, UD_OP_PTR, UD_OP_IMM,
+ UD_OP_JIMM, UD_OP_CONST
+};
+
+#include "itab.h"
+
+union ud_lval {
+ int8_t sbyte;
+ uint8_t ubyte;
+ int16_t sword;
+ uint16_t uword;
+ int32_t sdword;
+ uint32_t udword;
+ int64_t sqword;
+ uint64_t uqword;
+ struct {
+ uint16_t seg;
+ uint32_t off;
+ } ptr;
+};
+
+/* -----------------------------------------------------------------------------
+ * struct ud_operand - Disassembled instruction Operand.
+ * -----------------------------------------------------------------------------
+ */
+struct ud_operand {
+ enum ud_type type;
+ uint16_t size;
+ enum ud_type base;
+ enum ud_type index;
+ uint8_t scale;
+ uint8_t offset;
+ union ud_lval lval;
+ /*
+ * internal use only
+ */
+ uint64_t _legacy; /* this will be removed in 1.8 */
+ uint8_t _oprcode;
+};
+
+/* -----------------------------------------------------------------------------
+ * struct ud - The udis86 object.
+ * -----------------------------------------------------------------------------
+ */
+struct ud
+{
+ /*
+ * input buffering
+ */
+ int (*inp_hook) (struct ud*);
+#ifndef __UD_STANDALONE__
+ FILE* inp_file;
+#endif
+ const uint8_t* inp_buf;
+ size_t inp_buf_size;
+ size_t inp_buf_index;
+ uint8_t inp_curr;
+ size_t inp_ctr;
+ uint8_t inp_sess[64];
+ int inp_end;
+ int inp_peek;
+
+ void (*translator)(struct ud*);
+ uint64_t insn_offset;
+ char insn_hexcode[64];
+
+ /*
+ * Assembly output buffer
+ */
+ char *asm_buf;
+ size_t asm_buf_size;
+ size_t asm_buf_fill;
+ char asm_buf_int[128];
+
+ /*
+ * Symbol resolver for use in the translation phase.
+ */
+ const char* (*sym_resolver)(struct ud*, uint64_t addr, int64_t *offset);
+
+ uint8_t dis_mode;
+ uint64_t pc;
+ uint8_t vendor;
+ enum ud_mnemonic_code mnemonic;
+ struct ud_operand operand[4];
+ uint8_t error;
+ uint8_t _rex;
+ uint8_t pfx_rex;
+ uint8_t pfx_seg;
+ uint8_t pfx_opr;
+ uint8_t pfx_adr;
+ uint8_t pfx_lock;
+ uint8_t pfx_str;
+ uint8_t pfx_rep;
+ uint8_t pfx_repe;
+ uint8_t pfx_repne;
+ uint8_t opr_mode;
+ uint8_t adr_mode;
+ uint8_t br_far;
+ uint8_t br_near;
+ uint8_t have_modrm;
+ uint8_t modrm;
+ uint8_t modrm_offset;
+ uint8_t vex_op;
+ uint8_t vex_b1;
+ uint8_t vex_b2;
+ uint8_t primary_opcode;
+ void * user_opaque_data;
+ struct ud_itab_entry * itab_entry;
+ struct ud_lookup_table_list_entry *le;
+};
+
+/* -----------------------------------------------------------------------------
+ * Type-definitions
+ * -----------------------------------------------------------------------------
+ */
+typedef enum ud_type ud_type_t;
+typedef enum ud_mnemonic_code ud_mnemonic_code_t;
+
+typedef struct ud ud_t;
+typedef struct ud_operand ud_operand_t;
+
+#define UD_SYN_INTEL ud_translate_intel
+#define UD_SYN_ATT ud_translate_att
+#define UD_EOI (-1)
+#define UD_INP_CACHE_SZ 32
+#define UD_VENDOR_AMD 0
+#define UD_VENDOR_INTEL 1
+#define UD_VENDOR_ANY 2
+
+#endif
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/udint.h b/ext/opcache/jit/libudis86/udint.h
new file mode 100644
index 0000000000..734f0eaa82
--- /dev/null
+++ b/ext/opcache/jit/libudis86/udint.h
@@ -0,0 +1,99 @@
+/* udis86 - libudis86/udint.h -- definitions for internal use only
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _UDINT_H_
+#define _UDINT_H_
+
+#include "types.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#if defined(UD_DEBUG) && HAVE_ASSERT_H
+# include <assert.h>
+# define UD_ASSERT(_x) assert(_x)
+#else
+# define UD_ASSERT(_x)
+#endif /* !HAVE_ASSERT_H */
+
+#if defined(UD_DEBUG)
+ #define UDERR(u, msg) \
+ do { \
+ (u)->error = 1; \
+ fprintf(stderr, "decode-error: %s:%d: %s", \
+ __FILE__, __LINE__, (msg)); \
+ } while (0)
+#else
+ #define UDERR(u, m) \
+ do { \
+ (u)->error = 1; \
+ } while (0)
+#endif /* !LOGERR */
+
+#define UD_RETURN_ON_ERROR(u) \
+ do { \
+ if ((u)->error != 0) { \
+ return (u)->error; \
+ } \
+ } while (0)
+
+#define UD_RETURN_WITH_ERROR(u, m) \
+ do { \
+ UDERR(u, m); \
+ return (u)->error; \
+ } while (0)
+
+#ifndef __UD_STANDALONE__
+# define UD_NON_STANDALONE(x) x
+#else
+# define UD_NON_STANDALONE(x)
+#endif
+
+/* printf formatting int64 specifier */
+#ifdef FMT64
+# undef FMT64
+#endif
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+# define FMT64 "I64"
+#else
+# if defined(__APPLE__)
+# define FMT64 "ll"
+# elif defined(__amd64__) || defined(__x86_64__)
+# define FMT64 "l"
+# else
+# define FMT64 "ll"
+# endif /* !x64 */
+#endif
+
+/* define an inline macro */
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+# define UD_INLINE __inline /* MS Visual Studio requires __inline
+ instead of inline for C code */
+#else
+# define UD_INLINE inline
+#endif
+
+#endif /* _UDINT_H_ */
diff --git a/ext/opcache/jit/libudis86/udis86.c b/ext/opcache/jit/libudis86/udis86.c
new file mode 100644
index 0000000000..0e00729feb
--- /dev/null
+++ b/ext/opcache/jit/libudis86/udis86.c
@@ -0,0 +1,458 @@
+/* udis86 - libudis86/udis86.c
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "udint.h"
+#include "extern.h"
+#include "decode.h"
+
+#if !defined(__UD_STANDALONE__)
+# if HAVE_STRING_H
+# include <string.h>
+# endif
+#endif /* !__UD_STANDALONE__ */
+
+static void ud_inp_init(struct ud *u);
+
+/* =============================================================================
+ * ud_init
+ * Initializes ud_t object.
+ * =============================================================================
+ */
+extern void
+ud_init(struct ud* u)
+{
+ memset((void*)u, 0, sizeof(struct ud));
+ ud_set_mode(u, 16);
+ u->mnemonic = UD_Iinvalid;
+ ud_set_pc(u, 0);
+#ifndef __UD_STANDALONE__
+ ud_set_input_file(u, stdin);
+#endif /* __UD_STANDALONE__ */
+
+ ud_set_asm_buffer(u, u->asm_buf_int, sizeof(u->asm_buf_int));
+}
+
+
+/* =============================================================================
+ * ud_disassemble
+ * Disassembles one instruction and returns the number of
+ * bytes disassembled. A zero means end of disassembly.
+ * =============================================================================
+ */
+extern unsigned int
+ud_disassemble(struct ud* u)
+{
+ int len;
+ if (u->inp_end) {
+ return 0;
+ }
+ if ((len = ud_decode(u)) > 0) {
+ if (u->translator != NULL) {
+ u->asm_buf[0] = '\0';
+ u->translator(u);
+ }
+ }
+ return len;
+}
+
+
+/* =============================================================================
+ * ud_set_mode() - Set Disassemly Mode.
+ * =============================================================================
+ */
+extern void
+ud_set_mode(struct ud* u, uint8_t m)
+{
+ switch(m) {
+ case 16:
+ case 32:
+ case 64: u->dis_mode = m ; return;
+ default: u->dis_mode = 16; return;
+ }
+}
+
+/* =============================================================================
+ * ud_set_vendor() - Set vendor.
+ * =============================================================================
+ */
+extern void
+ud_set_vendor(struct ud* u, unsigned v)
+{
+ switch(v) {
+ case UD_VENDOR_INTEL:
+ u->vendor = v;
+ break;
+ case UD_VENDOR_ANY:
+ u->vendor = v;
+ break;
+ default:
+ u->vendor = UD_VENDOR_AMD;
+ }
+}
+
+/* =============================================================================
+ * ud_set_pc() - Sets code origin.
+ * =============================================================================
+ */
+extern void
+ud_set_pc(struct ud* u, uint64_t o)
+{
+ u->pc = o;
+}
+
+/* =============================================================================
+ * ud_set_syntax() - Sets the output syntax.
+ * =============================================================================
+ */
+extern void
+ud_set_syntax(struct ud* u, void (*t)(struct ud*))
+{
+ u->translator = t;
+}
+
+/* =============================================================================
+ * ud_insn() - returns the disassembled instruction
+ * =============================================================================
+ */
+const char*
+ud_insn_asm(const struct ud* u)
+{
+ return u->asm_buf;
+}
+
+/* =============================================================================
+ * ud_insn_offset() - Returns the offset.
+ * =============================================================================
+ */
+uint64_t
+ud_insn_off(const struct ud* u)
+{
+ return u->insn_offset;
+}
+
+
+/* =============================================================================
+ * ud_insn_hex() - Returns hex form of disassembled instruction.
+ * =============================================================================
+ */
+const char*
+ud_insn_hex(struct ud* u)
+{
+ u->insn_hexcode[0] = 0;
+ if (!u->error) {
+ unsigned int i;
+ const unsigned char *src_ptr = ud_insn_ptr(u);
+ char* src_hex;
+ src_hex = (char*) u->insn_hexcode;
+ /* for each byte used to decode instruction */
+ for (i = 0; i < ud_insn_len(u) && i < sizeof(u->insn_hexcode) / 2;
+ ++i, ++src_ptr) {
+ sprintf(src_hex, "%02x", *src_ptr & 0xFF);
+ src_hex += 2;
+ }
+ }
+ return u->insn_hexcode;
+}
+
+
+/* =============================================================================
+ * ud_insn_ptr
+ * Returns a pointer to buffer containing the bytes that were
+ * disassembled.
+ * =============================================================================
+ */
+extern const uint8_t*
+ud_insn_ptr(const struct ud* u)
+{
+ return (u->inp_buf == NULL) ?
+ u->inp_sess : u->inp_buf + (u->inp_buf_index - u->inp_ctr);
+}
+
+
+/* =============================================================================
+ * ud_insn_len
+ * Returns the count of bytes disassembled.
+ * =============================================================================
+ */
+extern unsigned int
+ud_insn_len(const struct ud* u)
+{
+ return u->inp_ctr;
+}
+
+
+/* =============================================================================
+ * ud_insn_get_opr
+ * Return the operand struct representing the nth operand of
+ * the currently disassembled instruction. Returns NULL if
+ * there's no such operand.
+ * =============================================================================
+ */
+const struct ud_operand*
+ud_insn_opr(const struct ud *u, unsigned int n)
+{
+ if (n > 3 || u->operand[n].type == UD_NONE) {
+ return NULL;
+ } else {
+ return &u->operand[n];
+ }
+}
+
+
+/* =============================================================================
+ * ud_opr_is_sreg
+ * Returns non-zero if the given operand is of a segment register type.
+ * =============================================================================
+ */
+int
+ud_opr_is_sreg(const struct ud_operand *opr)
+{
+ return opr->type == UD_OP_REG &&
+ opr->base >= UD_R_ES &&
+ opr->base <= UD_R_GS;
+}
+
+
+/* =============================================================================
+ * ud_opr_is_sreg
+ * Returns non-zero if the given operand is of a general purpose
+ * register type.
+ * =============================================================================
+ */
+int
+ud_opr_is_gpr(const struct ud_operand *opr)
+{
+ return opr->type == UD_OP_REG &&
+ opr->base >= UD_R_AL &&
+ opr->base <= UD_R_R15;
+}
+
+
+/* =============================================================================
+ * ud_set_user_opaque_data
+ * ud_get_user_opaque_data
+ * Get/set user opaqute data pointer
+ * =============================================================================
+ */
+void
+ud_set_user_opaque_data(struct ud * u, void* opaque)
+{
+ u->user_opaque_data = opaque;
+}
+
+void*
+ud_get_user_opaque_data(const struct ud *u)
+{
+ return u->user_opaque_data;
+}
+
+
+/* =============================================================================
+ * ud_set_asm_buffer
+ * Allow the user to set an assembler output buffer. If `buf` is NULL,
+ * we switch back to the internal buffer.
+ * =============================================================================
+ */
+void
+ud_set_asm_buffer(struct ud *u, char *buf, size_t size)
+{
+ if (buf == NULL) {
+ ud_set_asm_buffer(u, u->asm_buf_int, sizeof(u->asm_buf_int));
+ } else {
+ u->asm_buf = buf;
+ u->asm_buf_size = size;
+ }
+}
+
+
+/* =============================================================================
+ * ud_set_sym_resolver
+ * Set symbol resolver for relative targets used in the translation
+ * phase.
+ *
+ * The resolver is a function that takes a uint64_t address and returns a
+ * symbolic name for the that address. The function also takes a second
+ * argument pointing to an integer that the client can optionally set to a
+ * non-zero value for offsetted targets. (symbol+offset) The function may
+ * also return NULL, in which case the translator only prints the target
+ * address.
+ *
+ * The function pointer maybe NULL which resets symbol resolution.
+ * =============================================================================
+ */
+void
+ud_set_sym_resolver(struct ud *u, const char* (*resolver)(struct ud*,
+ uint64_t addr,
+ int64_t *offset))
+{
+ u->sym_resolver = resolver;
+}
+
+
+/* =============================================================================
+ * ud_insn_mnemonic
+ * Return the current instruction mnemonic.
+ * =============================================================================
+ */
+enum ud_mnemonic_code
+ud_insn_mnemonic(const struct ud *u)
+{
+ return u->mnemonic;
+}
+
+
+/* =============================================================================
+ * ud_lookup_mnemonic
+ * Looks up mnemonic code in the mnemonic string table.
+ * Returns NULL if the mnemonic code is invalid.
+ * =============================================================================
+ */
+const char*
+ud_lookup_mnemonic(enum ud_mnemonic_code c)
+{
+ if (c < UD_MAX_MNEMONIC_CODE) {
+ return ud_mnemonics_str[c];
+ } else {
+ return "???";
+ }
+}
+
+
+/*
+ * ud_inp_init
+ * Initializes the input system.
+ */
+static void
+ud_inp_init(struct ud *u)
+{
+ u->inp_hook = NULL;
+ u->inp_buf = NULL;
+ u->inp_buf_size = 0;
+ u->inp_buf_index = 0;
+ u->inp_curr = 0;
+ u->inp_ctr = 0;
+ u->inp_end = 0;
+ u->inp_peek = UD_EOI;
+ UD_NON_STANDALONE(u->inp_file = NULL);
+}
+
+
+/* =============================================================================
+ * ud_inp_set_hook
+ * Sets input hook.
+ * =============================================================================
+ */
+void
+ud_set_input_hook(register struct ud* u, int (*hook)(struct ud*))
+{
+ ud_inp_init(u);
+ u->inp_hook = hook;
+}
+
+/* =============================================================================
+ * ud_inp_set_buffer
+ * Set buffer as input.
+ * =============================================================================
+ */
+void
+ud_set_input_buffer(register struct ud* u, const uint8_t* buf, size_t len)
+{
+ ud_inp_init(u);
+ u->inp_buf = buf;
+ u->inp_buf_size = len;
+ u->inp_buf_index = 0;
+}
+
+
+#ifndef __UD_STANDALONE__
+/* =============================================================================
+ * ud_input_set_file
+ * Set FILE as input.
+ * =============================================================================
+ */
+static int
+inp_file_hook(struct ud* u)
+{
+ return fgetc(u->inp_file);
+}
+
+void
+ud_set_input_file(register struct ud* u, FILE* f)
+{
+ ud_inp_init(u);
+ u->inp_hook = inp_file_hook;
+ u->inp_file = f;
+}
+#endif /* __UD_STANDALONE__ */
+
+
+/* =============================================================================
+ * ud_input_skip
+ * Skip n input bytes.
+ * ============================================================================
+ */
+void
+ud_input_skip(struct ud* u, size_t n)
+{
+ if (u->inp_end) {
+ return;
+ }
+ if (u->inp_buf == NULL) {
+ while (n--) {
+ int c = u->inp_hook(u);
+ if (c == UD_EOI) {
+ goto eoi;
+ }
+ }
+ return;
+ } else {
+ if (n > u->inp_buf_size ||
+ u->inp_buf_index > u->inp_buf_size - n) {
+ u->inp_buf_index = u->inp_buf_size;
+ goto eoi;
+ }
+ u->inp_buf_index += n;
+ return;
+ }
+eoi:
+ u->inp_end = 1;
+ UDERR(u, "cannot skip, eoi received\b");
+ return;
+}
+
+
+/* =============================================================================
+ * ud_input_end
+ * Returns non-zero on end-of-input.
+ * =============================================================================
+ */
+int
+ud_input_end(const struct ud *u)
+{
+ return u->inp_end;
+}
+
+/* vim:set ts=2 sw=2 expandtab */
diff --git a/ext/opcache/jit/vtune/ittnotify_config.h b/ext/opcache/jit/vtune/ittnotify_config.h
new file mode 100644
index 0000000000..fc3a476cdd
--- /dev/null
+++ b/ext/opcache/jit/vtune/ittnotify_config.h
@@ -0,0 +1,596 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+#ifndef _ITTNOTIFY_CONFIG_H_
+#define _ITTNOTIFY_CONFIG_H_
+
+/** @cond exclude_from_documentation */
+#ifndef ITT_OS_WIN
+# define ITT_OS_WIN 1
+#endif /* ITT_OS_WIN */
+
+#ifndef ITT_OS_LINUX
+# define ITT_OS_LINUX 2
+#endif /* ITT_OS_LINUX */
+
+#ifndef ITT_OS_MAC
+# define ITT_OS_MAC 3
+#endif /* ITT_OS_MAC */
+
+#ifndef ITT_OS_FREEBSD
+# define ITT_OS_FREEBSD 4
+#endif /* ITT_OS_FREEBSD */
+
+#ifndef ITT_OS
+# if defined WIN32 || defined _WIN32
+# define ITT_OS ITT_OS_WIN
+# elif defined( __APPLE__ ) && defined( __MACH__ )
+# define ITT_OS ITT_OS_MAC
+# elif defined( __FreeBSD__ )
+# define ITT_OS ITT_OS_FREEBSD
+# else
+# define ITT_OS ITT_OS_LINUX
+# endif
+#endif /* ITT_OS */
+
+#ifndef ITT_PLATFORM_WIN
+# define ITT_PLATFORM_WIN 1
+#endif /* ITT_PLATFORM_WIN */
+
+#ifndef ITT_PLATFORM_POSIX
+# define ITT_PLATFORM_POSIX 2
+#endif /* ITT_PLATFORM_POSIX */
+
+#ifndef ITT_PLATFORM_MAC
+# define ITT_PLATFORM_MAC 3
+#endif /* ITT_PLATFORM_MAC */
+
+#ifndef ITT_PLATFORM_FREEBSD
+# define ITT_PLATFORM_FREEBSD 4
+#endif /* ITT_PLATFORM_FREEBSD */
+
+#ifndef ITT_PLATFORM
+# if ITT_OS==ITT_OS_WIN
+# define ITT_PLATFORM ITT_PLATFORM_WIN
+# elif ITT_OS==ITT_OS_MAC
+# define ITT_PLATFORM ITT_PLATFORM_MAC
+# elif ITT_OS==ITT_OS_FREEBSD
+# define ITT_PLATFORM ITT_PLATFORM_FREEBSD
+# else
+# define ITT_PLATFORM ITT_PLATFORM_POSIX
+# endif
+#endif /* ITT_PLATFORM */
+
+#if defined(_UNICODE) && !defined(UNICODE)
+#define UNICODE
+#endif
+
+#include <stddef.h>
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#include <tchar.h>
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#include <stdint.h>
+#if defined(UNICODE) || defined(_UNICODE)
+#include <wchar.h>
+#endif /* UNICODE || _UNICODE */
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+#ifndef ITTAPI_CDECL
+# if ITT_PLATFORM==ITT_PLATFORM_WIN
+# define ITTAPI_CDECL __cdecl
+# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+# if defined _M_IX86 || defined __i386__
+# define ITTAPI_CDECL __attribute__ ((cdecl))
+# else /* _M_IX86 || __i386__ */
+# define ITTAPI_CDECL /* actual only on x86 platform */
+# endif /* _M_IX86 || __i386__ */
+# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#endif /* ITTAPI_CDECL */
+
+#ifndef STDCALL
+# if ITT_PLATFORM==ITT_PLATFORM_WIN
+# define STDCALL __stdcall
+# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+# if defined _M_IX86 || defined __i386__
+# define STDCALL __attribute__ ((stdcall))
+# else /* _M_IX86 || __i386__ */
+# define STDCALL /* supported only on x86 platform */
+# endif /* _M_IX86 || __i386__ */
+# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#endif /* STDCALL */
+
+#define ITTAPI ITTAPI_CDECL
+#define LIBITTAPI ITTAPI_CDECL
+
+/* TODO: Temporary for compatibility! */
+#define ITTAPI_CALL ITTAPI_CDECL
+#define LIBITTAPI_CALL ITTAPI_CDECL
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+/* use __forceinline (VC++ specific) */
+#define ITT_INLINE __forceinline
+#define ITT_INLINE_ATTRIBUTE /* nothing */
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+/*
+ * Generally, functions are not inlined unless optimization is specified.
+ * For functions declared inline, this attribute inlines the function even
+ * if no optimization level was specified.
+ */
+#ifdef __STRICT_ANSI__
+#define ITT_INLINE static
+#define ITT_INLINE_ATTRIBUTE __attribute__((unused))
+#else /* __STRICT_ANSI__ */
+#define ITT_INLINE static inline
+#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
+#endif /* __STRICT_ANSI__ */
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+/** @endcond */
+
+#ifndef ITT_ARCH_IA32
+# define ITT_ARCH_IA32 1
+#endif /* ITT_ARCH_IA32 */
+
+#ifndef ITT_ARCH_IA32E
+# define ITT_ARCH_IA32E 2
+#endif /* ITT_ARCH_IA32E */
+
+#ifndef ITT_ARCH_ARM
+# define ITT_ARCH_ARM 4
+#endif /* ITT_ARCH_ARM */
+
+#ifndef ITT_ARCH_PPC64
+# define ITT_ARCH_PPC64 5
+#endif /* ITT_ARCH_PPC64 */
+
+#ifndef ITT_ARCH
+# if defined _M_IX86 || defined __i386__
+# define ITT_ARCH ITT_ARCH_IA32
+# elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
+# define ITT_ARCH ITT_ARCH_IA32E
+# elif defined _M_IA64 || defined __ia64__
+# define ITT_ARCH ITT_ARCH_IA64
+# elif defined _M_ARM || defined __arm__
+# define ITT_ARCH ITT_ARCH_ARM
+# elif defined __powerpc64__
+# define ITT_ARCH ITT_ARCH_PPC64
+# endif
+#endif
+
+#ifdef __cplusplus
+# define ITT_EXTERN_C extern "C"
+# define ITT_EXTERN_C_BEGIN extern "C" {
+# define ITT_EXTERN_C_END }
+#else
+# define ITT_EXTERN_C /* nothing */
+# define ITT_EXTERN_C_BEGIN /* nothing */
+# define ITT_EXTERN_C_END /* nothing */
+#endif /* __cplusplus */
+
+#define ITT_TO_STR_AUX(x) #x
+#define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
+
+#define __ITT_BUILD_ASSERT(expr, suffix) do { \
+ static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
+ __itt_build_check_##suffix[0] = 0; \
+} while(0)
+#define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
+#define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
+
+#define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
+
+/* Replace with snapshot date YYYYMMDD for promotion build. */
+#define API_VERSION_BUILD 20151119
+
+#ifndef API_VERSION_NUM
+#define API_VERSION_NUM 0.0.0
+#endif /* API_VERSION_NUM */
+
+#define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
+ " (" ITT_TO_STR(API_VERSION_BUILD) ")"
+
+/* OS communication functions */
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#include <windows.h>
+typedef HMODULE lib_t;
+typedef DWORD TIDT;
+typedef CRITICAL_SECTION mutex_t;
+#define MUTEX_INITIALIZER { 0 }
+#define strong_alias(name, aliasname) /* empty for Windows */
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#include <dlfcn.h>
+#if defined(UNICODE) || defined(_UNICODE)
+#include <wchar.h>
+#endif /* UNICODE */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
+#endif /* _GNU_SOURCE */
+#ifndef __USE_UNIX98
+#define __USE_UNIX98 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein pthread.h missing dependency on __USE_XOPEN2K8 */
+#endif /*__USE_UNIX98*/
+#include <pthread.h>
+typedef void* lib_t;
+typedef pthread_t TIDT;
+typedef pthread_mutex_t mutex_t;
+#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#define __itt_get_proc(lib, name) GetProcAddress(lib, name)
+#define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
+#define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
+#define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
+#define __itt_load_lib(name) LoadLibraryA(name)
+#define __itt_unload_lib(handle) FreeLibrary(handle)
+#define __itt_system_error() (int)GetLastError()
+#define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
+#define __itt_fstrnlen(s, l) strnlen_s(s, l)
+#define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l)
+#define __itt_fstrdup(s) _strdup(s)
+#define __itt_thread_id() GetCurrentThreadId()
+#define __itt_thread_yield() SwitchToThread()
+#ifndef ITT_SIMPLE_INIT
+ITT_INLINE long
+__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
+ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
+{
+ return InterlockedIncrement(ptr);
+}
+#endif /* ITT_SIMPLE_INIT */
+#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
+#define __itt_get_proc(lib, name) dlsym(lib, name)
+#define __itt_mutex_init(mutex) {\
+ pthread_mutexattr_t mutex_attr; \
+ int error_code = pthread_mutexattr_init(&mutex_attr); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
+ error_code); \
+ error_code = pthread_mutexattr_settype(&mutex_attr, \
+ PTHREAD_MUTEX_RECURSIVE); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
+ error_code); \
+ error_code = pthread_mutex_init(mutex, &mutex_attr); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutex_init", \
+ error_code); \
+ error_code = pthread_mutexattr_destroy(&mutex_attr); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
+ error_code); \
+}
+#define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
+#define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
+#define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
+#define __itt_unload_lib(handle) dlclose(handle)
+#define __itt_system_error() errno
+#define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
+
+/* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */
+#ifdef SDL_STRNLEN_S
+#define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l)
+#else
+#define __itt_fstrnlen(s, l) strlen(s)
+#endif /* SDL_STRNLEN_S */
+#ifdef SDL_STRNCPY_S
+#define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
+#else
+#define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, l)
+#endif /* SDL_STRNCPY_S */
+
+#define __itt_fstrdup(s) strdup(s)
+#define __itt_thread_id() pthread_self()
+#define __itt_thread_yield() sched_yield()
+#if ITT_ARCH==ITT_ARCH_IA64
+#ifdef __INTEL_COMPILER
+#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
+#else /* __INTEL_COMPILER */
+/* TODO: Add Support for not Intel compilers for IA-64 architecture */
+#endif /* __INTEL_COMPILER */
+#elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */
+ITT_INLINE long
+__TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE;
+ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
+{
+ long result;
+ __asm__ __volatile__("lock\nxadd %0,%1"
+ : "=r"(result),"=m"(*(int*)ptr)
+ : "0"(addend), "m"(*(int*)ptr)
+ : "memory");
+ return result;
+}
+#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
+#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
+#endif /* ITT_ARCH==ITT_ARCH_IA64 */
+#ifndef ITT_SIMPLE_INIT
+ITT_INLINE long
+__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
+ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
+{
+ return __TBB_machine_fetchadd4(ptr, 1) + 1L;
+}
+#endif /* ITT_SIMPLE_INIT */
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+typedef enum {
+ __itt_collection_normal = 0,
+ __itt_collection_paused = 1
+} __itt_collection_state;
+
+typedef enum {
+ __itt_thread_normal = 0,
+ __itt_thread_ignored = 1
+} __itt_thread_state;
+
+#pragma pack(push, 8)
+
+typedef struct ___itt_thread_info
+{
+ const char* nameA; /*!< Copy of original name in ASCII. */
+#if defined(UNICODE) || defined(_UNICODE)
+ const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
+#else /* UNICODE || _UNICODE */
+ void* nameW;
+#endif /* UNICODE || _UNICODE */
+ TIDT tid;
+ __itt_thread_state state; /*!< Thread state (paused or normal) */
+ int extra1; /*!< Reserved to the runtime */
+ void* extra2; /*!< Reserved to the runtime */
+ struct ___itt_thread_info* next;
+} __itt_thread_info;
+
+#include "ittnotify_types.h" /* For __itt_group_id definition */
+
+typedef struct ___itt_api_info_20101001
+{
+ const char* name;
+ void** func_ptr;
+ void* init_func;
+ __itt_group_id group;
+} __itt_api_info_20101001;
+
+typedef struct ___itt_api_info
+{
+ const char* name;
+ void** func_ptr;
+ void* init_func;
+ void* null_func;
+ __itt_group_id group;
+} __itt_api_info;
+
+typedef struct __itt_counter_info
+{
+ const char* nameA; /*!< Copy of original name in ASCII. */
+#if defined(UNICODE) || defined(_UNICODE)
+ const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
+#else /* UNICODE || _UNICODE */
+ void* nameW;
+#endif /* UNICODE || _UNICODE */
+ const char* domainA; /*!< Copy of original name in ASCII. */
+#if defined(UNICODE) || defined(_UNICODE)
+ const wchar_t* domainW; /*!< Copy of original name in UNICODE. */
+#else /* UNICODE || _UNICODE */
+ void* domainW;
+#endif /* UNICODE || _UNICODE */
+ int type;
+ long index;
+ int extra1; /*!< Reserved to the runtime */
+ void* extra2; /*!< Reserved to the runtime */
+ struct __itt_counter_info* next;
+} __itt_counter_info_t;
+
+struct ___itt_domain;
+struct ___itt_string_handle;
+
+typedef struct ___itt_global
+{
+ unsigned char magic[8];
+ unsigned long version_major;
+ unsigned long version_minor;
+ unsigned long version_build;
+ volatile long api_initialized;
+ volatile long mutex_initialized;
+ volatile long atomic_counter;
+ mutex_t mutex;
+ lib_t lib;
+ void* error_handler;
+ const char** dll_path_ptr;
+ __itt_api_info* api_list_ptr;
+ struct ___itt_global* next;
+ /* Joinable structures below */
+ __itt_thread_info* thread_list;
+ struct ___itt_domain* domain_list;
+ struct ___itt_string_handle* string_list;
+ __itt_collection_state state;
+ __itt_counter_info_t* counter_list;
+} __itt_global;
+
+#pragma pack(pop)
+
+#define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
+ h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
+ if (h != NULL) { \
+ h->tid = t; \
+ h->nameA = NULL; \
+ h->nameW = n ? _wcsdup(n) : NULL; \
+ h->state = s; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->thread_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
+ h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
+ if (h != NULL) { \
+ h->tid = t; \
+ h->nameA = n ? __itt_fstrdup(n) : NULL; \
+ h->nameW = NULL; \
+ h->state = s; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->thread_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
+ h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
+ if (h != NULL) { \
+ h->flags = 1; /* domain is enabled by default */ \
+ h->nameA = NULL; \
+ h->nameW = name ? _wcsdup(name) : NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->domain_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
+ h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
+ if (h != NULL) { \
+ h->flags = 1; /* domain is enabled by default */ \
+ h->nameA = name ? __itt_fstrdup(name) : NULL; \
+ h->nameW = NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->domain_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
+ h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
+ if (h != NULL) { \
+ h->strA = NULL; \
+ h->strW = name ? _wcsdup(name) : NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->string_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
+ h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
+ if (h != NULL) { \
+ h->strA = name ? __itt_fstrdup(name) : NULL; \
+ h->strW = NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->string_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_COUNTER_W(gptr,h,h_tail,name,domain,type) { \
+ h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
+ if (h != NULL) { \
+ h->nameA = NULL; \
+ h->nameW = name ? _wcsdup(name) : NULL; \
+ h->domainA = NULL; \
+ h->domainW = name ? _wcsdup(domain) : NULL; \
+ h->type = type; \
+ h->index = 0; \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->counter_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \
+ h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
+ if (h != NULL) { \
+ h->nameA = name ? __itt_fstrdup(name) : NULL; \
+ h->nameW = NULL; \
+ h->domainA = domain ? __itt_fstrdup(domain) : NULL; \
+ h->domainW = NULL; \
+ h->type = type; \
+ h->index = 0; \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->counter_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#endif /* _ITTNOTIFY_CONFIG_H_ */
diff --git a/ext/opcache/jit/vtune/ittnotify_types.h b/ext/opcache/jit/vtune/ittnotify_types.h
new file mode 100644
index 0000000000..e10250bd63
--- /dev/null
+++ b/ext/opcache/jit/vtune/ittnotify_types.h
@@ -0,0 +1,115 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+
+#ifndef _ITTNOTIFY_TYPES_H_
+#define _ITTNOTIFY_TYPES_H_
+
+typedef enum ___itt_group_id
+{
+ __itt_group_none = 0,
+ __itt_group_legacy = 1<<0,
+ __itt_group_control = 1<<1,
+ __itt_group_thread = 1<<2,
+ __itt_group_mark = 1<<3,
+ __itt_group_sync = 1<<4,
+ __itt_group_fsync = 1<<5,
+ __itt_group_jit = 1<<6,
+ __itt_group_model = 1<<7,
+ __itt_group_splitter_min = 1<<7,
+ __itt_group_counter = 1<<8,
+ __itt_group_frame = 1<<9,
+ __itt_group_stitch = 1<<10,
+ __itt_group_heap = 1<<11,
+ __itt_group_splitter_max = 1<<12,
+ __itt_group_structure = 1<<12,
+ __itt_group_suppress = 1<<13,
+ __itt_group_arrays = 1<<14,
+ __itt_group_all = -1
+} __itt_group_id;
+
+#pragma pack(push, 8)
+
+typedef struct ___itt_group_list
+{
+ __itt_group_id id;
+ const char* name;
+} __itt_group_list;
+
+#pragma pack(pop)
+
+#define ITT_GROUP_LIST(varname) \
+ static __itt_group_list varname[] = { \
+ { __itt_group_all, "all" }, \
+ { __itt_group_control, "control" }, \
+ { __itt_group_thread, "thread" }, \
+ { __itt_group_mark, "mark" }, \
+ { __itt_group_sync, "sync" }, \
+ { __itt_group_fsync, "fsync" }, \
+ { __itt_group_jit, "jit" }, \
+ { __itt_group_model, "model" }, \
+ { __itt_group_counter, "counter" }, \
+ { __itt_group_frame, "frame" }, \
+ { __itt_group_stitch, "stitch" }, \
+ { __itt_group_heap, "heap" }, \
+ { __itt_group_structure, "structure" }, \
+ { __itt_group_suppress, "suppress" }, \
+ { __itt_group_arrays, "arrays" }, \
+ { __itt_group_none, NULL } \
+ }
+
+#endif /* _ITTNOTIFY_TYPES_H_ */
diff --git a/ext/opcache/jit/vtune/jitprofiling.c b/ext/opcache/jit/vtune/jitprofiling.c
new file mode 100644
index 0000000000..86efe047c4
--- /dev/null
+++ b/ext/opcache/jit/vtune/jitprofiling.c
@@ -0,0 +1,312 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+
+#include "ittnotify_config.h"
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#include <windows.h>
+#pragma optimize("", off)
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#include <stdlib.h>
+
+#include "jitprofiling.h"
+
+static const char rcsid[] = "\n@(#) $Revision: 463960 $\n";
+
+#define DLL_ENVIRONMENT_VAR "VS_PROFILER"
+
+#ifndef NEW_DLL_ENVIRONMENT_VAR
+#if ITT_ARCH==ITT_ARCH_IA32
+#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER32"
+#else
+#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER64"
+#endif
+#endif /* NEW_DLL_ENVIRONMENT_VAR */
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#define DEFAULT_DLLNAME "JitPI.dll"
+HINSTANCE m_libHandle = NULL;
+#elif ITT_PLATFORM==ITT_PLATFORM_MAC
+#define DEFAULT_DLLNAME "libJitPI.dylib"
+void* m_libHandle = NULL;
+#else
+#define DEFAULT_DLLNAME "libJitPI.so"
+void* m_libHandle = NULL;
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+/* default location of JIT profiling agent on Android */
+#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so"
+
+/* the function pointers */
+typedef unsigned int(JITAPI *TPInitialize)(void);
+static TPInitialize FUNC_Initialize=NULL;
+
+typedef unsigned int(JITAPI *TPNotify)(unsigned int, void*);
+static TPNotify FUNC_NotifyEvent=NULL;
+
+static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING;
+
+/* end collector dll part. */
+
+/* loadiJIT_Funcs() : this function is called just in the beginning
+ * and is responsible to load the functions from BistroJavaCollector.dll
+ * result:
+ * on success: the functions loads, iJIT_DLL_is_missing=0, return value = 1
+ * on failure: the functions are NULL, iJIT_DLL_is_missing=1, return value = 0
+ */
+static int loadiJIT_Funcs(void);
+
+/* global representing whether the collector can't be loaded */
+static int iJIT_DLL_is_missing = 0;
+
+ITT_EXTERN_C int JITAPI
+iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData)
+{
+ int ReturnValue;
+
+ /* initialization part - the collector has not been loaded yet. */
+ if (!FUNC_NotifyEvent)
+ {
+ if (iJIT_DLL_is_missing)
+ return 0;
+
+ if (!loadiJIT_Funcs())
+ return 0;
+ }
+
+ if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED ||
+ event_type == iJVM_EVENT_TYPE_METHOD_UPDATE)
+ {
+ if (((piJIT_Method_Load)EventSpecificData)->method_id == 0)
+ return 0;
+ }
+ else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2)
+ {
+ if (((piJIT_Method_Load_V2)EventSpecificData)->method_id == 0)
+ return 0;
+ }
+ else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3)
+ {
+ if (((piJIT_Method_Load_V3)EventSpecificData)->method_id == 0)
+ return 0;
+ }
+ else if (event_type == iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED)
+ {
+ if (((piJIT_Method_Inline_Load)EventSpecificData)->method_id == 0 ||
+ ((piJIT_Method_Inline_Load)EventSpecificData)->parent_method_id == 0)
+ return 0;
+ }
+
+ ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData);
+
+ return ReturnValue;
+}
+
+ITT_EXTERN_C iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive()
+{
+ if (!iJIT_DLL_is_missing)
+ {
+ loadiJIT_Funcs();
+ }
+
+ return executionMode;
+}
+
+/* This function loads the collector dll and the relevant functions.
+ * on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1
+ * on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0
+ */
+static int loadiJIT_Funcs()
+{
+ static int bDllWasLoaded = 0;
+ char *dllName = (char*)rcsid; /* !! Just to avoid unused code elimination */
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ DWORD dNameLength = 0;
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+ if(bDllWasLoaded)
+ {
+ /* dll was already loaded, no need to do it for the second time */
+ return 1;
+ }
+
+ /* Assumes that the DLL will not be found */
+ iJIT_DLL_is_missing = 1;
+ FUNC_NotifyEvent = NULL;
+
+ if (m_libHandle)
+ {
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ FreeLibrary(m_libHandle);
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ dlclose(m_libHandle);
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ m_libHandle = NULL;
+ }
+
+ /* Try to get the dll name from the environment */
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ dNameLength = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, NULL, 0);
+ if (dNameLength)
+ {
+ DWORD envret = 0;
+ dllName = (char*)malloc(sizeof(char) * (dNameLength + 1));
+ if(dllName != NULL)
+ {
+ envret = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR,
+ dllName, dNameLength);
+ if (envret)
+ {
+ /* Try to load the dll from the PATH... */
+ m_libHandle = LoadLibraryExA(dllName,
+ NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ }
+ free(dllName);
+ }
+ } else {
+ /* Try to use old VS_PROFILER variable */
+ dNameLength = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, NULL, 0);
+ if (dNameLength)
+ {
+ DWORD envret = 0;
+ dllName = (char*)malloc(sizeof(char) * (dNameLength + 1));
+ if(dllName != NULL)
+ {
+ envret = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR,
+ dllName, dNameLength);
+ if (envret)
+ {
+ /* Try to load the dll from the PATH... */
+ m_libHandle = LoadLibraryA(dllName);
+ }
+ free(dllName);
+ }
+ }
+ }
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ dllName = getenv(NEW_DLL_ENVIRONMENT_VAR);
+ if (!dllName)
+ dllName = getenv(DLL_ENVIRONMENT_VAR);
+#if defined(__ANDROID__) || defined(ANDROID)
+ if (!dllName)
+ dllName = ANDROID_JIT_AGENT_PATH;
+#endif
+ if (dllName)
+ {
+ /* Try to load the dll from the PATH... */
+ m_libHandle = dlopen(dllName, RTLD_LAZY);
+ }
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+ if (!m_libHandle)
+ {
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ m_libHandle = LoadLibraryA(DEFAULT_DLLNAME);
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY);
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ }
+
+ /* if the dll wasn't loaded - exit. */
+ if (!m_libHandle)
+ {
+ iJIT_DLL_is_missing = 1; /* don't try to initialize
+ * JIT agent the second time
+ */
+ return 0;
+ }
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent");
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ FUNC_NotifyEvent = (TPNotify)dlsym(m_libHandle, "NotifyEvent");
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ if (!FUNC_NotifyEvent)
+ {
+ FUNC_Initialize = NULL;
+ return 0;
+ }
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize");
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ FUNC_Initialize = (TPInitialize)dlsym(m_libHandle, "Initialize");
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ if (!FUNC_Initialize)
+ {
+ FUNC_NotifyEvent = NULL;
+ return 0;
+ }
+
+ executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize();
+
+ bDllWasLoaded = 1;
+ iJIT_DLL_is_missing = 0; /* DLL is ok. */
+
+ return 1;
+}
+
+ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID()
+{
+ static unsigned int methodID = 1;
+
+ if (methodID == 0)
+ return 0; /* ERROR : this is not a valid value */
+
+ return methodID++;
+}
diff --git a/ext/opcache/jit/vtune/jitprofiling.h b/ext/opcache/jit/vtune/jitprofiling.h
new file mode 100644
index 0000000000..3e166c04d4
--- /dev/null
+++ b/ext/opcache/jit/vtune/jitprofiling.h
@@ -0,0 +1,694 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+
+#ifndef __JITPROFILING_H__
+#define __JITPROFILING_H__
+
+/**
+ * @brief JIT Profiling APIs
+ *
+ * The JIT Profiling API is used to report information about just-in-time
+ * generated code that can be used by performance tools. The user inserts
+ * calls in the code generator to report information before JIT-compiled
+ * code goes to execution. This information is collected at runtime and used
+ * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics
+ * associated with JIT-compiled code.
+ *
+ * These APIs can be used to\n
+ * - **Profile trace-based and method-based JIT-compiled
+ * code**. Some examples of environments that you can profile with these APIs:
+ * dynamic JIT compilation of JavaScript code traces, JIT execution in OpenCL(TM)
+ * software technology, Java/.NET managed execution environments, and custom
+ * ISV JIT engines.
+ * @code
+ * #include <jitprofiling.h>
+ *
+ * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) {
+ * return;
+ * }
+ *
+ * iJIT_Method_Load jmethod = {0};
+ * jmethod.method_id = iJIT_GetNewMethodID();
+ * jmethod.method_name = "method_name";
+ * jmethod.class_file_name = "class_name";
+ * jmethod.source_file_name = "source_file_name";
+ * jmethod.method_load_address = code_addr;
+ * jmethod.method_size = code_size;
+ *
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL);
+ * @endcode
+ *
+ * * Expected behavior:
+ * * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an
+ * already reported method, then such a method becomes invalid and its
+ * memory region is treated as unloaded. VTune Amplifier displays the metrics
+ * collected by the method until it is overwritten.
+ * * If supplied line number information contains multiple source lines for
+ * the same assembly instruction (code location), then VTune Amplifier picks up
+ * the first line number.
+ * * Dynamically generated code can be associated with a module name.
+ * Use the iJIT_Method_Load_V2 structure.\n
+ * Clarification of some cases:
+ * * If you register a function with the same method ID multiple times,
+ * specifying different module names, then the VTune Amplifier picks up
+ * the module name registered first. If you want to distinguish the same
+ * function between different JIT engines, supply different method IDs for
+ * each function. Other symbolic information (for example, source file)
+ * can be identical.
+ *
+ * - **Analyze split functions** (multiple joint or disjoint code regions
+ * belonging to the same function) **including re-JIT**
+ * with potential overlapping of code regions in time, which is common in
+ * resource-limited environments.
+ * @code
+ * #include <jitprofiling.h>
+ *
+ * unsigned int method_id = iJIT_GetNewMethodID();
+ *
+ * iJIT_Method_Load a = {0};
+ * a.method_id = method_id;
+ * a.method_load_address = 0x100;
+ * a.method_size = 0x20;
+ *
+ * iJIT_Method_Load b = {0};
+ * b.method_id = method_id;
+ * b.method_load_address = 0x200;
+ * b.method_size = 0x30;
+ *
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b);
+ * @endcode
+ *
+ * * Expected behaviour:
+ * * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an
+ * already reported method, then such a method becomes invalid and
+ * its memory region is treated as unloaded.
+ * * All code regions reported with the same method ID are considered as
+ * belonging to the same method. Symbolic information (method name,
+ * source file name) will be taken from the first notification, and all
+ * subsequent notifications with the same method ID will be processed
+ * only for line number table information. So, the VTune Amplifier will map
+ * samples to a source line using the line number table from the current
+ * notification while taking the source file name from the very first one.\n
+ * Clarification of some cases:\n
+ * * If you register a second code region with a different source file
+ * name and the same method ID, then this information will be saved and
+ * will not be considered as an extension of the first code region, but
+ * VTune Amplifier will use the source file of the first code region and map
+ * performance metrics incorrectly.
+ * * If you register a second code region with the same source file as
+ * for the first region and the same method ID, then the source file will be
+ * discarded but VTune Amplifier will map metrics to the source file correctly.
+ * * If you register a second code region with a null source file and
+ * the same method ID, then provided line number info will be associated
+ * with the source file of the first code region.
+ *
+ * - **Explore inline functions** including multi-level hierarchy of
+ * nested inline methods which shows how performance metrics are distributed through them.
+ * @code
+ * #include <jitprofiling.h>
+ *
+ * // method_id parent_id
+ * // [-- c --] 3000 2000
+ * // [---- d -----] 2001 1000
+ * // [---- b ----] 2000 1000
+ * // [------------ a ----------------] 1000 n/a
+ *
+ * iJIT_Method_Load a = {0};
+ * a.method_id = 1000;
+ *
+ * iJIT_Method_Inline_Load b = {0};
+ * b.method_id = 2000;
+ * b.parent_method_id = 1000;
+ *
+ * iJIT_Method_Inline_Load c = {0};
+ * c.method_id = 3000;
+ * c.parent_method_id = 2000;
+ *
+ * iJIT_Method_Inline_Load d = {0};
+ * d.method_id = 2001;
+ * d.parent_method_id = 1000;
+ *
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d);
+ * @endcode
+ *
+ * * Requirements:
+ * * Each inline (iJIT_Method_Inline_Load) method should be associated
+ * with two method IDs: one for itself; one for its immediate parent.
+ * * Address regions of inline methods of the same parent method cannot
+ * overlap each other.
+ * * Execution of the parent method must not be started until it and all
+ * its inline methods are reported.
+ * * Expected behaviour:
+ * * In case of nested inline methods an order of
+ * iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important.
+ * * If any event overwrites either inline method or top parent method,
+ * then the parent, including inline methods, becomes invalid and its memory
+ * region is treated as unloaded.
+ *
+ * **Life time of allocated data**\n
+ * The client sends an event notification to the agent with event-specific
+ * data, which is a structure. The pointers in the structure refer to memory
+ * allocated by the client, which responsible for releasing it. The pointers are
+ * used by the iJIT_NotifyEvent method to copy client's data in a trace file,
+ * and they are not used after the iJIT_NotifyEvent method returns.
+ */
+
+/**
+ * @defgroup jitapi JIT Profiling
+ * @ingroup internal
+ * @{
+ */
+
+/**
+ * @brief Enumerator for the types of notifications
+ */
+typedef enum iJIT_jvm_event
+{
+ iJVM_EVENT_TYPE_SHUTDOWN = 2, /**<\brief Send this to shutdown the agent.
+ * Use NULL for event data. */
+
+ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**<\brief Send when dynamic code is
+ * JIT compiled and loaded into
+ * memory by the JIT engine, but
+ * before the code is executed.
+ * Use iJIT_Method_Load as event
+ * data. */
+/** @cond exclude_from_documentation */
+ iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**<\brief Send when compiled dynamic
+ * code is being unloaded from memory.
+ * Use iJIT_Method_Load as event data.*/
+/** @endcond */
+
+ iJVM_EVENT_TYPE_METHOD_UPDATE, /**<\brief Send to provide new content for
+ * a previously reported dynamic code.
+ * The previous content will be invalidated
+ * starting from the time of the notification.
+ * Use iJIT_Method_Load as event data but
+ * required fields are following:
+ * - method_id identify the code to update.
+ * - method_load_address specify start address
+ * within identified code range
+ * where update should be started.
+ * - method_size specify length of updated code
+ * range. */
+
+
+ iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**<\brief Send when an inline dynamic
+ * code is JIT compiled and loaded
+ * into memory by the JIT engine,
+ * but before the parent code region
+ * starts executing.
+ * Use iJIT_Method_Inline_Load as event data.*/
+
+/** @cond exclude_from_documentation */
+ iJVM_EVENT_TYPE_METHOD_UPDATE_V2,
+/** @endcond */
+
+ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 = 21, /**<\brief Send when a dynamic code is
+ * JIT compiled and loaded into
+ * memory by the JIT engine, but
+ * before the code is executed.
+ * Use iJIT_Method_Load_V2 as event data. */
+
+ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 /**<\brief Send when a dynamic code is
+ * JIT compiled and loaded into
+ * memory by the JIT engine, but
+ * before the code is executed.
+ * Use iJIT_Method_Load_V3 as event data. */
+} iJIT_JVM_EVENT;
+
+/**
+ * @brief Enumerator for the agent's mode
+ */
+typedef enum _iJIT_IsProfilingActiveFlags
+{
+ iJIT_NOTHING_RUNNING = 0x0000, /**<\brief The agent is not running;
+ * iJIT_NotifyEvent calls will
+ * not be processed. */
+ iJIT_SAMPLING_ON = 0x0001, /**<\brief The agent is running and
+ * ready to process notifications. */
+} iJIT_IsProfilingActiveFlags;
+
+/**
+ * @brief Description of a single entry in the line number information of a code region.
+ * @details A table of line number entries gives information about how the reported code region
+ * is mapped to source file.
+ * Intel(R) VTune(TM) Amplifier uses line number information to attribute
+ * the samples (virtual address) to a line number. \n
+ * It is acceptable to report different code addresses for the same source line:
+ * @code
+ * Offset LineNumber
+ * 1 2
+ * 12 4
+ * 15 2
+ * 18 1
+ * 21 30
+ *
+ * VTune Amplifier constructs the following table using the client data
+ *
+ * Code subrange Line number
+ * 0-1 2
+ * 1-12 4
+ * 12-15 2
+ * 15-18 1
+ * 18-21 30
+ * @endcode
+ */
+typedef struct _LineNumberInfo
+{
+ unsigned int Offset; /**<\brief Offset from the begining of the code region. */
+ unsigned int LineNumber; /**<\brief Matching source line number offset (from beginning of source file). */
+
+} *pLineNumberInfo, LineNumberInfo;
+
+/**
+ * @brief Enumerator for the code architecture.
+ */
+typedef enum _iJIT_CodeArchitecture
+{
+ iJIT_CA_NATIVE = 0, /**<\brief Native to the process architecture that is calling it. */
+
+ iJIT_CA_32, /**<\brief 32-bit machine code. */
+
+ iJIT_CA_64 /**<\brief 64-bit machine code. */
+
+} iJIT_CodeArchitecture;
+
+#pragma pack(push, 8)
+
+/**
+ * @brief Description of a JIT-compiled method
+ * @details When you use the iJIT_Method_Load structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Load
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself.\n
+ * You must use the same method ID for all code
+ * regions of the same method, otherwise different
+ * method IDs specify different methods. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Can't be NULL. */
+
+ void* method_load_address; /**<\brief The start virtual address of the method code
+ * region. If NULL, data provided with
+ * event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table.0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array */
+
+ unsigned int class_id; /**<\brief This field is obsolete. */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL.*/
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL.*/
+
+} *piJIT_Method_Load, iJIT_Method_Load;
+
+/**
+ * @brief Description of a JIT-compiled method
+ * @details When you use the iJIT_Method_Load_V2 structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Load_V2
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself.\n
+ * You must use the same method ID for all code
+ * regions of the same method, otherwise different
+ * method IDs specify different methods. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Can't be NULL. */
+
+ void* method_load_address; /**<\brief The start virtual address of the method code
+ * region. If NULL, then data provided with the
+ * event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table. 0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array. */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL. */
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL. */
+
+ char* module_name; /**<\brief Module name. Can be NULL.
+ The module name can be useful for distinguishing among
+ different JIT engines. VTune Amplifier will display
+ reported methods grouped by specific module. */
+
+} *piJIT_Method_Load_V2, iJIT_Method_Load_V2;
+
+/**
+ * @brief Description of a JIT-compiled method
+ * @details The iJIT_Method_Load_V3 structure is the same as iJIT_Method_Load_V2
+ * with a newly introduced 'arch' field that specifies architecture of the code region.
+ * When you use the iJIT_Method_Load_V3 structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Load_V3
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or manage ID uniqueness
+ * and correct range by yourself.\n
+ * You must use the same method ID for all code
+ * regions of the same method, otherwise they are
+ * treated as regions of different methods. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Cannot be NULL. */
+
+ void* method_load_address; /**<\brief The start virtual address of the method code
+ * region. If NULL, then data provided with the
+ * event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table. 0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array. */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL. */
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL. */
+
+ char* module_name; /**<\brief Module name. Can be NULL.
+ * The module name can be useful for distinguishing among
+ * different JIT engines. VTune Amplifier will display
+ * reported methods grouped by specific module. */
+
+ iJIT_CodeArchitecture module_arch; /**<\brief Architecture of the method's code region.
+ * By default, it is the same as the process
+ * architecture that is calling it.
+ * For example, you can use it if your 32-bit JIT
+ * engine generates 64-bit code.
+ *
+ * If JIT engine reports both 32-bit and 64-bit types
+ * of methods then VTune Amplifier splits the methods
+ * with the same module name but with different
+ * architectures in two different modules. VTune Amplifier
+ * modifies the original name provided with a 64-bit method
+ * version by ending it with '(64)' */
+
+} *piJIT_Method_Load_V3, iJIT_Method_Load_V3;
+
+/**
+ * @brief Description of an inline JIT-compiled method
+ * @details When you use the_iJIT_Method_Inline_Load structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Inline_Load
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself. */
+
+ unsigned int parent_method_id; /**<\brief Unique immediate parent's method ID.
+ * Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Can't be NULL. */
+
+ void* method_load_address; /** <\brief The virtual address on which the method
+ * is inlined. If NULL, then data provided with
+ * the event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table. 0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL.*/
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL.*/
+
+} *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load;
+
+/** @cond exclude_from_documentation */
+/**
+ * @brief Description of a segment type
+ * @details Use the segment type to specify a type of data supplied
+ * with the iJVM_EVENT_TYPE_METHOD_UPDATE_V2 event to be applied to
+ * a certain code trace.
+ */
+typedef enum _iJIT_SegmentType
+{
+ iJIT_CT_UNKNOWN = 0,
+
+ iJIT_CT_CODE, /**<\brief Executable code. */
+
+ iJIT_CT_DATA, /**<\brief Data (not executable code).
+ * VTune Amplifier uses the format string
+ * (see iJIT_Method_Update) to represent
+ * this data in the VTune Amplifier GUI */
+
+ iJIT_CT_KEEP, /**<\brief Use the previous markup for the trace.
+ * Can be used for the following
+ * iJVM_EVENT_TYPE_METHOD_UPDATE_V2 events,
+ * if the type of the previously reported segment
+ * type is the same. */
+ iJIT_CT_EOF
+} iJIT_SegmentType;
+
+/**
+ * @brief Description of a dynamic update of the content within JIT-compiled method
+ * @details The JIT engine may generate the methods that are updated at runtime
+ * partially by mixed (data + executable code) content. When you use the iJIT_Method_Update
+ * structure to describe the update of the content within a JIT-compiled method,
+ * use iJVM_EVENT_TYPE_METHOD_UPDATE_V2 as an event type to report it.
+ *
+ * On the first Update event, VTune Amplifier copies the original code range reported by
+ * the iJVM_EVENT_TYPE_METHOD_LOAD event, then modifies it with the supplied bytes and
+ * adds the modified range to the original method. For next update events, VTune Amplifier
+ * does the same but it uses the latest modified version of a code region for update.
+ * Eventually, VTune Amplifier GUI displays multiple code ranges for the method reported by
+ * the iJVM_EVENT_TYPE_METHOD_LOAD event.
+ * Notes:
+ * - Multiple update events with different types for the same trace are allowed
+ * but they must be reported for the same code ranges.
+ * Example,
+ * @code
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [code] Ignored
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [------------ trace ---------]
+ * @endcode
+ * - The types of previously reported events can be changed but they must be reported
+ * for the same code ranges.
+ * Example,
+ * @code
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [------------ trace ---------]
+ * @endcode
+ */
+
+typedef struct _iJIT_Method_Update
+{
+ void* load_address; /**<\brief Start address of the update within a method */
+
+ unsigned int size; /**<\brief The update size */
+
+ iJIT_SegmentType type; /**<\brief Type of the update */
+
+ const char* data_format; /**<\brief C string that contains a format string
+ * that follows the same specifications as format in printf.
+ * The format string is used for iJIT_CT_CODE only
+ * and cannot be NULL.
+ * Format can be changed on the fly. */
+} *piJIT_Method_Update, iJIT_Method_Update;
+
+/** @endcond */
+
+#pragma pack(pop)
+
+/** @cond exclude_from_documentation */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef JITAPI_CDECL
+# if defined WIN32 || defined _WIN32
+# define JITAPI_CDECL __cdecl
+# else /* defined WIN32 || defined _WIN32 */
+# if defined _M_IX86 || defined __i386__
+# define JITAPI_CDECL __attribute__ ((cdecl))
+# else /* _M_IX86 || __i386__ */
+# define JITAPI_CDECL /* actual only on x86_64 platform */
+# endif /* _M_IX86 || __i386__ */
+# endif /* defined WIN32 || defined _WIN32 */
+#endif /* JITAPI_CDECL */
+
+#define JITAPI JITAPI_CDECL
+/** @endcond */
+
+/**
+ * @brief Generates a new unique method ID.
+ *
+ * You must use this API to obtain unique and valid method IDs for methods or
+ * traces reported to the agent if you don't have your own mechanism to generate
+ * unique method IDs.
+ *
+ * @return a new unique method ID. When out of unique method IDs, this API
+ * returns 0, which is not an accepted value.
+ */
+unsigned int JITAPI iJIT_GetNewMethodID(void);
+
+/**
+ * @brief Returns the current mode of the agent.
+ *
+ * @return iJIT_SAMPLING_ON, indicating that agent is running, or
+ * iJIT_NOTHING_RUNNING if no agent is running.
+ */
+iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
+
+/**
+ * @brief Reports infomation about JIT-compiled code to the agent.
+ *
+ * The reported information is used to attribute samples obtained from any
+ * Intel(R) VTune(TM) Amplifier collector. This API needs to be called
+ * after JIT compilation and before the first entry into the JIT-compiled
+ * code.
+ *
+ * @param[in] event_type - type of the data sent to the agent
+ * @param[in] EventSpecificData - pointer to event-specific data
+ *
+ * @returns 1 on success, otherwise 0.
+ */
+int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+/** @endcond */
+
+/** @} jitapi group */
+
+#endif /* __JITPROFILING_H__ */
diff --git a/ext/opcache/jit/zend_elf.c b/ext/opcache/jit/zend_elf.c
new file mode 100644
index 0000000000..f5180e0a96
--- /dev/null
+++ b/ext/opcache/jit/zend_elf.c
@@ -0,0 +1,109 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#if defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#endif
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "zend_API.h"
+#include "zend_elf.h"
+
+static void* zend_elf_read_sect(int fd, zend_elf_sectheader *sect)
+{
+ void *s = emalloc(sect->size);
+
+ if (lseek(fd, sect->ofs, SEEK_SET) < 0) {
+ efree(s);
+ return NULL;
+ }
+ if (read(fd, s, sect->size) != (ssize_t)sect->size) {
+ efree(s);
+ return NULL;
+ }
+
+ return s;
+}
+
+void zend_elf_load_symbols(void)
+{
+ zend_elf_header hdr;
+ zend_elf_sectheader sect;
+ int i;
+#if defined(__linux__)
+ int fd = open("/proc/self/exe", O_RDONLY);
+#elif defined(__NetBSD__)
+ int fd = open("/proc/curproc/exe", O_RDONLY);
+#elif defined(__FreeBSD__)
+ char path[PATH_MAX];
+ size_t pathlen = sizeof(path);
+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+ if (sysctl(mib, 4, path, &pathlen, NULL, 0) == -1) {
+ return;
+ }
+ int fd = open(path, O_RDONLY);
+#else
+ // To complete eventually for other ELF platforms.
+ // Otherwise APPLE is Mach-O
+ int fd = -1;
+#endif
+
+ if (fd >= 0) {
+ if (read(fd, &hdr, sizeof(hdr)) == sizeof(hdr)
+ && hdr.emagic[0] == '\177'
+ && hdr.emagic[1] == 'E'
+ && hdr.emagic[2] == 'L'
+ && hdr.emagic[3] == 'F'
+ && lseek(fd, hdr.shofs, SEEK_SET) >= 0) {
+ for (i = 0; i < hdr.shnum; i++) {
+ if (read(fd, &sect, sizeof(sect)) == sizeof(sect)
+ && sect.type == ELFSECT_TYPE_SYMTAB) {
+ uint32_t n, count = sect.size / sizeof(zend_elf_symbol);
+ zend_elf_symbol *syms = zend_elf_read_sect(fd, &sect);
+ char *str_tbl;
+
+ if (syms) {
+ if (lseek(fd, hdr.shofs + sect.link * sizeof(sect), SEEK_SET) >= 0
+ && read(fd, &sect, sizeof(sect)) == sizeof(sect)
+ && (str_tbl = (char*)zend_elf_read_sect(fd, &sect)) != NULL) {
+ for (n = 0; n < count; n++) {
+ if (syms[n].name
+ && (ELFSYM_TYPE(syms[n].info) == ELFSYM_TYPE_FUNC
+ /*|| ELFSYM_TYPE(syms[n].info) == ELFSYM_TYPE_DATA*/)
+ && (ELFSYM_BIND(syms[n].info) == ELFSYM_BIND_LOCAL
+ /*|| ELFSYM_BIND(syms[n].info) == ELFSYM_BIND_GLOBAL*/)) {
+ zend_jit_disasm_add_symbol(str_tbl + syms[n].name, syms[n].value, syms[n].size);
+ }
+ }
+ efree(str_tbl);
+ }
+ efree(syms);
+ }
+ if (lseek(fd, hdr.shofs + (i + 1) * sizeof(sect), SEEK_SET) < 0) {
+ break;
+ }
+ }
+ }
+ }
+ close(fd);
+ }
+}
diff --git a/ext/opcache/jit/zend_elf.h b/ext/opcache/jit/zend_elf.h
new file mode 100644
index 0000000000..305e08708d
--- /dev/null
+++ b/ext/opcache/jit/zend_elf.h
@@ -0,0 +1,115 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef ZEND_ELF
+#define ZEND_ELF
+
+#if SIZEOF_SIZE_T == 8
+# define ELF64
+#else
+# undef ELF64
+#endif
+
+typedef struct _zend_elf_header {
+ uint8_t emagic[4];
+ uint8_t eclass;
+ uint8_t eendian;
+ uint8_t eversion;
+ uint8_t eosabi;
+ uint8_t eabiversion;
+ uint8_t epad[7];
+ uint16_t type;
+ uint16_t machine;
+ uint32_t version;
+ uintptr_t entry;
+ uintptr_t phofs;
+ uintptr_t shofs;
+ uint32_t flags;
+ uint16_t ehsize;
+ uint16_t phentsize;
+ uint16_t phnum;
+ uint16_t shentsize;
+ uint16_t shnum;
+ uint16_t shstridx;
+} zend_elf_header;
+
+typedef struct zend_elf_sectheader {
+ uint32_t name;
+ uint32_t type;
+ uintptr_t flags;
+ uintptr_t addr;
+ uintptr_t ofs;
+ uintptr_t size;
+ uint32_t link;
+ uint32_t info;
+ uintptr_t align;
+ uintptr_t entsize;
+} zend_elf_sectheader;
+
+#define ELFSECT_IDX_ABS 0xfff1
+
+enum {
+ ELFSECT_TYPE_PROGBITS = 1,
+ ELFSECT_TYPE_SYMTAB = 2,
+ ELFSECT_TYPE_STRTAB = 3,
+ ELFSECT_TYPE_NOBITS = 8,
+ ELFSECT_TYPE_DYNSYM = 11,
+};
+
+#define ELFSECT_FLAGS_WRITE (1 << 0)
+#define ELFSECT_FLAGS_ALLOC (1 << 1)
+#define ELFSECT_FLAGS_EXEC (1 << 2)
+#define ELFSECT_FLAGS_TLS (1 << 10)
+
+typedef struct zend_elf_symbol {
+#ifdef ELF64
+ uint32_t name;
+ uint8_t info;
+ uint8_t other;
+ uint16_t sectidx;
+ uintptr_t value;
+ uint64_t size;
+#else
+ uint32_t name;
+ uintptr_t value;
+ uint32_t size;
+ uint8_t info;
+ uint8_t other;
+ uint16_t sectidx;
+#endif
+} zend_elf_symbol;
+
+#define ELFSYM_BIND(info) ((info) >> 4)
+#define ELFSYM_TYPE(info) ((info) & 0xf)
+#define ELFSYM_INFO(bind, type) (((bind) << 4) | (type))
+
+enum {
+ ELFSYM_TYPE_DATA = 2,
+ ELFSYM_TYPE_FUNC = 2,
+ ELFSYM_TYPE_FILE = 4,
+};
+
+enum {
+ ELFSYM_BIND_LOCAL = 0,
+ ELFSYM_BIND_GLOBAL = 1,
+};
+
+void zend_elf_load_symbols(void);
+
+#endif
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
new file mode 100644
index 0000000000..ce6ee37751
--- /dev/null
+++ b/ext/opcache/jit/zend_jit.c
@@ -0,0 +1,3263 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include <ZendAccelerator.h>
+#include "zend_shared_alloc.h"
+#include "Zend/zend_execute.h"
+#include "Zend/zend_vm.h"
+#include "Zend/zend_exceptions.h"
+#include "Zend/zend_constants.h"
+#include "zend_smart_str.h"
+#include "jit/zend_jit.h"
+#include "jit/zend_jit_internal.h"
+
+#ifdef HAVE_JIT
+
+#include "Optimizer/zend_func_info.h"
+#include "Optimizer/zend_ssa.h"
+#include "Optimizer/zend_inference.h"
+#include "Optimizer/zend_call_graph.h"
+#include "Optimizer/zend_dump.h"
+
+//#define CONTEXT_THREADED_JIT
+#define ZEND_JIT_USE_RC_INFERENCE
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+# define ZEND_SSA_RC_INFERENCE_FLAG ZEND_SSA_RC_INFERENCE
+# define RC_MAY_BE_1(info) (((info) & (MAY_BE_RC1|MAY_BE_REF)) != 0)
+# define RC_MAY_BE_N(info) (((info) & (MAY_BE_RCN|MAY_BE_REF)) != 0)
+#else
+# define ZEND_SSA_RC_INFERENCE_FLAG 0
+# define RC_MAY_BE_1(info) 1
+# define RC_MAY_BE_N(info) 1
+#endif
+
+#define JIT_PREFIX "JIT$"
+#define JIT_STUB_PREFIX "JIT$$"
+
+#define DASM_M_GROW(ctx, t, p, sz, need) \
+ do { \
+ size_t _sz = (sz), _need = (need); \
+ if (_sz < _need) { \
+ if (_sz < 16) _sz = 16; \
+ while (_sz < _need) _sz += _sz; \
+ (p) = (t *)erealloc((p), _sz); \
+ (sz) = _sz; \
+ } \
+ } while(0)
+
+#define DASM_M_FREE(ctx, p, sz) efree(p)
+
+#include "dynasm/dasm_proto.h"
+
+typedef struct _zend_jit_stub {
+ const char *name;
+ int (*stub)(dasm_State **Dst);
+} zend_jit_stub;
+
+#define JIT_STUB(name) \
+ {JIT_STUB_PREFIX #name, zend_jit_ ## name ## _stub}
+
+static zend_uchar zend_jit_level = 0;
+static zend_uchar zend_jit_trigger = 0;
+static zend_uchar zend_jit_reg_alloc = 0;
+static zend_uchar zend_jit_cpu_flags = 0;
+
+zend_ulong zend_jit_profile_counter = 0;
+int zend_jit_profile_counter_rid = -1;
+
+int16_t zend_jit_hot_counters[ZEND_HOT_COUNTERS_COUNT];
+
+const zend_op *zend_jit_halt_op = NULL;
+static int zend_jit_vm_kind = 0;
+
+static void *dasm_buf = NULL;
+static void *dasm_end = NULL;
+static void **dasm_ptr = NULL;
+
+static size_t dasm_size = 0;
+
+static zend_long jit_bisect_pos = 0;
+
+static const void *zend_jit_runtime_jit_handler = NULL;
+static const void *zend_jit_profile_jit_handler = NULL;
+static const void *zend_jit_func_counter_handler = NULL;
+static const void *zend_jit_loop_counter_handler = NULL;
+
+static int zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
+static void ZEND_FASTCALL zend_runtime_jit(void);
+
+static zend_bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa *ssa, int var, int use)
+{
+ if (ssa->vars[var].phi_use_chain) {
+ zend_ssa_phi *phi = ssa->vars[var].phi_use_chain;
+ do {
+ if (!ssa->vars[phi->ssa_var].no_val) {
+ return 0;
+ }
+ phi = zend_ssa_next_use_phi(ssa, var, phi);
+ } while (phi);
+ }
+
+ use = zend_ssa_next_use(ssa->ops, var, use);
+ return use < 0 || zend_ssa_is_no_val_use(op_array->opcodes + use, ssa->ops + use, var);
+}
+
+static zend_bool zend_is_commutative(zend_uchar opcode)
+{
+ return
+ opcode == ZEND_ADD ||
+ opcode == ZEND_MUL ||
+ opcode == ZEND_BW_OR ||
+ opcode == ZEND_BW_AND ||
+ opcode == ZEND_BW_XOR;
+}
+
+static zend_bool zend_long_is_power_of_two(zend_long x)
+{
+ return (x > 0) && !(x & (x - 1));
+}
+
+#include "dynasm/dasm_x86.h"
+#include "jit/zend_jit_x86.h"
+#include "jit/zend_jit_helpers.c"
+#include "jit/zend_jit_x86.c"
+#include "jit/zend_jit_disasm_x86.c"
+#ifndef _WIN32
+#include "jit/zend_jit_gdb.c"
+#include "jit/zend_jit_perf_dump.c"
+#endif
+#ifdef HAVE_OPROFILE
+# include "jit/zend_jit_oprofile.c"
+#endif
+#include "jit/zend_jit_vtune.c"
+
+#if _WIN32
+# include <Windows.h>
+#else
+# include <sys/mman.h>
+# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+#endif
+
+#define DASM_ALIGNMENT 16
+
+ZEND_EXT_API void zend_jit_status(zval *ret)
+{
+ zval stats;
+ array_init(&stats);
+ add_assoc_long(&stats, "level", zend_jit_level);
+ add_assoc_long(&stats, "trigger", zend_jit_trigger);
+ add_assoc_long(&stats, "reg-alloc", zend_jit_reg_alloc);
+ if (dasm_buf) {
+ add_assoc_long(&stats, "buffer_size", (char*)dasm_end - (char*)dasm_buf);
+ add_assoc_long(&stats, "buffer_free", (char*)dasm_end - (char*)*dasm_ptr);
+ } else {
+ add_assoc_long(&stats, "buffer_size", 0);
+ add_assoc_long(&stats, "buffer_free", 0);
+ }
+ add_assoc_zval(ret, "jit", &stats);
+}
+
+static zend_string *zend_jit_func_name(const zend_op_array *op_array)
+{
+ smart_str buf = {0};
+
+ if (op_array->function_name) {
+ if (op_array->scope) {
+ smart_str_appends(&buf, JIT_PREFIX);
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->scope->name), ZSTR_LEN(op_array->scope->name));
+ smart_str_appends(&buf, "::");
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name));
+ smart_str_0(&buf);
+ return buf.s;
+ } else {
+ smart_str_appends(&buf, JIT_PREFIX);
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name));
+ smart_str_0(&buf);
+ return buf.s;
+ }
+ } else if (op_array->filename) {
+ smart_str_appends(&buf, JIT_PREFIX);
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->filename), ZSTR_LEN(op_array->filename));
+ smart_str_0(&buf);
+ return buf.s;
+ } else {
+ return NULL;
+ }
+}
+
+static void *dasm_link_and_encode(dasm_State **dasm_state,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ const zend_op *rt_opline,
+ zend_lifetime_interval **ra,
+ const char *name)
+{
+ size_t size;
+ int ret;
+ void *entry;
+#if defined(HAVE_DISASM) || defined(HAVE_GDB) || defined(HAVE_OPROFILE) || defined(HAVE_PERFTOOLS) || defined(HAVE_VTUNE)
+ zend_string *str = NULL;
+#endif
+
+ if (rt_opline && ssa && ssa->cfg.map) {
+ /* Create additional entry point, to switch from interpreter to JIT-ed
+ * code at run-time.
+ */
+ int b = ssa->cfg.map[rt_opline - op_array->opcodes];
+
+//#ifdef CONTEXT_THREADED_JIT
+// if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY))) {
+//#else
+ if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY))) {
+//#endif
+ zend_jit_label(dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(dasm_state);
+ if (ra) {
+ int i;
+ zend_lifetime_interval *ival;
+ zend_life_range *range;
+ uint32_t pos = rt_opline - op_array->opcodes;
+
+ for (i = 0; i < ssa->vars_count; i++) {
+ ival = ra[i];
+
+ if (ival && ival->reg != ZREG_NONE) {
+ range = &ival->range;
+
+ if (pos >= range->start && pos <= range->end) {
+ if (!zend_jit_load_ssa_var(dasm_state, ssa, i, ival->reg)) {
+ return NULL;
+ }
+ break;
+ }
+ range = range->next;
+ }
+ }
+ }
+ zend_jit_jmp(dasm_state, b);
+ }
+ }
+
+ if (dasm_link(dasm_state, &size) != DASM_S_OK) {
+ // TODO: dasm_link() failed ???
+ return NULL;
+ }
+
+ if ((void*)((char*)*dasm_ptr + size) > dasm_end) {
+ *dasm_ptr = dasm_end; //prevent further try
+ // TODO: jit_buffer_size overflow ???
+ return NULL;
+ }
+
+ ret = dasm_encode(dasm_state, *dasm_ptr);
+
+ if (ret != DASM_S_OK) {
+ // TODO: dasm_encode() failed ???
+ return NULL;
+ }
+
+ entry = *dasm_ptr;
+ *dasm_ptr = (void*)((char*)*dasm_ptr + ZEND_MM_ALIGNED_SIZE_EX(size, DASM_ALIGNMENT));
+
+ if (op_array && ssa) {
+ int b;
+
+ for (b = 0; b < ssa->cfg.blocks_count; b++) {
+//#ifdef CONTEXT_THREADED_JIT
+// if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY)) {
+//#else
+ if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) {
+//#endif
+ zend_op *opline = op_array->opcodes + ssa->cfg.blocks[b].start;
+ int offset = dasm_getpclabel(dasm_state, ssa->cfg.blocks_count + b);
+
+ if (offset >= 0) {
+ opline->handler = (void*)(((char*)entry) + offset);
+ }
+ }
+ }
+ if (rt_opline && ssa && ssa->cfg.map) {
+ int b = ssa->cfg.map[rt_opline - op_array->opcodes];
+ zend_op *opline = (zend_op*)rt_opline;
+ int offset = dasm_getpclabel(dasm_state, ssa->cfg.blocks_count + b);
+
+ if (offset >= 0) {
+ opline->handler = (void*)(((char*)entry) + offset);
+ }
+ }
+ }
+
+#if defined(HAVE_DISASM) || defined(HAVE_GDB) || defined(HAVE_OPROFILE) || defined(HAVE_PERFTOOLS) || defined(HAVE_VTUNE)
+ if (!name) {
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM|ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_OPROFILE|ZEND_JIT_DEBUG_PERF|ZEND_JIT_DEBUG_VTUNE|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ str = zend_jit_func_name(op_array);
+ if (str) {
+ name = ZSTR_VAL(str);
+ }
+ }
+#ifdef HAVE_DISASM
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_ASM) {
+ zend_jit_disasm_add_symbol(name, (uintptr_t)entry, size);
+ zend_jit_disasm(
+ name,
+ (op_array && op_array->filename) ? ZSTR_VAL(op_array->filename) : NULL,
+ op_array,
+ &ssa->cfg,
+ entry,
+ size);
+ }
+ } else {
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM_STUBS|ZEND_JIT_DEBUG_ASM)) {
+ zend_jit_disasm_add_symbol(name, (uintptr_t)entry, size);
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_ASM_STUBS) {
+ zend_jit_disasm(
+ name,
+ (op_array && op_array->filename) ? ZSTR_VAL(op_array->filename) : NULL,
+ op_array,
+ &ssa->cfg,
+ entry,
+ size);
+ }
+ }
+# endif
+ }
+#endif
+
+#ifdef HAVE_GDB
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_GDB) {
+ if (name) {
+ zend_jit_gdb_register(
+ name,
+ op_array,
+ entry,
+ size);
+ }
+ }
+#endif
+
+#ifdef HAVE_OPROFILE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_OPROFILE) {
+ zend_jit_oprofile_register(
+ name,
+ entry,
+ size);
+ }
+#endif
+
+#ifdef HAVE_PERFTOOLS
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_PERF|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ if (name) {
+ zend_jit_perf_map_register(
+ name,
+ entry,
+ size);
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_PERF_DUMP) {
+ zend_jit_perf_jitdump_register(
+ name,
+ entry,
+ size);
+ }
+ }
+ }
+#endif
+
+#ifdef HAVE_VTUNE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_VTUNE) {
+ if (name) {
+ zend_jit_vtune_register(
+ name,
+ entry,
+ size);
+ }
+ }
+#endif
+
+#if defined(HAVE_DISASM) || defined(HAVE_GDB) || defined(HAVE_OPROFILE) || defined(HAVE_PERFTOOLS) || defined(HAVE_VTUNE)
+ if (str) {
+ zend_string_release(str);
+ }
+#endif
+
+ return entry;
+}
+
+static int zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t num;
+ int res;
+
+ if (!ssa->ops || !ssa->var_info) {
+ return 1;
+ }
+ switch (opline->opcode) {
+ case ZEND_PRE_INC:
+ case ZEND_POST_INC:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.overflow);
+ case ZEND_PRE_DEC:
+ case ZEND_POST_DEC:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.underflow);
+ case ZEND_ADD:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].result_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_add_will_overflow(op1_min, op2_min)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_add_will_overflow(op1_max, op2_max)) {
+ return 1;
+ }
+ }
+ return 0;
+ case ZEND_SUB:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].result_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_sub_will_overflow(op1_min, op2_max)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_sub_will_overflow(op1_max, op2_min)) {
+ return 1;
+ }
+ }
+ return 0;
+ case ZEND_MUL:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].result_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.underflow ||
+ ssa->var_info[res].range.overflow);
+ case ZEND_ASSIGN_OP:
+ if (opline->extended_value == ZEND_ADD) {
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_add_will_overflow(op1_min, op2_min)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_add_will_overflow(op1_max, op2_max)) {
+ return 1;
+ }
+ }
+ return 0;
+ } else if (opline->extended_value == ZEND_SUB) {
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_sub_will_overflow(op1_min, op2_max)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_sub_will_overflow(op1_max, op2_min)) {
+ return 1;
+ }
+ }
+ return 0;
+ } else if (opline->extended_value == ZEND_MUL) {
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.underflow ||
+ ssa->var_info[res].range.overflow);
+ }
+ default:
+ return 1;
+ }
+}
+
+static int zend_jit_build_cfg(const zend_op_array *op_array, zend_cfg *cfg)
+{
+ uint32_t flags;
+
+ flags = ZEND_CFG_STACKLESS | ZEND_CFG_NO_ENTRY_PREDECESSORS | ZEND_SSA_RC_INFERENCE_FLAG | ZEND_SSA_USE_CV_RESULTS | ZEND_CFG_RECV_ENTRY;
+
+ if (zend_build_cfg(&CG(arena), op_array, flags, cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ /* Don't JIT huge functions. Apart from likely being detrimental due to the amount of
+ * generated code, some of our analysis is recursive and will stack overflow with many
+ * blocks. */
+ if (cfg->blocks_count > 100000) {
+ return FAILURE;
+ }
+
+ if (zend_cfg_build_predecessors(&CG(arena), cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ /* Compute Dominators Tree */
+ if (zend_cfg_compute_dominators_tree(op_array, cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ /* Identify reducible and irreducible loops */
+ if (zend_cfg_identify_loops(op_array, cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_op_array_analyze1(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa)
+{
+ if (zend_jit_build_cfg(op_array, &ssa->cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+#if 0
+ /* TODO: debugger and profiler supports? */
+ if ((ssa->cfg.flags & ZEND_FUNC_HAS_EXTENDED_INFO)) {
+ return FAILURE;
+ }
+#endif
+
+ if ((zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC)
+ && ssa->cfg.blocks
+ && op_array->last_try_catch == 0
+ && !(op_array->fn_flags & ZEND_ACC_GENERATOR)
+ && !(ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
+ if (zend_build_ssa(&CG(arena), script, op_array, ZEND_SSA_RC_INFERENCE | ZEND_SSA_USE_CV_RESULTS, ssa) != SUCCESS) {
+ return FAILURE;
+ }
+
+ if (zend_ssa_compute_use_def_chains(&CG(arena), op_array, ssa) != SUCCESS) {
+ return FAILURE;
+ }
+
+ if (zend_ssa_find_false_dependencies(op_array, ssa) != SUCCESS) {
+ return FAILURE;
+ }
+
+ if (zend_ssa_find_sccs(op_array, ssa) != SUCCESS){
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_op_array_analyze2(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa)
+{
+ if ((zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC)
+ && ssa->cfg.blocks
+ && op_array->last_try_catch == 0
+ && !(op_array->fn_flags & ZEND_ACC_GENERATOR)
+ && !(ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
+
+ uint32_t optimization_level = ZCG(accel_directives).optimization_level;
+ if (zend_ssa_inference(&CG(arena), op_array, script, ssa, optimization_level) != SUCCESS) {
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_add_range(zend_lifetime_interval **intervals, int var, uint32_t from, uint32_t to)
+{
+ zend_lifetime_interval *ival = intervals[var];
+
+ if (!ival) {
+ ival = zend_arena_alloc(&CG(arena), sizeof(zend_lifetime_interval));
+ if (!ival) {
+ return FAILURE;
+ }
+ ival->ssa_var = var;
+ ival->reg = ZREG_NONE;
+ ival->split = 0;
+ ival->store = 0;
+ ival->load = 0;
+ ival->range.start = from;
+ ival->range.end = to;
+ ival->range.next = NULL;
+ ival->hint = NULL;
+ ival->used_as_hint = NULL;
+ intervals[var] = ival;
+ } else if (ival->range.start > to + 1) {
+ zend_life_range *range = zend_arena_alloc(&CG(arena), sizeof(zend_life_range));
+
+ if (!range) {
+ return FAILURE;
+ }
+ range->start = ival->range.start;
+ range->end = ival->range.end;
+ range->next = ival->range.next;
+ ival->range.start = from;
+ ival->range.end = to;
+ ival->range.next = range;
+ } else if (ival->range.start == to + 1) {
+ ival->range.start = from;
+ } else {
+ zend_life_range *range = &ival->range;
+ zend_life_range *last = NULL;
+
+ do {
+ if (range->start > to + 1) {
+ break;
+ } else if (range->end + 1 >= from) {
+ if (range->start > from) {
+ range->start = from;
+ }
+ last = range;
+ range = range->next;
+ while (range) {
+ if (range->start > to + 1) {
+ break;
+ }
+ last->end = range->end;
+ range = range->next;
+ last->next = range;
+ }
+ if (to > last->end) {
+ last->end = to;
+ }
+ return SUCCESS;
+ }
+ last = range;
+ range = range->next;
+ } while (range);
+
+ range = zend_arena_alloc(&CG(arena), sizeof(zend_life_range));
+ if (!range) {
+ return FAILURE;
+ }
+ range->start = from;
+ range->end = to;
+ range->next = last->next;
+ last->next = range;
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_begin_range(zend_lifetime_interval **intervals, int var, uint32_t block_start, uint32_t from)
+{
+ if (block_start != from && intervals[var]) {
+ zend_life_range *range = &intervals[var]->range;
+
+ do {
+ if (from >= range->start && from <= range->end) {
+ if (range->start == block_start) {
+ range->start = from;
+ } else {
+ zend_life_range *r = zend_arena_alloc(&CG(arena), sizeof(zend_life_range));
+ if (!r) {
+ return FAILURE;
+ }
+ r->start = from;
+ r->end = range->end;
+ r->next = range->next;
+ range->end = block_start - 1;
+ range->next = r;
+ }
+ return SUCCESS;
+ }
+ range = range->next;
+ } while (range);
+ }
+
+ // dead store
+ return zend_jit_add_range(intervals, var, from, from);
+}
+
+static void zend_jit_insert_interval(zend_lifetime_interval **list, zend_lifetime_interval *ival)
+{
+ while (1) {
+ if (*list == NULL) {
+ *list = ival;
+ ival->list_next = NULL;
+ return;
+ } else if (ival->range.start < (*list)->range.start) {
+ ival->list_next = *list;
+ *list = ival;
+ return;
+ }
+ list = &(*list)->list_next;
+ }
+}
+
+static int zend_jit_split_interval(zend_lifetime_interval *current, uint32_t pos, zend_lifetime_interval **list, zend_lifetime_interval **free)
+{
+ zend_lifetime_interval *ival;
+ zend_life_range *range = &current->range;
+ zend_life_range *prev = NULL;
+
+ if (*free) {
+ ival = *free;
+ *free = ival->list_next;
+ } else {
+ ival = zend_arena_alloc(&CG(arena), sizeof(zend_lifetime_interval));
+
+ if (!ival) {
+ return FAILURE;
+ }
+ }
+
+ current->store = 1;
+
+ ival->ssa_var = current->ssa_var;
+ ival->reg = ZREG_NONE;
+ ival->split = 1;
+ ival->store = 0;
+ ival->load = 1;
+ ival->hint = NULL;
+
+ do {
+ if (pos >= range->start && pos <= range->end) {
+ break;
+ }
+ prev = range;
+ range = range->next;
+ } while(range);
+
+ ZEND_ASSERT(range != NULL);
+
+ ival->range.start = pos;
+ ival->range.end = range->end;
+ ival->range.next = range->next;
+
+ if (pos == range->start) {
+ ZEND_ASSERT(prev != NULL);
+ prev->next = NULL;
+ } else {
+ range->end = pos - 1;
+ }
+
+ zend_jit_insert_interval(list, ival);
+
+ return SUCCESS;
+}
+
+static zend_lifetime_interval *zend_jit_sort_intervals(zend_lifetime_interval **intervals, int count)
+{
+ zend_lifetime_interval *list, *last;
+ int i;
+
+ list = NULL;
+ i = 0;
+ while (i < count) {
+ list = intervals[i];
+ i++;
+ if (list) {
+ last = list;
+ last->list_next = NULL;
+ break;
+ }
+ }
+
+ while (i < count) {
+ zend_lifetime_interval *ival = intervals[i];
+
+ i++;
+ if (ival) {
+ if ((ival->range.start > last->range.start) ||
+ (ival->range.start == last->range.start &&
+ ival->range.end > last->range.end)) {
+ last->list_next = ival;
+ last = ival;
+ ival->list_next = NULL;
+ } else {
+ zend_lifetime_interval **p = &list;
+
+ while (1) {
+ if (*p == NULL) {
+ *p = last = ival;
+ ival->list_next = NULL;
+ break;
+ } else if ((ival->range.start < (*p)->range.start) ||
+ (ival->range.start == (*p)->range.start &&
+ ival->range.end < (*p)->range.end)) {
+ ival->list_next = *p;
+ *p = ival;
+ break;
+ }
+ p = &(*p)->list_next;
+ }
+ }
+ }
+ }
+
+ return list;
+}
+
+static ZEND_ATTRIBUTE_UNUSED void zend_jit_print_regset(zend_regset regset)
+{
+ zend_reg reg;
+ int first = 1;
+
+ ZEND_REGSET_FOREACH(regset, reg) {
+ if (first) {
+ first = 0;
+ fprintf(stderr, "%s", zend_reg_name[reg]);
+ } else {
+ fprintf(stderr, ", %s", zend_reg_name[reg]);
+ }
+ } ZEND_REGSET_FOREACH_END();
+}
+
+static int *zend_jit_compute_block_order_int(zend_ssa *ssa, int n, int *block_order)
+{
+ zend_basic_block *b = ssa->cfg.blocks + n;
+
+tail_call:
+ *block_order = n;
+ block_order++;
+
+ n = b->children;
+ while (n >= 0) {
+ b = ssa->cfg.blocks + n;
+ if (b->next_child < 0) {
+ goto tail_call;
+ }
+ block_order = zend_jit_compute_block_order_int(ssa, n, block_order);
+ n = b->next_child;
+ }
+
+ return block_order;
+}
+
+static int zend_jit_compute_block_order(zend_ssa *ssa, int *block_order)
+{
+ int *end = zend_jit_compute_block_order_int(ssa, 0, block_order);
+
+ return end - block_order;
+}
+
+static zend_bool zend_jit_in_loop(zend_ssa *ssa, int header, zend_basic_block *b)
+{
+ while (b->loop_header >= 0) {
+ if (b->loop_header == header) {
+ return 1;
+ }
+ b = ssa->cfg.blocks + b->loop_header;
+ }
+ return 0;
+}
+
+static void zend_jit_compute_loop_body(zend_ssa *ssa, int header, int n, zend_bitset loop_body)
+{
+ zend_basic_block *b = ssa->cfg.blocks + n;
+ uint32_t i;
+
+tail_call:
+ if (b->len) {
+ for (i = b->start; i < b->start + b->len; i++) {
+ zend_bitset_incl(loop_body, i);
+ }
+ }
+
+ n = b->children;
+ while (n >= 0) {
+ b = ssa->cfg.blocks + n;
+ if (zend_jit_in_loop(ssa, header, b)) {
+ if (b->next_child < 0) {
+ goto tail_call;
+ }
+ zend_jit_compute_loop_body(ssa, header, n, loop_body);
+ }
+ n = b->next_child;
+ }
+}
+
+static void zend_jit_add_hint(zend_lifetime_interval **intervals, int dst, int src)
+{
+ if (intervals[dst]->range.start < intervals[src]->range.start) {
+ int tmp = src;
+ src = dst;
+ dst = tmp;
+ }
+ while (1) {
+ if (intervals[dst]->hint) {
+ if (intervals[dst]->hint->range.start < intervals[src]->range.start) {
+ int tmp = src;
+ src = intervals[dst]->hint->ssa_var;
+ dst = tmp;
+ } else {
+ dst = intervals[dst]->hint->ssa_var;
+ }
+ } else {
+ if (dst != src) {
+ intervals[dst]->hint = intervals[src];
+ }
+ return;
+ }
+ }
+}
+
+/* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
+ Michael Franz, CGO'10 (2010), Figure 4. */
+static int zend_jit_compute_liveness(const zend_op_array *op_array, zend_ssa *ssa, zend_bitset candidates, zend_lifetime_interval **list)
+{
+ int set_size, i, j, k, l;
+ uint32_t n;
+ zend_bitset live, live_in, pi_vars, loop_body;
+ int *block_order;
+ zend_ssa_phi *phi;
+ zend_lifetime_interval **intervals;
+ size_t mem_size;
+ ALLOCA_FLAG(use_heap);
+
+ set_size = zend_bitset_len(ssa->vars_count);
+ mem_size =
+ ZEND_MM_ALIGNED_SIZE(ssa->vars_count * sizeof(zend_lifetime_interval*)) +
+ ZEND_MM_ALIGNED_SIZE((set_size * ssa->cfg.blocks_count) * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(zend_bitset_len(op_array->last) * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(ssa->cfg.blocks_count * sizeof(int));
+ intervals = do_alloca(mem_size, use_heap);
+ if (!intervals) {
+ *list = NULL;
+ return FAILURE;
+ }
+
+ live_in = (zend_bitset)((char*)intervals + ZEND_MM_ALIGNED_SIZE(ssa->vars_count * sizeof(zend_lifetime_interval*)));
+ live = (zend_bitset)((char*)live_in + ZEND_MM_ALIGNED_SIZE((set_size * ssa->cfg.blocks_count) * ZEND_BITSET_ELM_SIZE));
+ pi_vars = (zend_bitset)((char*)live + ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE));
+ loop_body = (zend_bitset)((char*)pi_vars + ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE));
+ block_order = (int*)((char*)loop_body + ZEND_MM_ALIGNED_SIZE(zend_bitset_len(op_array->last) * ZEND_BITSET_ELM_SIZE));
+
+ memset(intervals, 0, ssa->vars_count * sizeof(zend_lifetime_interval*));
+ zend_bitset_clear(live_in, set_size * ssa->cfg.blocks_count);
+
+ /* TODO: Provide a linear block order where all dominators of a block
+ * are before this block, and where all blocks belonging to the same loop
+ * are contiguous ???
+ */
+ for (l = zend_jit_compute_block_order(ssa, block_order) - 1; l >= 0; l--) {
+ zend_basic_block *b;
+
+ i = block_order[l];
+ b = ssa->cfg.blocks + i;
+
+ /* live = UNION of successor.liveIn for each successor of b */
+ /* live.add(phi.inputOf(b)) for each phi of successors of b */
+ zend_bitset_clear(live, set_size);
+ for (j = 0; j < b->successors_count; j++) {
+ int succ = b->successors[j];
+
+ zend_bitset_union(live, live_in + set_size * succ, set_size);
+ zend_bitset_clear(pi_vars, set_size);
+ for (phi = ssa->blocks[succ].phis; phi; phi = phi->next) {
+ if (ssa->vars[phi->ssa_var].no_val) {
+ /* skip */
+ } else if (phi->pi >= 0) {
+ if (phi->pi == i && phi->sources[0] >= 0) {
+ if (zend_bitset_in(candidates, phi->sources[0])) {
+ zend_bitset_incl(live, phi->sources[0]);
+ }
+ zend_bitset_incl(pi_vars, phi->var);
+ }
+ } else if (!zend_bitset_in(pi_vars, phi->var)) {
+ for (k = 0; k < ssa->cfg.blocks[succ].predecessors_count; k++) {
+ if (ssa->cfg.predecessors[ssa->cfg.blocks[succ].predecessor_offset + k] == i) {
+ if (phi->sources[k] >= 0 && zend_bitset_in(candidates, phi->sources[k])) {
+ zend_bitset_incl(live, phi->sources[k]);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /* addRange(var, b.from, b.to) for each var in live */
+ ZEND_BITSET_FOREACH(live, set_size, j) {
+ if (zend_bitset_in(candidates, j)) {
+ if (zend_jit_add_range(intervals, j, b->start, b->start + b->len - 1) != SUCCESS) {
+ goto failure;
+ }
+ }
+ } ZEND_BITSET_FOREACH_END();
+
+ /* for each operation op of b in reverse order */
+ for (n = b->start + b->len; n > b->start;) {
+ zend_ssa_op *op;
+ const zend_op *opline;
+ uint32_t num;
+
+ n--;
+ op = ssa->ops + n;
+ opline = op_array->opcodes + n;
+
+ if (UNEXPECTED(opline->opcode == ZEND_OP_DATA)) {
+ num = n - 1;
+ } else {
+ num = n;
+ }
+
+ /* for each output operand opd of op do */
+ /* setFrom(opd, op) */
+ /* live.remove(opd) */
+ if (op->op1_def >= 0 && zend_bitset_in(candidates, op->op1_def)) {
+ if (zend_jit_begin_range(intervals, op->op1_def, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ zend_bitset_excl(live, op->op1_def);
+ }
+ if (op->op2_def >= 0 && zend_bitset_in(candidates, op->op2_def)) {
+ if (zend_jit_begin_range(intervals, op->op2_def, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ zend_bitset_excl(live, op->op2_def);
+ }
+ if (op->result_def >= 0 && zend_bitset_in(candidates, op->result_def)) {
+ if (zend_jit_begin_range(intervals, op->result_def, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ zend_bitset_excl(live, op->result_def);
+ }
+
+ /* for each input operand opd of op do */
+ /* live.add(opd) */
+ /* addRange(opd, b.from, op) */
+ if (op->op1_use >= 0
+ && zend_bitset_in(candidates, op->op1_use)
+ && !zend_ssa_is_no_val_use(opline, op, op->op1_use)) {
+ zend_bitset_incl(live, op->op1_use);
+ if (zend_jit_add_range(intervals, op->op1_use, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ }
+ if (op->op2_use >= 0
+ && zend_bitset_in(candidates, op->op2_use)
+ && !zend_ssa_is_no_val_use(opline, op, op->op2_use)) {
+ zend_bitset_incl(live, op->op2_use);
+ if (zend_jit_add_range(intervals, op->op2_use, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ }
+ if (op->result_use >= 0
+ && zend_bitset_in(candidates, op->result_use)
+ && !zend_ssa_is_no_val_use(opline, op, op->result_use)) {
+ zend_bitset_incl(live, op->result_use);
+ if (zend_jit_add_range(intervals, op->result_use, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ }
+ }
+
+ /* live.remove(phi.output) for each phi of b */
+ for (phi = ssa->blocks[i].phis; phi; phi = phi->next) {
+ zend_bitset_excl(live, phi->ssa_var);
+ }
+
+ /* b.liveIn = live */
+ zend_bitset_copy(live_in + set_size * i, live, set_size);
+ }
+
+ for (i = ssa->cfg.blocks_count - 1; i >= 0; i--) {
+ zend_basic_block *b = ssa->cfg.blocks + i;
+
+ /* if b is loop header */
+ if ((b->flags & ZEND_BB_LOOP_HEADER)) {
+ live = live_in + set_size * i;
+
+ if (!zend_bitset_empty(live, set_size)) {
+ uint32_t set_size2 = zend_bitset_len(op_array->last);
+
+ zend_bitset_clear(loop_body, set_size2);
+ zend_jit_compute_loop_body(ssa, i, i, loop_body);
+ while (!zend_bitset_empty(loop_body, set_size2)) {
+ uint32_t from = zend_bitset_first(loop_body, set_size2);
+ uint32_t to = from;
+
+ do {
+ zend_bitset_excl(loop_body, to);
+ to++;
+ } while (zend_bitset_in(loop_body, to));
+ to--;
+
+ ZEND_BITSET_FOREACH(live, set_size, j) {
+ if (zend_jit_add_range(intervals, j, from, to) != SUCCESS) {
+ goto failure;
+ }
+ } ZEND_BITSET_FOREACH_END();
+ }
+ }
+ }
+
+ }
+
+ if (zend_jit_reg_alloc >= ZEND_JIT_REG_ALLOC_GLOBAL) {
+ /* Register hinting (a cheap way for register coalescing) */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i]) {
+ int var = intervals[i]->ssa_var;
+ int src;
+
+ if (ssa->vars[var].definition_phi) {
+ zend_ssa_phi *phi = ssa->vars[var].definition_phi;
+
+ if (phi->pi >= 0) {
+ src = phi->sources[0];
+ if (intervals[src]) {
+ zend_jit_add_hint(intervals, i, src);
+ }
+ } else {
+ for (k = 0; k < ssa->cfg.blocks[phi->block].predecessors_count; k++) {
+ src = phi->sources[k];
+ if (src >= 0) {
+ if (ssa->vars[src].definition_phi
+ && ssa->vars[src].definition_phi->pi >= 0
+ && phi->block == ssa->vars[src].definition_phi->block) {
+ /* Skip zero-lenght interval for Pi variable */
+ src = ssa->vars[src].definition_phi->sources[0];
+ }
+ if (intervals[src]) {
+ zend_jit_add_hint(intervals, i, src);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i] && !intervals[i]->hint) {
+ int var = intervals[i]->ssa_var;
+
+ if (ssa->vars[var].definition >= 0) {
+ uint32_t line = ssa->vars[var].definition;
+ const zend_op *opline = op_array->opcodes + line;
+
+ switch (opline->opcode) {
+ case ZEND_QM_ASSIGN:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ if (ssa->ops[line].op1_use >= 0 &&
+ intervals[ssa->ops[line].op1_use] &&
+ (var == ssa->ops[line].op1_def ||
+ (var == ssa->ops[line].result_def &&
+ (ssa->ops[line].op1_def < 0 ||
+ !intervals[ssa->ops[line].op1_def])))) {
+ zend_jit_add_hint(intervals, i, ssa->ops[line].op1_use);
+ }
+ break;
+ case ZEND_SEND_VAR:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ if (var == ssa->ops[line].op1_def &&
+ ssa->ops[line].op1_use >= 0 &&
+ intervals[ssa->ops[line].op1_use]) {
+ zend_jit_add_hint(intervals, i, ssa->ops[line].op1_use);
+ }
+ break;
+ case ZEND_ASSIGN:
+ if (ssa->ops[line].op2_use >= 0 &&
+ intervals[ssa->ops[line].op2_use] &&
+ (var == ssa->ops[line].op2_def ||
+ (var == ssa->ops[line].op1_def &&
+ (ssa->ops[line].op2_def < 0 ||
+ !intervals[ssa->ops[line].op2_def])) ||
+ (var == ssa->ops[line].result_def &&
+ (ssa->ops[line].op2_def < 0 ||
+ !intervals[ssa->ops[line].op2_def]) &&
+ (ssa->ops[line].op1_def < 0 ||
+ !intervals[ssa->ops[line].op1_def])))) {
+ zend_jit_add_hint(intervals, i, ssa->ops[line].op2_use);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ *list = zend_jit_sort_intervals(intervals, ssa->vars_count);
+
+ if (*list) {
+ zend_lifetime_interval *ival = *list;
+ while (ival) {
+ if (ival->hint) {
+ ival->hint->used_as_hint = ival;
+ }
+ ival = ival->list_next;
+ }
+ }
+
+ free_alloca(intervals, use_heap);
+ return SUCCESS;
+
+failure:
+ *list = NULL;
+ free_alloca(intervals, use_heap);
+ return FAILURE;
+}
+
+static uint32_t zend_interval_end(zend_lifetime_interval *ival)
+{
+ zend_life_range *range = &ival->range;
+
+ while (range->next) {
+ range = range->next;
+ }
+ return range->end;
+}
+
+static zend_bool zend_interval_covers(zend_lifetime_interval *ival, uint32_t position)
+{
+ zend_life_range *range = &ival->range;
+
+ do {
+ if (position >= range->start && position <= range->end) {
+ return 1;
+ }
+ range = range->next;
+ } while (range);
+
+ return 0;
+}
+
+static uint32_t zend_interval_intersection(zend_lifetime_interval *ival1, zend_lifetime_interval *ival2)
+{
+ zend_life_range *r1 = &ival1->range;
+ zend_life_range *r2 = &ival2->range;
+
+ do {
+ if (r1->start <= r2->end) {
+ if (r2->start <= r1->end) {
+ return MAX(r1->start, r2->start);
+ } else {
+ r2 = r2->next;
+ }
+ } else {
+ r1 = r1->next;
+ }
+ } while (r1 && r2);
+
+ return 0xffffffff;
+}
+
+/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
+ Christian Wimmer VEE'05 (2005), Figure 4. Allocation without spilling */
+static int zend_jit_try_allocate_free_reg(const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval *current, zend_regset available, zend_regset *hints, zend_lifetime_interval *active, zend_lifetime_interval *inactive, zend_lifetime_interval **list, zend_lifetime_interval **free)
+{
+ zend_lifetime_interval *it;
+ uint32_t freeUntilPos[ZREG_NUM];
+ uint32_t pos, pos2;
+ zend_reg i, reg, reg2;
+ zend_reg hint = ZREG_NONE;
+ zend_regset low_priority_regs;
+ zend_life_range *range;
+
+ if ((ssa->var_info[current->ssa_var].type & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ available = ZEND_REGSET_INTERSECTION(available, ZEND_REGSET_FP);
+ } else {
+ available = ZEND_REGSET_INTERSECTION(available, ZEND_REGSET_GP);
+ }
+
+ /* TODO: Allow usage of preserved registers ???
+ * Their values have to be stored in prologuee and restored in epilogue
+ */
+ available = ZEND_REGSET_DIFFERENCE(available, ZEND_REGSET_PRESERVED);
+
+ if (ZEND_REGSET_IS_EMPTY(available)) {
+ return 0;
+ }
+
+ /* Set freeUntilPos of all physical registers to maxInt */
+ for (i = 0; i < ZREG_NUM; i++) {
+ freeUntilPos[i] = 0xffffffff;
+ }
+
+ /* for each interval it in active do */
+ /* freeUntilPos[it.reg] = 0 */
+ it = active;
+ if (ssa->vars[current->ssa_var].definition == current->range.start) {
+ while (it) {
+ if (current->range.start != zend_interval_end(it)) {
+ freeUntilPos[it->reg] = 0;
+ } else if (zend_jit_may_reuse_reg(op_array, ssa, current->range.start, current->ssa_var, it->ssa_var)) {
+ if (!ZEND_REGSET_IN(*hints, it->reg) &&
+ /* TODO: Avoid most often scratch registers. Find a better way ??? */
+ (!current->used_as_hint ||
+ (it->reg != ZREG_R0 && it->reg != ZREG_R1 && it->reg != ZREG_XMM0 && it->reg != ZREG_XMM1))) {
+ hint = it->reg;
+ }
+ } else {
+ freeUntilPos[it->reg] = 0;
+ }
+ it = it->list_next;
+ }
+ } else {
+ while (it) {
+ freeUntilPos[it->reg] = 0;
+ it = it->list_next;
+ }
+ }
+ if (current->hint) {
+ hint = current->hint->reg;
+ if (hint != ZREG_NONE && current->hint->used_as_hint == current) {
+ ZEND_REGSET_EXCL(*hints, hint);
+ }
+ }
+
+ /* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
+ Michael Franz, CGO'10 (2010), Figure 6. */
+ if (current->split) {
+ /* for each interval it in inactive intersecting with current do */
+ /* freeUntilPos[it.reg] = next intersection of it with current */
+ it = inactive;
+ while (it) {
+ uint32_t next = zend_interval_intersection(current, it);
+
+ //ZEND_ASSERT(next != 0xffffffff && !current->split);
+ if (next < freeUntilPos[it->reg]) {
+ freeUntilPos[it->reg] = next;
+ }
+ it = it->list_next;
+ }
+ }
+
+ /* Handle Scratch Registers */
+ /* TODO: Optimize ??? */
+ range = &current->range;
+ do {
+ uint32_t line = range->start;
+ zend_regset regset;
+ zend_reg reg;
+
+ if (ssa->ops[line].op1_def == current->ssa_var ||
+ ssa->ops[line].op2_def == current->ssa_var ||
+ ssa->ops[line].result_def == current->ssa_var) {
+ line++;
+ }
+ while (line <= range->end) {
+ regset = zend_jit_get_scratch_regset(op_array, ssa, line, current->ssa_var);
+ ZEND_REGSET_FOREACH(regset, reg) {
+ if (line < freeUntilPos[reg]) {
+ freeUntilPos[reg] = line;
+ }
+ } ZEND_REGSET_FOREACH_END();
+ line++;
+ }
+ range = range->next;
+ } while (range);
+
+#if 0
+ /* Coalesing */
+ if (ssa->vars[current->ssa_var].definition == current->start) {
+ zend_op *opline = op_array->opcodes + current->start;
+ int hint = -1;
+
+ switch (opline->opcode) {
+ case ZEND_ASSIGN:
+ hint = ssa->ops[current->start].op2_use;
+ case ZEND_QM_ASSIGN:
+ hint = ssa->ops[current->start].op1_use;
+ break;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ hint = ssa->ops[current->start].op1_use;
+ break;
+ case ZEND_ASSIGN_OP:
+ if (opline->extended_value == ZEND_ADD
+ || opline->extended_value == ZEND_SUB
+ || opline->extended_value == ZEND_MUL) {
+ hint = ssa->ops[current->start].op1_use;
+ }
+ break;
+ }
+ if (hint >= 0) {
+ }
+ }
+#endif
+
+ if (hint != ZREG_NONE && freeUntilPos[hint] > zend_interval_end(current)) {
+ current->reg = hint;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, hint);
+ }
+ return 1;
+ }
+
+ pos = 0; reg = ZREG_NONE;
+ pos2 = 0; reg2 = ZREG_NONE;
+ low_priority_regs = *hints;
+ if (current->used_as_hint) {
+ /* TODO: Avoid most often scratch registers. Find a better way ??? */
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_R0);
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_R1);
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_XMM0);
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_XMM1);
+ }
+
+ ZEND_REGSET_FOREACH(available, i) {
+ if (ZEND_REGSET_IN(low_priority_regs, i)) {
+ if (freeUntilPos[i] > pos2) {
+ reg2 = i;
+ pos2 = freeUntilPos[i];
+ }
+ } else if (freeUntilPos[i] > pos) {
+ reg = i;
+ pos = freeUntilPos[i];
+ }
+ } ZEND_REGSET_FOREACH_END();
+
+ if (reg == ZREG_NONE) {
+ if (reg2 != ZREG_NONE) {
+ reg = reg2;
+ pos = pos2;
+ reg2 = ZREG_NONE;
+ }
+ }
+
+ if (reg == ZREG_NONE) {
+ /* no register available without spilling */
+ return 0;
+ } else if (zend_interval_end(current) < pos) {
+ /* register available for the whole interval */
+ current->reg = reg;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, reg);
+ }
+ return 1;
+#if 0
+ // TODO: allow low prioirity register usage
+ } else if (reg2 != ZREG_NONE && zend_interval_end(current) < pos2) {
+ /* register available for the whole interval */
+ current->reg = reg2;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, reg2);
+ }
+ return 1;
+#endif
+ } else {
+ /* TODO: enable interval splitting ??? */
+ /* register available for the first part of the interval */
+ if (1 || zend_jit_split_interval(current, pos, list, free) != SUCCESS) {
+ return 0;
+ }
+ current->reg = reg;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, reg);
+ }
+ return 1;
+ }
+}
+
+/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
+ Christian Wimmer VEE'05 (2005), Figure 5. Allocation with spilling.
+ and "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
+ Michael Franz, CGO'10 (2010), Figure 6. */
+static int zend_jit_allocate_blocked_reg(void)
+{
+ /* TODO: ??? */
+ return 0;
+}
+
+/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
+ Christian Wimmer VEE'10 (2005), Figure 2. */
+static zend_lifetime_interval* zend_jit_linear_scan(const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval *list)
+{
+ zend_lifetime_interval *unhandled, *active, *inactive, *handled, *free;
+ zend_lifetime_interval *current, **p, *q;
+ uint32_t position;
+ zend_regset available = ZEND_REGSET_UNION(ZEND_REGSET_GP, ZEND_REGSET_FP);
+ zend_regset hints = ZEND_REGSET_EMPTY;
+
+ unhandled = list;
+ /* active = inactive = handled = free = {} */
+ active = inactive = handled = free = NULL;
+ while (unhandled != NULL) {
+ current = unhandled;
+ unhandled = unhandled->list_next;
+ position = current->range.start;
+
+ p = &active;
+ while (*p) {
+ uint32_t end = zend_interval_end(*p);
+
+ q = *p;
+ if (end < position) {
+ /* move ival from active to handled */
+ ZEND_REGSET_INCL(available, q->reg);
+ *p = q->list_next;
+ q->list_next = handled;
+ handled = q;
+ } else if (!zend_interval_covers(q, position)) {
+ /* move ival from active to inactive */
+ ZEND_REGSET_INCL(available, q->reg);
+ *p = q->list_next;
+ q->list_next = inactive;
+ inactive = q;
+ } else {
+ p = &q->list_next;
+ }
+ }
+
+ p = &inactive;
+ while (*p) {
+ uint32_t end = zend_interval_end(*p);
+
+ q = *p;
+ if (end < position) {
+ /* move ival from inactive to handled */
+ *p = q->list_next;
+ q->list_next = handled;
+ handled = q;
+ } else if (zend_interval_covers(q, position)) {
+ /* move ival from inactive to active */
+ ZEND_REGSET_EXCL(available, q->reg);
+ *p = q->list_next;
+ q->list_next = active;
+ active = q;
+ } else {
+ p = &q->list_next;
+ }
+ }
+
+ if (zend_jit_try_allocate_free_reg(op_array, ssa, current, available, &hints, active, inactive, &unhandled, &free) ||
+ zend_jit_allocate_blocked_reg()) {
+ ZEND_REGSET_EXCL(available, current->reg);
+ current->list_next = active;
+ active = current;
+ } else {
+ current->list_next = free;
+ free = current;
+ }
+ }
+
+ /* move active to handled */
+ while (active) {
+ current = active;
+ active = active->list_next;
+ current->list_next = handled;
+ handled = current;
+ }
+
+ /* move inactive to handled */
+ while (inactive) {
+ current = inactive;
+ inactive = inactive->list_next;
+ current->list_next = handled;
+ handled = current;
+ }
+
+ return handled;
+}
+
+static zend_lifetime_interval** zend_jit_allocate_registers(const zend_op_array *op_array, zend_ssa *ssa)
+{
+ void *checkpoint;
+ int set_size, candidates_count, i;
+ zend_bitset candidates = NULL;
+ zend_lifetime_interval *list, *ival;
+ zend_lifetime_interval **intervals;
+ ALLOCA_FLAG(use_heap);
+
+ if (!ssa->var_info) {
+ return NULL;
+ }
+
+ /* Identify SSA variables suitable for register allocation */
+ set_size = zend_bitset_len(ssa->vars_count);
+ candidates = ZEND_BITSET_ALLOCA(set_size, use_heap);
+ if (!candidates) {
+ return NULL;
+ }
+ candidates_count = 0;
+ zend_bitset_clear(candidates, set_size);
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (zend_jit_may_be_in_reg(op_array, ssa, i)) {
+ zend_bitset_incl(candidates, i);
+ candidates_count++;
+ }
+ }
+ if (!candidates_count) {
+ free_alloca(candidates, use_heap);
+ return NULL;
+ }
+
+ checkpoint = zend_arena_checkpoint(CG(arena));
+
+ /* Find life-time intervals */
+ if (zend_jit_compute_liveness(op_array, ssa, candidates, &list) != SUCCESS) {
+ goto failure;
+ }
+
+ if (list) {
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_REG_ALLOC) {
+ fprintf(stderr, "Live Ranges \"%s\"\n", op_array->function_name ? ZSTR_VAL(op_array->function_name) : "[main]");
+ ival = list;
+ while (ival) {
+ zend_life_range *range;
+ int var_num = ssa->vars[ival->ssa_var].var;
+
+ fprintf(stderr, "#%d.", ival->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ fprintf(stderr, ": %u-%u", ival->range.start, ival->range.end);
+ range = ival->range.next;
+ while (range) {
+ fprintf(stderr, ", %u-%u", range->start, range->end);
+ range = range->next;
+ }
+ if (ival->load) {
+ fprintf(stderr, " load");
+ }
+ if (ival->store) {
+ fprintf(stderr, " store");
+ }
+ if (ival->hint) {
+ var_num = ssa->vars[ival->hint->ssa_var].var;
+ fprintf(stderr, " hint=#%d.", ival->hint->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ }
+ fprintf(stderr, "\n");
+ ival = ival->list_next;
+ }
+ fprintf(stderr, "\n");
+ }
+
+ /* Linear Scan Register Allocation */
+ list = zend_jit_linear_scan(op_array, ssa, list);
+
+ if (list) {
+ intervals = zend_arena_calloc(&CG(arena), ssa->vars_count, sizeof(zend_lifetime_interval*));
+ if (!intervals) {
+ goto failure;
+ }
+
+ ival = list;
+ while (ival != NULL) {
+ zend_lifetime_interval *next = ival->list_next;
+
+ ival->list_next = intervals[ival->ssa_var];
+ intervals[ival->ssa_var] = ival;
+ ival = next;
+ }
+
+ if (zend_jit_reg_alloc >= ZEND_JIT_REG_ALLOC_GLOBAL) {
+ /* Naive SSA resolution */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (ssa->vars[i].definition_phi && !ssa->vars[i].no_val) {
+ zend_ssa_phi *phi = ssa->vars[i].definition_phi;
+ int k, src;
+
+ if (phi->pi >= 0) {
+ if (!ssa->vars[i].phi_use_chain
+ || ssa->vars[i].phi_use_chain->block != phi->block) {
+ src = phi->sources[0];
+ if (intervals[i]) {
+ if (!intervals[src]) {
+ intervals[i]->load = 1;
+ } else if (intervals[i]->reg != intervals[src]->reg) {
+ intervals[i]->load = 1;
+ intervals[src]->store = 1;
+ }
+ } else if (intervals[src]) {
+ intervals[src]->store = 1;
+ }
+ }
+ } else {
+ int need_move = 0;
+
+ for (k = 0; k < ssa->cfg.blocks[phi->block].predecessors_count; k++) {
+ src = phi->sources[k];
+ if (src >= 0) {
+ if (ssa->vars[src].definition_phi
+ && ssa->vars[src].definition_phi->pi >= 0
+ && phi->block == ssa->vars[src].definition_phi->block) {
+ /* Skip zero-lenght interval for Pi variable */
+ src = ssa->vars[src].definition_phi->sources[0];
+ }
+ if (intervals[i]) {
+ if (!intervals[src]) {
+ need_move = 1;
+ } else if (intervals[i]->reg != intervals[src]->reg) {
+ need_move = 1;
+ }
+ } else if (intervals[src]) {
+ need_move = 1;
+ }
+ }
+ }
+ if (need_move) {
+ if (intervals[i]) {
+ intervals[i]->load = 1;
+ }
+ for (k = 0; k < ssa->cfg.blocks[phi->block].predecessors_count; k++) {
+ src = phi->sources[k];
+ if (src >= 0) {
+ if (ssa->vars[src].definition_phi
+ && ssa->vars[src].definition_phi->pi >= 0
+ && phi->block == ssa->vars[src].definition_phi->block) {
+ /* Skip zero-lenght interval for Pi variable */
+ src = ssa->vars[src].definition_phi->sources[0];
+ }
+ if (intervals[src]) {
+ intervals[src]->store = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ /* Remove useless register allocation */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i] &&
+ (intervals[i]->load ||
+ (intervals[i]->store && ssa->vars[i].definition >= 0)) &&
+ ssa->vars[i].use_chain < 0) {
+ zend_bool may_remove = 1;
+ zend_ssa_phi *phi = ssa->vars[i].phi_use_chain;
+
+ while (phi) {
+ if (intervals[phi->ssa_var] &&
+ !intervals[phi->ssa_var]->load) {
+ may_remove = 0;
+ break;
+ }
+ phi = zend_ssa_next_use_phi(ssa, i, phi);
+ }
+ if (may_remove) {
+ intervals[i] = NULL;
+ }
+ }
+ }
+ /* Remove intervals used once */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i] &&
+ intervals[i]->load &&
+ intervals[i]->store &&
+ (ssa->vars[i].use_chain < 0 ||
+ zend_ssa_next_use(ssa->ops, i, ssa->vars[i].use_chain) < 0)) {
+ zend_bool may_remove = 1;
+ zend_ssa_phi *phi = ssa->vars[i].phi_use_chain;
+
+ while (phi) {
+ if (intervals[phi->ssa_var] &&
+ !intervals[phi->ssa_var]->load) {
+ may_remove = 0;
+ break;
+ }
+ phi = zend_ssa_next_use_phi(ssa, i, phi);
+ }
+ if (may_remove) {
+ intervals[i] = NULL;
+ }
+ }
+ }
+ }
+
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_REG_ALLOC) {
+ fprintf(stderr, "Allocated Live Ranges \"%s\"\n", op_array->function_name ? ZSTR_VAL(op_array->function_name) : "[main]");
+ for (i = 0; i < ssa->vars_count; i++) {
+ ival = intervals[i];
+ while (ival) {
+ zend_life_range *range;
+ int var_num = ssa->vars[ival->ssa_var].var;
+
+ fprintf(stderr, "#%d.", ival->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ fprintf(stderr, ": %u-%u", ival->range.start, ival->range.end);
+ range = ival->range.next;
+ while (range) {
+ fprintf(stderr, ", %u-%u", range->start, range->end);
+ range = range->next;
+ }
+ fprintf(stderr, " (%s)", zend_reg_name[ival->reg]);
+ if (ival->load) {
+ fprintf(stderr, " load");
+ }
+ if (ival->store) {
+ fprintf(stderr, " store");
+ }
+ if (ival->hint) {
+ var_num = ssa->vars[ival->hint->ssa_var].var;
+ fprintf(stderr, " hint=#%d.", ival->hint->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ if (ival->hint->reg != ZREG_NONE) {
+ fprintf(stderr, " (%s)", zend_reg_name[ival->hint->reg]);
+ }
+ }
+ fprintf(stderr, "\n");
+ ival = ival->list_next;
+ }
+ }
+ fprintf(stderr, "\n");
+ }
+
+ free_alloca(candidates, use_heap);
+ return intervals;
+ }
+ }
+
+failure:
+ zend_arena_release(&CG(arena), checkpoint);
+ free_alloca(candidates, use_heap);
+ return NULL;
+}
+
+static void zend_calc_checked_this_r(zend_bitset checked_this, const zend_op_array *op_array, zend_cfg *cfg, int b, int checked)
+{
+ zend_op *opline = &op_array->opcodes[cfg->blocks[b].start];
+ zend_op *end = opline + cfg->blocks[b].len;
+ int old_checked = checked;
+ int i;
+
+ for (; opline < end; opline++) {
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ case ZEND_FETCH_OBJ_R:
+ case ZEND_FETCH_OBJ_W:
+ case ZEND_FETCH_OBJ_RW:
+ case ZEND_FETCH_OBJ_IS:
+ case ZEND_FETCH_OBJ_FUNC_ARG:
+ case ZEND_FETCH_OBJ_UNSET:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_OBJ_REF:
+ case ZEND_INIT_METHOD_CALL:
+ case ZEND_CLONE:
+ case ZEND_UNSET_OBJ:
+ case ZEND_ISSET_ISEMPTY_PROP_OBJ:
+ if (opline->op1_type != IS_UNUSED) {
+ break;
+ }
+ case ZEND_FETCH_THIS:
+ if (checked) {
+ zend_bitset_incl(checked_this, (opline - op_array->opcodes));
+ } else {
+ checked = 1;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (cfg->blocks[b].flags & ZEND_BB_TRY) {
+ checked = old_checked;
+ }
+
+ for (i = cfg->blocks[b].children; i >= 0; i = cfg->blocks[i].next_child) {
+ zend_calc_checked_this_r(checked_this, op_array, cfg, i, checked);
+ }
+}
+
+static zend_bitset zend_calc_checked_this(zend_arena **arena, const zend_op_array *op_array, zend_cfg *cfg)
+{
+ uint32_t bitset_len = zend_bitset_len(op_array->last);
+ zend_bitset checked_this = zend_arena_calloc(arena, bitset_len, ZEND_BITSET_ELM_SIZE);
+
+ zend_calc_checked_this_r(checked_this, op_array, cfg, 0, 0);
+
+ return checked_this;
+}
+
+static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_opline)
+{
+ int b, i, end;
+ zend_op *opline;
+ dasm_State* dasm_state = NULL;
+ void *handler;
+ int call_level = 0;
+ void *checkpoint = NULL;
+ zend_lifetime_interval **ra = NULL;
+ zend_bitset checked_this = NULL;
+ zend_bool is_terminated = 1; /* previous basic block is terminated by jump */
+ zend_bool recv_emitted = 0; /* emitted at least one RECV opcode */
+
+ if (ZCG(accel_directives).jit_bisect_limit) {
+ jit_bisect_pos++;
+ if (jit_bisect_pos >= ZCG(accel_directives).jit_bisect_limit) {
+ if (jit_bisect_pos == ZCG(accel_directives).jit_bisect_limit) {
+ fprintf(stderr, "Not JITing %s%s%s in %s:%d and after due to jit_bisect_limit\n",
+ op_array->scope ? ZSTR_VAL(op_array->scope->name) : "",
+ op_array->scope ? "::" : "",
+ op_array->function_name ? ZSTR_VAL(op_array->function_name) : "{main}",
+ ZSTR_VAL(op_array->filename), op_array->line_start);
+ }
+ return FAILURE;
+ }
+ }
+
+ if (zend_jit_reg_alloc) {
+ checkpoint = zend_arena_checkpoint(CG(arena));
+ ra = zend_jit_allocate_registers(op_array, ssa);
+ }
+
+ /* mark hidden branch targets */
+ for (b = 0; b < ssa->cfg.blocks_count; b++) {
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_REACHABLE &&
+ ssa->cfg.blocks[b].len > 1) {
+
+ opline = op_array->opcodes + ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len - 1;
+ if (opline->opcode == ZEND_DO_FCALL &&
+ (opline-1)->opcode == ZEND_NEW) {
+ ssa->cfg.blocks[ssa->cfg.blocks[b].successors[0]].flags |= ZEND_BB_TARGET;
+ }
+ }
+ }
+
+ dasm_init(&dasm_state, DASM_MAXSECTION);
+ dasm_setupglobal(&dasm_state, dasm_labels, zend_lb_MAX);
+ dasm_setup(&dasm_state, dasm_actions);
+
+ dasm_growpc(&dasm_state, ssa->cfg.blocks_count * 2 + 1);
+
+ zend_jit_align_func(&dasm_state);
+ for (b = 0; b < ssa->cfg.blocks_count; b++) {
+ if ((ssa->cfg.blocks[b].flags & ZEND_BB_REACHABLE) == 0) {
+ continue;
+ }
+//#ifndef CONTEXT_THREADED_JIT
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_ENTRY) {
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_TARGET) {
+ /* pass */
+ } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE &&
+ ssa->cfg.blocks[b].len == 1 &&
+ (ssa->cfg.blocks[b].flags & ZEND_BB_EXIT) &&
+ op_array->opcodes[ssa->cfg.blocks[b].start].opcode != ZEND_JMP) {
+ /* don't generate code for BB with single opcode */
+ continue;
+ }
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_FOLLOW) {
+ if (!is_terminated) {
+ zend_jit_jmp(&dasm_state, b);
+ }
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ } else
+//#endif
+ if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY)) {
+ opline = op_array->opcodes + ssa->cfg.blocks[b].start;
+ if (ssa->cfg.flags & ZEND_CFG_RECV_ENTRY) {
+ if (opline->opcode == ZEND_RECV_INIT) {
+ if (opline == op_array->opcodes ||
+ (opline-1)->opcode != ZEND_RECV_INIT) {
+ if (recv_emitted) {
+ zend_jit_jmp(&dasm_state, b);
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ for (i = 1; (opline+i)->opcode == ZEND_RECV_INIT; i++) {
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b + i);
+ }
+ zend_jit_prologue(&dasm_state);
+ }
+ recv_emitted = 1;
+ } else if (opline->opcode == ZEND_RECV) {
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ /* skip */
+ continue;
+ } else if (recv_emitted) {
+ zend_jit_jmp(&dasm_state, b);
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ } else {
+ zend_arg_info *arg_info;
+
+ if (opline->op1.num <= op_array->num_args) {
+ arg_info = &op_array->arg_info[opline->op1.num - 1];
+ } else if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ } else {
+ /* skip */
+ continue;
+ }
+ if (!ZEND_TYPE_IS_SET(arg_info->type)) {
+ /* skip */
+ continue;
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ recv_emitted = 1;
+ }
+ } else {
+ if (recv_emitted) {
+ zend_jit_jmp(&dasm_state, b);
+ } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE &&
+ ssa->cfg.blocks[b].len == 1 &&
+ (ssa->cfg.blocks[b].flags & ZEND_BB_EXIT)) {
+ /* don't generate code for BB with single opcode */
+ dasm_free(&dasm_state);
+
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return SUCCESS;
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ recv_emitted = 1;
+ }
+ } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE &&
+ ssa->cfg.blocks[b].len == 1 &&
+ (ssa->cfg.blocks[b].flags & ZEND_BB_EXIT)) {
+ /* don't generate code for BB with single opcode */
+ dasm_free(&dasm_state);
+
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return SUCCESS;
+ } else {
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ }
+ }
+
+ is_terminated = 0;
+
+ zend_jit_label(&dasm_state, b);
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ if ((ssa->cfg.blocks[b].flags & ZEND_BB_FOLLOW)
+ && ssa->cfg.blocks[b].start != 0
+ && (op_array->opcodes[ssa->cfg.blocks[b].start - 1].opcode == ZEND_NOP
+ || op_array->opcodes[ssa->cfg.blocks[b].start - 1].opcode == ZEND_SWITCH_LONG
+ || op_array->opcodes[ssa->cfg.blocks[b].start - 1].opcode == ZEND_SWITCH_STRING)) {
+ if (!zend_jit_reset_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)
+ || !zend_jit_set_valid_ip(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ } else {
+ if (!zend_jit_set_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ }
+ } else if (ssa->cfg.blocks[b].flags & ZEND_BB_TARGET) {
+ if (!zend_jit_reset_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ } else if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY|ZEND_BB_ENTRY)) {
+ if (!zend_jit_set_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ }
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) {
+ if (!zend_jit_check_timeout(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ }
+ if (!ssa->cfg.blocks[b].len) {
+ continue;
+ }
+ if ((zend_jit_reg_alloc >= ZEND_JIT_REG_ALLOC_GLOBAL) && ra) {
+ zend_ssa_phi *phi = ssa->blocks[b].phis;
+
+ while (phi) {
+ zend_lifetime_interval *ival = ra[phi->ssa_var];
+
+ if (ival) {
+ if (ival->load) {
+ ZEND_ASSERT(ival->reg != ZREG_NONE);
+
+ if (!zend_jit_load_ssa_var(&dasm_state, ssa, phi->ssa_var, ival->reg)) {
+ goto jit_failure;
+ }
+ } else if (ival->store) {
+ ZEND_ASSERT(ival->reg != ZREG_NONE);
+
+ if (!zend_jit_store_ssa_var(&dasm_state, ssa, phi->ssa_var, ival->reg)) {
+ goto jit_failure;
+ }
+ }
+ }
+ phi = phi->next;
+ }
+ }
+ end = ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len - 1;
+ for (i = ssa->cfg.blocks[b].start; i <= end; i++) {
+ opline = op_array->opcodes + i;
+ switch (opline->opcode) {
+ case ZEND_INIT_FCALL:
+ case ZEND_INIT_FCALL_BY_NAME:
+ case ZEND_INIT_NS_FCALL_BY_NAME:
+ case ZEND_INIT_METHOD_CALL:
+ case ZEND_INIT_DYNAMIC_CALL:
+ case ZEND_INIT_STATIC_METHOD_CALL:
+ case ZEND_INIT_USER_CALL:
+ case ZEND_NEW:
+ call_level++;
+ }
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_INLINE) {
+ switch (opline->opcode) {
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ if (!zend_jit_inc_dec(&dasm_state, opline, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ if (!zend_jit_long_math(&dasm_state, opline, &i, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+// case ZEND_DIV: // TODO: check for division by zero ???
+ if (!zend_jit_math(&dasm_state, opline, &i, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_CONCAT:
+ case ZEND_FAST_CONCAT:
+ if (!zend_jit_concat(&dasm_state, opline, &i, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_DIM_OP:
+ if (opline->extended_value != ZEND_POW
+ && opline->extended_value != ZEND_DIV) {
+ // TODO: check for division by zero ???
+ if (!zend_jit_assign_op(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ }
+ break;
+ case ZEND_ASSIGN_DIM:
+ if (!zend_jit_assign_dim(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN:
+ if (!zend_jit_assign(&dasm_state, opline, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_QM_ASSIGN:
+ if (!zend_jit_qm_assign(&dasm_state, opline, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_INIT_FCALL:
+ case ZEND_INIT_FCALL_BY_NAME:
+ if (!zend_jit_init_fcall(&dasm_state, opline, b, op_array, ssa, call_level)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAL_EX:
+ if (!zend_jit_send_val(&dasm_state, opline, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SEND_REF:
+ if (!zend_jit_send_ref(&dasm_state, opline, op_array, ssa, 0)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_VAR_NO_REF:
+ case ZEND_SEND_VAR_NO_REF_EX:
+ if (!zend_jit_send_var(&dasm_state, opline, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_DO_UCALL:
+ is_terminated = 1;
+ /* break missing intentionally */
+ case ZEND_DO_ICALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_DO_FCALL:
+ if (!zend_jit_do_fcall(&dasm_state, opline, op_array, ssa, call_level, b + 1)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_CASE:
+ if (!zend_jit_cmp(&dasm_state, opline, b, &i, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ if (!zend_jit_identical(&dasm_state, opline, b, &i, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_DEFINED:
+ if (!zend_jit_defined(&dasm_state, opline, b, &i, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_TYPE_CHECK:
+ if (!zend_jit_type_check(&dasm_state, opline, b, &i, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_RETURN:
+ if (!zend_jit_return(&dasm_state, opline, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ if (!zend_jit_bool_jmpznz(&dasm_state, opline, b, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ if (opline > op_array->opcodes + ssa->cfg.blocks[b].start &&
+ ((opline-1)->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) {
+ /* smart branch */
+ if (!zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ goto done;
+ }
+ /* break missing intentionally */
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ if (!zend_jit_bool_jmpznz(&dasm_state, opline, b, op_array, ssa, ra)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_FETCH_DIM_R:
+ case ZEND_FETCH_DIM_IS:
+ if (!zend_jit_fetch_dim_read(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ISSET_ISEMPTY_DIM_OBJ:
+ if (!zend_jit_isset_isempty_dim(&dasm_state, opline, b, &i, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_FETCH_OBJ_R:
+ case ZEND_FETCH_OBJ_IS:
+ if (opline->op1_type == IS_UNUSED && !checked_this) {
+ checked_this = zend_calc_checked_this(&CG(arena), op_array, &ssa->cfg);
+ }
+ if (!zend_jit_fetch_obj_read(&dasm_state, opline, op_array, ssa, checked_this)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_BIND_GLOBAL:
+ if (!zend_jit_bind_global(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_RECV:
+ if (!zend_jit_recv(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_RECV_INIT:
+ if (!zend_jit_recv_init(&dasm_state, opline, op_array, (opline + 1)->opcode != ZEND_RECV_INIT, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_FREE:
+ case ZEND_FE_FREE:
+ if (!zend_jit_free(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ECHO:
+ if (!zend_jit_echo(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ if (!zend_jit_switch(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ default:
+ break;
+ }
+ }
+
+ switch (opline->opcode) {
+ case ZEND_RECV_INIT:
+ case ZEND_BIND_GLOBAL:
+ if (opline == op_array->opcodes ||
+ opline->opcode != op_array->opcodes[i-1].opcode) {
+ /* repeatable opcodes */
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ }
+ zend_jit_set_opline(&dasm_state, opline+1);
+ break;
+ case ZEND_NOP:
+ case ZEND_OP_DATA:
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ break;
+ case ZEND_JMP:
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ const zend_op *target = OP_JMP_ADDR(opline, opline->op1);
+
+ if (!zend_jit_set_ip(&dasm_state, target)) {
+ goto jit_failure;
+ }
+ }
+ if (!zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ case ZEND_CATCH:
+ case ZEND_FAST_CALL:
+ case ZEND_FAST_RET:
+ case ZEND_GENERATOR_CREATE:
+ case ZEND_GENERATOR_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_RETURN:
+ case ZEND_EXIT:
+ /* switch through trampoline */
+ case ZEND_YIELD:
+ case ZEND_YIELD_FROM:
+ if (!zend_jit_tail_handler(&dasm_state, opline)) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ /* stackless execution */
+ case ZEND_INCLUDE_OR_EVAL:
+ case ZEND_DO_FCALL:
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ if (!zend_jit_call(&dasm_state, opline, b + 1)) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ case ZEND_JMPZNZ:
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) ||
+ !zend_jit_cond_jmp(&dasm_state, OP_JMP_ADDR(opline, opline->op2), ssa->cfg.blocks[b].successors[1]) ||
+ !zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ if (opline > op_array->opcodes &&
+ ((opline-1)->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) {
+ /* smart branch */
+ if (!zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ goto done;
+ }
+ /* break missing intentionally */
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_ASSERT_CHECK:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) ||
+ !zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ break;
+ case ZEND_NEW:
+ if (!zend_jit_handler(&dasm_state, opline, 1)) {
+ return 0;
+ }
+ if (opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL) {
+ zend_class_entry *ce = NULL;
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC) {
+ if (ssa->ops && ssa->var_info) {
+ zend_ssa_var_info *res_ssa = &ssa->var_info[ssa->ops[opline - op_array->opcodes].result_def];
+ if (res_ssa->ce && !res_ssa->is_instanceof) {
+ ce = res_ssa->ce;
+ }
+ }
+ } else {
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ if (Z_TYPE_P(zv) == IS_STRING) {
+ zval *lc = zv + 1;
+ ce = (zend_class_entry*)zend_hash_find_ptr(EG(class_table), Z_STR_P(lc));
+ }
+ }
+ }
+
+ i++;
+
+ if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || ce->constructor) {
+ const zend_op *next_opline = opline + 1;
+
+ zend_jit_cond_jmp(&dasm_state, next_opline, ssa->cfg.blocks[b].successors[0]);
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ zend_jit_call(&dasm_state, next_opline, b + 1);
+ is_terminated = 1;
+ } else {
+ zend_jit_do_fcall(&dasm_state, next_opline, op_array, ssa, call_level, b + 1);
+ }
+ }
+ }
+ break;
+ default:
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ }
+done:
+ switch (opline->opcode) {
+ case ZEND_DO_FCALL:
+ case ZEND_DO_ICALL:
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ call_level--;
+ }
+ }
+ }
+
+ handler = dasm_link_and_encode(&dasm_state, op_array, ssa, rt_opline, ra, NULL);
+ if (!handler) {
+ goto jit_failure;
+ }
+ dasm_free(&dasm_state);
+
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return SUCCESS;
+
+jit_failure:
+ if (dasm_state) {
+ dasm_free(&dasm_state);
+ }
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return FAILURE;
+}
+
+static int zend_jit_collect_calls(zend_op_array *op_array, zend_script *script)
+{
+ zend_func_info *func_info =
+ zend_arena_calloc(&CG(arena), 1, sizeof(zend_func_info));
+
+ ZEND_SET_FUNC_INFO(op_array, func_info);
+ func_info->num_args = -1;
+ func_info->return_value_used = -1;
+ return zend_analyze_calls(&CG(arena), script, ZEND_CALL_TREE, op_array, func_info);
+}
+
+static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, const zend_op *rt_opline)
+{
+ zend_ssa ssa;
+ void *checkpoint;
+
+ if (*dasm_ptr == dasm_end) {
+ return FAILURE;
+ }
+
+ checkpoint = zend_arena_checkpoint(CG(arena));
+
+ /* Build SSA */
+ memset(&ssa, 0, sizeof(zend_ssa));
+
+ if (zend_jit_op_array_analyze1(op_array, script, &ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ if (zend_jit_op_array_analyze2(op_array, script, &ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_SSA) {
+ zend_dump_op_array(op_array, ZEND_DUMP_HIDE_UNREACHABLE|ZEND_DUMP_RC_INFERENCE|ZEND_DUMP_SSA, "JIT", &ssa);
+ }
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNCS) {
+ if (zend_jit_collect_calls(op_array, script) != SUCCESS) {
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+ goto jit_failure;
+ }
+ }
+
+ if (zend_jit(op_array, &ssa, rt_opline) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNCS) {
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+ }
+
+ zend_arena_release(&CG(arena), checkpoint);
+ return SUCCESS;
+
+jit_failure:
+ zend_arena_release(&CG(arena), checkpoint);
+ return FAILURE;
+}
+
+/* Run-time JIT handler */
+static void ZEND_FASTCALL zend_runtime_jit(void)
+{
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_op_array *op_array = &EX(func)->op_array;
+ zend_op *opline = op_array->opcodes;
+
+ zend_shared_alloc_lock();
+
+ if (ZEND_FUNC_INFO(op_array)) {
+ SHM_UNPROTECT();
+ zend_jit_unprotect();
+
+ /* restore original opcode handlers */
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ opline->handler = ZEND_FUNC_INFO(op_array);
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+
+ /* perform real JIT for this function */
+ zend_real_jit_func(op_array, NULL, NULL);
+
+ zend_jit_protect();
+ SHM_PROTECT();
+ }
+
+ zend_shared_alloc_unlock();
+
+ /* JIT-ed code is going to be called by VM */
+}
+
+void zend_jit_check_funcs(HashTable *function_table, zend_bool is_method) {
+ zend_op *opline;
+ zend_function *func;
+ zend_op_array *op_array;
+ uintptr_t counter;
+
+ ZEND_HASH_REVERSE_FOREACH_PTR(function_table, func) {
+ if (func->type == ZEND_INTERNAL_FUNCTION) {
+ break;
+ }
+ op_array = &func->op_array;
+ opline = op_array->opcodes;
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ if (opline->handler == zend_jit_profile_jit_handler) {
+ if (!RUN_TIME_CACHE(op_array)) {
+ continue;
+ }
+ counter = (uintptr_t)ZEND_COUNTER_INFO(op_array);
+ ZEND_COUNTER_INFO(op_array) = 0;
+ opline->handler = ZEND_FUNC_INFO(op_array);
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+ if (((double)counter / (double)zend_jit_profile_counter) > ZEND_JIT_PROF_THRESHOLD) {
+ zend_real_jit_func(op_array, NULL, NULL);
+ }
+ }
+ } ZEND_HASH_FOREACH_END();
+}
+
+void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend_op *opline)
+{
+ zend_op_array *op_array = &EX(func)->op_array;
+ zend_jit_op_array_extension *jit_extension;
+ uint32_t i;
+
+ zend_shared_alloc_lock();
+ jit_extension = (zend_jit_op_array_extension*)ZEND_FUNC_INFO(op_array);
+
+ if (jit_extension) {
+ SHM_UNPROTECT();
+ zend_jit_unprotect();
+
+ *(jit_extension->counter) = ZEND_JIT_HOT_COUNTER_INIT;
+ for (i = 0; i < op_array->last; i++) {
+ op_array->opcodes[i].handler = jit_extension->orig_handlers[i];
+ }
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+
+ /* perform real JIT for this function */
+ zend_real_jit_func(op_array, NULL, opline);
+
+ zend_jit_protect();
+ SHM_PROTECT();
+ }
+
+ zend_shared_alloc_unlock();
+
+ /* JIT-ed code is going to be called by VM */
+}
+
+static int zend_jit_setup_hot_counters(zend_op_array *op_array)
+{
+ zend_op *opline = op_array->opcodes;
+ zend_jit_op_array_extension *jit_extension;
+ zend_cfg cfg;
+ uint32_t i;
+
+ ZEND_ASSERT(zend_jit_func_counter_handler != NULL);
+ ZEND_ASSERT(zend_jit_loop_counter_handler != NULL);
+
+ if (zend_jit_build_cfg(op_array, &cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ jit_extension = (zend_jit_op_array_extension*)zend_shared_alloc(sizeof(zend_jit_op_array_extension) + (op_array->last - 1) * sizeof(void*));
+ jit_extension->counter = &zend_jit_hot_counters[zend_jit_op_array_hash(op_array) & (ZEND_HOT_COUNTERS_COUNT - 1)];
+ for (i = 0; i < op_array->last; i++) {
+ jit_extension->orig_handlers[i] = op_array->opcodes[i].handler;
+ }
+ ZEND_SET_FUNC_INFO(op_array, (void*)jit_extension);
+
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+
+ opline->handler = (const void*)zend_jit_func_counter_handler;
+
+ for (i = 0; i < cfg.blocks_count; i++) {
+ if ((cfg.blocks[i].flags & ZEND_BB_REACHABLE) &&
+ (cfg.blocks[i].flags & ZEND_BB_LOOP_HEADER)) {
+ op_array->opcodes[cfg.blocks[i].start].handler =
+ (const void*)zend_jit_loop_counter_handler;
+ }
+ }
+
+ return SUCCESS;
+}
+
+static int zend_needs_manual_jit(const zend_op_array *op_array)
+{
+ if (op_array->doc_comment) {
+ const char *s = ZSTR_VAL(op_array->doc_comment);
+ const char *p = strstr(s, "@jit");
+
+ if (p) {
+ size_t l = ZSTR_LEN(op_array->doc_comment);
+
+ if ((p == s + 3 || *(p-1) <= ' ') &&
+ (p + 6 == s + l || *(p+4) <= ' ')) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
+{
+ if (dasm_ptr == NULL) {
+ return FAILURE;
+ }
+
+ if (zend_jit_trigger == ZEND_JIT_ON_FIRST_EXEC) {
+ zend_op *opline = op_array->opcodes;
+
+ /* Set run-time JIT handler */
+ ZEND_ASSERT(zend_jit_runtime_jit_handler != NULL);
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ ZEND_SET_FUNC_INFO(op_array, (void*)opline->handler);
+ opline->handler = (const void*)zend_jit_runtime_jit_handler;
+
+ return SUCCESS;
+ } else if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ zend_op *opline = op_array->opcodes;
+
+ ZEND_ASSERT(zend_jit_profile_jit_handler != NULL);
+ if (op_array->function_name) {
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ ZEND_SET_FUNC_INFO(op_array, (void*)opline->handler);
+ opline->handler = (const void*)zend_jit_profile_jit_handler;
+ }
+
+ return SUCCESS;
+ } else if (zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ return zend_jit_setup_hot_counters(op_array);
+ } else if (zend_jit_trigger == ZEND_JIT_ON_SCRIPT_LOAD) {
+ return zend_real_jit_func(op_array, script, NULL);
+ } else if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT) {
+ if (zend_needs_manual_jit(op_array)) {
+ return zend_real_jit_func(op_array, script, NULL);
+ } else {
+ return SUCCESS;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+}
+
+ZEND_EXT_API int zend_jit_script(zend_script *script)
+{
+ void *checkpoint;
+ zend_call_graph call_graph;
+ zend_func_info *info;
+ int i;
+
+ if (dasm_ptr == NULL || *dasm_ptr == dasm_end) {
+ return FAILURE;
+ }
+
+ checkpoint = zend_arena_checkpoint(CG(arena));
+
+ call_graph.op_arrays_count = 0;
+ if (zend_build_call_graph(&CG(arena), script, &call_graph) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ zend_analyze_call_graph(&CG(arena), script, &call_graph);
+
+ if (zend_jit_trigger == ZEND_JIT_ON_FIRST_EXEC ||
+ zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST ||
+ zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
+ if (zend_jit_op_array(call_graph.op_arrays[i], script) != SUCCESS) {
+ goto jit_failure;
+ }
+ }
+ } else if (zend_jit_trigger == ZEND_JIT_ON_SCRIPT_LOAD ||
+ zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT) {
+
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT) {
+ int do_jit = 0;
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ do_jit = 1;
+ break;
+ }
+ }
+ if (!do_jit) {
+ goto jit_failure;
+ }
+ }
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ if (zend_jit_op_array_analyze1(call_graph.op_arrays[i], script, &info->ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+ info->flags = info->ssa.cfg.flags;
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ info->call_map = zend_build_call_map(&CG(arena), info, call_graph.op_arrays[i]);
+ if (call_graph.op_arrays[i]->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ zend_init_func_return_info(call_graph.op_arrays[i], script, &info->return_info);
+ }
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT &&
+ !zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ continue;
+ }
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ if (zend_jit_op_array_analyze2(call_graph.op_arrays[i], script, &info->ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+ info->flags = info->ssa.cfg.flags;
+ }
+ }
+
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_SSA) {
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT &&
+ !zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ continue;
+ }
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ zend_dump_op_array(call_graph.op_arrays[i], ZEND_DUMP_HIDE_UNREACHABLE|ZEND_DUMP_RC_INFERENCE|ZEND_DUMP_SSA, "JIT", &info->ssa);
+ }
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT &&
+ !zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ continue;
+ }
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ if (zend_jit(call_graph.op_arrays[i], &info->ssa, NULL) != SUCCESS) {
+ goto jit_failure;
+ }
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ zend_arena_release(&CG(arena), checkpoint);
+ return SUCCESS;
+
+jit_failure:
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
+ }
+ zend_arena_release(&CG(arena), checkpoint);
+ return FAILURE;
+}
+
+ZEND_EXT_API void zend_jit_unprotect(void)
+{
+#ifdef HAVE_MPROTECT
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_WRITE) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ }
+#elif _WIN32
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_READWRITE, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ }
+#endif
+}
+
+ZEND_EXT_API void zend_jit_protect(void)
+{
+#ifdef HAVE_MPROTECT
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_EXEC) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ }
+#elif _WIN32
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_EXECUTE_READ, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ }
+#endif
+}
+
+static int zend_jit_make_stubs(void)
+{
+ dasm_State* dasm_state = NULL;
+ uint32_t i;
+
+ dasm_init(&dasm_state, DASM_MAXSECTION);
+ dasm_setupglobal(&dasm_state, dasm_labels, zend_lb_MAX);
+
+ for (i = 0; i < sizeof(zend_jit_stubs)/sizeof(zend_jit_stubs[0]); i++) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_stubs[i].stub(&dasm_state)) {
+ return 0;
+ }
+ if (!dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, zend_jit_stubs[i].name)) {
+ return 0;
+ }
+ }
+
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ if (zend_jit_trigger == ZEND_JIT_ON_FIRST_EXEC) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_runtime_jit_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_runtime_jit_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_runtime_jit");
+ if (!zend_jit_runtime_jit_handler) {
+ return 0;
+ }
+ } else if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_profile_jit_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_profile_jit_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_profile_jit");
+ if (!zend_jit_profile_jit_handler) {
+ return 0;
+ }
+ } else if (zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_func_counter_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_func_counter_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_func_counter");
+ if (!zend_jit_func_counter_handler) {
+ return 0;
+ }
+
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_loop_counter_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_loop_counter_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_loop_counter");
+ if (!zend_jit_loop_counter_handler) {
+ return 0;
+ }
+ }
+ } else {
+ zend_jit_runtime_jit_handler = (const void*)zend_runtime_jit;
+ zend_jit_profile_jit_handler = (const void*)zend_jit_profile_helper;
+ zend_jit_func_counter_handler = (const void*)zend_jit_func_counter_helper;
+ zend_jit_loop_counter_handler = (const void*)zend_jit_loop_counter_helper;
+ }
+
+ dasm_free(&dasm_state);
+ return 1;
+}
+
+ZEND_EXT_API int zend_jit_startup(zend_long jit, void *buf, size_t size, zend_bool reattached)
+{
+ int ret;
+
+ zend_jit_level = ZEND_JIT_LEVEL(jit);
+ zend_jit_trigger = ZEND_JIT_TRIGGER(jit);
+ zend_jit_reg_alloc = ZEND_JIT_REG_ALLOC(jit);
+ zend_jit_cpu_flags = ZEND_JIT_CPU_FLAGS(jit);
+
+ zend_jit_vm_kind = zend_vm_kind();
+ if (zend_jit_vm_kind != ZEND_VM_KIND_CALL &&
+ zend_jit_vm_kind != ZEND_VM_KIND_HYBRID) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+
+ zend_jit_halt_op = zend_get_halt_op();
+
+ if (zend_jit_setup() != SUCCESS) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+
+ if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ zend_jit_profile_counter_rid = zend_get_op_array_extension_handle();
+ }
+
+#ifdef HAVE_GDB
+ zend_jit_gdb_init();
+#endif
+
+#ifdef HAVE_OPROFILE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_OPROFILE) {
+ if (!zend_jit_oprofile_startup()) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+ }
+#endif
+
+ dasm_buf = buf;
+ dasm_size = size;
+
+#ifdef HAVE_MPROTECT
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ } else {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_EXEC) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ }
+#elif _WIN32
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_EXECUTE_READWRITE, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ } else {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_EXECUTE_READ, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ }
+#endif
+
+ dasm_ptr = dasm_end = (void*)(((char*)dasm_buf) + size - sizeof(*dasm_ptr));
+ if (!reattached) {
+ zend_jit_unprotect();
+ *dasm_ptr = dasm_buf;
+#if _WIN32
+ /* reserve space for global labels */
+ *dasm_ptr = (void**)*dasm_ptr + zend_lb_MAX;
+#endif
+ zend_jit_protect();
+ }
+
+#ifdef HAVE_DISASM
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM|ZEND_JIT_DEBUG_ASM_STUBS)) {
+ if (!zend_jit_disasm_init()) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+ }
+#endif
+
+#ifdef HAVE_PERFTOOLS
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_PERF_DUMP) {
+ zend_jit_perf_jitdump_open();
+ }
+#endif
+
+ if (!reattached) {
+ zend_jit_unprotect();
+ ret = zend_jit_make_stubs();
+#if _WIN32
+ /* save global labels */
+ memcpy(dasm_buf, dasm_labels, sizeof(void*) * zend_lb_MAX);
+#endif
+ zend_jit_protect();
+ if (!ret) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+ } else {
+#if _WIN32
+ /* restore global labels */
+ memcpy(dasm_labels, dasm_buf, sizeof(void*) * zend_lb_MAX);
+#endif
+ }
+
+ return SUCCESS;
+}
+
+ZEND_EXT_API void zend_jit_shutdown(void)
+{
+#ifdef HAVE_OPROFILE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_OPROFILE) {
+ zend_jit_oprofile_shutdown();
+ }
+#endif
+
+#ifdef HAVE_GDB
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_GDB) {
+ zend_jit_gdb_unregister();
+ }
+#endif
+
+#ifdef HAVE_DISASM
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM|ZEND_JIT_DEBUG_ASM_STUBS)) {
+ zend_jit_disasm_shutdown();
+ }
+#endif
+
+#ifdef HAVE_PERFTOOLS
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_PERF_DUMP) {
+ zend_jit_perf_jitdump_close();
+ }
+#endif
+}
+
+ZEND_EXT_API void zend_jit_activate(void)
+{
+ if (zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ int i;
+
+ for (i = 0; i < ZEND_HOT_COUNTERS_COUNT; i++) {
+ zend_jit_hot_counters[i] = ZEND_JIT_HOT_COUNTER_INIT;
+ }
+ }
+}
+
+ZEND_EXT_API void zend_jit_deactivate(void)
+{
+ if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ if (!zend_jit_profile_counter) {
+ return;
+ } else {
+ zend_class_entry *ce;
+
+ zend_shared_alloc_lock();
+ SHM_UNPROTECT();
+ zend_jit_unprotect();
+
+ zend_jit_check_funcs(EG(function_table), 0);
+ ZEND_HASH_REVERSE_FOREACH_PTR(EG(class_table), ce) {
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ break;
+ }
+ zend_jit_check_funcs(&ce->function_table, 1);
+ } ZEND_HASH_FOREACH_END();
+
+ zend_jit_protect();
+ SHM_PROTECT();
+ zend_shared_alloc_unlock();
+
+ zend_jit_profile_counter = 0;
+ }
+ }
+}
+
+#else /* HAVE_JIT */
+
+ZEND_EXT_API int zend_jit_op_array(const zend_op_array *op_array, zend_script *script)
+{
+ return FAILURE;
+}
+
+ZEND_EXT_API int zend_jit_script(zend_script *script)
+{
+ return FAILURE;
+}
+
+ZEND_EXT_API void zend_jit_unprotect(void)
+{
+}
+
+ZEND_EXT_API void zend_jit_protect(void)
+{
+}
+
+ZEND_EXT_API int zend_jit_startup(zend_long jit, size_t size)
+{
+ return FAILURE;
+}
+
+ZEND_EXT_API void zend_jit_shutdown(void)
+{
+}
+
+ZEND_EXT_API void zend_jit_activate(void)
+{
+}
+
+ZEND_EXT_API void zend_jit_deactivate(void)
+{
+}
+
+#endif /* HAVE_JIT */
diff --git a/ext/opcache/jit/zend_jit.h b/ext/opcache/jit/zend_jit.h
new file mode 100644
index 0000000000..fa65ed7840
--- /dev/null
+++ b/ext/opcache/jit/zend_jit.h
@@ -0,0 +1,109 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef HAVE_JIT_H
+#define HAVE_JIT_H
+
+#define ZEND_JIT_LEVEL_NONE 0 /* no JIT */
+#define ZEND_JIT_LEVEL_MINIMAL 1 /* minimal JIT (subroutine threading) */
+#define ZEND_JIT_LEVEL_INLINE 2 /* selective inline threading */
+#define ZEND_JIT_LEVEL_OPT_FUNC 3 /* optimized JIT based on Type-Inference */
+#define ZEND_JIT_LEVEL_OPT_FUNCS 4 /* optimized JIT based on Type-Inference and call-tree */
+#define ZEND_JIT_LEVEL_OPT_SCRIPT 5 /* optimized JIT based on Type-Inference and inner-procedure analises */
+
+#define ZEND_JIT_LEVEL(n) ((n) % 10)
+
+#define ZEND_JIT_ON_SCRIPT_LOAD 0
+#define ZEND_JIT_ON_FIRST_EXEC 1
+#define ZEND_JIT_ON_PROF_REQUEST 2 /* compile the most frequently caled on first requrest functions */
+#define ZEND_JIT_ON_HOT_COUNTERS 3 /* compile functions after N calls or loop iterations */
+#define ZEND_JIT_ON_DOC_COMMENT 4 /* compile functions with "@jit" tag in doc-comments */
+
+#define ZEND_JIT_TRIGGER(n) (((n) / 10) % 10)
+
+#define ZEND_JIT_REG_ALLOC_NONE 0 /* no register allocation */
+#define ZEND_JIT_REG_ALLOC_ENABLED 1 /* local linear scan register allocation */
+#define ZEND_JIT_REG_ALLOC_GLOBAL 2 /* global linear scan register allocation */
+
+#define ZEND_JIT_REG_ALLOC(n) (((n) / 100) % 10)
+
+#define ZEND_JIT_CPU_AVX 1 /* use AVX instructions, if available */
+
+#define ZEND_JIT_CPU_FLAGS(n) (((n) / 1000) % 10)
+
+
+#define ZEND_JIT_DEFAULT "1205"
+
+
+/* Makes profile based JIT (opcache.jit=2*) to generate code only for most
+ * offten called functions (above the threshold).
+ * TODO: this setting should be configurable
+ */
+#define ZEND_JIT_PROF_THRESHOLD 0.005
+
+/* Hot Counters based JIT parameters.
+ * TODO: this setting should be configurable
+ */
+#define ZEND_JIT_HOT_FUNC_COST 1
+#define ZEND_JIT_HOT_LOOP_COST 2
+#define ZEND_JIT_HOT_COUNTER_INIT 127
+
+#define ZEND_JIT_DEBUG_ASM (1<<0)
+#define ZEND_JIT_DEBUG_SSA (1<<1)
+#define ZEND_JIT_DEBUG_REG_ALLOC (1<<2)
+#define ZEND_JIT_DEBUG_ASM_STUBS (1<<3)
+
+#define ZEND_JIT_DEBUG_PERF (1<<4)
+#define ZEND_JIT_DEBUG_PERF_DUMP (1<<5)
+#define ZEND_JIT_DEBUG_OPROFILE (1<<6)
+#define ZEND_JIT_DEBUG_VTUNE (1<<7)
+
+#define ZEND_JIT_DEBUG_GDB (1<<8)
+
+ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script);
+ZEND_EXT_API int zend_jit_script(zend_script *script);
+ZEND_EXT_API void zend_jit_unprotect(void);
+ZEND_EXT_API void zend_jit_protect(void);
+ZEND_EXT_API int zend_jit_startup(zend_long jit, void *jit_buffer, size_t size, zend_bool reattached);
+ZEND_EXT_API void zend_jit_shutdown(void);
+ZEND_EXT_API void zend_jit_activate(void);
+ZEND_EXT_API void zend_jit_deactivate(void);
+ZEND_EXT_API void zend_jit_status(zval *ret);
+
+typedef struct _zend_lifetime_interval zend_lifetime_interval;
+typedef struct _zend_life_range zend_life_range;
+
+struct _zend_life_range {
+ uint32_t start;
+ uint32_t end;
+ zend_life_range *next;
+};
+
+struct _zend_lifetime_interval {
+ int ssa_var;
+ int8_t reg;
+ zend_bool split;
+ zend_bool store;
+ zend_bool load;
+ zend_life_range range;
+ zend_lifetime_interval *hint;
+ zend_lifetime_interval *used_as_hint;
+ zend_lifetime_interval *list_next;
+};
+
+#endif /* HAVE_JIT_H */
diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c
new file mode 100644
index 0000000000..70708729b4
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_disasm_x86.c
@@ -0,0 +1,518 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_DISASM 1
+#define DISASM_INTEL_SYNTAX 0
+
+#include "jit/libudis86/itab.c"
+#include "jit/libudis86/decode.c"
+#include "jit/libudis86/syn.c"
+#if DISASM_INTEL_SYNTAX
+# include "jit/libudis86/syn-intel.c"
+#else
+# include "jit/libudis86/syn-att.c"
+#endif
+#include "jit/libudis86/udis86.c"
+
+static void zend_jit_disasm_add_symbol(const char *name,
+ uint64_t addr,
+ uint64_t size);
+
+#ifndef _WIN32
+# include "jit/zend_elf.c"
+#endif
+
+#include "zend_sort.h"
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#ifndef _WIN32
+#include <dlfcn.h>
+#endif
+
+static struct ud ud;
+
+typedef struct _sym_node {
+ uint64_t addr;
+ uint64_t end;
+ struct _sym_node *parent;
+ struct _sym_node *child[2];
+ unsigned char info;
+ char name[1];
+} zend_sym_node;
+
+static zend_sym_node *symbols = NULL;
+
+static void zend_syms_rotateleft(zend_sym_node *p) {
+ zend_sym_node *r = p->child[1];
+ p->child[1] = r->child[0];
+ if (r->child[0]) {
+ r->child[0]->parent = p;
+ }
+ r->parent = p->parent;
+ if (p->parent == NULL) {
+ symbols = r;
+ } else if (p->parent->child[0] == p) {
+ p->parent->child[0] = r;
+ } else {
+ p->parent->child[1] = r;
+ }
+ r->child[0] = p;
+ p->parent = r;
+}
+
+static void zend_syms_rotateright(zend_sym_node *p) {
+ zend_sym_node *l = p->child[0];
+ p->child[0] = l->child[1];
+ if (l->child[1]) {
+ l->child[1]->parent = p;
+ }
+ l->parent = p->parent;
+ if (p->parent == NULL) {
+ symbols = l;
+ } else if (p->parent->child[1] == p) {
+ p->parent->child[1] = l;
+ } else {
+ p->parent->child[0] = l;
+ }
+ l->child[1] = p;
+ p->parent = l;
+}
+
+static void zend_jit_disasm_add_symbol(const char *name,
+ uint64_t addr,
+ uint64_t size)
+{
+ zend_sym_node *sym;
+ size_t len = strlen(name);
+
+ sym = malloc(sizeof(zend_sym_node) + len + 1);
+ if (!sym) {
+ return;
+ }
+ sym->addr = addr;
+ sym->end = (addr + size - 1);
+ memcpy((char*)&sym->name, name, len + 1);
+ sym->parent = sym->child[0] = sym->child[1] = NULL;
+ sym->info = 1;
+ if (symbols) {
+ zend_sym_node *node = symbols;
+
+ /* insert it into rbtree */
+ do {
+ if (sym->addr > node->addr) {
+ ZEND_ASSERT(sym->addr > (node->end));
+ if (node->child[1]) {
+ node = node->child[1];
+ } else {
+ node->child[1] = sym;
+ sym->parent = node;
+ break;
+ }
+ } else if (sym->addr < node->addr) {
+ if (node->child[0]) {
+ node = node->child[0];
+ } else {
+ node->child[0] = sym;
+ sym->parent = node;
+ break;
+ }
+ } else {
+ ZEND_ASSERT(sym->addr == node->addr);
+ free(sym);
+ return;
+ }
+ } while (1);
+
+ /* fix rbtree after instering */
+ while (sym && sym != symbols && sym->parent->info == 1) {
+ if (sym->parent == sym->parent->parent->child[0]) {
+ node = sym->parent->parent->child[1];
+ if (node && node->info == 1) {
+ sym->parent->info = 0;
+ node->info = 0;
+ sym->parent->parent->info = 1;
+ sym = sym->parent->parent;
+ } else {
+ if (sym == sym->parent->child[1]) {
+ sym = sym->parent;
+ zend_syms_rotateleft(sym);
+ }
+ sym->parent->info = 0;
+ sym->parent->parent->info = 1;
+ zend_syms_rotateright(sym->parent->parent);
+ }
+ } else {
+ node = sym->parent->parent->child[0];
+ if (node && node->info == 1) {
+ sym->parent->info = 0;
+ node->info = 0;
+ sym->parent->parent->info = 1;
+ sym = sym->parent->parent;
+ } else {
+ if (sym == sym->parent->child[0]) {
+ sym = sym->parent;
+ zend_syms_rotateright(sym);
+ }
+ sym->parent->info = 0;
+ sym->parent->parent->info = 1;
+ zend_syms_rotateleft(sym->parent->parent);
+ }
+ }
+ }
+ } else {
+ symbols = sym;
+ }
+ symbols->info = 0;
+}
+
+static void zend_jit_disasm_destroy_symbols(zend_sym_node *n) {
+ if (n) {
+ if (n->child[0]) {
+ zend_jit_disasm_destroy_symbols(n->child[0]);
+ } else if (n->child[1]) {
+ zend_jit_disasm_destroy_symbols(n->child[1]);
+ }
+ free(n);
+ }
+}
+
+static const char* zend_jit_disasm_find_symbol(uint64_t addr,
+ int64_t *offset) {
+ zend_sym_node *node = symbols;
+ while (node) {
+ if (addr < node->addr) {
+ node = node->child[0];
+ } else if (addr > node->end) {
+ node = node->child[1];
+ } else {
+ *offset = addr - node->addr;
+ return node->name;
+ }
+ }
+ return NULL;
+}
+
+static const char* zend_jit_disasm_resolver(struct ud *ud,
+ uint64_t addr,
+ int64_t *offset)
+{
+#ifndef _WIN32
+ ((void)ud);
+ const char *name;
+ void *a = (void*)(zend_uintptr_t)(addr);
+ Dl_info info;
+
+ name = zend_jit_disasm_find_symbol(addr, offset);
+ if (name) {
+ return name;
+ }
+
+ if (dladdr(a, &info)
+ && info.dli_sname != NULL
+ && info.dli_saddr == a) {
+ return info.dli_sname;
+ }
+#else
+ const char *name;
+ name = zend_jit_disasm_find_symbol(addr, offset);
+ if (name) {
+ return name;
+ }
+#endif
+
+ return NULL;
+}
+
+static int zend_jit_cmp_labels(Bucket *b1, Bucket *b2)
+{
+ return ((b1->h > b2->h) > 0) ? 1 : -1;
+}
+
+static int zend_jit_disasm(const char *name,
+ const char *filename,
+ const zend_op_array *op_array,
+ zend_cfg *cfg,
+ const void *start,
+ size_t size)
+{
+ const void *end = (void *)((char *)start + size);
+ zval zv, *z;
+ zend_long n, m;
+ HashTable labels;
+ const struct ud_operand *op;
+ uint64_t addr;
+ int b;
+
+ if (name) {
+ fprintf(stderr, "%s: ; (%s)\n", name, filename ? filename : "unknown");
+ }
+
+ ud_set_input_buffer(&ud, (uint8_t*)start, (uint8_t*)end - (uint8_t*)start);
+ ud_set_pc(&ud, (uint64_t)(uintptr_t)start);
+
+ zend_hash_init(&labels, 8, NULL, NULL, 0);
+ if (op_array && cfg) {
+ ZVAL_FALSE(&zv);
+ for (b = 0; b < cfg->blocks_count; b++) {
+ if (cfg->blocks[b].flags & (ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) {
+ addr = (uint64_t)(uintptr_t)op_array->opcodes[cfg->blocks[b].start].handler;
+ if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) {
+ zend_hash_index_add(&labels, addr, &zv);
+ }
+ }
+ }
+ }
+ ZVAL_TRUE(&zv);
+ while (ud_disassemble(&ud)) {
+ op = ud_insn_opr(&ud, 0);
+ if (op && op->type == UD_OP_JIMM) {
+ addr = ud_syn_rel_target(&ud, (struct ud_operand*)op);
+ if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) {
+ zend_hash_index_add(&labels, addr, &zv);
+ }
+ }
+ }
+
+ zend_hash_sort(&labels, (compare_func_t)zend_jit_cmp_labels, 0);
+
+ /* label numbering */
+ n = 0; m = 0;
+ ZEND_HASH_FOREACH_VAL(&labels, z) {
+ if (Z_TYPE_P(z) == IS_FALSE) {
+ m--;
+ ZVAL_LONG(z, m);
+ } else {
+ n++;
+ ZVAL_LONG(z, n);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ ud_set_input_buffer(&ud, (uint8_t*)start, (uint8_t*)end - (uint8_t*)start);
+ ud_set_pc(&ud, (uint64_t)(uintptr_t)start);
+
+ while (ud_disassemble(&ud)) {
+ addr = ud_insn_off(&ud);
+ z = zend_hash_index_find(&labels, addr);
+ if (z) {
+ if (Z_LVAL_P(z) < 0) {
+ fprintf(stderr, ".ENTRY" ZEND_LONG_FMT ":\n", -Z_LVAL_P(z));
+ } else {
+ fprintf(stderr, ".L" ZEND_LONG_FMT ":\n", Z_LVAL_P(z));
+ }
+ }
+ op = ud_insn_opr(&ud, 0);
+ if (op && op->type == UD_OP_JIMM) {
+ addr = ud_syn_rel_target(&ud, (struct ud_operand*)op);
+ if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) {
+ z = zend_hash_index_find(&labels, addr);
+ if (z) {
+ const char *str = ud_insn_asm(&ud);
+ int len;
+
+ len = 0;
+ while (str[len] != 0 && str[len] != ' ' && str[len] != '\t') {
+ len++;
+ }
+ if (str[len] != 0) {
+ while (str[len] == ' ' || str[len] == '\t') {
+ len++;
+ }
+ if (Z_LVAL_P(z) < 0) {
+ fprintf(stderr, "\t%.*s.ENTRY" ZEND_LONG_FMT "\n", len, str, -Z_LVAL_P(z));
+ } else {
+ fprintf(stderr, "\t%.*s.L" ZEND_LONG_FMT "\n", len, str, Z_LVAL_P(z));
+ }
+ continue;
+ }
+ }
+ }
+ }
+ fprintf(stderr, "\t%s\n", ud_insn_asm(&ud));
+ }
+ fprintf(stderr, "\n");
+
+ zend_hash_destroy(&labels);
+
+ return 1;
+}
+
+static int zend_jit_disasm_init(void)
+{
+ ud_init(&ud);
+#if defined(__x86_64__) || defined(_WIN64)
+ ud_set_mode(&ud, 64);
+#else
+ ud_set_mode(&ud, 32);
+#endif
+#if DISASM_INTEL_SYNTAX
+ ud_set_syntax(&ud, UD_SYN_INTEL);
+#else
+ ud_set_syntax(&ud, UD_SYN_ATT);
+#endif
+ ud_set_sym_resolver(&ud, zend_jit_disasm_resolver);
+
+#ifndef ZTS
+#define REGISTER_EG(n) \
+ zend_jit_disasm_add_symbol("EG("#n")", \
+ (uint64_t)(uintptr_t)&executor_globals.n, sizeof(executor_globals.n))
+ REGISTER_EG(uninitialized_zval);
+ REGISTER_EG(exception);
+ REGISTER_EG(vm_interrupt);
+ REGISTER_EG(exception_op);
+ REGISTER_EG(timed_out);
+ REGISTER_EG(current_execute_data);
+ REGISTER_EG(vm_stack_top);
+ REGISTER_EG(vm_stack_end);
+ REGISTER_EG(symbol_table);
+#undef REGISTER_EG
+#endif
+
+ /* Register JIT helper functions */
+#define REGISTER_HELPER(n) \
+ zend_jit_disasm_add_symbol(#n, \
+ (uint64_t)(uintptr_t)n, sizeof(void*));
+ REGISTER_HELPER(memcmp);
+ REGISTER_HELPER(zend_jit_init_func_run_time_cache_helper);
+ REGISTER_HELPER(zend_jit_find_func_helper);
+ REGISTER_HELPER(zend_jit_extend_stack_helper);
+ REGISTER_HELPER(zend_jit_int_extend_stack_helper);
+ REGISTER_HELPER(zend_jit_leave_nested_func_helper);
+ REGISTER_HELPER(zend_jit_leave_top_func_helper);
+ REGISTER_HELPER(zend_jit_symtable_find);
+ REGISTER_HELPER(zend_jit_hash_index_lookup_rw);
+ REGISTER_HELPER(zend_jit_hash_index_lookup_w);
+ REGISTER_HELPER(zend_jit_hash_lookup_rw);
+ REGISTER_HELPER(zend_jit_hash_lookup_w);
+ REGISTER_HELPER(zend_jit_symtable_lookup_rw);
+ REGISTER_HELPER(zend_jit_symtable_lookup_w);
+ REGISTER_HELPER(zend_jit_fetch_dimension_rw_long_helper);
+ REGISTER_HELPER(zend_jit_undefined_op_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_r_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_is_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_isset_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_str_r_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_str_is_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_obj_r_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_obj_is_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_rw_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_w_helper);
+ REGISTER_HELPER(zend_jit_assign_dim_helper);
+ REGISTER_HELPER(zend_jit_assign_dim_op_helper);
+ REGISTER_HELPER(zend_jit_fast_assign_concat_helper);
+ REGISTER_HELPER(zend_jit_fast_concat_helper);
+ REGISTER_HELPER(zend_jit_isset_dim_helper);
+ REGISTER_HELPER(zend_jit_free_call_frame);
+ REGISTER_HELPER(zend_jit_zval_copy_deref_helper)
+ REGISTER_HELPER(zend_jit_new_ref_helper);
+ REGISTER_HELPER(zend_jit_fetch_global_helper);
+ REGISTER_HELPER(zend_jit_verify_arg_object);
+ REGISTER_HELPER(zend_jit_verify_arg_slow);
+ REGISTER_HELPER(zend_jit_fetch_obj_r_slow);
+ REGISTER_HELPER(zend_jit_fetch_obj_r_dynamic);
+ REGISTER_HELPER(zend_jit_fetch_obj_is_slow);
+ REGISTER_HELPER(zend_jit_fetch_obj_is_dynamic);
+ REGISTER_HELPER(zend_jit_vm_stack_free_args_helper);
+ REGISTER_HELPER(zend_jit_copy_extra_args_helper);
+ REGISTER_HELPER(zend_jit_deprecated_helper);
+ REGISTER_HELPER(zend_jit_assign_const_to_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_tmp_to_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_var_to_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_cv_to_typed_ref);
+ REGISTER_HELPER(zend_jit_pre_inc_typed_ref);
+ REGISTER_HELPER(zend_jit_pre_dec_typed_ref);
+ REGISTER_HELPER(zend_jit_post_inc_typed_ref);
+ REGISTER_HELPER(zend_jit_post_dec_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_op_to_typed_ref);
+ REGISTER_HELPER(zend_jit_only_vars_by_reference);
+ REGISTER_HELPER(zend_jit_invalid_array_access);
+ REGISTER_HELPER(zend_jit_prepare_assign_dim_ref);
+ REGISTER_HELPER(zend_runtime_jit);
+ REGISTER_HELPER(zend_jit_hot_func);
+#undef REGISTER_HELPER
+
+#ifndef _WIN32
+ zend_elf_load_symbols();
+#endif
+
+ if (zend_vm_kind() == ZEND_VM_KIND_HYBRID) {
+ zend_op opline;
+
+ memset(&opline, 0, sizeof(opline));
+
+ opline.opcode = ZEND_DO_UCALL;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_UCALL_SPEC_RETVAL_UNUSED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_UCALL;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_UCALL_SPEC_RETVAL_USED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL_BY_NAME;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_UNUSED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL_BY_NAME;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_SPEC_RETVAL_USED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_CONST;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_CONST_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_TMP_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_TMP_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_VAR_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_CV;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_CV_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+ }
+
+ return 1;
+}
+
+static void zend_jit_disasm_shutdown(void)
+{
+ zend_jit_disasm_destroy_symbols(symbols);
+}
diff --git a/ext/opcache/jit/zend_jit_gdb.c b/ext/opcache/jit/zend_jit_gdb.c
new file mode 100644
index 0000000000..58b075ea8c
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_gdb.c
@@ -0,0 +1,493 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+ | Based on Mike Pall's implementation of GDB interface for LuaJIT. |
+ | LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_GDB
+
+#ifdef HAVE_GDB
+
+#include "zend_elf.h"
+#include "zend_gdb.h"
+
+/* DWARF definitions. */
+#define DW_CIE_VERSION 1
+
+/* CFA (Canonical frame address) */
+enum {
+ DW_CFA_nop = 0x0,
+ DW_CFA_offset_extended = 0x5,
+ DW_CFA_def_cfa = 0xc,
+ DW_CFA_def_cfa_offset = 0xe,
+ DW_CFA_offset_extended_sf = 0x11,
+ DW_CFA_advance_loc = 0x40,
+ DW_CFA_offset = 0x80
+};
+
+enum {
+ DW_EH_PE_udata4 = 0x03,
+ DW_EH_PE_textrel = 0x20
+};
+
+enum {
+ DW_TAG_compile_unit = 0x11
+};
+
+enum {
+ DW_children_no = 0,
+ DW_children_yes = 1
+};
+
+enum {
+ DW_AT_name = 0x03,
+ DW_AT_stmt_list = 0x10,
+ DW_AT_low_pc = 0x11,
+ DW_AT_high_pc = 0x12
+};
+
+enum {
+ DW_FORM_addr = 0x01,
+ DW_FORM_data4 = 0x06,
+ DW_FORM_string = 0x08
+};
+
+enum {
+ DW_LNS_extended_op = 0,
+ DW_LNS_copy = 1,
+ DW_LNS_advance_pc = 2,
+ DW_LNS_advance_line = 3
+};
+
+enum {
+ DW_LNE_end_sequence = 1,
+ DW_LNE_set_address = 2
+};
+
+enum {
+#if defined(__i386__)
+ DW_REG_AX, DW_REG_CX, DW_REG_DX, DW_REG_BX,
+ DW_REG_SP, DW_REG_BP, DW_REG_SI, DW_REG_DI,
+ DW_REG_RA,
+#elif defined(__x86_64__)
+ /* Yes, the order is strange, but correct. */
+ DW_REG_AX, DW_REG_DX, DW_REG_CX, DW_REG_BX,
+ DW_REG_SI, DW_REG_DI, DW_REG_BP, DW_REG_SP,
+ DW_REG_8, DW_REG_9, DW_REG_10, DW_REG_11,
+ DW_REG_12, DW_REG_13, DW_REG_14, DW_REG_15,
+ DW_REG_RA,
+ /* TODO: ARM supports? */
+#else
+#error "Unsupported target architecture"
+#endif
+};
+
+enum {
+ GDBJIT_SECT_NULL,
+ GDBJIT_SECT_text,
+ GDBJIT_SECT_eh_frame,
+ GDBJIT_SECT_shstrtab,
+ GDBJIT_SECT_strtab,
+ GDBJIT_SECT_symtab,
+ GDBJIT_SECT_debug_info,
+ GDBJIT_SECT_debug_abbrev,
+ GDBJIT_SECT_debug_line,
+ GDBJIT_SECT__MAX
+};
+
+enum {
+ GDBJIT_SYM_UNDEF,
+ GDBJIT_SYM_FILE,
+ GDBJIT_SYM_FUNC,
+ GDBJIT_SYM__MAX
+};
+
+typedef struct _zend_gdbjit_obj {
+ zend_elf_header hdr;
+ zend_elf_sectheader sect[GDBJIT_SECT__MAX];
+ zend_elf_symbol sym[GDBJIT_SYM__MAX];
+ uint8_t space[4096];
+} zend_gdbjit_obj;
+
+static const zend_elf_header zend_elfhdr_template = {
+ .emagic = { 0x7f, 'E', 'L', 'F' },
+#ifdef ELF64
+ .eclass = 2,
+#else
+ .eclass = 1,
+#endif
+#ifdef WORDS_BIGENDIAN
+ .eendian = 2,
+#else
+ .eendian = 1,
+#endif
+ .eversion = 1,
+#if defined(Linux)
+ .eosabi = 0, /* Nope, it's not 3. ??? */
+#elif defined(__FreeBSD__)
+ .eosabi = 9,
+#elif defined(__OpenBSD__)
+ .eosabi = 12,
+#elif defined(__DragonFly__)
+ .eosabi = 0,
+#elif (defined(__sun__) && defined(__svr4__))
+ .eosabi = 6,
+#else
+ .eosabi = 0,
+#endif
+ .eabiversion = 0,
+ .epad = { 0, 0, 0, 0, 0, 0, 0 },
+ .type = 1,
+#if defined(__i386__)
+ .machine = 3,
+#elif defined(__x86_64__)
+ .machine = 62,
+#else
+# error "Unsupported target architecture"
+#endif
+ .version = 1,
+ .entry = 0,
+ .phofs = 0,
+ .shofs = offsetof(zend_gdbjit_obj, sect),
+ .flags = 0,
+ .ehsize = sizeof(zend_elf_header),
+ .phentsize = 0,
+ .phnum = 0,
+ .shentsize = sizeof(zend_elf_sectheader),
+ .shnum = GDBJIT_SECT__MAX,
+ .shstridx = GDBJIT_SECT_shstrtab
+};
+
+/* Context for generating the ELF object for the GDB JIT API. */
+typedef struct _zend_gdbjit_ctx {
+ uint8_t *p; /* Pointer to next address in obj.space. */
+ uint8_t *startp; /* Pointer to start address in obj.space. */
+ uintptr_t mcaddr; /* Machine code address. */
+ uint32_t szmcode; /* Size of machine code. */
+ int32_t lineno; /* Starting line number. */
+ const char *name; /* JIT function name */
+ const char *filename; /* Starting file name. */
+ size_t objsize; /* Final size of ELF object. */
+ zend_gdbjit_obj obj; /* In-memory ELF object. */
+} zend_gdbjit_ctx;
+
+/* Add a zero-terminated string */
+static uint32_t zend_gdbjit_strz(zend_gdbjit_ctx *ctx, const char *str)
+{
+ uint8_t *p = ctx->p;
+ uint32_t ofs = (uint32_t)(p - ctx->startp);
+ do {
+ *p++ = (uint8_t)*str;
+ } while (*str++);
+ ctx->p = p;
+ return ofs;
+}
+
+/* Add a ULEB128 value */
+static void zend_gdbjit_uleb128(zend_gdbjit_ctx *ctx, uint32_t v)
+{
+ uint8_t *p = ctx->p;
+ for (; v >= 0x80; v >>= 7)
+ *p++ = (uint8_t)((v & 0x7f) | 0x80);
+ *p++ = (uint8_t)v;
+ ctx->p = p;
+}
+
+/* Add a SLEB128 value */
+static void zend_gdbjit_sleb128(zend_gdbjit_ctx *ctx, int32_t v)
+{
+ uint8_t *p = ctx->p;
+ for (; (uint32_t)(v+0x40) >= 0x80; v >>= 7)
+ *p++ = (uint8_t)((v & 0x7f) | 0x80);
+ *p++ = (uint8_t)(v & 0x7f);
+ ctx->p = p;
+}
+
+static void zend_gdbjit_secthdr(zend_gdbjit_ctx *ctx)
+{
+ zend_elf_sectheader *sect;
+
+ *ctx->p++ = '\0';
+
+#define SECTDEF(id, tp, al) \
+ sect = &ctx->obj.sect[GDBJIT_SECT_##id]; \
+ sect->name = zend_gdbjit_strz(ctx, "." #id); \
+ sect->type = ELFSECT_TYPE_##tp; \
+ sect->align = (al)
+
+ SECTDEF(text, NOBITS, 16);
+ sect->flags = ELFSECT_FLAGS_ALLOC|ELFSECT_FLAGS_EXEC;
+ sect->addr = ctx->mcaddr;
+ sect->ofs = 0;
+ sect->size = ctx->szmcode;
+
+ SECTDEF(eh_frame, PROGBITS, sizeof(uintptr_t));
+ sect->flags = ELFSECT_FLAGS_ALLOC;
+
+ SECTDEF(shstrtab, STRTAB, 1);
+ SECTDEF(strtab, STRTAB, 1);
+
+ SECTDEF(symtab, SYMTAB, sizeof(uintptr_t));
+ sect->ofs = offsetof(zend_gdbjit_obj, sym);
+ sect->size = sizeof(ctx->obj.sym);
+ sect->link = GDBJIT_SECT_strtab;
+ sect->entsize = sizeof(zend_elf_symbol);
+ sect->info = GDBJIT_SYM_FUNC;
+
+ SECTDEF(debug_info, PROGBITS, 1);
+ SECTDEF(debug_abbrev, PROGBITS, 1);
+ SECTDEF(debug_line, PROGBITS, 1);
+
+#undef SECTDEF
+}
+
+static void zend_gdbjit_symtab(zend_gdbjit_ctx *ctx)
+{
+ zend_elf_symbol *sym;
+
+ *ctx->p++ = '\0';
+
+ sym = &ctx->obj.sym[GDBJIT_SYM_FILE];
+ sym->name = zend_gdbjit_strz(ctx, "JIT code");
+ sym->sectidx = ELFSECT_IDX_ABS;
+ sym->info = ELFSYM_INFO(ELFSYM_BIND_LOCAL, ELFSYM_TYPE_FILE);
+
+ sym = &ctx->obj.sym[GDBJIT_SYM_FUNC];
+ sym->name = zend_gdbjit_strz(ctx, ctx->name);
+ sym->sectidx = GDBJIT_SECT_text;
+ sym->value = 0;
+ sym->size = ctx->szmcode;
+ sym->info = ELFSYM_INFO(ELFSYM_BIND_GLOBAL, ELFSYM_TYPE_FUNC);
+}
+
+#define SECTALIGN(p, a) \
+ ((p) = (uint8_t *)(((uintptr_t)(p) + ((a)-1)) & ~(uintptr_t)((a)-1)))
+
+/* Shortcuts to generate DWARF structures. */
+#define DB(x) (*p++ = (x))
+#define DI8(x) (*(int8_t *)p = (x), p++)
+#define DU16(x) (*(uint16_t *)p = (x), p += 2)
+#define DU32(x) (*(uint32_t *)p = (x), p += 4)
+#define DADDR(x) (*(uintptr_t *)p = (x), p += sizeof(uintptr_t))
+#define DUV(x) (ctx->p = p, zend_gdbjit_uleb128(ctx, (x)), p = ctx->p)
+#define DSV(x) (ctx->p = p, zend_gdbjit_sleb128(ctx, (x)), p = ctx->p)
+#define DSTR(str) (ctx->p = p, zend_gdbjit_strz(ctx, (str)), p = ctx->p)
+#define DALIGNNOP(s) while ((uintptr_t)p & ((s)-1)) *p++ = DW_CFA_nop
+#define DSECT(name, stmt) \
+ { uint32_t *szp_##name = (uint32_t *)p; p += 4; stmt \
+ *szp_##name = (uint32_t)((p-(uint8_t *)szp_##name)-4); }
+
+static void zend_gdbjit_ehframe(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+ uint8_t *framep = p;
+
+ /* DWARF EH CIE (Common Information Entry) */
+ DSECT(CIE,
+ DU32(0); /* CIE ID. */
+ DB(DW_CIE_VERSION); /* Version */
+ DSTR("zR"); /* Augmentation String. */
+ DUV(1); /* Code alignment factor. */
+ DSV(-(int32_t)sizeof(uintptr_t)); /* Data alignment factor. */
+ DB(DW_REG_RA); /* Return address register. */
+ DB(1); DB(DW_EH_PE_textrel|DW_EH_PE_udata4); /* Augmentation data. */
+ DB(DW_CFA_def_cfa); DUV(DW_REG_SP); DUV(sizeof(uintptr_t));
+ DB(DW_CFA_offset|DW_REG_RA); DUV(1);
+ DALIGNNOP(sizeof(uintptr_t));
+ )
+
+ /* DWARF EH FDE (Frame Description Entry). */
+ DSECT(FDE,
+ DU32((uint32_t)(p-framep)); /* Offset to CIE Pointer. */
+ DU32(0); /* Machine code offset relative to .text. */
+ DU32(ctx->szmcode); /* Machine code length. */
+ DB(0); /* Augmentation data. */
+ DB(DW_CFA_def_cfa_offset); DUV(sizeof(uintptr_t));
+#if defined(__i386__)
+ DB(DW_CFA_advance_loc|3); /* sub $0xc,%esp */
+ DB(DW_CFA_def_cfa_offset); DUV(16); /* Aligned stack frame size. */
+#elif defined(__x86_64__)
+ DB(DW_CFA_advance_loc|4); /* sub $0x8,%rsp */
+ DB(DW_CFA_def_cfa_offset); DUV(16); /* Aligned stack frame size. */
+#else
+# error "Unsupported target architecture"
+#endif
+ DALIGNNOP(sizeof(uintptr_t));
+ )
+
+ ctx->p = p;
+}
+
+static void zend_gdbjit_debuginfo(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+
+ DSECT(info,
+ DU16(2); /* DWARF version. */
+ DU32(0); /* Abbrev offset. */
+ DB(sizeof(uintptr_t)); /* Pointer size. */
+
+ DUV(1); /* Abbrev #1: DW_TAG_compile_unit. */
+ DSTR(ctx->filename); /* DW_AT_name. */
+ DADDR(ctx->mcaddr); /* DW_AT_low_pc. */
+ DADDR(ctx->mcaddr + ctx->szmcode); /* DW_AT_high_pc. */
+ DU32(0); /* DW_AT_stmt_list. */
+ );
+
+ ctx->p = p;
+}
+
+static void zend_gdbjit_debugabbrev(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+
+ /* Abbrev #1: DW_TAG_compile_unit. */
+ DUV(1);
+ DUV(DW_TAG_compile_unit);
+ DB(DW_children_no);
+ DUV(DW_AT_name);
+ DUV(DW_FORM_string);
+ DUV(DW_AT_low_pc);
+ DUV(DW_FORM_addr);
+ DUV(DW_AT_high_pc);
+ DUV(DW_FORM_addr);
+ DUV(DW_AT_stmt_list);
+ DUV(DW_FORM_data4);
+ DB(0);
+ DB(0);
+
+ ctx->p = p;
+}
+
+#define DLNE(op, s) (DB(DW_LNS_extended_op), DUV(1+(s)), DB((op)))
+
+static void zend_gdbjit_debugline(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+
+ DSECT(line,
+ DU16(2); /* DWARF version. */
+ DSECT(header,
+ DB(1); /* Minimum instruction length. */
+ DB(1); /* is_stmt. */
+ DI8(0); /* Line base for special opcodes. */
+ DB(2); /* Line range for special opcodes. */
+ DB(3+1); /* Opcode base at DW_LNS_advance_line+1. */
+ DB(0); DB(1); DB(1); /* Standard opcode lengths. */
+ /* Directory table. */
+ DB(0);
+ /* File name table. */
+ DSTR(ctx->filename); DUV(0); DUV(0); DUV(0);
+ DB(0);
+ );
+ DLNE(DW_LNE_set_address, sizeof(uintptr_t));
+ DADDR(ctx->mcaddr);
+ if (ctx->lineno) (DB(DW_LNS_advance_line), DSV(ctx->lineno-1));
+ DB(DW_LNS_copy);
+ DB(DW_LNS_advance_pc); DUV(ctx->szmcode);
+ DLNE(DW_LNE_end_sequence, 0);
+ );
+
+ ctx->p = p;
+}
+
+
+#undef DLNE
+
+/* Undef shortcuts. */
+#undef DB
+#undef DI8
+#undef DU16
+#undef DU32
+#undef DADDR
+#undef DUV
+#undef DSV
+#undef DSTR
+#undef DALIGNNOP
+#undef DSECT
+
+typedef void (*zend_gdbjit_initf) (zend_gdbjit_ctx *ctx);
+
+static void zend_gdbjit_initsect(zend_gdbjit_ctx *ctx, int sect, zend_gdbjit_initf initf)
+{
+ ctx->startp = ctx->p;
+ ctx->obj.sect[sect].ofs = (uintptr_t)((char *)ctx->p - (char *)&ctx->obj);
+ initf(ctx);
+ ctx->obj.sect[sect].size = (uintptr_t)(ctx->p - ctx->startp);
+}
+
+static void zend_gdbjit_buildobj(zend_gdbjit_ctx *ctx)
+{
+ zend_gdbjit_obj *obj = &ctx->obj;
+
+ /* Fill in ELF header and clear structures. */
+ memcpy(&obj->hdr, &zend_elfhdr_template, sizeof(zend_elf_header));
+ memset(&obj->sect, 0, sizeof(zend_elf_sectheader) * GDBJIT_SECT__MAX);
+ memset(&obj->sym, 0, sizeof(zend_elf_symbol) * GDBJIT_SYM__MAX);
+
+ /* Initialize sections. */
+ ctx->p = obj->space;
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_shstrtab, zend_gdbjit_secthdr);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_strtab, zend_gdbjit_symtab);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_debug_info, zend_gdbjit_debuginfo);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_debug_abbrev, zend_gdbjit_debugabbrev);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_debug_line, zend_gdbjit_debugline);
+ SECTALIGN(ctx->p, sizeof(uintptr_t));
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_eh_frame, zend_gdbjit_ehframe);
+ ctx->objsize = (size_t)((char *)ctx->p - (char *)obj);
+
+ ZEND_ASSERT(ctx->objsize < sizeof(zend_gdbjit_obj));
+}
+
+static int zend_jit_gdb_register(const char *name,
+ const zend_op_array *op_array,
+ const void *start,
+ size_t size)
+{
+ zend_gdbjit_ctx ctx;
+
+ ctx.mcaddr = (uintptr_t)start;
+ ctx.szmcode = (uint32_t)size;
+ ctx.name = name;
+ ctx.filename = op_array ? ZSTR_VAL(op_array->filename) : "unknown";
+ ctx.lineno = op_array ? op_array->line_start : 0;
+
+ zend_gdbjit_buildobj(&ctx);
+
+ return zend_gdb_register_code(&ctx.obj, ctx.objsize);
+}
+
+static int zend_jit_gdb_unregister(void)
+{
+ zend_gdb_unregister_all();
+ return 1;
+}
+
+static void zend_jit_gdb_init(void)
+{
+#if 0
+ /* This might enable registration of all JIT-ed code, but unfortunately,
+ * in case of many functions, this takes enormous time. */
+ if (zend_gdb_present()) {
+ ZCG(accel_directives).jit_debug |= ZEND_JIT_DEBUG_GDB;
+ }
+#endif
+}
+
+#endif
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
new file mode 100644
index 0000000000..da96660a10
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -0,0 +1,1479 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "Zend/zend_API.h"
+
+static ZEND_COLD void undef_result_after_exception() {
+ const zend_op *opline = EG(opline_before_exception);
+ ZEND_ASSERT(EG(exception));
+ if (opline->result_type & (IS_VAR | IS_TMP_VAR)) {
+ zend_execute_data *execute_data = EG(current_execute_data);
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+}
+
+static zend_never_inline zend_function* ZEND_FASTCALL _zend_jit_init_func_run_time_cache(const zend_op_array *op_array) /* {{{ */
+{
+ void **run_time_cache;
+
+ run_time_cache = zend_arena_alloc(&CG(arena), op_array->cache_size);
+ memset(run_time_cache, 0, op_array->cache_size);
+ ZEND_MAP_PTR_SET(op_array->run_time_cache, run_time_cache);
+ return (zend_function*)op_array;
+}
+/* }}} */
+
+static zend_never_inline zend_op_array* ZEND_FASTCALL zend_jit_init_func_run_time_cache_helper(zend_op_array *op_array) /* {{{ */
+{
+ void **run_time_cache;
+
+ if (!RUN_TIME_CACHE(op_array)) {
+ run_time_cache = zend_arena_alloc(&CG(arena), op_array->cache_size);
+ memset(run_time_cache, 0, op_array->cache_size);
+ ZEND_MAP_PTR_SET(op_array->run_time_cache, run_time_cache);
+ }
+ return op_array;
+}
+/* }}} */
+
+static zend_function* ZEND_FASTCALL zend_jit_find_func_helper(zend_string *name)
+{
+ zval *func = zend_hash_find_ex(EG(function_table), name, 1);
+ zend_function *fbc;
+
+ if (UNEXPECTED(func == NULL)) {
+ return NULL;
+ }
+ fbc = Z_FUNC_P(func);
+ if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
+ fbc = _zend_jit_init_func_run_time_cache(&fbc->op_array);
+ }
+ return fbc;
+}
+
+static zend_execute_data* ZEND_FASTCALL zend_jit_extend_stack_helper(uint32_t used_stack, zend_function *fbc)
+{
+ zend_execute_data *call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
+ call->func = fbc;
+ ZEND_CALL_INFO(call) = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_ALLOCATED;
+ return call;
+}
+
+static zend_execute_data* ZEND_FASTCALL zend_jit_int_extend_stack_helper(uint32_t used_stack)
+{
+ zend_execute_data *call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
+ ZEND_CALL_INFO(call) = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_ALLOCATED;
+ return call;
+}
+
+static zval* ZEND_FASTCALL zend_jit_symtable_find(HashTable *ht, zend_string *str)
+{
+ zend_ulong idx;
+ register const char *tmp = str->val;
+
+ do {
+ if (*tmp > '9') {
+ break;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ break;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ break;
+ }
+ }
+ if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
+ return zend_hash_index_find(ht, idx);
+ }
+ } while (0);
+
+ return zend_hash_find(ht, str);
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_long idx)
+{
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, idx);
+ retval = zend_hash_index_update(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_w(HashTable *ht, zend_long idx)
+{
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *str)
+{
+ zval *retval = zend_hash_find(ht, str);
+
+ if (retval) {
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(str));
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(str));
+ retval = zend_hash_update(ht, str, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_lookup_w(HashTable *ht, zend_string *str)
+{
+ zval *retval = zend_hash_find(ht, str);
+
+ if (retval) {
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_string *str)
+{
+ zend_ulong idx;
+ register const char *tmp = str->val;
+
+ do {
+ if (*tmp > '9') {
+ break;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ break;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ break;
+ }
+ }
+ if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(str));
+ retval = zend_hash_index_update(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+ }
+ } while (0);
+
+ return zend_jit_hash_lookup_rw(ht, str);
+}
+
+static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string *str)
+{
+ zend_ulong idx;
+ register const char *tmp = str->val;
+
+ do {
+ if (*tmp > '9') {
+ break;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ break;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ break;
+ }
+ }
+ if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+ }
+ } while (0);
+
+ return zend_jit_hash_lookup_w(ht, str);
+}
+
+static void ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
+{
+ const zend_execute_data *execute_data = EG(current_execute_data);
+ zend_string *cv = EX(func)->op_array.vars[EX_VAR_TO_NUM(var)];
+
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(cv));
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim, zval *result)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ ZVAL_NULL(result);
+ return;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ ZVAL_NULL(result);
+ return;
+ }
+ }
+ } else {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ ZVAL_NULL(result);
+ return;
+ }
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_undef:
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ ZVAL_NULL(result);
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim, zval *result)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ ZVAL_NULL(result);
+ return;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ ZVAL_NULL(result);
+ return;
+ }
+ }
+ } else {
+ ZVAL_NULL(result);
+ return;
+ }
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_undef:
+ ZVAL_NULL(result);
+}
+
+static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *dim)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ //zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type in isset or empty");
+ return 0;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ }
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_REFERENCE)) {
+ retval = Z_REFVAL_P(retval);
+ }
+ return (Z_TYPE_P(retval) > IS_NULL);
+ } else {
+ return 0;
+ }
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_REFERENCE)) {
+ retval = Z_REFVAL_P(retval);
+ }
+ return (Z_TYPE_P(retval) > IS_NULL);
+
+num_undef:
+ return 0;
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *dim)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ undef_result_after_exception();
+ return NULL;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ retval = zend_hash_update(ht, offset_key, &EG(uninitialized_zval));
+ }
+ return retval;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ return retval;
+
+num_undef:
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ retval = zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ undef_result_after_exception();
+ return NULL;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval));
+ }
+ return retval;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ return retval;
+
+num_undef:
+ retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
+ return retval;
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval *dim, zval *result)
+{
+ zend_long offset;
+
+try_string_offset:
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
+ switch (Z_TYPE_P(dim)) {
+ /* case IS_LONG: */
+ case IS_STRING:
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ break;
+ }
+ zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
+ break;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ case IS_DOUBLE:
+ case IS_NULL:
+ case IS_FALSE:
+ case IS_TRUE:
+ zend_error(E_WARNING, "String offset cast occurred");
+ break;
+ case IS_REFERENCE:
+ dim = Z_REFVAL_P(dim);
+ goto try_string_offset;
+ default:
+ zend_type_error("Illegal offset type");
+ break;
+ }
+
+ offset = _zval_get_long_func(dim);
+ } else {
+ offset = Z_LVAL_P(dim);
+ }
+
+ if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
+ zend_error(E_WARNING, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
+ ZVAL_EMPTY_STRING(result);
+ } else {
+ zend_uchar c;
+ zend_long real_offset;
+
+ real_offset = (UNEXPECTED(offset < 0)) /* Handle negative offset */
+ ? (zend_long)Z_STRLEN_P(container) + offset : offset;
+ c = (zend_uchar)Z_STRVAL_P(container)[real_offset];
+ ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_str_is_helper(zval *container, zval *dim, zval *result)
+{
+ zend_long offset;
+
+try_string_offset:
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
+ switch (Z_TYPE_P(dim)) {
+ /* case IS_LONG: */
+ case IS_STRING:
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ break;
+ }
+ ZVAL_NULL(result);
+ return;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ case IS_DOUBLE:
+ case IS_NULL:
+ case IS_FALSE:
+ case IS_TRUE:
+ break;
+ case IS_REFERENCE:
+ dim = Z_REFVAL_P(dim);
+ goto try_string_offset;
+ default:
+ zend_type_error("Illegal offset type");
+ break;
+ }
+
+ offset = _zval_get_long_func(dim);
+ } else {
+ offset = Z_LVAL_P(dim);
+ }
+
+ if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
+ ZVAL_NULL(result);
+ } else {
+ zend_uchar c;
+ zend_long real_offset;
+
+ real_offset = (UNEXPECTED(offset < 0)) /* Handle negative offset */
+ ? (zend_long)Z_STRLEN_P(container) + offset : offset;
+ c = (zend_uchar)Z_STRVAL_P(container)[real_offset];
+ ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_obj_r_helper(zval *container, zval *dim, zval *result)
+{
+ zval *retval;
+
+ if (UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ dim = &EG(uninitialized_zval);
+ }
+
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, BP_VAR_R, result);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_obj_is_helper(zval *container, zval *dim, zval *result)
+{
+ zval *retval;
+
+ if (UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ dim = &EG(uninitialized_zval);
+ }
+
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, BP_VAR_IS, result);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(result);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_dimension_rw_long_helper(HashTable *ht, zend_long hval)
+{
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ return zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+}
+
+static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
+{
+ zend_long offset;
+
+try_again:
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
+ switch(Z_TYPE_P(dim)) {
+ case IS_STRING:
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ break;
+ }
+ if (type != BP_VAR_UNSET) {
+ zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
+ }
+ break;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ case IS_DOUBLE:
+ case IS_NULL:
+ case IS_FALSE:
+ case IS_TRUE:
+ zend_error(E_WARNING, "String offset cast occurred");
+ break;
+ case IS_REFERENCE:
+ dim = Z_REFVAL_P(dim);
+ goto try_again;
+ default:
+ zend_type_error("Illegal offset type");
+ break;
+ }
+
+ offset = _zval_get_long_func(dim);
+ } else {
+ offset = Z_LVAL_P(dim);
+ }
+
+ return offset;
+}
+
+static zend_never_inline ZEND_COLD void zend_wrong_string_offset(void)
+{
+ const char *msg = NULL;
+ const zend_op *opline = EG(current_execute_data)->opline;
+ const zend_op *end;
+ uint32_t var;
+
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ msg = "Cannot use assign-op operators with string offsets";
+ break;
+ case ZEND_FETCH_DIM_W:
+ case ZEND_FETCH_DIM_RW:
+ case ZEND_FETCH_DIM_FUNC_ARG:
+ case ZEND_FETCH_DIM_UNSET:
+ /* TODO: Encode the "reason" into opline->extended_value??? */
+ var = opline->result.var;
+ opline++;
+ end = EG(current_execute_data)->func->op_array.opcodes +
+ EG(current_execute_data)->func->op_array.last;
+ while (opline < end) {
+ if (opline->op1_type == IS_VAR && opline->op1.var == var) {
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_OBJ_OP:
+ msg = "Cannot use string offset as an object";
+ break;
+ case ZEND_ASSIGN_DIM_OP:
+ msg = "Cannot use string offset as an array";
+ break;
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ msg = "Cannot use assign-op operators with string offsets";
+ break;
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ msg = "Cannot increment/decrement string offsets";
+ break;
+ case ZEND_FETCH_DIM_W:
+ case ZEND_FETCH_DIM_RW:
+ case ZEND_FETCH_DIM_FUNC_ARG:
+ case ZEND_FETCH_DIM_UNSET:
+ case ZEND_ASSIGN_DIM:
+ msg = "Cannot use string offset as an array";
+ break;
+ case ZEND_FETCH_OBJ_W:
+ case ZEND_FETCH_OBJ_RW:
+ case ZEND_FETCH_OBJ_FUNC_ARG:
+ case ZEND_FETCH_OBJ_UNSET:
+ case ZEND_ASSIGN_OBJ:
+ msg = "Cannot use string offset as an object";
+ break;
+ case ZEND_ASSIGN_REF:
+ case ZEND_ADD_ARRAY_ELEMENT:
+ case ZEND_INIT_ARRAY:
+ case ZEND_MAKE_REF:
+ msg = "Cannot create references to/from string offsets";
+ break;
+ case ZEND_RETURN_BY_REF:
+ case ZEND_VERIFY_RETURN_TYPE:
+ msg = "Cannot return string offsets by reference";
+ break;
+ case ZEND_UNSET_DIM:
+ case ZEND_UNSET_OBJ:
+ msg = "Cannot unset string offsets";
+ break;
+ case ZEND_YIELD:
+ msg = "Cannot yield string offsets by reference";
+ break;
+ case ZEND_SEND_REF:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_FUNC_ARG:
+ msg = "Only variables can be passed by reference";
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE();
+ }
+ break;
+ }
+ if (opline->op2_type == IS_VAR && opline->op2.var == var) {
+ ZEND_ASSERT(opline->opcode == ZEND_ASSIGN_REF);
+ msg = "Cannot create references to/from string offsets";
+ break;
+ }
+ }
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE();
+ }
+ ZEND_ASSERT(msg != NULL);
+ zend_throw_error(NULL, "%s", msg);
+}
+
+static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value, zval *result)
+{
+ zend_string *old_str;
+ zend_uchar c;
+ size_t string_len;
+ zend_long offset;
+
+ offset = zend_check_string_offset(dim, BP_VAR_W);
+ if (offset < -(zend_long)Z_STRLEN_P(str)) {
+ /* Error on negative offset */
+ zend_error(E_WARNING, "Illegal string offset: " ZEND_LONG_FMT, offset);
+ if (result) {
+ ZVAL_NULL(result);
+ }
+ return;
+ }
+
+ if (Z_TYPE_P(value) != IS_STRING) {
+ /* Convert to string, just the time to pick the 1st byte */
+ zend_string *tmp = zval_try_get_string_func(value);
+
+ if (UNEXPECTED(!tmp)) {
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
+ return;
+ }
+
+ string_len = ZSTR_LEN(tmp);
+ c = (zend_uchar)ZSTR_VAL(tmp)[0];
+ zend_string_release(tmp);
+ } else {
+ string_len = Z_STRLEN_P(value);
+ c = (zend_uchar)Z_STRVAL_P(value)[0];
+ }
+
+ if (string_len == 0) {
+ /* Error on empty input string */
+ zend_error(E_WARNING, "Cannot assign an empty string to a string offset");
+ if (result) {
+ ZVAL_NULL(result);
+ }
+ return;
+ }
+
+ if (offset < 0) { /* Handle negative offset */
+ offset += (zend_long)Z_STRLEN_P(str);
+ }
+
+ if ((size_t)offset >= Z_STRLEN_P(str)) {
+ /* Extend string if needed */
+ zend_long old_len = Z_STRLEN_P(str);
+ Z_STR_P(str) = zend_string_extend(Z_STR_P(str), offset + 1, 0);
+ Z_TYPE_INFO_P(str) = IS_STRING_EX;
+ memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
+ Z_STRVAL_P(str)[offset+1] = 0;
+ } else if (!Z_REFCOUNTED_P(str)) {
+ old_str = Z_STR_P(str);
+ Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
+ Z_TYPE_INFO_P(str) = IS_STRING_EX;
+ zend_string_release(old_str);
+ } else {
+ SEPARATE_STRING(str);
+ zend_string_forget_hash_val(Z_STR_P(str));
+ }
+
+ Z_STRVAL_P(str)[offset] = c;
+
+ if (result) {
+ /* Return the new character */
+ ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_assign_dim_helper(zval *object_ptr, zval *dim, zval *value, zval *result)
+{
+ if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
+ ZVAL_DEREF(value);
+ Z_OBJ_HT_P(object_ptr)->write_dimension(Z_OBJ_P(object_ptr), dim, value);
+ if (result) {
+ if (EXPECTED(!EG(exception))) {
+ ZVAL_COPY(result, value);
+ } else {
+ ZVAL_UNDEF(result);
+ }
+ }
+ } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
+ if (!dim) {
+ zend_throw_error(NULL, "[] operator not supported for strings");
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
+ } else {
+ zend_assign_to_string_offset(object_ptr, dim, value, result);
+ }
+ } else {
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *dim, zval *value, binary_op_type binary_op)
+{
+ if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zval *object = container;
+ zval *property = dim;
+ zval *z;
+ zval rv, res;
+
+ z = Z_OBJ_HT_P(object)->read_dimension(Z_OBJ_P(object), property, BP_VAR_R, &rv);
+ if (z != NULL) {
+
+ if (binary_op(&res, Z_ISREF_P(z) ? Z_REFVAL_P(z) : z, value) == SUCCESS) {
+ Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), property, &res);
+ }
+ if (z == &rv) {
+ zval_ptr_dtor(&rv);
+ }
+//??? if (retval) {
+//??? ZVAL_COPY(retval, &res);
+//??? }
+ zval_ptr_dtor(&res);
+ } else {
+ zend_error(E_WARNING, "Attempt to assign property of non-object");
+//??? if (retval) {
+//??? ZVAL_NULL(retval);
+//??? }
+ }
+ } else {
+ if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
+ if (!dim) {
+ zend_throw_error(NULL, "[] operator not supported for strings");
+ } else {
+ zend_check_string_offset(dim, BP_VAR_RW);
+ zend_wrong_string_offset();
+ }
+//??? } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
+//??? ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
+ } else {
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
+//??? if (retval) {
+//??? ZVAL_NULL(retval);
+//??? }
+ }
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op2)
+{
+ size_t op1_len = Z_STRLEN_P(op1);
+ size_t op2_len = Z_STRLEN_P(op2);
+ size_t result_len = op1_len + op2_len;
+ zend_string *result_str;
+
+ if (UNEXPECTED(op1_len > SIZE_MAX - op2_len)) {
+ zend_throw_error(NULL, "String size overflow");
+ return;
+ }
+
+ if (Z_REFCOUNTED_P(op1)) {
+ result_str = zend_string_extend(Z_STR_P(op1), result_len, 0);
+ } else {
+ result_str = zend_string_alloc(result_len, 0);
+ memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
+ }
+
+ ZVAL_NEW_STR(op1, result_str);
+
+ memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len);
+ ZSTR_VAL(result_str)[result_len] = '\0';
+}
+
+static void ZEND_FASTCALL zend_jit_fast_concat_helper(zval *result, zval *op1, zval *op2)
+{
+ size_t op1_len = Z_STRLEN_P(op1);
+ size_t op2_len = Z_STRLEN_P(op2);
+ size_t result_len = op1_len + op2_len;
+ zend_string *result_str;
+
+ if (UNEXPECTED(op1_len > SIZE_MAX - op2_len)) {
+ zend_throw_error(NULL, "String size overflow");
+ return;
+ }
+
+ result_str = zend_string_alloc(result_len, 0);
+ memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
+
+ ZVAL_NEW_STR(result, result_str);
+
+ memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len);
+ ZSTR_VAL(result_str)[result_len] = '\0';
+}
+
+static int ZEND_FASTCALL zend_jit_isset_dim_helper(zval *container, zval *offset)
+{
+ if (UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ offset = &EG(uninitialized_zval);
+ }
+
+ if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ 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;
+
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ lval = Z_LVAL_P(offset);
+isset_str_offset:
+ if (UNEXPECTED(lval < 0)) { /* Handle negative offset */
+ lval += (zend_long)Z_STRLEN_P(container);
+ }
+ if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) {
+ return 1;
+ }
+ } else {
+ ZVAL_DEREF(offset);
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ lval = zval_get_long(offset);
+ goto isset_str_offset;
+ }
+ }
+ }
+ return 0;
+}
+
+static void ZEND_FASTCALL zend_jit_free_call_frame(zend_execute_data *call)
+{
+ zend_vm_stack_free_call_frame(call);
+}
+
+static zval* ZEND_FASTCALL zend_jit_new_ref_helper(zval *value)
+{
+ zend_reference *ref = (zend_reference*)emalloc(sizeof(zend_reference));
+ GC_SET_REFCOUNT(ref, 1);
+ GC_TYPE_INFO(ref) = IS_REFERENCE;
+ ref->sources.ptr = NULL;
+ ZVAL_COPY_VALUE(&ref->val, value);
+ Z_REF_P(value) = ref;
+ Z_TYPE_INFO_P(value) = IS_REFERENCE_EX;
+
+ return value;
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_global_helper(zend_execute_data *execute_data, zval *varname, uint32_t cache_slot)
+{
+ uint32_t idx;
+ zval *value = zend_hash_find(&EG(symbol_table), Z_STR_P(varname));
+
+ if (UNEXPECTED(value == NULL)) {
+ value = zend_hash_add_new(&EG(symbol_table), Z_STR_P(varname), &EG(uninitialized_zval));
+ idx = ((char*)value - (char*)EG(symbol_table).arData) / sizeof(Bucket);
+ /* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+ CACHE_PTR(cache_slot, (void*)(uintptr_t)(idx + 1));
+ } else {
+ idx = ((char*)value - (char*)EG(symbol_table).arData) / sizeof(Bucket);
+ /* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+ CACHE_PTR(cache_slot, (void*)(uintptr_t)(idx + 1));
+ /* GLOBAL variable may be an INDIRECT pointer to CV */
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_NULL(value);
+ }
+ }
+ }
+
+ if (UNEXPECTED(!Z_ISREF_P(value))) {
+ return zend_jit_new_ref_helper(value);
+ }
+
+ return value;
+}
+
+static void ZEND_FASTCALL zend_jit_verify_arg_object(zval *arg, const zend_op_array *op_array, uint32_t arg_num, zend_arg_info *arg_info, void **cache_slot)
+{
+ zend_class_entry *ce;
+ if (EXPECTED(*cache_slot)) {
+ ce = (zend_class_entry *)*cache_slot;
+ } else {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(arg_info->type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (UNEXPECTED(!ce)) {
+ zend_verify_arg_error((zend_function*)op_array, arg_info, arg_num, cache_slot, arg);
+ return;
+ }
+ *cache_slot = (void *)ce;
+ }
+ if (UNEXPECTED(!instanceof_function(Z_OBJCE_P(arg), ce))) {
+ zend_verify_arg_error((zend_function*)op_array, arg_info, arg_num, cache_slot, arg);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_verify_arg_slow(zval *arg, const zend_op_array *op_array, uint32_t arg_num, zend_arg_info *arg_info, void **cache_slot)
+{
+ uint32_t type_mask;
+
+ if (UNEXPECTED(ZEND_TYPE_IS_CLASS(arg_info->type))) {
+ zend_class_entry *ce;
+ if (Z_TYPE_P(arg) == IS_NULL && ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
+ /* Null passed to nullable type */
+ return;
+ }
+
+ /* This is always an error - we fetch the class name for the error message here */
+ if (EXPECTED(*cache_slot)) {
+ ce = (zend_class_entry *) *cache_slot;
+ } else {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(arg_info->type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (ce) {
+ *cache_slot = (void *)ce;
+ }
+ }
+ goto err;
+ }
+
+ type_mask = ZEND_TYPE_MASK(arg_info->type);
+ if (type_mask & MAY_BE_CALLABLE) {
+ if (zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL) == 0) {
+ goto err;
+ }
+ } else if (type_mask & MAY_BE_ITERABLE) {
+ if (zend_is_iterable(arg) == 0) {
+ goto err;
+ }
+ } else {
+ if (Z_ISUNDEF_P(arg) ||
+ zend_verify_scalar_type_hint(ZEND_TYPE_MASK(arg_info->type), arg, ZEND_ARG_USES_STRICT_TYPES(), /* is_internal */ 0) == 0) {
+ goto err;
+ }
+ }
+ return;
+err:
+ zend_verify_arg_error((zend_function*)op_array, arg_info, arg_num, cache_slot, arg);
+}
+
+static void ZEND_FASTCALL zend_jit_zval_copy_deref_helper(zval *dst, zval *src)
+{
+ ZVAL_DEREF(src);
+ ZVAL_COPY(dst, src);
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_r_slow(zend_object *zobj, zval *offset, zval *result, uint32_t cache_slot)
+{
+ zval *retval;
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_string *name, *tmp_name;
+
+ name = zval_get_tmp_string(offset, &tmp_name);
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, CACHE_ADDR(cache_slot), result);
+ zend_tmp_string_release(tmp_name);
+ if (retval != result) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(retval);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_r_dynamic(zend_object *zobj, intptr_t prop_offset, zval *offset, zval *result, uint32_t cache_slot)
+{
+ if (zobj->properties) {
+ zval *retval;
+
+ if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(prop_offset)) {
+ intptr_t idx = ZEND_DECODE_DYN_PROP_OFFSET(prop_offset);
+
+ if (EXPECTED(idx < zobj->properties->nNumUsed * sizeof(Bucket))) {
+ 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 != NULL) &&
+ EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(offset)) &&
+ EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(offset), Z_STRLEN_P(offset)) == 0)))) {
+ ZVAL_COPY_DEREF(result, &p->val);
+ return;
+ }
+ }
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
+ }
+
+ retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+
+ if (EXPECTED(retval)) {
+ intptr_t idx = (char*)retval - (char*)zobj->properties->arData;
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+ }
+ }
+ zend_jit_fetch_obj_r_slow(zobj, offset, result, cache_slot);
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_is_slow(zend_object *zobj, zval *offset, zval *result, uint32_t cache_slot)
+{
+ zval *retval;
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_string *name, *tmp_name;
+
+ name = zval_get_tmp_string(offset, &tmp_name);
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, CACHE_ADDR(cache_slot), result);
+ zend_tmp_string_release(tmp_name);
+ if (retval != result) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(retval);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_is_dynamic(zend_object *zobj, intptr_t prop_offset, zval *offset, zval *result, uint32_t cache_slot)
+{
+ if (zobj->properties) {
+ zval *retval;
+
+ if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(prop_offset)) {
+ intptr_t idx = ZEND_DECODE_DYN_PROP_OFFSET(prop_offset);
+
+ if (EXPECTED(idx < zobj->properties->nNumUsed * sizeof(Bucket))) {
+ 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 != NULL) &&
+ EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(offset)) &&
+ EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(offset), Z_STRLEN_P(offset)) == 0)))) {
+ ZVAL_COPY_DEREF(result, &p->val);
+ return;
+ }
+ }
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
+ }
+
+ retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+
+ if (EXPECTED(retval)) {
+ intptr_t idx = (char*)retval - (char*)zobj->properties->arData;
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
+ ZVAL_COPY(result, retval);
+ return;
+ }
+ }
+ zend_jit_fetch_obj_is_slow(zobj, offset, result, cache_slot);
+}
+
+static void ZEND_FASTCALL zend_jit_vm_stack_free_args_helper(zend_execute_data *call)
+{
+ zend_vm_stack_free_args(call);
+}
+
+static zend_always_inline void zend_jit_assign_to_typed_ref(zend_reference *ref, zval *value, zend_uchar value_type)
+{
+ zval variable;
+
+ ZVAL_REF(&variable, ref);
+ zend_assign_to_variable(&variable, value, value_type, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)));
+}
+
+static void ZEND_FASTCALL zend_jit_assign_const_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_CONST);
+}
+
+static void ZEND_FASTCALL zend_jit_assign_tmp_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_TMP_VAR);
+}
+
+static void ZEND_FASTCALL zend_jit_assign_var_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_VAR);
+}
+
+static void ZEND_FASTCALL zend_jit_assign_cv_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_CV);
+}
+
+
+static zend_property_info *zend_jit_get_prop_not_accepting_double(zend_reference *ref)
+{
+ zend_property_info *prop;
+ ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
+ if (!ZEND_TYPE_IS_MASK(prop->type) || !(ZEND_TYPE_MASK(prop->type) & MAY_BE_DOUBLE)) {
+ return prop;
+ }
+ } ZEND_REF_FOREACH_TYPE_SOURCES_END();
+ return NULL;
+}
+
+static ZEND_COLD void zend_jit_throw_incdec_ref_error(zend_reference *ref, zend_bool inc)
+{
+ zend_property_info *error_prop = zend_jit_get_prop_not_accepting_double(ref);
+ /* Currently there should be no way for a typed reference to accept both int and double.
+ * Generalize this and the related property code once this becomes possible. */
+ ZEND_ASSERT(error_prop);
+ zend_type_error(
+ "Cannot %s a reference held by property %s::$%s of type %sint past its %simal value",
+ inc ? "increment" : "decrement",
+ ZSTR_VAL(error_prop->ce->name),
+ zend_get_unmangled_property_name(error_prop->name),
+ ZEND_TYPE_ALLOW_NULL(error_prop->type) ? "?" : "",
+ inc ? "max" : "min");
+}
+
+static void ZEND_FASTCALL zend_jit_pre_inc_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ zval tmp;
+
+ ZVAL_COPY(&tmp, var_ptr);
+
+ increment_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE(tmp) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 1);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else {
+ zval_ptr_dtor(&tmp);
+ }
+ if (ret) {
+ ZVAL_COPY(ret, var_ptr);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_pre_dec_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ zval tmp;
+
+ ZVAL_COPY(&tmp, var_ptr);
+
+ decrement_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE(tmp) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 0);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else {
+ zval_ptr_dtor(&tmp);
+ }
+ if (ret) {
+ ZVAL_COPY(ret, var_ptr);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_post_inc_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ ZVAL_COPY(ret, var_ptr);
+
+ increment_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(ret) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 1);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_post_dec_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ ZVAL_COPY(ret, var_ptr);
+
+ decrement_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(ret) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 0);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_assign_op_to_typed_ref(zend_reference *ref, zval *val, binary_op_type binary_op)
+{
+ zval z_copy;
+
+ binary_op(&z_copy, &ref->val, val);
+ if (EXPECTED(zend_verify_ref_assignable_zval(ref, &z_copy, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(&ref->val);
+ ZVAL_COPY_VALUE(&ref->val, &z_copy);
+ } else {
+ zval_ptr_dtor(&z_copy);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_only_vars_by_reference(zval *arg)
+{
+ ZVAL_NEW_REF(arg, arg);
+ zend_error(E_NOTICE, "Only variables should be passed by reference");
+}
+
+static void ZEND_FASTCALL zend_jit_invalid_array_access(zval *container)
+{
+ const char *type = Z_ISUNDEF_P(container) ? "null" : zend_zval_type_name(container);
+ zend_error(E_WARNING, "Trying to access array offset on value of type %s", type);
+}
+
+static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) {
+ zval *val = Z_REFVAL_P(ref);
+ if (Z_TYPE_P(val) <= IS_FALSE) {
+ if (ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(ref))
+ && !zend_verify_ref_array_assignable(Z_REF_P(ref))) {
+ return NULL;
+ }
+ ZVAL_ARR(val, zend_new_array(8));
+ }
+ return val;
+}
diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h
new file mode 100644
index 0000000000..f327fd5128
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_internal.h
@@ -0,0 +1,119 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef ZEND_JIT_INTERNAL_H
+#define ZEND_JIT_INTERNAL_H
+
+/* Profiler */
+extern zend_ulong zend_jit_profile_counter;
+extern int zend_jit_profile_counter_rid;
+
+#define ZEND_COUNTER_INFO(op_array) \
+ ZEND_OP_ARRAY_EXTENSION(op_array, zend_jit_profile_counter_rid)
+
+/* Hot Counters */
+
+#define ZEND_HOT_COUNTERS_COUNT 128
+
+extern int16_t zend_jit_hot_counters[ZEND_HOT_COUNTERS_COUNT];
+
+void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend_op *opline);
+
+typedef struct _zend_jit_op_array_extension {
+ int16_t *counter;
+ const void *orig_handlers[1];
+} zend_jit_op_array_extension;
+
+static zend_always_inline zend_long zend_jit_op_array_hash(const zend_op_array *op_array)
+{
+ uintptr_t x;
+
+ x = (uintptr_t)op_array->opcodes >> 3;
+#if SIZEOF_SIZE_T == 4
+ x = ((x >> 16) ^ x) * 0x45d9f3b;
+ x = ((x >> 16) ^ x) * 0x45d9f3b;
+ x = (x >> 16) ^ x;
+#elif SIZEOF_SIZE_T == 8
+ x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
+ x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
+ x = x ^ (x >> 31);
+#endif
+ return x;
+}
+
+extern const zend_op *zend_jit_halt_op;
+
+#ifdef HAVE_GCC_GLOBAL_REGS
+# define EXECUTE_DATA_D void
+# define EXECUTE_DATA_C
+# define EXECUTE_DATA_DC
+# define EXECUTE_DATA_CC
+# define OPLINE_D void
+# define OPLINE_C
+# define OPLINE_DC
+# define OPLINE_CC
+# define ZEND_OPCODE_HANDLER_RET void
+# define ZEND_OPCODE_HANDLER_ARGS EXECUTE_DATA_D
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU
+# define ZEND_OPCODE_HANDLER_ARGS_DC
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC
+# define ZEND_OPCODE_RETURN() return
+# define ZEND_OPCODE_TAIL_CALL(handler) do { \
+ handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \
+ return; \
+ } while(0)
+#else
+# define EXECUTE_DATA_D zend_execute_data* execute_data
+# define EXECUTE_DATA_C execute_data
+# define EXECUTE_DATA_DC , EXECUTE_DATA_D
+# define EXECUTE_DATA_CC , EXECUTE_DATA_C
+# define OPLINE_D const zend_op* opline
+# define OPLINE_C opline
+# define OPLINE_DC , OPLINE_D
+# define OPLINE_CC , OPLINE_C
+# define ZEND_OPCODE_HANDLER_RET int
+# define ZEND_OPCODE_HANDLER_ARGS EXECUTE_DATA_D
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU EXECUTE_DATA_C
+# define ZEND_OPCODE_HANDLER_ARGS_DC EXECUTE_DATA_DC
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC EXECUTE_DATA_CC
+# define ZEND_OPCODE_RETURN() return 0
+# define ZEND_OPCODE_TAIL_CALL(handler) do { \
+ return handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \
+ } while(0)
+#endif
+
+/* VM handlers */
+typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *zend_vm_opcode_handler_t)(ZEND_OPCODE_HANDLER_ARGS);
+
+/* VM helpers */
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_nested_func_helper(uint32_t call_info EXECUTE_DATA_DC);
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_top_func_helper(uint32_t call_info EXECUTE_DATA_DC);
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_profile_helper(ZEND_OPCODE_HANDLER_ARGS);
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_func_counter_helper(ZEND_OPCODE_HANDLER_ARGS);
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_counter_helper(ZEND_OPCODE_HANDLER_ARGS);
+
+void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D);
+void ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D);
+
+void ZEND_FASTCALL zend_jit_get_constant(const zval *key, uint32_t flags);
+int ZEND_FASTCALL zend_jit_check_constant(const zval *key);
+
+#endif /* ZEND_JIT_INTERNAL_H */
diff --git a/ext/dom/userdatahandler.c b/ext/opcache/jit/zend_jit_oprofile.c
index 6695d65c15..50dd027279 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/opcache/jit/zend_jit_oprofile.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
+ | Zend JIT |
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
@@ -12,44 +12,39 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+----------------------------------------------------------------------+
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#define HAVE_OPROFILE 1
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
+#include <opagent.h>
+static op_agent_t op_agent = NULL;
-/*
-* class domuserdatahandler
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#UserDataHandler
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_userdatahandler_class_functions[] = {
- PHP_FALIAS(handle, dom_userdatahandler_handle, NULL)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent
-Since:
-*/
-PHP_FUNCTION(dom_userdatahandler_handle)
+static void zend_jit_oprofile_register(const char *name,
+ const void *start,
+ size_t size)
{
- DOM_NOT_IMPLEMENTED();
+ if (op_agent) {
+ op_write_native_code(op_agent, name, (uint64_t)(zend_uintptr_t)start, start, size);
+ }
}
-/* }}} end dom_userdatahandler_handle */
-/* }}} */
+static int zend_jit_oprofile_startup(void)
+{
+ op_agent = op_open_agent();
+ if (!op_agent) {
+ fprintf(stderr, "OpAgent initialization failed [%d]!\n", errno);
+ return 0;
+ }
+ return 1;
+}
-#endif
+static void zend_jit_oprofile_shutdown(void)
+{
+ if (op_agent) {
+//??? sleep(60);
+ op_close_agent(op_agent);
+ }
+}
diff --git a/ext/opcache/jit/zend_jit_perf_dump.c b/ext/opcache/jit/zend_jit_perf_dump.c
new file mode 100644
index 0000000000..94b1e4b859
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_perf_dump.c
@@ -0,0 +1,246 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_PERFTOOLS 1
+
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
+
+#if defined(__darwin__)
+# include <pthread.h>
+#elif defined(__FreeBSD__)
+# include <sys/thr.h>
+# include <sys/sysctl.h>
+#elif defined(__NetBSD__)
+# include <lwp.h>
+#endif
+
+#include "zend_elf.h"
+
+/*
+ * 1) Profile using perf-<pid>.map
+ *
+ * perf record php -d opcache.huge_code_pages=0 -d opcache.jit_debug=0x10 bench.php
+ * perf report
+ *
+ * 2) Profile using jit-<pid>.dump
+ *
+ * perf record -k 1 php -d opcache.huge_code_pages=0 -d opcache.jit_debug=0x20 bench.php
+ * perf inject -j -i perf.data -o perf.data.jitted
+ * perf report -i perf.data.jitted
+ *
+ */
+
+
+#define ZEND_PERF_JITDUMP_HEADER_MAGIC 0x4A695444
+#define ZEND_PERF_JITDUMP_HEADER_VERSION 1
+
+#define ZEND_PERF_JITDUMP_RECORD_LOAD 0
+#define ZEND_PERF_JITDUMP_RECORD_MOVE 1
+#define ZEND_PERF_JITDUMP_RECORD_DEBUG_INFO 2
+#define ZEND_PERF_JITDUMP_RECORD_CLOSE 3
+#define ZEND_PERF_JITDUMP_UNWINDING_UNFO 4
+
+#define ALIGN8(size) (((size) + 7) & ~7)
+#define PADDING8(size) (ALIGN8(size) - (size))
+
+typedef struct zend_perf_jitdump_header {
+ uint32_t magic;
+ uint32_t version;
+ uint32_t size;
+ uint32_t elf_mach_target;
+ uint32_t reserved;
+ uint32_t process_id;
+ uint64_t time_stamp;
+ uint64_t flags;
+} zend_perf_jitdump_header;
+
+typedef struct _zend_perf_jitdump_record {
+ uint32_t event;
+ uint32_t size;
+ uint64_t time_stamp;
+} zend_perf_jitdump_record;
+
+typedef struct _zend_perf_jitdump_load_record {
+ zend_perf_jitdump_record hdr;
+ uint32_t process_id;
+ uint32_t thread_id;
+ uint64_t vma;
+ uint64_t code_address;
+ uint64_t code_size;
+ uint64_t code_id;
+} zend_perf_jitdump_load_record;
+
+static int jitdump_fd = -1;
+static void *jitdump_mem = MAP_FAILED;
+
+static uint64_t zend_perf_timestamp(void)
+{
+ struct timespec ts;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
+ return 0;
+ }
+ return ((uint64_t)ts.tv_sec * 1000000000) + ts.tv_nsec;
+}
+
+static void zend_jit_perf_jitdump_open(void)
+{
+ char filename[64];
+ int fd, ret;
+ zend_elf_header elf_hdr;
+ zend_perf_jitdump_header jit_hdr;
+
+ sprintf(filename, "/tmp/jit-%d.dump", getpid());
+ if (!zend_perf_timestamp()) {
+ return;
+ }
+
+#if defined(__linux__)
+ fd = open("/proc/self/exe", O_RDONLY);
+#elif defined(__NetBSD__)
+ fd = open("/proc/curproc/exe", O_RDONLY);
+#elif defined(__FreeBSD__)
+ char path[PATH_MAX];
+ size_t pathlen = sizeof(path);
+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+ if (sysctl(mib, 4, path, &pathlen, NULL, 0) == -1) {
+ return;
+ }
+ fd = open(path, O_RDONLY);
+#else
+ fd = -1;
+#endif
+ if (fd < 0) {
+ return;
+ }
+
+ ret = read(fd, &elf_hdr, sizeof(elf_hdr));
+ close(fd);
+
+ if (ret != sizeof(elf_hdr) ||
+ elf_hdr.emagic[0] != 0x7f ||
+ elf_hdr.emagic[1] != 'E' ||
+ elf_hdr.emagic[2] != 'L' ||
+ elf_hdr.emagic[3] != 'F') {
+ return;
+ }
+
+ jitdump_fd = open(filename, O_CREAT | O_TRUNC | O_RDWR, 0666);
+ if (jitdump_fd < 0) {
+ return;
+ }
+
+ jitdump_mem = mmap(NULL,
+ sysconf(_SC_PAGESIZE),
+ PROT_READ|PROT_EXEC,
+ MAP_PRIVATE, jitdump_fd, 0);
+
+ if (jitdump_mem == MAP_FAILED) {
+ close(jitdump_fd);
+ jitdump_fd = -1;
+ return;
+ }
+
+ memset(&jit_hdr, 0, sizeof(jit_hdr));
+ jit_hdr.magic = ZEND_PERF_JITDUMP_HEADER_MAGIC;
+ jit_hdr.version = ZEND_PERF_JITDUMP_HEADER_VERSION;
+ jit_hdr.size = sizeof(jit_hdr);
+ jit_hdr.elf_mach_target = elf_hdr.machine;
+ jit_hdr.process_id = getpid();
+ jit_hdr.time_stamp = zend_perf_timestamp();
+ jit_hdr.flags = 0;
+ zend_quiet_write(jitdump_fd, &jit_hdr, sizeof(jit_hdr));
+}
+
+static void zend_jit_perf_jitdump_close(void)
+{
+ if (jitdump_fd >= 0) {
+ zend_perf_jitdump_record rec;
+
+ rec.event = ZEND_PERF_JITDUMP_RECORD_CLOSE;
+ rec.size = sizeof(rec);
+ rec.time_stamp = zend_perf_timestamp();
+ zend_quiet_write(jitdump_fd, &rec, sizeof(rec));
+ close(jitdump_fd);
+
+ if (jitdump_mem != MAP_FAILED) {
+ munmap(jitdump_mem, sysconf(_SC_PAGESIZE));
+ }
+ }
+}
+
+static void zend_jit_perf_jitdump_register(const char *name, void *start, size_t size)
+{
+ if (jitdump_fd >= 0) {
+ static uint64_t id = 1;
+ zend_perf_jitdump_load_record rec;
+ size_t len = strlen(name);
+ uint32_t thread_id = 0;
+#if defined(__linux__)
+ thread_id = syscall(SYS_gettid);
+#elif defined(__darwin__)
+ uint64_t thread_id_u64;
+ pthread_threadid_np(NULL, &thread_id_u64);
+ thread_id = (uint32_t) thread_id_u64;
+#elif defined(__FreeBSD__)
+ long tid;
+ thr_self(&tid);
+ thread_id = (uint32_t)tid;
+#elif defined(__OpenBSD__)
+ thread_id = getthrid();
+#elif defined(__NetBSD__)
+ thread_id = _lwp_self();
+#endif
+
+ memset(&rec, 0, sizeof(rec));
+ rec.hdr.event = ZEND_PERF_JITDUMP_RECORD_LOAD;
+ rec.hdr.size = sizeof(rec) + len + 1 + size;
+ rec.hdr.time_stamp = zend_perf_timestamp();
+ rec.process_id = getpid();
+ rec.thread_id = thread_id;
+ rec.vma = (uint64_t)(uintptr_t)start;
+ rec.code_address = (uint64_t)(uintptr_t)start;
+ rec.code_size = (uint64_t)size;
+ rec.code_id = id++;
+
+ zend_quiet_write(jitdump_fd, &rec, sizeof(rec));
+ zend_quiet_write(jitdump_fd, name, len + 1);
+ zend_quiet_write(jitdump_fd, start, size);
+ }
+}
+
+static void zend_jit_perf_map_register(const char *name, void *start, size_t size)
+{
+ static FILE *fp = NULL;
+
+ if (!fp) {
+ char filename[64];
+
+ sprintf(filename, "/tmp/perf-%d.map", getpid());
+ fp = fopen(filename, "w");
+ if (!fp) {
+ return;
+ }
+ setlinebuf(fp);
+ }
+ fprintf(fp, "%zx %zx %s\n", (size_t)(uintptr_t)start, size, name);
+}
diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c
new file mode 100644
index 0000000000..346d50ec59
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_vm_helpers.c
@@ -0,0 +1,270 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "Zend/zend_execute.h"
+#include "Zend/zend_exceptions.h"
+#include "Zend/zend_vm.h"
+#include "Zend/zend_closures.h"
+#include "Zend/zend_constants.h"
+#include "Zend/zend_API.h"
+
+#include <ZendAccelerator.h>
+#include "Optimizer/zend_func_info.h"
+#include "zend_jit.h"
+#include "zend_jit_internal.h"
+
+#ifdef HAVE_GCC_GLOBAL_REGS
+# pragma GCC diagnostic ignored "-Wvolatile-register-var"
+# if defined(__x86_64__)
+register zend_execute_data* volatile execute_data __asm__("%r14");
+register const zend_op* volatile opline __asm__("%r15");
+# else
+register zend_execute_data* volatile execute_data __asm__("%esi");
+register const zend_op* volatile opline __asm__("%edi");
+# endif
+# pragma GCC diagnostic warning "-Wvolatile-register-var"
+#endif
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_nested_func_helper(uint32_t call_info EXECUTE_DATA_DC)
+{
+ zend_execute_data *old_execute_data;
+
+ if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
+ zend_clean_and_cache_symbol_table(EX(symbol_table));
+ }
+ EG(current_execute_data) = EX(prev_execute_data);
+
+ zend_vm_stack_free_extra_args_ex(call_info, execute_data);
+ if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
+ OBJ_RELEASE(Z_OBJ(execute_data->This));
+ } else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
+ OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ }
+
+ old_execute_data = execute_data;
+ execute_data = EX(prev_execute_data);
+ zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
+
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ const zend_op *old_opline = EX(opline);
+ zend_throw_exception_internal(NULL);
+ if (old_opline->result_type != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR(old_opline->result.var));
+ }
+#ifndef HAVE_GCC_GLOBAL_REGS
+ return 2; // ZEND_VM_LEAVE
+#endif
+ } else {
+ EX(opline)++;
+#ifdef HAVE_GCC_GLOBAL_REGS
+ opline = EX(opline);
+#else
+ return 2; // ZEND_VM_LEAVE
+#endif
+ }
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_top_func_helper(uint32_t call_info EXECUTE_DATA_DC)
+{
+ if (UNEXPECTED(call_info & (ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS))) {
+ if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
+ zend_clean_and_cache_symbol_table(EX(symbol_table));
+ }
+ zend_vm_stack_free_extra_args_ex(call_info, execute_data);
+ }
+ EG(current_execute_data) = EX(prev_execute_data);
+ if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
+ OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ }
+ execute_data = EG(current_execute_data);
+#ifdef HAVE_GCC_GLOBAL_REGS
+ opline = zend_jit_halt_op;
+#else
+ return -1; // ZEND_VM_RETURN
+#endif
+}
+
+void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D)
+{
+ zend_op_array *op_array = &EX(func)->op_array;
+
+ if (EXPECTED(!(op_array->fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))) {
+ uint32_t first_extra_arg = op_array->num_args;
+ uint32_t num_args = EX_NUM_ARGS();
+ zval *end, *src, *dst;
+ uint32_t type_flags = 0;
+
+ if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
+#ifdef HAVE_GCC_GLOBAL_REGS
+ opline += first_extra_arg;
+#endif
+ }
+
+ /* move extra args into separate array after all CV and TMP vars */
+ end = EX_VAR_NUM(first_extra_arg - 1);
+ src = end + (num_args - first_extra_arg);
+ dst = src + (op_array->last_var + op_array->T - first_extra_arg);
+ if (EXPECTED(src != dst)) {
+ do {
+ type_flags |= Z_TYPE_INFO_P(src);
+ ZVAL_COPY_VALUE(dst, src);
+ ZVAL_UNDEF(src);
+ src--;
+ dst--;
+ } while (src != end);
+ if (type_flags & (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT)) {
+ ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
+ }
+ } else {
+ do {
+ if (Z_REFCOUNTED_P(src)) {
+ ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
+ break;
+ }
+ src--;
+ } while (src != end);
+ }
+ }
+}
+
+void ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D)
+{
+ zend_execute_data *call = (zend_execute_data *) opline;
+ zend_function *fbc = call->func;
+ zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
+ fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
+ fbc->common.scope ? "::" : "",
+ ZSTR_VAL(fbc->common.function_name));
+ if (EG(exception)) {
+#ifndef HAVE_GCC_GLOBAL_REGS
+ zend_execute_data *execute_data = EG(current_execute_data);
+#endif
+ const zend_op *opline = EG(opline_before_exception);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+
+ zend_vm_stack_free_args(call);
+
+ if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
+ OBJ_RELEASE(Z_OBJ(call->This));
+ }
+
+ zend_vm_stack_free_call_frame(call);
+ }
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_profile_helper(ZEND_OPCODE_HANDLER_ARGS)
+{
+ zend_op_array *op_array = (zend_op_array*)EX(func);
+ zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)ZEND_FUNC_INFO(op_array);
+ uintptr_t counter = (uintptr_t)ZEND_COUNTER_INFO(op_array);
+
+ ZEND_COUNTER_INFO(op_array) = (void*)(counter + 1);
+ ++zend_jit_profile_counter;
+ ZEND_OPCODE_TAIL_CALL(handler);
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_func_counter_helper(ZEND_OPCODE_HANDLER_ARGS)
+{
+ zend_jit_op_array_extension *jit_extension =
+ (zend_jit_op_array_extension*)ZEND_FUNC_INFO(&EX(func)->op_array);
+#ifndef HAVE_GCC_GLOBAL_REGS
+ const zend_op *opline = EX(opline);
+#endif
+
+ *(jit_extension->counter) -= ZEND_JIT_HOT_FUNC_COST;
+
+ if (UNEXPECTED(*(jit_extension->counter) <= 0)) {
+ zend_jit_hot_func(execute_data, opline);
+ ZEND_OPCODE_RETURN();
+ } else {
+ zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)jit_extension->orig_handlers[opline - EX(func)->op_array.opcodes];
+ ZEND_OPCODE_TAIL_CALL(handler);
+ }
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_counter_helper(ZEND_OPCODE_HANDLER_ARGS)
+{
+ zend_jit_op_array_extension *jit_extension =
+ (zend_jit_op_array_extension*)ZEND_FUNC_INFO(&EX(func)->op_array);
+#ifndef HAVE_GCC_GLOBAL_REGS
+ const zend_op *opline = EX(opline);
+#endif
+
+ *(jit_extension->counter) -= ZEND_JIT_HOT_LOOP_COST;
+
+ if (UNEXPECTED(*(jit_extension->counter) <= 0)) {
+ zend_jit_hot_func(execute_data, opline);
+ ZEND_OPCODE_RETURN();
+ } else {
+ zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)jit_extension->orig_handlers[opline - EX(func)->op_array.opcodes];
+ ZEND_OPCODE_TAIL_CALL(handler);
+ }
+}
+
+static zend_always_inline int _zend_quick_get_constant(
+ const zval *key, uint32_t flags, int check_defined_only)
+{
+#ifndef HAVE_GCC_GLOBAL_REGS
+ zend_execute_data *execute_data = EG(current_execute_data);
+#endif
+ const zend_op *opline = EX(opline);
+ zval *zv;
+ 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 if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
+ key++;
+ zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
+ if (zv) {
+ c = (zend_constant*)Z_PTR_P(zv);
+ }
+ }
+
+ if (!c) {
+ if (!check_defined_only) {
+ zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+ CACHE_PTR(opline->extended_value, ENCODE_SPECIAL_CACHE_NUM(zend_hash_num_elements(EG(zend_constants))));
+ return FAILURE;
+ }
+
+ if (!check_defined_only) {
+ ZVAL_COPY_OR_DUP(EX_VAR(opline->result.var), &c->value);
+ }
+
+ CACHE_PTR(opline->extended_value, c);
+ return SUCCESS;
+}
+
+void ZEND_FASTCALL zend_jit_get_constant(const zval *key, uint32_t flags)
+{
+ _zend_quick_get_constant(key, flags, 0);
+}
+
+int ZEND_FASTCALL zend_jit_check_constant(const zval *key)
+{
+ return _zend_quick_get_constant(key, 0, 1);
+}
diff --git a/ext/opcache/jit/zend_jit_vtune.c b/ext/opcache/jit/zend_jit_vtune.c
new file mode 100644
index 0000000000..877afa8606
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_vtune.c
@@ -0,0 +1,42 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_VTUNE 1
+
+#include "jit/vtune/jitprofiling.h"
+#include "jit/vtune/jitprofiling.c"
+
+static void zend_jit_vtune_register(const char *name,
+ const void *start,
+ size_t size)
+{
+ iJIT_Method_Load jmethod = {0};
+
+ if (iJIT_IsProfilingActive() != iJIT_SAMPLING_ON) {
+ return;
+ }
+
+ jmethod.method_id = iJIT_GetNewMethodID();
+ jmethod.method_name = (char*)name;
+ jmethod.class_file_name = NULL;
+ jmethod.source_file_name = NULL;
+ jmethod.method_load_address = (void*)start;
+ jmethod.method_size = size;
+
+ iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
+}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
new file mode 100644
index 0000000000..7422aab592
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -0,0 +1,10313 @@
+/*
+ * +----------------------------------------------------------------------+
+ * | Zend JIT |
+ * +----------------------------------------------------------------------+
+ * | Copyright (c) The PHP Group |
+ * +----------------------------------------------------------------------+
+ * | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ * | If you did not receive a copy of the PHP license and are unable to |
+ * | obtain it through the world-wide-web, please send a note to |
+ * | license@php.net so we can mail you a copy immediately. |
+ * +----------------------------------------------------------------------+
+ * | Authors: Dmitry Stogov <dmitry@php.net> |
+ * | Xinchen Hui <laruence@php.net> |
+ * +----------------------------------------------------------------------+
+ */
+
+|.if X64
+ |.arch x64
+|.else
+ |.arch x86
+|.endif
+
+|.if X64WIN
+ |.define FP, r14
+ |.define IP, r15
+ |.define IPl, r15d
+ |.define RX, r15 // the same as VM IP reused as a general purpos reg
+ |.define CARG1, rcx // x64/POSIX C call arguments.
+ |.define CARG2, rdx
+ |.define CARG3, r8
+ |.define CARG4, r9
+ |.define CARG1d, ecx
+ |.define CARG2d, edx
+ |.define CARG3d, r8d
+ |.define CARG4d, r9d
+ |.define FCARG1a, CARG1 // Simulate x86 fastcall.
+ |.define FCARG2a, CARG2
+ |.define FCARG1d, CARG1d
+ |.define FCARG2d, CARG2d
+ |.define SPAD, 0x08 // padding for CPU stack alignment
+ |.define NR_SPAD, 0x58 // padding for CPU stack alignment
+ |.define T3, [r4+0x50] // Used to store old value of IP
+ |.define T2, [r4+0x48] // Used to store old value of FP
+ |.define T1, [r4+0x40]
+ |.define A6, [r4+0x28] // preallocated slot for 6-th argument
+ |.define A5, [r4+0x20] // preallocated slot for 5-th argument
+|.elif X64
+ |.define FP, r14
+ |.define IP, r15
+ |.define IPl, r15d
+ |.define RX, r15 // the same as VM IP reused as a general purpos reg
+ |.define CARG1, rdi // x64/POSIX C call arguments.
+ |.define CARG2, rsi
+ |.define CARG3, rdx
+ |.define CARG4, rcx
+ |.define CARG5, r8
+ |.define CARG6, r9
+ |.define CARG1d, edi
+ |.define CARG2d, esi
+ |.define CARG3d, edx
+ |.define CARG4d, ecx
+ |.define CARG5d, r8d
+ |.define CARG6d, r9d
+ |.define FCARG1a, CARG1 // Simulate x86 fastcall.
+ |.define FCARG2a, CARG2
+ |.define FCARG1d, CARG1d
+ |.define FCARG2d, CARG2d
+ |.define SPAD, 0x08 // padding for CPU stack alignment
+ |.define NR_SPAD, 0x18 // padding for CPU stack alignment
+ |.define T3, [r4+0x10] // Used to store old value of IP (CALL VM only)
+ |.define T2, [r4+0x08] // Used to store old value of FP (CALL VM only)
+ |.define T1, [r4]
+|.else
+ |.define FP, esi
+ |.define IP, edi
+ |.define IPl, edi
+ |.define RX, edi // the same as VM IP reused as a general purpos reg
+ |.define FCARG1a, ecx // x86 fastcall arguments.
+ |.define FCARG2a, edx
+ |.define FCARG1d, ecx
+ |.define FCARG2d, edx
+ |.define SPAD, 12 // padding for CPU stack alignment
+ |.define NR_SPAD, 12 // padding for CPU stack alignment
+ |.define T3, [r4+0x10] // Used to store old value of IP (CALL VM only)
+ |.define T2, [r4+0x08] // Used to store old value of FP (CALL VM only)
+ |.define T1, [r4]
+|.endif
+
+|.define HYBRID_SPAD, 16 // padding for stack alignment
+
+/* According to x86 and x86_64 ABI, CPU stack has to be 16 byte aligned to
+ * guarantee proper alignment of 128-bit SSE data allocated on stack.
+ * With broken alignment any execution of SSE code, including calls to
+ * memcpy() and others, may lead to crash.
+ */
+
+#include "Zend/zend_cpuinfo.h"
+#include "jit/zend_jit_x86.h"
+
+/* The generated code may contain tautological comparisons, ignore them. */
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
+
+const char* zend_reg_name[] = {
+#if defined(__x86_64__) || defined(_M_X64)
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
+ "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xm15"
+#else
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+ "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
+#endif
+};
+
+#ifdef HAVE_GCC_GLOBAL_REGS
+# define GCC_GLOBAL_REGS 1
+#else
+# define GCC_GLOBAL_REGS 0
+#endif
+
+static uint32_t zend_jit_x86_flags = 0;
+
+#if ZTS
+static size_t tsrm_ls_cache_tcb_offset = 0;
+static size_t tsrm_tls_index;
+static size_t tsrm_tls_offset;
+#endif
+
+/* By default avoid JITing inline handlers if it does not seem profitable due to lack of
+ * type information. Disabling this option allows testing some JIT handlers in the
+ * presence of try/catch blocks, which prevent SSA construction. */
+#ifndef PROFITABILITY_CHECKS
+# define PROFITABILITY_CHECKS 1
+#endif
+
+|.type EX, zend_execute_data, FP
+|.type OP, zend_op
+|.type ZVAL, zval
+
+|.actionlist dasm_actions
+
+|.globals zend_lb
+static void* dasm_labels[zend_lb_MAX];
+
+|.section code, cold_code
+
+#define IS_32BIT(addr) (((uintptr_t)(addr)) <= 0xffffffff)
+
+#define IS_SIGNED_32BIT(val) ((((intptr_t)(val)) <= 0x7fffffff) && (((intptr_t)(val)) >= (-2147483647 - 1)))
+
+#define BP_JIT_IS 6
+
+|.macro LOAD_ADDR, reg, addr
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mov reg, ((ptrdiff_t)addr) // 0x48 0xc7 0xc0 <imm-32-bit>
+|| } else {
+| mov64 reg, ((ptrdiff_t)addr) // 0x48 0xb8 <imm-64-bit>
+|| }
+| .else
+| mov reg, ((ptrdiff_t)addr)
+| .endif
+|.endmacro
+
+|.macro LOAD_TSRM_CACHE, reg
+| .if X64WIN
+| gs
+| mov reg, aword [0x58]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+| .elif WIN
+| fs
+| mov reg, aword [0x2c]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+| .elif X64APPLE
+| gs
+|| if (tsrm_ls_cache_tcb_offset) {
+| mov reg, aword [tsrm_ls_cache_tcb_offset]
+|| } else {
+| mov reg, aword [tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+|| }
+| .elif X64
+| fs
+|| if (tsrm_ls_cache_tcb_offset) {
+| mov reg, aword [tsrm_ls_cache_tcb_offset]
+|| } else {
+| mov reg, [0x8]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+|| }
+| .else
+| gs
+|| if (tsrm_ls_cache_tcb_offset) {
+| mov reg, aword [tsrm_ls_cache_tcb_offset]
+|| } else {
+| mov reg, [0x4]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+|| }
+| .endif
+|.endmacro
+
+|.macro LOAD_ADDR_ZTS, reg, struct, field
+| .if ZTS
+| LOAD_TSRM_CACHE reg
+| lea reg, aword [reg + (struct.._offset + offsetof(zend_..struct, field))]
+| .else
+| LOAD_ADDR reg, &struct.field
+| .endif
+|.endmacro
+
+|.macro SAVE_OPLINE
+|| if (GCC_GLOBAL_REGS) {
+| mov aword EX->opline, IP
+|| }
+|.endmacro
+
+|.macro LOAD_OPLINE
+|| if (GCC_GLOBAL_REGS) {
+| mov IP, aword EX->opline
+|| }
+|.endmacro
+
+|.macro LOAD_IP_ADDR, addr
+|| if (GCC_GLOBAL_REGS) {
+| LOAD_ADDR IP, addr
+|| } else {
+| LOAD_ADDR RX, addr
+| mov aword EX->opline, RX
+|| }
+|.endmacro
+
+|.macro LOAD_IP_ADDR_ZTS, struct, field
+| .if ZTS
+|| if (GCC_GLOBAL_REGS) {
+| LOAD_TSRM_CACHE IP
+| mov IP, aword [IP + (struct.._offset + offsetof(zend_..struct, field))]
+|| } else {
+| LOAD_TSRM_CACHE RX
+| lea RX, aword [RX + (struct.._offset + offsetof(zend_..struct, field))]
+| mov aword EX->opline, RX
+|| }
+| .else
+| LOAD_IP_ADDR &struct.field
+| .endif
+|.endmacro
+
+|.macro GET_IP, reg
+|| if (GCC_GLOBAL_REGS) {
+| mov reg, IP
+|| } else {
+| mov reg, aword EX->opline
+|| }
+|.endmacro
+
+|.macro ADD_IP, val
+|| if (GCC_GLOBAL_REGS) {
+| add IP, val
+|| } else {
+| add aword EX->opline, val
+|| }
+|.endmacro
+
+|.macro JMP_IP
+|| if (GCC_GLOBAL_REGS) {
+| jmp aword [IP]
+|| } else {
+| mov r0, aword EX:FCARG1a->opline
+| jmp aword [r0]
+|| }
+|.endmacro
+
+/* In 64-bit build we compare only low 32-bits.
+ * x86_64 cmp instruction doesn't support immediate 64-bit operand, and full
+ * comparison would require additinal load of 64-bit address into register.
+ * This is not a problem at all, while JIT buffer size is less than 4GB.
+ */
+|.macro CMP_IP, addr
+|| if (GCC_GLOBAL_REGS) {
+| cmp IPl, addr
+|| } else {
+| cmp dword EX->opline, addr
+|| }
+|.endmacro
+
+|.macro ADDR_OP1, addr_ins, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| addr_ins ((ptrdiff_t)addr)
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| addr_ins tmp_reg
+|| }
+| .else
+| addr_ins ((ptrdiff_t)addr)
+| .endif
+|.endmacro
+
+|.macro ADDR_OP2_2, addr_ins, op1, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| addr_ins op1, ((ptrdiff_t)addr)
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| addr_ins op1, tmp_reg
+|| }
+| .else
+| addr_ins op1, ((ptrdiff_t)addr)
+| .endif
+|.endmacro
+
+|.macro PUSH_ADDR, addr, tmp_reg
+| ADDR_OP1 push, addr, tmp_reg
+|.endmacro
+
+|.macro PUSH_ADDR_ZTS, struct, field, tmp_reg
+| .if ZTS
+| LOAD_TSRM_CACHE tmp_reg
+| lea tmp_reg, aword [tmp_reg + (struct.._offset + offsetof(zend_..struct, field))]
+| push tmp_reg
+| .else
+| ADDR_OP1 push, &struct.field, tmp_reg
+| .endif
+|.endmacro
+
+|.macro MEM_OP1, mem_ins, prefix, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins prefix [addr]
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins prefix [tmp_reg]
+|| }
+| .else
+| mem_ins prefix [addr]
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_1, mem_ins, prefix, addr, op2, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins prefix [addr], op2
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins prefix [tmp_reg], op2
+|| }
+| .else
+| mem_ins prefix [addr], op2
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_2, mem_ins, op1, prefix, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins op1, prefix [addr]
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins op1, prefix [tmp_reg]
+|| }
+| .else
+| mem_ins op1, prefix [addr]
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_1_ZTS, mem_ins, prefix, struct, field, op2, tmp_reg
+| .if ZTS
+| LOAD_TSRM_CACHE tmp_reg
+| mem_ins prefix [tmp_reg + (struct.._offset + offsetof(zend_..struct, field))], op2
+| .else
+| MEM_OP2_1 mem_ins, prefix, &struct.field, op2, tmp_reg
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_2_ZTS, mem_ins, op1, prefix, struct, field, tmp_reg
+| .if ZTS
+| LOAD_TSRM_CACHE tmp_reg
+| mem_ins op1, prefix [tmp_reg + (struct.._offset + offsetof(zend_..struct, field))]
+| .else
+| MEM_OP2_2 mem_ins, op1, prefix, &struct.field, tmp_reg
+| .endif
+|.endmacro
+
+|.macro MEM_OP3_3, mem_ins, op1, op2, prefix, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins op1, op2, prefix [addr]
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins op1, op2, prefix [tmp_reg]
+|| }
+| .else
+| mem_ins op1, op2, prefix [addr]
+| .endif
+|.endmacro
+
+|.macro LOAD_BASE_ADDR, reg, base, offset
+|| if (offset) {
+| lea reg, qword [Ra(base)+offset]
+|| } else {
+| mov reg, Ra(base)
+|| }
+|.endmacro
+
+|.macro PUSH_BASE_ADDR, base, offset, tmp_reg
+|| if (offset) {
+| lea tmp_reg, qword [Ra(base)+offset]
+| push tmp_reg
+|| } else {
+| push Ra(base)
+|| }
+|.endmacro
+
+|.macro EXT_CALL, func, tmp_reg
+| .if X64
+|| if (IS_32BIT(dasm_end) && IS_32BIT(func)) {
+| call qword &func
+|| } else {
+| LOAD_ADDR tmp_reg, func
+| call tmp_reg
+|| }
+| .else
+| call dword &func
+| .endif
+|.endmacro
+
+|.macro EXT_JMP, func, tmp_reg
+| .if X64
+|| if (IS_32BIT(dasm_end) && IS_32BIT(func)) {
+| jmp qword &func
+|| } else {
+| LOAD_ADDR tmp_reg, func
+| jmp tmp_reg
+|| }
+| .else
+| jmp dword &func
+| .endif
+|.endmacro
+
+|.macro LOAD_ZVAL_ADDR, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| LOAD_ADDR reg, Z_ZV(addr)
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| LOAD_BASE_ADDR reg, Z_REG(addr), Z_OFFSET(addr)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro PUSH_ZVAL_ADDR, addr, tmp_reg
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| PUSH_ADDR Z_ZV(addr), tmp_reg
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| PUSH_BASE_ADDR Z_REG(addr), Z_OFFSET(addr), tmp_reg
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro GET_Z_TYPE_INFO, reg, zv
+| mov reg, dword [zv+offsetof(zval,u1.type_info)]
+|.endmacro
+
+|.macro SET_Z_TYPE_INFO, zv, type
+| mov dword [zv+offsetof(zval,u1.type_info)], type
+|.endmacro
+
+|.macro GET_ZVAL_TYPE_INFO, reg, addr
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov reg, dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval,u1.type_info)]
+|.endmacro
+
+|.macro SET_ZVAL_TYPE_INFO, addr, type
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval,u1.type_info)], type
+|.endmacro
+
+|.macro GET_Z_PTR, reg, zv
+| mov reg, aword [zv]
+|.endmacro
+
+|.macro SET_Z_PTR, zv, val
+| mov aword [zv], val
+|.endmacro
+
+|.macro GET_ZVAL_PTR, reg, addr
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov reg, aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|.endmacro
+
+|.macro SET_ZVAL_PTR, addr, val
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov aword [Ra(Z_REG(addr))+Z_OFFSET(addr)], val
+|.endmacro
+
+|.macro GET_ZVAL_W2, reg, addr
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov reg, dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+4]
+|.endmacro
+
+|.macro SET_ZVAL_W2, addr, val
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+4], val
+|.endmacro
+
+|.macro UNDEF_OPLINE_RESULT
+| mov r0, EX->opline
+|.if X64
+ | movsxd r0, dword OP:r0->result.var
+|.else
+ | mov r0, OP:r0->result.var
+|.endif
+| SET_Z_TYPE_INFO FP + r0, IS_UNDEF
+|.endmacro
+
+|.macro SSE_AVX_INS, sse_ins, avx_ins, op1, op2
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| avx_ins op1, op2
+|| } else {
+| sse_ins op1, op2
+|| }
+|.endmacro
+
+|.macro SSE_OP, sse_ins, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| MEM_OP2_2 sse_ins, xmm(reg-ZREG_XMM0), qword, Z_ZV(addr), r0
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| sse_ins xmm(reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| sse_ins xmm(reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SSE_AVX_OP, sse_ins, avx_ins, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| .if X64
+|| if (IS_32BIT(Z_ZV(addr))) {
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+|| } else {
+| LOAD_ADDR r0, Z_ZV(addr)
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [r0]
+|| }
+| .else
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+| .endif
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SSE_GET_ZVAL_LVAL, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+|| if (Z_LVAL_P(Z_ZV(addr)) == 0) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vxorps xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0)
+|| } else {
+| xorps xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0)
+|| }
+|| } else {
+|.if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(addr)))) {
+| mov64 r0, Z_LVAL_P(Z_ZV(addr))
+|| } else {
+| mov r0, Z_LVAL_P(Z_ZV(addr))
+|| }
+|.else
+| mov r0, Z_LVAL_P(Z_ZV(addr))
+|.endif
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vcvtsi2sd, xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), r0
+|| } else {
+| cvtsi2sd, xmm(reg-ZREG_XMM0), r0
+|| }
+|| }
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vcvtsi2sd xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else {
+| cvtsi2sd xmm(reg-ZREG_XMM0), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| }
+|| } else if (Z_MODE(addr) == IS_REG) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vcvtsi2sd xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), Ra(Z_REG(addr))
+|| } else {
+| cvtsi2sd xmm(reg-ZREG_XMM0), Ra(Z_REG(addr))
+|| }
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SSE_GET_ZVAL_DVAL, reg, addr
+|| if (Z_MODE(addr) != IS_REG || reg != Z_REG(addr)) {
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| .if X64
+|| if (IS_32BIT(Z_ZV(addr))) {
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+|| } else {
+| LOAD_ADDR r0, Z_ZV(addr)
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [r0]
+|| }
+| .else
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+| .endif
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| SSE_AVX_INS movsd, vmovaps, xmm(reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|| }
+|.endmacro
+
+|.macro SSE_MATH, opcode, reg, addr
+|| switch (opcode) {
+|| case ZEND_ADD:
+| SSE_OP addsd, reg, addr
+|| break;
+|| case ZEND_SUB:
+| SSE_OP subsd, reg, addr
+|| break;
+|| case ZEND_MUL:
+| SSE_OP mulsd, reg, addr
+|| break;
+|| case ZEND_DIV:
+| SSE_OP divsd, reg, addr
+|| break;
+|| }
+|.endmacro
+
+|.macro SSE_MATH_REG, opcode, dst_reg, src_reg
+|| switch (opcode) {
+|| case ZEND_ADD:
+| addsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_SUB:
+| subsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_MUL:
+| mulsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_DIV:
+| divsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| }
+|.endmacro
+
+|.macro SSE_SET_ZVAL_DVAL, addr, reg
+|| if (Z_MODE(addr) == IS_REG) {
+|| if (reg != Z_REG(addr)) {
+| SSE_AVX_INS movsd, vmovaps, xmm(Z_REG(addr)-ZREG_XMM0), xmm(reg-ZREG_XMM0)
+|| }
+|| } else {
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| SSE_AVX_INS movsd, vmovsd, qword [Ra(Z_REG(addr))+Z_OFFSET(addr)], xmm(reg-ZREG_XMM0)
+|| }
+|.endmacro
+
+|.macro AVX_OP, avx_ins, reg, op1_reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| MEM_OP3_3 avx_ins, xmm(reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), qword, Z_ZV(addr), r0
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| avx_ins xmm(reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| avx_ins xmm(reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro AVX_MATH, opcode, reg, op1_reg, addr
+|| switch (opcode) {
+|| case ZEND_ADD:
+| AVX_OP vaddsd, reg, op1_reg, addr
+|| break;
+|| case ZEND_SUB:
+| AVX_OP vsubsd, reg, op1_reg, addr
+|| break;
+|| case ZEND_MUL:
+| AVX_OP vmulsd, reg, op1_reg, addr
+|| break;
+|| case ZEND_DIV:
+| AVX_OP vdivsd, reg, op1_reg, addr
+|| break;
+|| }
+|.endmacro
+
+|.macro AVX_MATH_REG, opcode, dst_reg, op1_reg, src_reg
+|| switch (opcode) {
+|| case ZEND_ADD:
+| vaddsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_SUB:
+| vsubsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_MUL:
+| vmulsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_DIV:
+| vdivsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| }
+|.endmacro
+
+|.macro LONG_OP, long_ins, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(addr)))) {
+|| if (reg != ZREG_R0) {
+| mov64 r0, Z_LVAL_P(Z_ZV(addr))
+| long_ins Ra(reg), r0
+|| } else {
+| mov64 r1, Z_LVAL_P(Z_ZV(addr))
+| long_ins Ra(reg), r1
+|| }
+|| } else {
+| long_ins Ra(reg), Z_LVAL_P(Z_ZV(addr))
+|| }
+| .else
+| long_ins Ra(reg), Z_LVAL_P(Z_ZV(addr))
+| .endif
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| long_ins Ra(reg), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| long_ins Ra(reg), Ra(Z_REG(addr))
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro LONG_OP_WITH_CONST, long_ins, op1_addr, lval
+|| if (Z_MODE(op1_addr) == IS_MEM_ZVAL) {
+| .if X64
+|| if (!IS_SIGNED_32BIT(lval)) {
+| mov64 r0, lval
+| long_ins aword [Ra(Z_REG(op1_addr))+Z_OFFSET(op1_addr)], r0
+|| } else {
+| long_ins aword [Ra(Z_REG(op1_addr))+Z_OFFSET(op1_addr)], lval
+|| }
+| .else
+| long_ins aword [Ra(Z_REG(op1_addr))+Z_OFFSET(op1_addr)], lval
+| .endif
+|| } else if (Z_MODE(op1_addr) == IS_REG) {
+| .if X64
+|| if (!IS_SIGNED_32BIT(lval)) {
+| mov64 r0, lval
+| long_ins Ra(Z_REG(op1_addr)), r0
+|| } else {
+| long_ins Ra(Z_REG(op1_addr)), lval
+|| }
+| .else
+| long_ins Ra(Z_REG(op1_addr)), lval
+| .endif
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro GET_ZVAL_LVAL, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+|| if (Z_LVAL_P(Z_ZV(addr)) == 0) {
+| xor Ra(reg), Ra(reg)
+|| } else {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(addr)))) {
+| mov64 Ra(reg), Z_LVAL_P(Z_ZV(addr))
+|| } else {
+| mov Ra(reg), Z_LVAL_P(Z_ZV(addr))
+|| }
+| .else
+| mov Ra(reg), Z_LVAL_P(Z_ZV(addr))
+| .endif
+|| }
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| mov Ra(reg), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+|| if (reg != Z_REG(addr)) {
+| mov Ra(reg), Ra(Z_REG(addr))
+|| }
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro LONG_MATH, opcode, reg, addr
+|| switch (opcode) {
+|| case ZEND_ADD:
+| LONG_OP add, reg, addr
+|| break;
+|| case ZEND_SUB:
+| LONG_OP sub, reg, addr
+|| break;
+|| case ZEND_MUL:
+| LONG_OP imul, reg, addr
+|| break;
+|| case ZEND_BW_OR:
+| LONG_OP or, reg, addr
+|| break;
+|| case ZEND_BW_AND:
+| LONG_OP and, reg, addr
+|| break;
+|| case ZEND_BW_XOR:
+| LONG_OP xor, reg, addr
+|| break;
+|| default:
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro LONG_MATH_REG, opcode, dst_reg, src_reg
+|| switch (opcode) {
+|| case ZEND_ADD:
+| add dst_reg, src_reg
+|| break;
+|| case ZEND_SUB:
+| sub dst_reg, src_reg
+|| break;
+|| case ZEND_MUL:
+| imul dst_reg, src_reg
+|| break;
+|| case ZEND_BW_OR:
+| or dst_reg, src_reg
+|| break;
+|| case ZEND_BW_AND:
+| and dst_reg, src_reg
+|| break;
+|| case ZEND_BW_XOR:
+| xor dst_reg, src_reg
+|| break;
+|| default:
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SET_ZVAL_LVAL, addr, lval
+|| if (Z_MODE(addr) == IS_REG) {
+| mov Ra(Z_REG(addr)), lval
+|| } else {
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov aword [Ra(Z_REG(addr))+Z_OFFSET(addr)], lval
+|| }
+|.endmacro
+
+|.macro ZVAL_COPY_CONST, dst_addr, dst_info, zv, tmp_reg
+|| if (Z_TYPE_P(zv) > IS_TRUE) {
+|| if (Z_TYPE_P(zv) == IS_DOUBLE) {
+|| zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ? Z_REG(dst_addr) : ZREG_XMM0;
+|| if (Z_DVAL_P(zv) == 0.0 && !is_signed(Z_DVAL_P(zv))) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vxorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| } else {
+| xorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| }
+| .if X64
+|| } else if (!IS_32BIT(zv)) {
+| mov64 tmp_reg, ((uintptr_t)zv)
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [tmp_reg]
+| .endif
+|| } else {
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [((uint32_t)(uintptr_t)zv)]
+|| }
+| SSE_SET_ZVAL_DVAL dst_addr, dst_reg
+|| } else if (Z_LVAL_P(zv) == 0 && Z_MODE(dst_addr) == IS_REG) {
+| xor Ra(Z_REG(dst_addr)), Ra(Z_REG(dst_addr))
+|| } else {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| mov64 Ra(Z_REG(dst_addr)), ((uintptr_t)Z_LVAL_P(zv))
+|| } else {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL dst_addr, tmp_reg
+|| }
+|| } else {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+|| }
+| .else
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| .endif
+|| }
+|| }
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if (((dst_info & MAY_BE_ANY) != (1<<Z_TYPE_P(zv))) || (dst_info & (MAY_BE_STRING|MAY_BE_ARRAY)) != 0) {
+| SET_ZVAL_TYPE_INFO dst_addr, Z_TYPE_INFO_P(zv)
+|| }
+|| }
+|.endmacro
+
+|.macro ZVAL_COPY_CONST_2, dst_addr, res_addr, dst_info, zv, tmp_reg
+|| if (Z_TYPE_P(zv) > IS_TRUE) {
+|| if (Z_TYPE_P(zv) == IS_DOUBLE) {
+|| zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ?
+|| Z_REG(dst_addr) : ((Z_MODE(res_addr) == IS_REG) ? Z_MODE(res_addr) : ZREG_XMM0);
+|| if (Z_DVAL_P(zv) == 0.0 && !is_signed(Z_DVAL_P(zv))) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vxorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| } else {
+| xorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| }
+| .if X64
+|| } else if (!IS_32BIT(zv)) {
+| mov64 tmp_reg, ((uintptr_t)zv)
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [tmp_reg]
+| .endif
+|| } else {
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [((uint32_t)(uintptr_t)zv)]
+|| }
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+| SSE_SET_ZVAL_DVAL res_addr, ZREG_XMM0
+|| } else if (Z_LVAL_P(zv) == 0 && (Z_MODE(dst_addr) == IS_REG || Z_MODE(res_addr) == IS_REG)) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| xor Ra(Z_REG(dst_addr)), Ra(Z_REG(dst_addr))
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else {
+| xor Ra(Z_REG(res_addr)), Ra(Z_REG(res_addr))
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| }
+|| } else {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| mov64 Ra(Z_REG(dst_addr)), ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| mov64 Ra(Z_REG(res_addr)), ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL dst_addr, tmp_reg
+| SET_ZVAL_LVAL res_addr, tmp_reg
+|| }
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+|| }
+| .else
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+|| }
+| .endif
+|| }
+|| }
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if (((dst_info & MAY_BE_ANY) != (1<<Z_TYPE_P(zv))) || (dst_info & (MAY_BE_STRING|MAY_BE_ARRAY)) != 0) {
+| SET_ZVAL_TYPE_INFO dst_addr, Z_TYPE_INFO_P(zv)
+|| }
+|| }
+|| if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+| SET_ZVAL_TYPE_INFO res_addr, Z_TYPE_INFO_P(zv)
+|| }
+|.endmacro
+
+/* the same as above, but "src" may overlap with "tmp_reg1" */
+|.macro ZVAL_COPY_VALUE, dst_addr, dst_info, src_addr, src_info, tmp_reg1, tmp_reg2
+|| if (src_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
+|| if ((src_info & MAY_BE_ANY) == MAY_BE_LONG) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+|| if (Z_MODE(dst_addr) != IS_REG || Z_REG(dst_addr) != Z_REG(src_addr)) {
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(src_addr))
+|| }
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| GET_ZVAL_LVAL Z_REG(dst_addr), src_addr
+|| } else {
+| GET_ZVAL_LVAL tmp_reg2, src_addr
+| SET_ZVAL_LVAL dst_addr, Ra(tmp_reg2)
+|| }
+|| } else if ((src_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(src_addr)
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| SSE_GET_ZVAL_DVAL Z_REG(dst_addr), src_addr
+|| } else {
+| SSE_GET_ZVAL_DVAL ZREG_XMM0, src_addr
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+|| }
+|| } else if (!(src_info & MAY_BE_DOUBLE)) {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+|| } else {
+| .if X64
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| .else
+|| if (tmp_reg1 == tmp_reg2 || tmp_reg1 == Z_REG(src_addr)) {
+| GET_ZVAL_W2 Ra(tmp_reg2), src_addr
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg2)
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+|| } else {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| GET_ZVAL_W2 Ra(tmp_reg1), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg1)
+|| }
+| .endif
+|| }
+|| }
+|| if ((src_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+|| has_concrete_type(src_info & MAY_BE_ANY)) {
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != (src_info & (MAY_BE_ANY|MAY_BE_UNDEF))) {
+|| zend_uchar type = concrete_type(src_info);
+| SET_ZVAL_TYPE_INFO dst_addr, type
+|| }
+|| }
+|| } else {
+| GET_ZVAL_TYPE_INFO Rd(tmp_reg1), src_addr
+| SET_ZVAL_TYPE_INFO dst_addr, Rd(tmp_reg1)
+|| }
+|.endmacro
+
+|.macro ZVAL_COPY_VALUE_2, dst_addr, dst_info, res_addr, src_addr, src_info, tmp_reg1, tmp_reg2
+|| if (src_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
+|| if ((src_info & MAY_BE_ANY) == MAY_BE_LONG) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+|| if (Z_MODE(dst_addr) != IS_REG || Z_REG(dst_addr) != Z_REG(src_addr)) {
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(src_addr))
+|| }
+|| if (Z_MODE(res_addr) != IS_REG || Z_REG(res_addr) != Z_REG(src_addr)) {
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(src_addr))
+|| }
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| GET_ZVAL_LVAL Z_REG(dst_addr), src_addr
+|| if (Z_MODE(res_addr) != IS_REG || Z_REG(res_addr) != Z_REG(dst_addr)) {
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| }
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| GET_ZVAL_LVAL Z_REG(res_addr), src_addr
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| GET_ZVAL_LVAL tmp_reg2, src_addr
+| SET_ZVAL_LVAL dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_LVAL res_addr, Ra(tmp_reg2)
+|| }
+|| } else if ((src_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(src_addr)
+| SSE_SET_ZVAL_DVAL res_addr, Z_REG(src_addr)
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| SSE_GET_ZVAL_DVAL Z_REG(dst_addr), src_addr
+| SSE_SET_ZVAL_DVAL res_addr, Z_REG(dst_addr)
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SSE_GET_ZVAL_DVAL Z_REG(res_addr), src_addr
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(res_addr)
+|| } else {
+| SSE_GET_ZVAL_DVAL ZREG_XMM0, src_addr
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+| SSE_SET_ZVAL_DVAL res_addr, ZREG_XMM0
+|| }
+|| } else if (!(src_info & MAY_BE_DOUBLE)) {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+|| } else {
+| .if X64
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+| .else
+|| if (tmp_reg1 == tmp_reg2 || tmp_reg1 == Z_REG(src_addr)) {
+| GET_ZVAL_W2 Ra(tmp_reg2), src_addr
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_W2 res_addr, Ra(tmp_reg2)
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+|| } else {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| GET_ZVAL_W2 Ra(tmp_reg1), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg1)
+| SET_ZVAL_W2 res_addr, Ra(tmp_reg1)
+|| }
+| .endif
+|| }
+|| }
+|| if ((src_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+|| has_concrete_type(src_info & MAY_BE_ANY)) {
+|| zend_uchar type = concrete_type(src_info);
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != (src_info & (MAY_BE_ANY|MAY_BE_UNDEF))) {
+| SET_ZVAL_TYPE_INFO dst_addr, type
+|| }
+|| }
+|| if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+| SET_ZVAL_TYPE_INFO res_addr, type
+|| }
+|| } else {
+| GET_ZVAL_TYPE_INFO Rd(tmp_reg1), src_addr
+| SET_ZVAL_TYPE_INFO dst_addr, Rd(tmp_reg1)
+| SET_ZVAL_TYPE_INFO res_addr, Rd(tmp_reg1)
+|| }
+|.endmacro
+
+|.macro IF_TYPE, type, val, label
+| cmp type, val
+| je label
+|.endmacro
+
+|.macro IF_NOT_TYPE, type, val, label
+| cmp type, val
+| jne label
+|.endmacro
+
+|.macro IF_Z_TYPE, zv, val, label
+| IF_TYPE byte [zv + offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro IF_NOT_Z_TYPE, zv, val, label
+| IF_NOT_TYPE byte [zv + offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro CMP_ZVAL_TYPE, addr, val
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| cmp byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type)], val
+|.endmacro
+
+|.macro IF_ZVAL_TYPE, addr, val, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_TYPE byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_TYPE, addr, val, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_NOT_TYPE byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro IF_FLAGS, type_flags, mask, label
+| test type_flags, mask
+| jnz label
+|.endmacro
+
+|.macro IF_NOT_FLAGS, type_flags, mask, label
+| test type_flags, mask
+| jz label
+|.endmacro
+
+|.macro IF_REFCOUNTED, type_flags, label
+| IF_FLAGS type_flags, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_NOT_REFCOUNTED, type_flags, label
+| IF_NOT_FLAGS type_flags, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_ZVAL_FLAGS, addr, mask, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_FLAGS byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type_flags)], mask, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_FLAGS, addr, mask, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_NOT_FLAGS byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type_flags)], mask, label
+|.endmacro
+
+|.macro IF_ZVAL_REFCOUNTED, addr, label
+| IF_ZVAL_FLAGS addr, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_REFCOUNTED, addr, label
+| IF_NOT_ZVAL_FLAGS addr, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_COLLECTABLE, addr, label
+| IF_NOT_ZVAL_FLAGS addr, IS_TYPE_COLLECTABLE, label
+|.endmacro
+
+|.macro GC_ADDREF, zv
+| add dword [zv], 1
+|.endmacro
+
+|.macro GC_DELREF, zv
+| sub dword [zv], 1
+|.endmacro
+
+|.macro IF_GC_MAY_NOT_LEAK, ptr, tmp_reg, label
+| mov tmp_reg, dword [ptr + 4]
+| and tmp_reg, (GC_INFO_MASK | (GC_COLLECTABLE << GC_FLAGS_SHIFT))
+| cmp tmp_reg, (GC_COLLECTABLE << GC_FLAGS_SHIFT)
+| jne label
+|.endmacro
+
+|.macro ADDREF_CONST, zv, tmp_reg
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| add dword [tmp_reg], 1
+|| } else {
+| add dword [Z_LVAL_P(zv)], 1
+|| }
+| .else
+| add dword [Z_LVAL_P(zv)], 1
+| .endif
+|.endmacro
+
+|.macro ADDREF_CONST_2, zv, tmp_reg
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| add dword [tmp_reg], 2
+|| } else {
+| add dword [Z_LVAL_P(zv)], 2
+|| }
+| .else
+| add dword [Z_LVAL_P(zv)], 2
+| .endif
+|.endmacro
+
+|.macro TRY_ADDREF, val_info, type_flags_reg, value_ptr_reg
+|| if (val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+|| if (val_info & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+| IF_NOT_REFCOUNTED type_flags_reg, >1
+|| }
+| GC_ADDREF value_ptr_reg
+|1:
+|| }
+|.endmacro
+
+|.macro TRY_ADDREF_2, val_info, type_flags_reg, value_ptr_reg
+|| if (val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+|| if (val_info & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+| IF_NOT_REFCOUNTED type_flags_reg, >1
+|| }
+| add dword [value_ptr_reg], 2
+|1:
+|| }
+|.endmacro
+
+|.macro ZVAL_DEREF, reg, info
+|| if (info & MAY_BE_REF) {
+| IF_NOT_Z_TYPE, reg, IS_REFERENCE, >1
+| GET_Z_PTR reg, reg
+| add reg, offsetof(zend_reference, val)
+|1:
+|| }
+|.endmacro
+
+|.macro SAVE_VALID_OPLINE, op
+|| if (op == last_valid_opline) {
+| SAVE_OPLINE
+|| } else {
+| ADDR_OP2_2 mov, aword EX->opline, op, r0
+|| }
+|.endmacro
+
+// zval should be in FCARG1a
+|.macro ZVAL_DTOR_FUNC, var_info, opline // arg1 must be in FCARG1a
+|| do {
+|| if (has_concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+|| zend_uchar type = concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
+|| if (type == IS_STRING && !ZEND_DEBUG) {
+| EXT_CALL _efree, r0
+|| break;
+|| } else if (type == IS_ARRAY) {
+|| if (opline) {
+| SAVE_VALID_OPLINE opline
+|| }
+| EXT_CALL zend_array_destroy, r0
+|| break;
+|| } else if (type == IS_OBJECT) {
+|| if (opline) {
+| SAVE_VALID_OPLINE opline
+|| }
+| EXT_CALL zend_objects_store_del, r0
+|| break;
+|| }
+|| }
+|| if (opline) {
+| SAVE_VALID_OPLINE opline
+|| }
+| EXT_CALL rc_dtor_func, r0
+|| } while(0);
+|.endmacro
+
+|.macro ZVAL_PTR_DTOR, addr, op_info, gc, cold, safe, opline
+|| if ((op_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+|| if ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+| // if (Z_REFCOUNTED_P(cv)) {
+|| if (cold) {
+| IF_ZVAL_REFCOUNTED addr, >1
+|.cold_code
+|1:
+|| } else {
+| IF_NOT_ZVAL_REFCOUNTED addr, >4
+|| }
+|| }
+| // if (!Z_DELREF_P(cv)) {
+| GET_ZVAL_PTR FCARG1a, addr
+| GC_DELREF FCARG1a
+|| if (RC_MAY_BE_1(op_info)) {
+|| if (RC_MAY_BE_N(op_info)) {
+|| if (gc && RC_MAY_BE_N(op_info) && ((op_info) & (MAY_BE_REF|MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
+| jnz >3
+|| } else {
+| jnz >4
+|| }
+|| }
+|| if (safe) {
+| // ZVAL_NULL(cv);
+| SET_ZVAL_TYPE_INFO addr, IS_NULL
+|| }
+| // zval_dtor_func(r);
+| ZVAL_DTOR_FUNC op_info, opline
+|| if (gc && RC_MAY_BE_N(op_info) && ((op_info) & (MAY_BE_REF|MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
+| jmp >4
+|| }
+|3:
+|| }
+|| if (gc && RC_MAY_BE_N(op_info) && ((op_info) & (MAY_BE_REF|MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
+|| if ((op_info) & MAY_BE_REF) {
+|| zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, offsetof(zend_reference, val));
+| IF_NOT_ZVAL_TYPE addr, IS_REFERENCE, >1
+| IF_NOT_ZVAL_COLLECTABLE ref_addr, >4
+| GET_ZVAL_PTR FCARG1a, ref_addr
+|1:
+|| }
+| IF_GC_MAY_NOT_LEAK FCARG1a, eax, >4
+| // gc_possible_root(Z_COUNTED_P(z))
+| EXT_CALL gc_possible_root, r0
+|| if (cold && ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) != 0) {
+| jmp >4
+|.code
+|| }
+|| } else if (cold && ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) != 0) {
+| jmp >4
+|.code
+|| }
+|4:
+|| }
+|.endmacro
+
+|.macro FREE_OP, op_type, op, op_info, cold, op_array, opline
+|| if (op_type & (IS_VAR|IS_TMP_VAR)) {
+| ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_FP, op.var), op_info, 0, cold, 0, opline
+|| }
+|.endmacro
+
+|.macro SEPARATE_ZVAL_NOREF, addr, op_info, cold
+|| if ((op_info & MAY_BE_ARRAY) && RC_MAY_BE_N(op_info)) {
+|| if (cold) {
+| IF_ZVAL_TYPE addr, IS_ARRAY, >1
+|.cold_code
+|1:
+|| } else {
+| IF_NOT_ZVAL_TYPE addr, IS_ARRAY, >2
+|| }
+| GET_ZVAL_PTR r0, addr
+|| if (RC_MAY_BE_1(op_info)) {
+| cmp dword [r0], 1 // if (GC_REFCOUNTED() > 1)
+| jbe >2
+|| }
+| IF_NOT_ZVAL_REFCOUNTED addr, >1
+| GC_DELREF r0
+|1:
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov aword T1, FCARG1a // save
+|| } else {
+| LOAD_ZVAL_ADDR FCARG1a, addr
+|| }
+| EXT_CALL zval_copy_ctor_func, r0
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov FCARG1a, aword T1 // restore
+|| }
+|| if (cold) {
+| jmp >2
+|.code
+|| }
+|2:
+|| }
+|.endmacro
+
+|.macro SEPARATE_ARRAY, addr, op_info, cold
+|| if (RC_MAY_BE_N(op_info)) {
+|| zend_reg tmp_reg;
+||
+|| tmp_reg = (Z_REG(addr) == ZREG_FCARG1a) ? ZREG_R0 : ZREG_FCARG1a;
+| GET_ZVAL_LVAL tmp_reg, addr
+|| if (RC_MAY_BE_1(op_info)) {
+| cmp dword [Ra(tmp_reg)], 1 // if (GC_REFCOUNTED() > 1)
+|| if (cold) {
+| ja >1
+|.cold_code
+|1:
+|| } else {
+| jbe >2
+|| }
+|| }
+| IF_NOT_ZVAL_REFCOUNTED addr, >1
+| GC_DELREF Ra(tmp_reg)
+|1:
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov aword T1, FCARG1a // save
+|| } else {
+| LOAD_ZVAL_ADDR FCARG1a, addr
+|| }
+| EXT_CALL zval_copy_ctor_func, r0
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov FCARG1a, aword T1 // restore
+|| }
+|| if (RC_MAY_BE_1(op_info)) {
+|| if (cold) {
+| jmp >2
+|.code
+|| }
+|| }
+|2:
+|| }
+| GET_ZVAL_LVAL ZREG_FCARG1a, addr
+|.endmacro
+
+|.macro EFREE_REG_24, op_array, opline
+||#if ZEND_DEBUG
+|| const char *filename = op_array->filename ? op_array->filename->val : NULL;
+| LOAD_ADDR FCARG2a, filename
+| .if X64WIN
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| mov aword A5, 0
+| EXT_CALL _efree, r0
+| .elif X64
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| xor CARG5, CARG5
+| EXT_CALL _efree, r0
+| .else
+| sub r4, 4
+| push 0
+| push 0
+| push opline->lineno
+| EXT_CALL _efree, r0
+| add r4, 4
+| .endif
+||#else
+||#ifdef HAVE_BUILTIN_CONSTANT_P
+| EXT_CALL _efree_24, r0
+||#else
+| EXT_CALL _efree, r0
+||#endif
+||#endif
+|.endmacro
+
+|.macro EFREE_24, ptr, op_array, opline
+| mov FCARG1a, ptr
+| EFREE_REG_24 op_array, opline
+|.endmacro
+
+|.macro EMALLOC, size, op_array, opline
+||#if ZEND_DEBUG
+|| const char *filename = op_array->filename ? op_array->filename->val : NULL;
+| mov FCARG1a, size
+| LOAD_ADDR FCARG2a, filename
+| .if X64WIN
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| mov aword A5, 0
+| EXT_CALL _emalloc, r0
+| .elif X64
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| xor CARG5, CARG5
+| EXT_CALL _emalloc, r0
+| .else
+| sub r4, 4
+| push 0
+| push 0
+| push opline->lineno
+| EXT_CALL _emalloc, r0
+| add r4, 4
+| .endif
+||#else
+||#ifdef HAVE_BUILTIN_CONSTANT_P
+|| if (size == 24) {
+| EXT_CALL _emalloc_24, r0
+|| } else {
+| mov FCARG1a, size
+| EXT_CALL _emalloc, r0
+|| }
+||#else
+| mov FCARG1a, size
+| EXT_CALL _emalloc, r0
+||#endif
+||#endif
+|.endmacro
+
+|.macro OBJ_RELEASE, reg, tmp_reg, exit_label
+| GC_DELREF reg
+| jne >1
+| // zend_objects_store_del(obj);
+| mov FCARG1a, reg
+| EXT_CALL zend_objects_store_del, r0
+| jmp exit_label
+|1:
+| IF_GC_MAY_NOT_LEAK reg, tmp_reg, >1
+| // gc_possible_root(obj)
+| mov FCARG1a, reg
+| EXT_CALL gc_possible_root, r0
+|1:
+|.endmacro
+
+|.macro UNDEFINED_OFFSET, opline
+|| if (opline == last_valid_opline) {
+| call ->undefined_offset_ex
+|| } else {
+| SAVE_VALID_OPLINE, opline
+| call ->undefined_offset
+|| }
+|.endmacro
+
+|.macro UNDEFINED_INDEX, opline
+|| if (opline == last_valid_opline) {
+| call ->undefined_index_ex
+|| } else {
+| SAVE_VALID_OPLINE, opline
+| call ->undefined_index
+|| }
+|.endmacro
+
+|.macro CANNOT_ADD_ELEMENT, opline
+|| if (opline == last_valid_opline) {
+| call ->cannot_add_element_ex
+|| } else {
+| SAVE_VALID_OPLINE, opline
+| call ->cannot_add_element
+|| }
+|.endmacro
+
+static zend_bool reuse_ip;
+static zend_bool delayed_call_chain;
+static uint32_t delayed_call_level;
+static const zend_op *last_valid_opline;
+static int jit_return_label;
+
+/* bit helpers */
+
+/* from http://aggregate.org/MAGIC/ */
+static uint32_t ones32(uint32_t x)
+{
+ x -= ((x >> 1) & 0x55555555);
+ x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
+ x = (((x >> 4) + x) & 0x0f0f0f0f);
+ x += (x >> 8);
+ x += (x >> 16);
+ return x & 0x0000003f;
+}
+
+static uint32_t floor_log2(uint32_t x)
+{
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
+ return ones32(x) - 1;
+}
+
+static zend_bool is_power_of_two(uint32_t x)
+{
+ return !(x & (x - 1));
+}
+
+static zend_bool has_concrete_type(uint32_t value_type)
+{
+ if (value_type & MAY_BE_UNDEF) {
+ value_type |= MAY_BE_NULL;
+ }
+ value_type &= MAY_BE_ANY;
+ return is_power_of_two (value_type);
+}
+
+static uint32_t concrete_type(uint32_t value_type)
+{
+ return floor_log2(value_type & MAY_BE_ANY);
+}
+
+static inline zend_bool is_signed(double d)
+{
+ return (((unsigned char*)&d)[sizeof(double)-1] & 0x80) != 0;
+}
+
+static int zend_jit_interrupt_handler_stub(dasm_State **Dst)
+{
+ |->interrupt_handler:
+ | //EG(vm_interrupt) = 0;
+ | MEM_OP2_1_ZTS mov, byte, executor_globals, vm_interrupt, 0, r0
+ | //if (EG(timed_out)) {
+ | MEM_OP2_1_ZTS cmp, byte, executor_globals, timed_out, 0, r0
+ | je >1
+ | //zend_timeout(0);
+ | xor FCARG1d, FCARG1d
+ | EXT_CALL zend_timeout, r0
+ |1:
+ | //} else if (zend_interrupt_function) {
+ if (zend_interrupt_function) {
+ | SAVE_OPLINE
+ | //zend_interrupt_function(execute_data);
+ |.if X64
+ | mov CARG1, FP
+ | EXT_CALL zend_interrupt_function, r0
+ |.else
+ | sub r4, 12
+ | push FP
+ | EXT_CALL zend_interrupt_function, r0
+ | add r4, 16
+ |.endif
+ | //ZEND_VM_ENTER();
+ | //execute_data = EG(current_execute_data);
+ | MEM_OP2_2_ZTS mov, FP, aword, executor_globals, current_execute_data, r0
+ | LOAD_OPLINE
+ }
+ | //ZEND_VM_CONTINUE()
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ | JMP_IP
+ } else {
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 1 // ZEND_VM_ENTER
+ | ret
+ }
+
+ return 1;
+}
+
+static int zend_jit_exception_handler_stub(dasm_State **Dst)
+{
+ |->exception_handler:
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ const void *handler = zend_get_opcode_handler_func(EG(exception_op));
+
+ | add r4, HYBRID_SPAD
+ | EXT_CALL handler, r0
+ | JMP_IP
+ } else {
+ const void *handler = EG(exception_op)->handler;
+
+ if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ } else {
+ | mov FCARG1a, FP
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ }
+ | EXT_JMP handler, r0
+ }
+
+ return 1;
+}
+
+static int zend_jit_exception_handler_undef_stub(dasm_State **Dst)
+{
+ |->exception_handler_undef:
+ | SET_Z_TYPE_INFO FP + r0, IS_UNDEF
+ | jmp ->exception_handler
+
+ return 1;
+}
+
+static int zend_jit_leave_function_stub(dasm_State **Dst)
+{
+ |->leave_function_handler:
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | test FCARG1d, ZEND_CALL_TOP
+ | jnz >1
+ | EXT_CALL zend_jit_leave_nested_func_helper, r0
+ | add r4, HYBRID_SPAD // stack alignment
+ | JMP_IP
+ |1:
+ | EXT_CALL zend_jit_leave_top_func_helper, r0
+ | add r4, HYBRID_SPAD // stack alignment
+ | JMP_IP
+ } else {
+ if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD
+ } else {
+ | mov FCARG2a, FP
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD
+ }
+ | test FCARG1d, ZEND_CALL_TOP
+ | jnz >1
+ | EXT_JMP zend_jit_leave_nested_func_helper, r0
+ |1:
+ | EXT_JMP zend_jit_leave_top_func_helper, r0
+ }
+
+ return 1;
+}
+
+static int zend_jit_leave_throw_stub(dasm_State **Dst)
+{
+ |->leave_throw_handler:
+ | // if (opline->opcode != ZEND_HANDLE_EXCEPTION) {
+ if (GCC_GLOBAL_REGS) {
+ | cmp byte OP:IP->opcode, ZEND_HANDLE_EXCEPTION
+ | je >5
+ | // EG(opline_before_exception) = opline;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, opline_before_exception, IP, r0
+ |5:
+ | // opline = EG(exception_op);
+ | LOAD_IP_ADDR_ZTS executor_globals, exception_op
+ | // HANDLE_EXCEPTION()
+ | jmp ->exception_handler
+ } else {
+ | GET_IP FCARG1a
+ | cmp byte OP:FCARG1a->opcode, ZEND_HANDLE_EXCEPTION
+ | je >5
+ | // EG(opline_before_exception) = opline;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, opline_before_exception, FCARG1a, r0
+ |5:
+ | // opline = EG(exception_op);
+ | LOAD_IP_ADDR_ZTS executor_globals, exception_op
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 2 // ZEND_VM_LEAVE
+ | ret
+ }
+
+ return 1;
+}
+
+static int zend_jit_icall_throw_stub(dasm_State **Dst)
+{
+ |->icall_throw_handler:
+ | // zend_throw_exception_internal(NULL);
+ |.if X64
+ | xor CARG1, CARG1
+ | EXT_CALL zend_throw_exception_internal, r0
+ |.else
+ | sub r4, 12
+ | push 0
+ | EXT_CALL zend_throw_exception_internal, r0
+ | add r4, 16
+ |.endif
+ | // HANDLE_EXCEPTION()
+ | jmp ->exception_handler
+
+ return 1;
+}
+
+static int zend_jit_throw_cannot_pass_by_ref_stub(dasm_State **Dst)
+{
+ |->throw_cannot_pass_by_ref:
+ | mov r0, EX->opline
+ |.if X64
+ | movsxd r1, dword OP:r0->result.var
+ |.else
+ | mov r1, OP:r0->result.var
+ |.endif
+ | SET_Z_TYPE_INFO RX+r1, IS_UNDEF
+ | mov RX, r0
+ |.if X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Cannot pass parameter %d by reference"
+ | mov CARG3d, dword OP:r0->op2.num
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | mov r1, dword OP:r0->op2.num
+ | sub r4, 4
+ | push r1
+ | push "Cannot pass parameter %d by reference"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | cmp byte OP:RX->op1_type, IS_TMP_VAR
+ | jne >9
+ |.if X64
+ | movsxd r0, dword OP:RX->op1.var
+ |.else
+ | mov r0, OP:RX->op1.var
+ |.endif
+ | add r0, FP
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, 0, NULL
+ |9:
+ | jmp ->exception_handler
+
+ return 1;
+}
+
+static int zend_jit_undefined_offset_ex_stub(dasm_State **Dst)
+{
+ |->undefined_offset_ex:
+ | SAVE_OPLINE
+ | jmp ->undefined_offset
+
+ return 1;
+}
+
+static int zend_jit_undefined_offset_stub(dasm_State **Dst)
+{
+ |->undefined_offset:
+ |.if X64WIN
+ | sub r4, 0x28
+ |.elif X64
+ | sub r4, 8
+ |.else
+ | sub r4, 12
+ |.endif
+ | mov r0, EX->opline
+ |.if X64
+ | movsxd r1, dword OP:r0->result.var
+ |.else
+ | mov r1, OP:r0->result.var
+ |.endif
+ | cmp byte OP:r0->op2_type, IS_CONST
+ | SET_Z_TYPE_INFO FP + r1, IS_NULL
+ | jne >2
+ |.if X64
+ | movsxd r1, dword OP:r0->op2.constant
+ | add r0, r1
+ |.else
+ | mov r0, aword OP:r0->op2.zv
+ |.endif
+ | jmp >3
+ |2:
+ |.if X64
+ | movsxd r0, dword OP:r0->op2.var
+ |.else
+ | mov r0, OP:r0->op2.var
+ |.endif
+ | add r0, FP
+ |3:
+ |.if X64WIN
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined offset: " ZEND_LONG_FMT
+ | mov CARG3, aword [r0]
+ | EXT_CALL zend_error, r0
+ | add r4, 0x28 // stack alignment
+ |.elif X64
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined offset: " ZEND_LONG_FMT
+ | mov CARG3, aword [r0]
+ | EXT_CALL zend_error, r0
+ | add r4, 8 // stack alignment
+ |.else
+ | sub r4, 4
+ | push aword [r0]
+ | push "Undefined offset: " ZEND_LONG_FMT
+ | push E_NOTICE
+ | EXT_CALL zend_error, r0
+ | add r4, 28
+ |.endif
+ | ret
+
+ return 1;
+}
+
+static int zend_jit_undefined_index_ex_stub(dasm_State **Dst)
+{
+ |->undefined_index_ex:
+ | SAVE_OPLINE
+ | jmp ->undefined_index
+
+ return 1;
+}
+
+static int zend_jit_undefined_index_stub(dasm_State **Dst)
+{
+ |->undefined_index:
+ |.if X64WIN
+ | sub r4, 0x28
+ |.elif X64
+ | sub r4, 8
+ |.else
+ | sub r4, 12
+ |.endif
+ | mov r0, EX->opline
+ |.if X64
+ | movsxd r1, dword OP:r0->result.var
+ |.else
+ | mov r1, OP:r0->result.var
+ |.endif
+ | cmp byte OP:r0->op2_type, IS_CONST
+ | SET_Z_TYPE_INFO FP + r1, IS_NULL
+ | jne >2
+ |.if X64
+ | movsxd r1, dword OP:r0->op2.constant
+ | add r0, r1
+ |.else
+ | mov r0, aword OP:r0->op2.zv
+ |.endif
+ | jmp >3
+ |2:
+ |.if X64
+ | movsxd r0, dword OP:r0->op2.var
+ |.else
+ | mov r0, OP:r0->op2.var
+ |.endif
+ | add r0, FP
+ |3:
+ |.if X64WIN
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined index: %s"
+ | mov CARG3, aword [r0]
+ | add CARG3, offsetof(zend_string, val)
+ | EXT_CALL zend_error, r0
+ | add r4, 0x28
+ |.elif X64
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined index: %s"
+ | mov CARG3, aword [r0]
+ | add CARG3, offsetof(zend_string, val)
+ | EXT_CALL zend_error, r0
+ | add r4, 8
+ |.else
+ | sub r4, 4
+ | mov r0, aword [r0]
+ | add r0, offsetof(zend_string, val)
+ | push r0
+ | push "Undefined index: %s"
+ | push E_NOTICE
+ | EXT_CALL zend_error, r0
+ | add r4, 28
+ |.endif
+ | ret
+
+ return 1;
+}
+
+static int zend_jit_cannot_add_element_ex_stub(dasm_State **Dst)
+{
+ |->cannot_add_element_ex:
+ | SAVE_OPLINE
+ | jmp ->cannot_add_element
+
+ return 1;
+}
+
+static int zend_jit_cannot_add_element_stub(dasm_State **Dst)
+{
+ |->cannot_add_element:
+ |.if X64WIN
+ | sub r4, 0x28
+ |.elif X64
+ | sub r4, 8
+ |.else
+ | sub r4, 12
+ |.endif
+ | mov r0, EX->opline
+ | cmp byte OP:r0->result_type, IS_UNUSED
+ | jz >1
+ |.if X64
+ | movsxd r0, dword OP:r0->result.var
+ |.else
+ | mov r0, OP:r0->result.var
+ |.endif
+ | SET_Z_TYPE_INFO FP + r0, IS_NULL
+ |1:
+ |.if X64WIN
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Cannot add element to the array as the next element is already occupied"
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 0x28
+ |.elif X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Cannot add element to the array as the next element is already occupied"
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 8
+ |.else
+ | sub r4, 8
+ | push "Cannot add element to the array as the next element is already occupied"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 28
+ |.endif
+ | ret
+
+ return 1;
+}
+
+static int zend_jit_not_obj_stub(dasm_State **Dst)
+{
+ |->not_obj:
+ |.if X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Using $this when not in object context"
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 8
+ | push "Using $this when not in object context"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_undefined_function_stub(dasm_State **Dst)
+{
+ |->undefined_function:
+ | mov r0, aword EX->opline
+ |.if X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Call to undefined function %s()"
+ | movsxd CARG3, dword [r0 + offsetof(zend_op, op2.constant)]
+ | mov CARG3, aword [r0 + CARG3]
+ | add CARG3, offsetof(zend_string, val)
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 4
+ | mov r0, aword [r0 + offsetof(zend_op, op2.zv)]
+ | mov r0, aword [r0]
+ | add r0, offsetof(zend_string, val)
+ | push r0
+ | push "Call to undefined function %s()"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_negative_shift_stub(dasm_State **Dst)
+{
+ |->negative_shift:
+ | UNDEF_OPLINE_RESULT
+ |.if X64
+ |.if WIN
+ | LOAD_ADDR CARG1, &zend_ce_arithmetic_error
+ | mov CARG1, aword [CARG1]
+ |.else
+ | LOAD_ADDR CARG1, zend_ce_arithmetic_error
+ |.endif
+ | LOAD_ADDR CARG2, "Bit shift by negative number"
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 8
+ | push "Bit shift by negative number"
+ |.if WIN
+ | LOAD_ADDR r0, &zend_ce_arithmetic_error
+ | push aword [r0]
+ |.else
+ | PUSH_ADDR zend_ce_arithmetic_error, r0
+ |.endif
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_mod_by_zero_stub(dasm_State **Dst)
+{
+ |->mod_by_zero:
+ | UNDEF_OPLINE_RESULT
+ |.if X64
+ |.if WIN
+ | LOAD_ADDR CARG1, &zend_ce_division_by_zero_error
+ | mov CARG1, aword [CARG1]
+ |.else
+ | LOAD_ADDR CARG1, zend_ce_division_by_zero_error
+ |.endif
+ | LOAD_ADDR CARG2, "Modulo by zero"
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 8
+ | push "Modulo by zero"
+ |.if WIN
+ | LOAD_ADDR r0, &zend_ce_division_by_zero_error
+ | push aword [r0]
+ |.else
+ | PUSH_ADDR zend_ce_division_by_zero_error, r0
+ |.endif
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_double_one_stub(dasm_State **Dst)
+{
+ |->one:
+ |.dword 0, 0x3ff00000
+ return 1;
+}
+
+static int zend_jit_hybrid_runtime_jit_stub(dasm_State **Dst)
+{
+ |->hybrid_runtime_jit:
+ | EXT_CALL zend_runtime_jit, r0
+ | JMP_IP
+ return 1;
+}
+
+static int zend_jit_hybrid_profile_jit_stub(dasm_State **Dst)
+{
+ |->hybrid_profile_jit:
+ | // ++zend_jit_profile_counter;
+ | .if X64
+ | LOAD_ADDR r0, &zend_jit_profile_counter
+ | inc aword [r0]
+ | .else
+ | inc aword [&zend_jit_profile_counter]
+ | .endif
+ | // op_array = (zend_op_array*)EX(func);
+ | mov r0, EX->func
+ | // ++ZEND_COUNTER_INFO(op_array)
+ | mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
+#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
+ | mov r2, aword [r2]
+#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
+ | xor r1, r1
+ | test r2, 1
+ | jz >1
+ | MEM_OP2_2_ZTS mov, r1, aword, compiler_globals, map_ptr_base, r1
+ | sub r1, 1
+ |1:
+ | mov r2, aword [r1 + r2]
+#else
+# error "Unknown ZEND_MAP_PTR_KIND"
+#endif
+ | inc aword [r2 + zend_jit_profile_counter_rid * sizeof(void*)]
+ | // handler = (const void*)ZEND_FUNC_INFO(op_array);
+ | mov r0, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
+ | // return ((zend_vm_opcode_handler_t)handler)();
+ | jmp r0
+ return 1;
+}
+
+/*
+ * This code is based Mike Pall's "Hashed profile counters" idea, implemented
+ * in LuaJIT. The full description may be found in "LuaJIT 2.0 intellectual
+ * property disclosure and research opportunities" email
+ * at http://lua-users.org/lists/lua-l/2009-11/msg00089.html
+ *
+ * In addition we use a variation of Knuth's multiplicative hash function
+ * described at https://code.i-harness.com/en/q/a21ce
+ *
+ * uint64_t hash(uint64_t x) {
+ * x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
+ * x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
+ * x = x ^ (x >> 31);
+ * return x;
+ * }
+ *
+ * uint_32_t hash(uint32_t x) {
+ * x = ((x >> 16) ^ x) * 0x45d9f3b;
+ * x = ((x >> 16) ^ x) * 0x45d9f3b;
+ * x = (x >> 16) ^ x;
+ * return x;
+ * }
+ *
+ */
+static int zend_jit_hybrid_func_counter_stub(dasm_State **Dst)
+{
+ |->hybrid_func_counter:
+ | mov r0, EX->func
+ | mov r1, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
+ | mov r2, aword [r1]
+ | sub word [r2], ZEND_JIT_HOT_FUNC_COST
+ | jle >1
+ | GET_IP r2
+ | sub r2, aword [r0 + offsetof(zend_op_array, opcodes)]
+ | // divide by sizeof(zend_op)
+ | .if X64
+ || ZEND_ASSERT(sizeof(zend_op) == 32);
+ | sar r2, 5
+ | .else
+ || ZEND_ASSERT(sizeof(zend_op) == 28);
+ | sar r2, 2
+ | imul r2, 0xb6db6db7
+ | .endif
+ | .if X64
+ | jmp aword [r1+r2*8+8]
+ | .else
+ | jmp aword [r1+r2*4+4]
+ | .endif
+ |1:
+ | mov FCARG1a, FP
+ | GET_IP FCARG2a
+ | EXT_CALL zend_jit_hot_func, r0
+ | JMP_IP
+ return 1;
+}
+
+static int zend_jit_hybrid_loop_counter_stub(dasm_State **Dst)
+{
+ |->hybrid_loop_counter:
+ | mov r0, EX->func
+ | mov r1, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
+ | mov r2, aword [r1]
+ | sub word [r2], ZEND_JIT_HOT_LOOP_COST
+ | jle >1
+ | GET_IP r2
+ | sub r2, aword [r0 + offsetof(zend_op_array, opcodes)]
+ | // divide by sizeof(zend_op)
+ | .if X64
+ || ZEND_ASSERT(sizeof(zend_op) == 32);
+ | sar r2, 5
+ | .else
+ || ZEND_ASSERT(sizeof(zend_op) == 28);
+ | sar r2, 2
+ | imul r2, 0xb6db6db7
+ | .endif
+ | .if X64
+ | jmp aword [r1+r2*8+8]
+ | .else
+ | jmp aword [r1+r2*4+4]
+ | .endif
+ |1:
+ | mov FCARG1a, FP
+ | GET_IP FCARG2a
+ | EXT_CALL zend_jit_hot_func, r0
+ | JMP_IP
+ return 1;
+}
+
+#ifdef CONTEXT_THREADED_JIT
+static int zend_jit_context_threaded_call_stub(dasm_State **Dst)
+{
+ |->context_threaded_call:
+ | pop r0
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+ | jmp aword [IP]
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ | jmp aword [IP]
+ } else {
+ ZEND_ASSERT(0);
+ // TODO: context threading can't work without GLOBAL REGS because we have to change
+ // the value of execute_data in execute_ex()
+ | mov FCARG1a, FP
+ | mov r0, aword [FP]
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | jmp aword [r0]
+ }
+ return 1;
+}
+#endif
+
+static const zend_jit_stub zend_jit_stubs[] = {
+ JIT_STUB(interrupt_handler),
+ JIT_STUB(exception_handler),
+ JIT_STUB(exception_handler_undef),
+ JIT_STUB(leave_function),
+ JIT_STUB(leave_throw),
+ JIT_STUB(icall_throw),
+ JIT_STUB(throw_cannot_pass_by_ref),
+ JIT_STUB(undefined_offset),
+ JIT_STUB(undefined_index),
+ JIT_STUB(cannot_add_element),
+ JIT_STUB(undefined_offset_ex),
+ JIT_STUB(undefined_index_ex),
+ JIT_STUB(cannot_add_element_ex),
+ JIT_STUB(not_obj),
+ JIT_STUB(undefined_function),
+ JIT_STUB(negative_shift),
+ JIT_STUB(mod_by_zero),
+ JIT_STUB(double_one),
+#ifdef CONTEXT_THREADED_JIT
+ JIT_STUB(context_threaded_call),
+#endif
+};
+
+#if ZTS && defined(ZEND_WIN32)
+extern uint32_t _tls_index;
+extern char *_tls_start;
+extern char *_tls_end;
+#endif
+
+static int zend_jit_setup(void)
+{
+ if (!zend_cpu_supports(ZEND_CPU_FEATURE_SSE2)) {
+ zend_error(E_CORE_ERROR, "CPU doesn't support SSE2");
+ return FAILURE;
+ }
+ if (zend_jit_cpu_flags & ZEND_JIT_CPU_AVX) {
+ if (zend_cpu_supports(ZEND_CPU_FEATURE_AVX)) {
+ zend_jit_x86_flags |= ZEND_JIT_CPU_AVX;
+ }
+ }
+
+#if ZTS
+# ifdef _WIN64
+ tsrm_tls_index = _tls_index * sizeof(void*);
+
+ /* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
+ /* Probably, it might be better solution */
+ do {
+ void ***tls_mem = ((void***)__readgsqword(0x58))[_tls_index];
+ void *val = _tsrm_ls_cache;
+ size_t offset = 0;
+ size_t size = (char*)&_tls_end - (char*)&_tls_start;
+
+ while (offset < size) {
+ if (*tls_mem == val) {
+ tsrm_tls_offset = offset;
+ break;
+ }
+ tls_mem++;
+ offset += sizeof(void*);
+ }
+ if (offset >= size) {
+ // TODO: error message ???
+ return FAILURE;
+ }
+ } while(0);
+# elif ZEND_WIN32
+ tsrm_tls_index = _tls_index * sizeof(void*);
+
+ /* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
+ /* Probably, it might be better solution */
+ do {
+ void ***tls_mem = ((void***)__readfsdword(0x2c))[_tls_index];
+ void *val = _tsrm_ls_cache;
+ size_t offset = 0;
+ size_t size = (char*)&_tls_end - (char*)&_tls_start;
+
+ while (offset < size) {
+ if (*tls_mem == val) {
+ tsrm_tls_offset = offset;
+ break;
+ }
+ tls_mem++;
+ offset += sizeof(void*);
+ }
+ if (offset >= size) {
+ // TODO: error message ???
+ return FAILURE;
+ }
+ } while(0);
+# elif defined(__APPLE__) && defined(__x86_64__)
+ tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
+ if (tsrm_ls_cache_tcb_offset == 0) {
+ size_t *ti;
+ __asm__(
+ "leaq __tsrm_ls_cache(%%rip),%0"
+ : "=r" (ti));
+ tsrm_tls_offset = ti[2];
+ tsrm_tls_index = ti[1] * 8;
+ }
+# elif defined(__GNUC__) && defined(__x86_64__)
+ tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
+ if (tsrm_ls_cache_tcb_offset == 0) {
+#if defined(__has_attribute) && __has_attribute(tls_model)
+ size_t ret;
+
+ asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
+ : "=r" (ret));
+ tsrm_ls_cache_tcb_offset = ret;
+#else
+ size_t *ti;
+
+ __asm__(
+ "leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
+ : "=a" (ti));
+ tsrm_tls_offset = ti[1];
+ tsrm_tls_index = ti[0] * 16;
+#endif
+ }
+# elif defined(__GNUC__) && defined(__i386__)
+ tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
+ if (tsrm_ls_cache_tcb_offset == 0) {
+#if 1
+ size_t ret;
+
+ asm ("leal _tsrm_ls_cache@ntpoff,%0\n"
+ : "=a" (ret));
+ tsrm_ls_cache_tcb_offset = ret;
+#else
+ size_t *ti, _ebx, _ecx, _edx;
+
+ __asm__(
+ "call 1f\n"
+ ".subsection 1\n"
+ "1:\tmovl (%%esp), %%ebx\n\t"
+ "ret\n"
+ ".previous\n\t"
+ "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"
+ "leal _tsrm_ls_cache@tlsldm(%%ebx), %0\n\t"
+ "call ___tls_get_addr@plt\n\t"
+ "leal _tsrm_ls_cache@tlsldm(%%ebx), %0\n"
+ : "=a" (ti), "=&b" (_ebx), "=&c" (_ecx), "=&d" (_edx));
+ tsrm_tls_offset = ti[1];
+ tsrm_tls_index = ti[0] * 8;
+#endif
+ }
+# endif
+#endif
+
+ return SUCCESS;
+}
+
+static int zend_jit_align_func(dasm_State **Dst)
+{
+ reuse_ip = 0;
+ delayed_call_chain = 0;
+ last_valid_opline = NULL;
+ jit_return_label = -1;
+ |.align 16
+ return 1;
+}
+
+static int zend_jit_prologue(dasm_State **Dst)
+{
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | sub r4, HYBRID_SPAD
+ } else if (GCC_GLOBAL_REGS) {
+ | sub r4, SPAD // stack alignment
+ } else {
+ | sub r4, NR_SPAD // stack alignment
+ | mov aword T2, FP // save FP
+ | mov aword T3, RX // save IP
+ | mov FP, FCARG1a
+ }
+ return 1;
+}
+
+static int zend_jit_label(dasm_State **Dst, unsigned int label)
+{
+ |=>label:
+ return 1;
+}
+
+static int zend_jit_save_call_chain(dasm_State **Dst, uint32_t call_level)
+{
+ | // call->prev_execute_data = EX(call);
+ if (call_level == 1) {
+ | mov aword EX:RX->prev_execute_data, 0
+ } else {
+ | mov r0, EX->call
+ | mov EX:RX->prev_execute_data, r0
+ }
+ | // EX(call) = call;
+ | mov EX->call, RX
+
+ delayed_call_chain = 0;
+
+ return 1;
+}
+
+static int zend_jit_set_ip(dasm_State **Dst, const zend_op *opline)
+{
+ if (!last_valid_opline) {
+ | LOAD_IP_ADDR opline
+ } else if (last_valid_opline != opline) {
+ if (GCC_GLOBAL_REGS) {
+ | ADD_IP (opline - last_valid_opline) * sizeof(zend_op);
+ } else {
+ | LOAD_IP_ADDR opline
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_set_valid_ip(dasm_State **Dst, const zend_op *opline)
+{
+ if (delayed_call_chain) {
+ if (!zend_jit_save_call_chain(Dst, delayed_call_level)) {
+ return 0;
+ }
+ }
+ if (!zend_jit_set_ip(Dst, opline)) {
+ return 0;
+ }
+ last_valid_opline = opline;
+ reuse_ip = 0;
+ return 1;
+}
+
+static int zend_jit_check_timeout(dasm_State **Dst, const zend_op *opline)
+{
+#if 0
+ if (!zend_jit_set_valid_ip(Dst, opline)) {
+ return 0;
+ }
+ | MEM_OP2_1_ZTS cmp, byte, executor_globals, vm_interrupt, 0, r0
+ | jne ->interrupt_handler
+#else
+ | MEM_OP2_1_ZTS cmp, byte, executor_globals, vm_interrupt, 0, r0
+ if (last_valid_opline == opline) {
+ | jne ->interrupt_handler
+ } else {
+ | jne >1
+ |.cold_code
+ |1:
+ | LOAD_IP_ADDR opline
+ | jmp ->interrupt_handler
+ |.code
+ }
+#endif
+ return 1;
+}
+
+static int zend_jit_check_exception(dasm_State **Dst)
+{
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ return 1;
+}
+
+static int zend_jit_check_exception_undef_result(dasm_State **Dst, const zend_op *opline)
+{
+ if (opline->result_type & (IS_TMP_VAR|IS_VAR)) {
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | mov r0, opline->result.var
+ | jne ->exception_handler_undef
+ return 1;
+ }
+ return zend_jit_check_exception(Dst);
+}
+
+static int zend_jit_handler(dasm_State **Dst, const zend_op *opline, int may_throw)
+{
+ const void *handler;
+
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ handler = zend_get_opcode_handler_func(opline);
+ } else {
+ handler = opline->handler;
+ }
+
+ if (!zend_jit_set_valid_ip(Dst, opline)) {
+ return 0;
+ }
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, FP
+ }
+ | EXT_CALL handler, r0
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+ last_valid_opline++;
+
+ /* Skip the following OP_DATA */
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_DIM:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_STATIC_PROP:
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ case ZEND_ASSIGN_STATIC_PROP_REF:
+ case ZEND_ASSIGN_OBJ_REF:
+ last_valid_opline++;
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+static int zend_jit_tail_handler(dasm_State **Dst, const zend_op *opline)
+{
+ if (!zend_jit_set_valid_ip(Dst, opline)) {
+ return 0;
+ }
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ if (opline->opcode == ZEND_DO_UCALL ||
+ opline->opcode == ZEND_DO_FCALL_BY_NAME ||
+ opline->opcode == ZEND_DO_FCALL ||
+ opline->opcode == ZEND_RETURN) {
+
+ /* Use inlined HYBRID VM handler */
+ const void *handler = opline->handler;
+
+ | add r4, HYBRID_SPAD
+ | EXT_JMP handler, r0
+ } else {
+ const void *handler = zend_get_opcode_handler_func(opline);
+
+ | EXT_CALL handler, r0
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ }
+ } else {
+ const void *handler = opline->handler;
+
+ if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ } else {
+ | mov FCARG1a, FP
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ }
+ | EXT_JMP handler, r0
+ }
+ last_valid_opline = NULL;
+ return 1;
+}
+
+static int zend_jit_set_opline(dasm_State **Dst, const zend_op *target_opline)
+{
+ if (!reuse_ip) {
+ last_valid_opline = target_opline;
+ }
+ return 1;
+}
+
+static int zend_jit_reset_opline(dasm_State **Dst, const zend_op *target_opline)
+{
+ last_valid_opline = NULL;
+ return 1;
+}
+
+static void zend_jit_start_reuse_ip(void) {
+ last_valid_opline = NULL;
+ reuse_ip = 1;
+}
+
+static void zend_jit_stop_reuse_ip(void) {
+ reuse_ip = 0;
+}
+
+static int zend_jit_jmp(dasm_State **Dst, unsigned int target_label)
+{
+ | jmp =>target_label
+ return 1;
+}
+
+static int zend_jit_cond_jmp(dasm_State **Dst, const zend_op *next_opline, unsigned int target_label)
+{
+ | CMP_IP next_opline
+ | jne =>target_label
+
+ last_valid_opline = next_opline;
+
+ return 1;
+}
+
+#ifdef CONTEXT_THREADED_JIT
+static int zend_jit_context_threaded_call(dasm_State **Dst, const zend_op *opline, unsigned int next_block)
+{
+ if (!zend_jit_handler(Dst, opline, 1)) return 0;
+ if (opline->opcode == ZEND_DO_UCALL) {
+ | call ->context_threaded_call
+ } else {
+ const zend_op *next_opline = opline + 1;
+
+ | CMP_IP next_opline
+ | je =>next_block
+ | call ->context_threaded_call
+ }
+ return 1;
+}
+#endif
+
+static int zend_jit_call(dasm_State **Dst, const zend_op *opline, unsigned int next_block)
+{
+#ifdef CONTEXT_THREADED_JIT
+ return zend_jit_context_threaded_call(Dst, opline, next_block);
+#else
+ return zend_jit_tail_handler(Dst, opline);
+#endif
+}
+
+static int zend_jit_spill_store(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info, zend_bool set_type)
+{
+ ZEND_ASSERT(Z_MODE(src) == IS_REG);
+ ZEND_ASSERT(Z_MODE(dst) == IS_MEM_ZVAL);
+
+ if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
+ | SET_ZVAL_LVAL dst, Ra(Z_REG(src))
+ if (set_type) {
+ | SET_ZVAL_TYPE_INFO dst, IS_LONG
+ }
+ } else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ | SSE_SET_ZVAL_DVAL dst, Z_REG(src)
+ if (set_type) {
+ | SET_ZVAL_TYPE_INFO dst, IS_DOUBLE
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ return 1;
+}
+
+static int zend_jit_load_reg(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info)
+{
+ ZEND_ASSERT(Z_MODE(src) == IS_MEM_ZVAL);
+ ZEND_ASSERT(Z_MODE(dst) == IS_REG);
+
+ if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
+ | GET_ZVAL_LVAL Z_REG(dst), src
+ } else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ | SSE_GET_ZVAL_DVAL Z_REG(dst), src
+ } else {
+ ZEND_ASSERT(0);
+ }
+ return 1;
+}
+
+static int zend_jit_store_ssa_var(dasm_State **Dst, zend_ssa *ssa, int var, zend_reg reg)
+{
+ zend_jit_addr src = ZEND_ADDR_REG(reg);
+ zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, ssa->vars[var].var));
+ uint32_t info = ssa->var_info[var].type;
+
+ return zend_jit_spill_store(Dst, src, dst, info, 1);
+}
+
+static int zend_jit_store_ssa_var_if_necessary(dasm_State **Dst, zend_ssa *ssa, zend_lifetime_interval **ra, zend_jit_addr src, int var, int old_var)
+{
+ if (Z_MODE(src) == IS_REG && ra[var] && ra[var]->store) {
+ zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, ssa->vars[var].var));
+ uint32_t info = ssa->var_info[var].type;
+ zend_bool set_type = 1;
+
+ if (old_var >= 0) {
+ uint32_t old_info = ssa->var_info[old_var].type;
+ if ((info & (MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)) ==
+ (old_info & (MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF))) {
+ if (!ra[old_var] || ra[old_var]->load || ra[old_var]->store) {
+ set_type = 0;
+ }
+ }
+ }
+ return zend_jit_spill_store(Dst, src, dst, info, set_type);
+ }
+ return 1;
+}
+
+static int zend_jit_load_ssa_var(dasm_State **Dst, zend_ssa *ssa, int var, zend_reg reg)
+{
+ zend_jit_addr src = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, ssa->vars[var].var));
+ zend_jit_addr dst = ZEND_ADDR_REG(reg);
+ uint32_t info = ssa->var_info[var].type;
+
+ return zend_jit_load_reg(Dst, src, dst, info);
+}
+
+static int zend_jit_update_regs(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info, zend_lifetime_interval *src_ival)
+{
+ if (src != dst) {
+ if (Z_MODE(src) == IS_REG) {
+ if (Z_MODE(dst) == IS_REG) {
+ if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
+ | mov Ra(Z_REG(dst)), Ra(Z_REG(src))
+ } else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ | SSE_AVX_INS movsd, vmovaps, xmm(Z_REG(dst)-ZREG_XMM0), xmm(Z_REG(src)-ZREG_XMM0)
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else if (Z_MODE(dst) == IS_MEM_ZVAL) {
+ if (!src_ival->load && !src_ival->store) {
+ if (!zend_jit_spill_store(Dst, src, dst, info, 1)) {
+ return 0;
+ }
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else if (Z_MODE(src) == IS_MEM_ZVAL) {
+ if (Z_MODE(dst) == IS_REG) {
+ if (!zend_jit_load_reg(Dst, src, dst, info)) {
+ return 0;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info, op1_def_info, res_use_info = 0;
+ zend_jit_addr op1_addr, op1_def_addr, res_addr = 0;
+
+ op1_info = OP1_INFO();
+ if (opline->op1_type != IS_CV || !(op1_info & MAY_BE_LONG)) {
+ goto fallback;
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ op1_def_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_def : -1);
+ if (opline->result_type != IS_UNUSED) {
+ res_use_info = RES_USE_INFO();
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+ }
+
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)-MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >2
+ }
+ if ((opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+ }
+ if (op1_addr != op1_def_addr) {
+ if (Z_MODE(op1_addr) != IS_REG && Z_MODE(op1_def_addr) == IS_REG &&
+ (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC)) {
+ if (!zend_jit_update_regs(Dst, res_addr, op1_def_addr, MAY_BE_LONG, ra[ssa->ops[opline - op_array->opcodes].op1_use])) {
+ return 0;
+ }
+ } else {
+ if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, MAY_BE_LONG, ra[ssa->ops[opline - op_array->opcodes].op1_use])) {
+ return 0;
+ }
+ }
+ }
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ | LONG_OP_WITH_CONST add, op1_def_addr, Z_L(1)
+ } else {
+ | LONG_OP_WITH_CONST sub, op1_def_addr, Z_L(1)
+ }
+ op1_def_info = OP1_DEF_INFO();
+
+ if ((op1_def_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa)) {
+ | jo >1
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+ }
+ |.cold_code
+ |1:
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ |.if X64
+ | mov64 rax, 0x43e0000000000000
+ | SET_ZVAL_LVAL op1_def_addr, rax
+ |.else
+ | SET_ZVAL_LVAL op1_def_addr, 0
+ | SET_ZVAL_W2 op1_def_addr, 0x41e00000
+ |.endif
+ } else {
+ |.if X64
+ | mov64 rax, 0xc3e0000000000000
+ | SET_ZVAL_LVAL op1_def_addr, rax
+ |.else
+ | SET_ZVAL_LVAL op1_def_addr, 0x00200000
+ | SET_ZVAL_W2 op1_def_addr, 0xc1e00000
+ |.endif
+ }
+ | SET_ZVAL_TYPE_INFO op1_def_addr, IS_DOUBLE
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R1
+ }
+ | jmp >3
+ |.code
+ } else {
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+ }
+ }
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
+ |.cold_code
+ |2:
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | SAVE_VALID_OPLINE opline
+ if (op1_info & MAY_BE_UNDEF) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >2
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_NULL
+ op1_info |= MAY_BE_NULL;
+ }
+ |2:
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+
+ | // ZVAL_DEREF(var_ptr);
+ if (op1_info & MAY_BE_REF) {
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >2
+ | GET_Z_PTR FCARG2a, FCARG1a
+ | cmp aword [FCARG2a + offsetof(zend_reference, sources.ptr)], 0
+ | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)]
+ | jz >2
+ |.if X64
+ if (RETURN_VALUE_USED(opline)) {
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ } else {
+ | mov CARG3, 0
+ }
+ |.else
+ | sub r4, 12
+ if (RETURN_VALUE_USED(opline)) {
+ | PUSH_ZVAL_ADDR res_addr, r0
+ } else {
+ | push 0
+ }
+ |.endif
+ if (opline->opcode == ZEND_PRE_INC) {
+ | EXT_CALL zend_jit_pre_inc_typed_ref, r0
+ } else if (opline->opcode == ZEND_PRE_DEC) {
+ | EXT_CALL zend_jit_pre_dec_typed_ref, r0
+ } else if (opline->opcode == ZEND_POST_INC) {
+ | EXT_CALL zend_jit_post_inc_typed_ref, r0
+ } else if (opline->opcode == ZEND_POST_DEC) {
+ | EXT_CALL zend_jit_post_dec_typed_ref, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ zend_jit_check_exception(Dst);
+ | jmp >3
+ |2:
+ }
+
+ if ((opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC)) {
+ if (opline->result_type != IS_UNUSED) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ | ZVAL_COPY_VALUE res_addr, res_use_info, val_addr, op1_info, ZREG_R0, ZREG_R2
+ | TRY_ADDREF op1_info, ah, r2
+ }
+ }
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ | EXT_CALL increment_function, r0
+ } else {
+ | EXT_CALL decrement_function, r0
+ }
+ } else {
+ zend_reg tmp_reg;
+
+ if ((opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC)) {
+ if (opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R2
+ }
+ }
+ if (Z_MODE(op1_def_addr) == IS_REG) {
+ tmp_reg = Z_REG(op1_def_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && zend_ssa_is_last_use(op_array, ssa, ssa->ops[opline-op_array->opcodes].op1_use, opline-op_array->opcodes)) {
+ tmp_reg = Z_REG(op1_addr);
+ } else {
+ tmp_reg = ZREG_XMM0;
+ }
+ | SSE_GET_ZVAL_DVAL tmp_reg, op1_addr
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | vaddsd xmm(tmp_reg-ZREG_XMM0), xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ } else {
+ | addsd xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ }
+ } else {
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | vsubsd xmm(tmp_reg-ZREG_XMM0), xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ } else {
+ | subsd xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ }
+ }
+ | SSE_SET_ZVAL_DVAL op1_def_addr, tmp_reg
+ }
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, op1_def_info, ZREG_R0, ZREG_R1
+ | TRY_ADDREF op1_def_info, ah, r1
+ }
+ | jmp >3
+ |.code
+ }
+ |3:
+ if (ra && !zend_jit_store_ssa_var_if_necessary(Dst, ssa, ra, op1_def_addr, ssa->ops[opline - op_array->opcodes].op1_def, ssa->ops[opline - op_array->opcodes].op1_use)) {
+ return 0;
+ }
+ if (opline->result_type != IS_UNUSED) {
+ if (ra && !zend_jit_store_ssa_var_if_necessary(Dst, ssa, ra, res_addr, ssa->ops[opline - op_array->opcodes].result_def, ssa->ops[opline - op_array->opcodes].result_use)) {
+ return 0;
+ }
+ }
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_math_long_long(dasm_State **Dst,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ const zend_op *opline,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ uint32_t res_use_info)
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+ zend_reg result_reg;
+
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && zend_ssa_is_last_use(op_array, ssa, ssa->ops[opline-op_array->opcodes].op1_use, opline-op_array->opcodes)) {
+ result_reg = Z_REG(op1_addr);
+ } else {
+ result_reg = ZREG_R0;
+ }
+
+ if (opcode == ZEND_MUL &&
+ ((Z_MODE(op2_addr) == IS_CONST_ZVAL &&
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op2_addr))) &&
+ is_power_of_two(Z_LVAL_P(Z_ZV(op2_addr)))) ||
+ (Z_MODE(op1_addr) == IS_CONST_ZVAL &&
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op1_addr))) &&
+ is_power_of_two(Z_LVAL_P(Z_ZV(op1_addr)))))) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
+ } else {
+ | GET_ZVAL_LVAL result_reg, op2_addr
+ | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op1_addr)))
+ }
+ } else if (opcode == ZEND_DIV &&
+ (Z_MODE(op2_addr) == IS_CONST_ZVAL &&
+ is_power_of_two(Z_LVAL_P(Z_ZV(op2_addr))))) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shr Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
+ } else {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ if (same_ops && opcode != ZEND_DIV) {
+ | LONG_MATH_REG opcode, Ra(result_reg), Ra(result_reg)
+ } else {
+ | LONG_MATH opcode, result_reg, op2_addr
+ }
+ }
+ if ((res_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa)) {
+ | jo >1
+ |.cold_code
+ |1:
+ zend_reg tmp_reg1 = ZREG_XMM0;
+ zend_reg tmp_reg2 = ZREG_XMM1;
+
+ | SSE_GET_ZVAL_LVAL tmp_reg1, op1_addr
+ | SSE_GET_ZVAL_LVAL tmp_reg2, op2_addr
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | AVX_MATH_REG opcode, tmp_reg1, tmp_reg1, tmp_reg2
+ } else {
+ | SSE_MATH_REG opcode, tmp_reg1, tmp_reg2
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, tmp_reg1
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ | jmp >2
+ |.code
+ | SET_ZVAL_LVAL res_addr, Ra(result_reg)
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_LONG
+ }
+ }
+ |2:
+ } else if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ | SET_ZVAL_LVAL res_addr, Ra(result_reg)
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_LONG
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_long_double(dasm_State **Dst,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ const zend_op *opline,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_use_info)
+{
+ zend_reg result_reg =
+ (Z_MODE(res_addr) == IS_REG) ? Z_REG(res_addr) : ZREG_XMM0;
+
+ | SSE_GET_ZVAL_LVAL result_reg, op1_addr
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | AVX_MATH opcode, result_reg, result_reg, op2_addr
+ } else {
+ | SSE_MATH opcode, result_reg, op2_addr
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, result_reg
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_double_long(dasm_State **Dst,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ const zend_op *opline,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_use_info)
+{
+ zend_reg result_reg;
+
+ if (zend_is_commutative(opcode)) {
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else {
+ result_reg = ZREG_XMM0;
+ }
+ | SSE_GET_ZVAL_LVAL result_reg, op2_addr
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | AVX_MATH opcode, result_reg, result_reg, op1_addr
+ } else {
+ | SSE_MATH opcode, result_reg, op1_addr
+ }
+ } else {
+ zend_reg tmp_reg;
+
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ tmp_reg = ZREG_XMM0;
+ } else if (Z_MODE(op1_addr) == IS_REG && zend_ssa_is_last_use(op_array, ssa, ssa->ops[opline-op_array->opcodes].op1_use, opline-op_array->opcodes)) {
+ result_reg = Z_REG(op1_addr);
+ tmp_reg = ZREG_XMM0;
+ } else {
+ result_reg = ZREG_XMM0;
+ tmp_reg = ZREG_XMM1;
+ }
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ zend_reg op1_reg;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ op1_reg = Z_REG(op1_addr);
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ op1_reg = result_reg;
+ }
+ | SSE_GET_ZVAL_LVAL tmp_reg, op2_addr
+ | AVX_MATH_REG opcode, result_reg, op1_reg, tmp_reg
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ | SSE_GET_ZVAL_LVAL tmp_reg, op2_addr
+ | SSE_MATH_REG opcode, result_reg, tmp_reg
+ }
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, result_reg
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_double_double(dasm_State **Dst,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ const zend_op *opline,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_use_info)
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+ zend_reg result_reg;
+
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && zend_ssa_is_last_use(op_array, ssa, ssa->ops[opline-op_array->opcodes].op1_use, opline-op_array->opcodes)) {
+ result_reg = Z_REG(op1_addr);
+ } else {
+ result_reg = ZREG_XMM0;
+ }
+
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ zend_reg op1_reg;
+ zend_jit_addr val_addr;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ op1_reg = Z_REG(op1_addr);
+ val_addr = op2_addr;
+ } else if (Z_MODE(op2_addr) == IS_REG && zend_is_commutative(opcode)) {
+ op1_reg = Z_REG(op2_addr);
+ val_addr = op1_addr;
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ op1_reg = result_reg;
+ val_addr = op2_addr;
+ }
+ if ((opcode == ZEND_MUL) &&
+ Z_MODE(val_addr) == IS_CONST_ZVAL && Z_DVAL_P(Z_ZV(val_addr)) == 2.0) {
+ | AVX_MATH_REG ZEND_ADD, result_reg, op1_reg, op1_reg
+ } else {
+ | AVX_MATH opcode, result_reg, op1_reg, val_addr
+ }
+ } else {
+ zend_jit_addr val_addr;
+
+ if (Z_MODE(op1_addr) != IS_REG && Z_MODE(op2_addr) == IS_REG && zend_is_commutative(opcode)) {
+ | SSE_GET_ZVAL_DVAL result_reg, op2_addr
+ val_addr = op1_addr;
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ val_addr = op2_addr;
+ }
+ if (same_ops) {
+ | SSE_MATH_REG opcode, result_reg, result_reg
+ } else if ((opcode == ZEND_MUL) &&
+ Z_MODE(val_addr) == IS_CONST_ZVAL && Z_DVAL_P(Z_ZV(val_addr)) == 2.0) {
+ | SSE_MATH_REG ZEND_ADD, result_reg, result_reg
+ } else {
+ | SSE_MATH opcode, result_reg, val_addr
+ }
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, result_reg
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_helper(dasm_State **Dst,
+ const zend_op *opline,
+ zend_uchar opcode,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ zend_uchar op1_type,
+ znode_op op1,
+ zend_jit_addr op1_addr,
+ uint32_t op1_info,
+ zend_uchar op2_type,
+ znode_op op2,
+ zend_jit_addr op2_addr,
+ uint32_t op2_info,
+ uint32_t res_var,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ uint32_t res_use_info)
+/* Labels: 1,2,3,4,5,6 */
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >3
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >6
+ }
+ }
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_LONG))) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >1
+ |.cold_code
+ |1:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >6
+ }
+ if (!zend_jit_math_long_double(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ | jmp >5
+ |.code
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+ }
+ if (!zend_jit_math_long_long(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_info, res_use_info)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ |3:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >6
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops) {
+ | IF_NOT_ZVAL_TYPE, op2_addr, IS_DOUBLE, >1
+ } else {
+ | IF_NOT_ZVAL_TYPE, op2_addr, IS_DOUBLE, >6
+ }
+ }
+ if (!zend_jit_math_double_double(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ | jmp >5
+ }
+ if (!same_ops) {
+ |1:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+ if (!zend_jit_math_double_long(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ | jmp >5
+ }
+ |.code
+ }
+ } else if ((op1_info & MAY_BE_DOUBLE) &&
+ !(op1_info & MAY_BE_LONG) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >6
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >1
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >6
+ }
+ }
+ if (!zend_jit_math_double_double(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |1:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+ if (!zend_jit_math_double_long(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ | jmp >5
+ |.code
+ }
+ }
+ } else if ((op2_info & MAY_BE_DOUBLE) &&
+ !(op2_info & MAY_BE_LONG) &&
+ (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >6
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >1
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >6
+ }
+ }
+ if (!zend_jit_math_double_double(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |1:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >6
+ }
+ if (!zend_jit_math_long_double(Dst, op_array, ssa, opline, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ | jmp >5
+ |.code
+ }
+ }
+ }
+
+ |5:
+
+ if ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ if ((op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ |.cold_code
+ }
+ |6:
+ | SAVE_VALID_OPLINE opline
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ | LOAD_ZVAL_ADDR FCARG1a, real_addr
+ } else if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ if (opcode == ZEND_ADD) {
+ | EXT_CALL add_function, r0
+ } else if (opcode == ZEND_SUB) {
+ | EXT_CALL sub_function, r0
+ } else if (opcode == ZEND_MUL) {
+ | EXT_CALL mul_function, r0
+ } else if (opcode == ZEND_DIV) {
+ | EXT_CALL div_function, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception(Dst);
+ }
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ if (!zend_jit_load_reg(Dst, real_addr, res_addr, res_info)) {
+ return 0;
+ }
+ }
+ if ((op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | jmp <5
+ |.code
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math(dasm_State **Dst, const zend_op *opline, int *opnum, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info, op2_info, res_use_info;
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ res_use_info = RES_USE_INFO();
+
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ goto fallback;
+ }
+
+ if (!(op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) ||
+ !(op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ goto fallback;
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op2_use : -1);
+
+ if (opline->result_type == IS_TMP_VAR &&
+ (opline+1)->opcode == ZEND_SEND_VAL &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == ssa->cfg.map[opline - op_array->opcodes]) {
+ /* Eliminate the following SEND_VAL */
+ (*opnum)++;
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
+ res_use_info = -1;
+ } else {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ssa->ops[opline - op_array->opcodes].result_def);
+ }
+
+ if (!zend_jit_math_helper(Dst, opline, opline->opcode, op_array, ssa, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, opline->result.var, res_addr, RES_INFO(), res_use_info)) {
+ return 0;
+ }
+ if (ra && !zend_jit_store_ssa_var_if_necessary(Dst, ssa, ra, res_addr, ssa->ops[opline - op_array->opcodes].result_def, ssa->ops[opline - op_array->opcodes].result_use)) {
+ return 0;
+ }
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_long_math_helper(dasm_State **Dst,
+ const zend_op *opline,
+ zend_uchar opcode,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ zend_uchar op1_type,
+ znode_op op1,
+ zend_jit_addr op1_addr,
+ uint32_t op1_info,
+ int op1_ssa_var,
+ zend_uchar op2_type,
+ znode_op op2,
+ zend_jit_addr op2_addr,
+ uint32_t op2_info,
+ int op2_ssa_var,
+ uint32_t res_var,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ uint32_t res_use_info)
+/* Labels: 6 */
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+ zend_reg result_reg;
+ zval tmp;
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >6
+ }
+ if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+
+ if (opcode == ZEND_MOD && Z_MODE(op2_addr) == IS_CONST_ZVAL &&
+ op1_ssa_var >= 0 &&
+ ssa->var_info[op1_ssa_var].has_range &&
+ ssa->var_info[op1_ssa_var].range.min >= 0) {
+ zend_long l = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (zend_long_is_power_of_two(l)) {
+ /* Optimisation for mod of power of 2 */
+ opcode = ZEND_BW_AND;
+ ZVAL_LONG(&tmp, l - 1);
+ op2_addr = ZEND_ADDR_CONST_ZVAL(&tmp);
+ }
+ }
+
+ if (opcode == ZEND_MOD) {
+ result_reg = ZREG_RAX;
+ } else if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && zend_ssa_is_last_use(op_array, ssa, ssa->ops[opline-op_array->opcodes].op1_use, opline-op_array->opcodes)) {
+ result_reg = Z_REG(op1_addr);
+ } else {
+ result_reg = ZREG_R0;
+ }
+
+ if (opcode == ZEND_SL) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
+ if (EXPECTED(op2_lval > 0)) {
+ | xor Ra(result_reg), Ra(result_reg)
+ } else {
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ }
+ } else {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shl Ra(result_reg), op2_lval
+ }
+ } else {
+ if (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_RCX) {
+ | GET_ZVAL_LVAL ZREG_RCX, op2_addr
+ }
+ if (op2_ssa_var < 0 ||
+ !ssa->var_info[op2_ssa_var].has_range ||
+ ssa->var_info[op2_ssa_var].range.min < 0 ||
+ ssa->var_info[op2_ssa_var].range.max >= SIZEOF_ZEND_LONG * 8) {
+ | cmp r1, (SIZEOF_ZEND_LONG*8)
+ | jae >1
+ |.cold_code
+ |1:
+ | cmp r1, 0
+ | mov Ra(result_reg), 0
+ | jg >1
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ |.code
+ }
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shl Ra(result_reg), cl
+ |1:
+ }
+ } else if (opcode == ZEND_SR) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
+ if (EXPECTED(op2_lval > 0)) {
+ | sar Ra(result_reg), (SIZEOF_ZEND_LONG * 8) - 1
+ } else {
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ }
+ } else {
+ | sar Ra(result_reg), op2_lval
+ }
+ } else {
+ if (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_RCX) {
+ | GET_ZVAL_LVAL ZREG_RCX, op2_addr
+ }
+ if (op2_ssa_var < 0 ||
+ !ssa->var_info[op2_ssa_var].has_range ||
+ ssa->var_info[op2_ssa_var].range.min < 0 ||
+ ssa->var_info[op2_ssa_var].range.max >= SIZEOF_ZEND_LONG * 8) {
+ | cmp r1, (SIZEOF_ZEND_LONG*8)
+ | jae >1
+ |.cold_code
+ |1:
+ | cmp r1, 0
+ | mov r1, (SIZEOF_ZEND_LONG * 8) - 1
+ | jg >1
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ |.code
+ }
+ |1:
+ | sar Ra(result_reg), cl
+ }
+ } else if (opcode == ZEND_MOD) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (op2_lval == 0) {
+ | SAVE_VALID_OPLINE opline
+ | jmp ->mod_by_zero
+ } else if (op2_lval == -1) {
+ | xor Ra(result_reg), Ra(result_reg)
+ } else {
+ result_reg = ZREG_RDX;
+ | GET_ZVAL_LVAL ZREG_RAX, op1_addr
+ | GET_ZVAL_LVAL ZREG_RCX, op2_addr
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ | idiv Ra(ZREG_RCX)
+ }
+ } else {
+ if (op2_ssa_var < 0 ||
+ !ssa->var_info[op2_ssa_var].has_range ||
+ (ssa->var_info[op2_ssa_var].range.min <= 0 &&
+ ssa->var_info[op2_ssa_var].range.max >= 0)) {
+ if (Z_MODE(op2_addr) == IS_MEM_ZVAL) {
+ | cmp aword [Ra(Z_REG(op2_addr))+Z_OFFSET(op2_addr)], 0
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ | test Ra(Z_REG(op2_addr)), Ra(Z_REG(op2_addr))
+ }
+ | jz >1
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | jmp ->mod_by_zero
+ |.code
+ }
+
+ //TODO: add check for -1 ???
+
+ result_reg = ZREG_RDX;
+ | GET_ZVAL_LVAL ZREG_RAX, op1_addr
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ if (Z_MODE(op2_addr) == IS_MEM_ZVAL) {
+ | idiv aword [Ra(Z_REG(op2_addr))+Z_OFFSET(op2_addr)]
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ | idiv Ra(Z_REG(op2_addr))
+ }
+ }
+ } else if (same_ops) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | LONG_MATH_REG opcode, Ra(result_reg), Ra(result_reg)
+ } else {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | LONG_MATH opcode, result_reg, op2_addr
+ }
+
+ | SET_ZVAL_LVAL res_addr, Ra(result_reg)
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_LONG
+ }
+ }
+ }
+
+ if ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ if ((op1_info & MAY_BE_LONG) &&
+ (op2_info & MAY_BE_LONG)) {
+ |5:
+ |.cold_code
+ }
+ |6:
+ | SAVE_VALID_OPLINE opline
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ | LOAD_ZVAL_ADDR FCARG1a, real_addr
+ } else if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ if (opcode == ZEND_BW_OR) {
+ | EXT_CALL bitwise_or_function, r0
+ } else if (opcode == ZEND_BW_AND) {
+ | EXT_CALL bitwise_and_function, r0
+ } else if (opcode == ZEND_BW_XOR) {
+ | EXT_CALL bitwise_xor_function, r0
+ } else if (opcode == ZEND_SL) {
+ | EXT_CALL shift_left_function, r0
+ } else if (opcode == ZEND_SR) {
+ | EXT_CALL shift_right_function, r0
+ } else if (opcode == ZEND_MOD) {
+ | EXT_CALL mod_function, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception(Dst);
+ }
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ if (!zend_jit_load_reg(Dst, real_addr, res_addr, res_info)) {
+ return 0;
+ }
+ }
+ if ((op1_info & MAY_BE_LONG) &&
+ (op2_info & MAY_BE_LONG)) {
+ | jmp <5
+ |.code
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_long_math(dasm_State **Dst, const zend_op *opline, int *opnum, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info, op2_info, res_use_info;
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+ int op1_ssa_var, op2_ssa_var;
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ if (ssa->ops) {
+ op1_ssa_var = ssa->ops[opline - op_array->opcodes].op1_use;
+ op2_ssa_var = ssa->ops[opline - op_array->opcodes].op2_use;
+ } else {
+ op1_ssa_var = op2_ssa_var = -1;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ res_use_info = RES_USE_INFO();
+
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ goto fallback;
+ }
+
+ if (!(op1_info & MAY_BE_LONG) ||
+ !(op2_info & MAY_BE_LONG)) {
+ goto fallback;
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op2_use : -1);
+
+ if (opline->result_type == IS_TMP_VAR &&
+ (opline+1)->opcode == ZEND_SEND_VAL &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == ssa->cfg.map[opline - op_array->opcodes]) {
+ /* Eliminate the following SEND_VAL */
+ (*opnum)++;
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
+ res_use_info = -1;
+ } else {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+ }
+
+ if (!zend_jit_long_math_helper(Dst, opline, opline->opcode, op_array, ssa, opline->op1_type, opline->op1, op1_addr, op1_info, op1_ssa_var, opline->op2_type, opline->op2, op2_addr, op2_info, op2_ssa_var, opline->result.var, res_addr, RES_INFO(), res_use_info)) {
+ return 0;
+ }
+ if (ra && !zend_jit_store_ssa_var_if_necessary(Dst, ssa, ra, res_addr, ssa->ops[opline - op_array->opcodes].result_def, ssa->ops[opline - op_array->opcodes].result_use)) {
+ return 0;
+ }
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_concat_helper(dasm_State **Dst,
+ const zend_op *opline,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ zend_uchar op1_type,
+ znode_op op1,
+ zend_jit_addr op1_addr,
+ uint32_t op1_info,
+ zend_uchar op2_type,
+ znode_op op2,
+ zend_jit_addr op2_addr,
+ uint32_t op2_info,
+ zend_jit_addr res_addr,
+ uint32_t res_info)
+{
+#if 1
+ if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >6
+ }
+ if (op2_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_STRING, >6
+ }
+ if (Z_MODE(op1_addr) == IS_MEM_ZVAL && Z_REG(op1_addr) == Z_REG(res_addr) && Z_OFFSET(op1_addr) == Z_OFFSET(res_addr)) {
+ if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ | EXT_CALL zend_jit_fast_assign_concat_helper, r0
+ } else {
+ if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_fast_concat_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ }
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ |5:
+ }
+ if ((op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) ||
+ (op2_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING))) {
+ if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
+ |.cold_code
+ |6:
+ }
+#endif
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ | EXT_CALL concat_function, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception(Dst);
+ }
+#if 1
+ if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
+ | jmp <5
+ |.code
+ }
+ }
+#endif
+
+ return 1;
+}
+
+static int zend_jit_concat(dasm_State **Dst, const zend_op *opline, int *opnum, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info, op2_info;
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ goto fallback;
+ }
+
+ if (!(op1_info & MAY_BE_STRING) ||
+ !(op2_info & MAY_BE_STRING)) {
+ goto fallback;
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+
+ if (opline->result_type == IS_TMP_VAR &&
+ (opline+1)->opcode == ZEND_SEND_VAL &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == ssa->cfg.map[opline - op_array->opcodes]) {
+ /* Eliminate the following SEND_VAL */
+ (*opnum)++;
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
+ } else {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+ }
+ return zend_jit_concat_helper(Dst, opline, op_array, ssa, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, res_addr, RES_INFO());
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t type, uint32_t op1_info, uint32_t op2_info, uint32_t found, uint32_t not_found)
+/* Labels: 1,2,3,4,5 */
+{
+ zend_jit_addr op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ if (op2_info & MAY_BE_LONG) {
+ if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_LONG)) {
+ | // if (EXPECTED(Z_TYPE_P(dim) == IS_LONG))
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >3
+ }
+ | // hval = Z_LVAL_P(dim);
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op2_addr
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long val = Z_LVAL_P(Z_ZV(op2_addr));
+ if (val >= 0 && val < HT_MAX_SIZE) {
+ | // ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ | test dword [FCARG1a + offsetof(zend_array, u.flags)], HASH_FLAG_PACKED
+ | jz >4 // HASH_FIND
+ | // if (EXPECTED((zend_ulong)(_h) < (zend_ulong)(_ht)->nNumUsed))
+ |.if X64
+ | movsxd r0, dword [FCARG1a + offsetof(zend_array, nNumUsed)]
+ if (val == 0) {
+ | test r0, r0
+ } else {
+ | cmp r0, val
+ }
+ |.else
+ | cmp dword [FCARG1a + offsetof(zend_array, nNumUsed)], val
+ |.endif
+ if (type == BP_JIT_IS) {
+ | jbe >9 // NOT_FOUND
+ } else {
+ | jbe >2 // NOT_FOUND
+ }
+ | // _ret = &_ht->arData[_h].val;
+ | mov r0, aword [FCARG1a + offsetof(zend_array, arData)]
+ if (val != 0) {
+ | add r0, val * sizeof(Bucket)
+ }
+ if (type == BP_JIT_IS) {
+ | jmp >5
+ } else {
+ | IF_NOT_Z_TYPE r0, IS_UNDEF, >8
+ }
+ }
+ } else {
+ | // ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ | test dword [FCARG1a + offsetof(zend_array, u.flags)], HASH_FLAG_PACKED
+ | jz >4 // HASH_FIND
+ | // if (EXPECTED((zend_ulong)(_h) < (zend_ulong)(_ht)->nNumUsed))
+ |.if X64
+ | movsxd r0, dword [FCARG1a + offsetof(zend_array, nNumUsed)]
+ | cmp r0, FCARG2a
+ |.else
+ | cmp dword [FCARG1a + offsetof(zend_array, nNumUsed)], FCARG2a
+ |.endif
+ if (type == BP_JIT_IS) {
+ | jbe >9 // NOT_FOUND
+ } else {
+ | jbe >2 // NOT_FOUND
+ }
+ | // _ret = &_ht->arData[_h].val;
+ |.if X64
+ | mov r0, FCARG2a
+ | shl r0, 5
+ |.else
+ | imul r0, FCARG2a, sizeof(Bucket)
+ |.endif
+ | add r0, aword [FCARG1a + offsetof(zend_array, arData)]
+ if (type == BP_JIT_IS) {
+ | jmp >5
+ } else {
+ | IF_NOT_Z_TYPE r0, IS_UNDEF, >8
+ }
+ }
+ }
+ switch (type) {
+ case BP_JIT_IS:
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ |4:
+ }
+ | EXT_CALL zend_hash_index_find, r0
+ | test r0, r0
+ | jz >9 // NOT_FOUND
+ if (op2_info & MAY_BE_STRING) {
+ | jmp >5
+ }
+ break;
+ case BP_VAR_R:
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long val = Z_LVAL_P(Z_ZV(op2_addr));
+ if (val >= 0 && val < HT_MAX_SIZE) {
+ | jmp >2 // NOT_FOUND
+ }
+ } else {
+ | jmp >2 // NOT_FOUND
+ }
+ |4:
+ }
+ | EXT_CALL zend_hash_index_find, r0
+ | test r0, r0
+ | jz >2 // NOT_FOUND
+ |.cold_code
+ |2:
+ switch (type) {
+ case BP_VAR_R:
+ | // zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ | // retval = &EG(uninitialized_zval);
+ | UNDEFINED_OFFSET opline
+ | jmp >9
+ break;
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ | // retval = &EG(uninitialized_zval);
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ | jmp >9
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ |.code
+ break;
+ case BP_VAR_RW:
+ |2:
+ | SAVE_VALID_OPLINE opline
+ | // zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ | //retval = zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+ | EXT_CALL zend_jit_fetch_dimension_rw_long_helper, r0
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ | jmp >8
+ |4:
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_hash_index_lookup_rw, r0
+ }
+ break;
+ case BP_VAR_W:
+ |2:
+ | //retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
+ |.if X64
+ | LOAD_ADDR_ZTS CARG3, executor_globals, uninitialized_zval
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR_ZTS executor_globals, uninitialized_zval, r0
+ |.endif
+ | EXT_CALL zend_hash_index_add_new, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ | jmp >8
+ |4:
+ | EXT_CALL zend_jit_hash_index_lookup_w, r0
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+
+ if (type != BP_JIT_IS && (op2_info & MAY_BE_STRING)) {
+ | jmp >8
+ }
+ }
+
+ if (op2_info & MAY_BE_STRING) {
+ |3:
+ if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_STRING))) {
+ | // if (EXPECTED(Z_TYPE_P(dim) == IS_STRING))
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_STRING, >3
+ }
+ | // offset_key = Z_STR_P(dim);
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op2_addr
+ | // retval = zend_hash_find(ht, offset_key);
+ switch (type) {
+ case BP_JIT_IS:
+ if (opline->op2_type != IS_CONST) {
+ | cmp byte [FCARG2a + offsetof(zend_string, val)], '9'
+ | jle >1
+ |.cold_code
+ |1:
+ | EXT_CALL zend_jit_symtable_find, r0
+ | jmp >1
+ |.code
+ | EXT_CALL zend_hash_find, r0
+ |1:
+ } else {
+ | EXT_CALL _zend_hash_find_known_hash, r0
+ }
+ | test r0, r0
+ | jz >9 // NOT_FOUND
+ | // if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT))
+ | IF_NOT_Z_TYPE r0, IS_INDIRECT, >1
+ | GET_Z_PTR r0, r0
+ |1:
+ break;
+ case BP_VAR_R:
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ if (opline->op2_type != IS_CONST) {
+ | cmp byte [FCARG2a + offsetof(zend_string, val)], '9'
+ | jle >1
+ |.cold_code
+ |1:
+ | EXT_CALL zend_jit_symtable_find, r0
+ | jmp >1
+ |.code
+ | EXT_CALL zend_hash_find, r0
+ |1:
+ } else {
+ | EXT_CALL _zend_hash_find_known_hash, r0
+ }
+ | test r0, r0
+ | jz >2 // NOT_FOUND
+ | // if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT))
+ | IF_Z_TYPE r0, IS_INDIRECT, >1 // SLOW
+ |.cold_code
+ |1:
+ | // retval = Z_INDIRECT_P(retval);
+ | GET_Z_PTR r0, r0
+ | IF_NOT_Z_TYPE r0, IS_UNDEF, >8
+ |2:
+ switch (type) {
+ case BP_VAR_R:
+ // zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ | UNDEFINED_INDEX opline
+ | jmp >9
+ break;
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ | // retval = &EG(uninitialized_zval);
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ | jmp >9
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ |.code
+ break;
+ case BP_VAR_RW:
+ | SAVE_VALID_OPLINE opline
+ if (opline->op2_type != IS_CONST) {
+ | EXT_CALL zend_jit_symtable_lookup_rw, r0
+ } else {
+ | EXT_CALL zend_jit_hash_lookup_rw, r0
+ }
+ break;
+ case BP_VAR_W:
+ if (opline->op2_type != IS_CONST) {
+ | EXT_CALL zend_jit_symtable_lookup_w, r0
+ } else {
+ | EXT_CALL zend_jit_hash_lookup_w, r0
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ }
+
+ if (type == BP_JIT_IS && (op2_info & (MAY_BE_LONG|MAY_BE_STRING))) {
+ |5:
+ if (op1_info & MAY_BE_ARRAY_OF_REF) {
+ | ZVAL_DEREF r0, MAY_BE_REF
+ }
+ | cmp byte [r0 + 8], IS_NULL
+ | jle >9 // NOT FOUND
+ }
+
+ if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_STRING))) {
+ if (op2_info & (MAY_BE_LONG|MAY_BE_STRING)) {
+ |.cold_code
+ |3:
+ }
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ switch (type) {
+ case BP_VAR_R:
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_fetch_dim_r_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | jmp >9
+ break;
+ case BP_JIT_IS:
+ | EXT_CALL zend_jit_fetch_dim_isset_helper, r0
+ | test r0, r0
+ | jne >8
+ | jmp >9
+ break;
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_fetch_dim_is_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | jmp >9
+ break;
+ case BP_VAR_RW:
+ | EXT_CALL zend_jit_fetch_dim_rw_helper, r0
+ | test r0, r0
+ | jne >8
+ | jmp >9
+ break;
+ case BP_VAR_W:
+ | EXT_CALL zend_jit_fetch_dim_w_helper, r0
+ | test r0, r0
+ | jne >8
+ | jmp >9
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ if (op2_info & (MAY_BE_LONG|MAY_BE_STRING)) {
+ |.code
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_simple_assign(dasm_State **Dst,
+ const zend_op *opline,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ zend_jit_addr var_addr,
+ uint32_t var_info,
+ zend_uchar val_type,
+ znode_op val,
+ zend_jit_addr val_addr,
+ uint32_t val_info,
+ zend_jit_addr res_addr,
+ int in_cold)
+/* Labels: 1,2,3 */
+{
+ ZEND_ASSERT(Z_MODE(var_addr) == IS_REG || Z_REG(var_addr) != ZREG_R0);
+ if (Z_MODE(val_addr) == IS_CONST_ZVAL) {
+ zval *zv = Z_ZV(val_addr);
+
+ if (!res_addr) {
+ | ZVAL_COPY_CONST var_addr, var_info, zv, r0
+ } else {
+ | ZVAL_COPY_CONST_2 var_addr, res_addr, var_info, zv, r0
+ }
+ if (Z_REFCOUNTED_P(zv)) {
+ if (!res_addr) {
+ | ADDREF_CONST zv, r0
+ } else {
+ | ADDREF_CONST_2 zv, r0
+ }
+ }
+ } else {
+ if (val_info & MAY_BE_UNDEF) {
+ if (in_cold) {
+ | IF_NOT_ZVAL_TYPE val_addr, IS_UNDEF, >2
+ } else {
+ | IF_ZVAL_TYPE val_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ if (Z_REG(var_addr) != ZREG_FP) {
+ | mov aword T1, Ra(Z_REG(var_addr)) // save
+ }
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, val.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (Z_REG(var_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(var_addr)), aword T1 // restore
+ }
+ | SET_ZVAL_TYPE_INFO var_addr, IS_NULL
+ if (res_addr) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ }
+ | jmp >3
+ if (in_cold) {
+ |2:
+ } else {
+ |.code
+ }
+ }
+ if (val_info & MAY_BE_REF) {
+ if (val_type == IS_CV) {
+ ZEND_ASSERT(Z_REG(var_addr) != ZREG_R2);
+ | LOAD_ZVAL_ADDR r2, val_addr
+ | ZVAL_DEREF r2, val_info
+ val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 0);
+ } else {
+ zend_jit_addr ref_addr;
+
+ if (in_cold) {
+ | IF_NOT_ZVAL_TYPE val_addr, IS_REFERENCE, >1
+ } else {
+ | IF_ZVAL_TYPE val_addr, IS_REFERENCE, >1
+ |.cold_code
+ |1:
+ }
+ | // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
+ | GET_ZVAL_PTR r2, val_addr
+ | GC_DELREF r2
+ | // ZVAL_COPY_VALUE(return_value, &ref->value);
+ ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 8);
+ if (!res_addr) {
+ | ZVAL_COPY_VALUE var_addr, var_info, ref_addr, val_info, ZREG_R2, ZREG_R0
+ } else {
+ | ZVAL_COPY_VALUE_2 var_addr, var_info, res_addr, ref_addr, val_info, ZREG_R2, ZREG_R0
+ }
+ | je >2
+ | IF_NOT_REFCOUNTED dh, >3
+ if (!res_addr) {
+ | GC_ADDREF r0
+ } else {
+ | add dword [r0], 2
+ }
+ | jmp >3
+ |2:
+ if (res_addr) {
+ | IF_NOT_REFCOUNTED dh, >2
+ | GC_ADDREF r0
+ |2:
+ }
+ | EFREE_24 aword [Ra(Z_REG(val_addr))+Z_OFFSET(val_addr)], op_array, opline
+ | jmp >3
+ if (in_cold) {
+ |1:
+ } else {
+ |.code
+ }
+ }
+ }
+
+ if (!res_addr) {
+ | ZVAL_COPY_VALUE var_addr, var_info, val_addr, val_info, ZREG_R2, ZREG_R0
+ } else {
+ | ZVAL_COPY_VALUE_2 var_addr, var_info, res_addr, val_addr, val_info, ZREG_R2, ZREG_R0
+ }
+
+ if (val_type == IS_CV) {
+ if (!res_addr) {
+ | TRY_ADDREF val_info, dh, r0
+ } else {
+ | TRY_ADDREF_2 val_info, dh, r0
+ }
+ } else {
+ if (res_addr) {
+ | TRY_ADDREF val_info, dh, r0
+ }
+ }
+ |3:
+ }
+ return 1;
+}
+
+static int zend_jit_assign_to_variable(dasm_State **Dst,
+ const zend_op *opline,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ zend_jit_addr var_addr,
+ uint32_t var_info,
+ zend_uchar val_type,
+ znode_op val,
+ zend_jit_addr val_addr,
+ uint32_t val_info,
+ zend_jit_addr res_addr)
+/* Labels: 1,2,3,4,5,8 */
+{
+ //ZEND_ASSERT(Z_MODE(var_addr) == IS_MEM_ZVAL);
+ if (var_info & MAY_BE_REF) {
+ if (Z_MODE(var_addr) != IS_REG || Z_REG(var_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, var_addr
+ var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+ | // if (Z_ISREF_P(variable_ptr)) {
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
+ | // if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
+ | jnz >2
+ | add FCARG1a, offsetof(zend_reference, val)
+ |.cold_code
+ |2:
+ | LOAD_ZVAL_ADDR FCARG2a, val_addr
+ | SAVE_VALID_OPLINE opline
+ if (val_type == IS_CONST) {
+ | EXT_CALL zend_jit_assign_const_to_typed_ref, r0
+ } else if (val_type == IS_TMP_VAR) {
+ | EXT_CALL zend_jit_assign_tmp_to_typed_ref, r0
+ } else if (val_type == IS_VAR) {
+ | EXT_CALL zend_jit_assign_var_to_typed_ref, r0
+ } else if (val_type == IS_CV) {
+ | EXT_CALL zend_jit_assign_cv_to_typed_ref, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ | jmp >8
+ |.code
+ |1:
+ }
+ if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ int in_cold = 0;
+
+ ZEND_ASSERT(Z_REG(var_addr) != ZREG_R0);
+ if (var_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | IF_ZVAL_REFCOUNTED var_addr, >1
+ |.cold_code
+ |1:
+ in_cold = 1;
+ }
+ | // TODO: support for object->set
+ | // TODO: support for assignment to itself
+ | GET_ZVAL_PTR r0, var_addr
+ | GC_DELREF r0
+ if (RC_MAY_BE_1(var_info)) {
+ if (RC_MAY_BE_N(var_info)) {
+ | jnz >4
+ }
+ | mov aword T1, r0 // save
+ if (!zend_jit_simple_assign(Dst, opline, op_array, ssa, var_addr, var_info, val_type, val, val_addr, val_info, res_addr, in_cold)) {
+ return 0;
+ }
+ | mov FCARG1a, aword T1 // restore
+ if (val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ | cmp dword [FCARG1a], 0
+ | jnz >8
+ }
+ | ZVAL_DTOR_FUNC var_info, opline
+ | jmp >8
+ |4:
+ }
+ if (RC_MAY_BE_N(var_info)) {
+ if (Z_REG(var_addr) == ZREG_FP) {
+ | GET_ZVAL_PTR FCARG1a, var_addr
+ | IF_GC_MAY_NOT_LEAK FCARG1a, eax, >5
+ } else if (Z_REG(var_addr) != ZREG_FCARG1a) {
+ | GET_ZVAL_PTR FCARG1a, var_addr
+ | IF_GC_MAY_NOT_LEAK FCARG1a, eax, >5
+ | mov T1, Ra(Z_REG(var_addr)) // save
+ } else {
+ | GET_ZVAL_PTR r0, var_addr
+ | IF_GC_MAY_NOT_LEAK r0, eax, >5
+ | mov T1, Ra(Z_REG(var_addr)) // save
+ | GET_ZVAL_PTR FCARG1a, var_addr
+ }
+ | EXT_CALL gc_possible_root, r0
+ if (Z_REG(var_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(var_addr)), T1 // restore
+ }
+ if (in_cold) {
+ | jmp >5
+ |.code
+ }
+ } else if (in_cold) {
+ ZEND_ASSERT(RC_MAY_BE_1(var_info));
+ |.code
+ }
+ |5:
+ }
+
+ if (!zend_jit_simple_assign(Dst, opline, op_array, ssa, var_addr, var_info, val_type, val, val_addr, val_info, res_addr, 0)) {
+ return 0;
+ }
+ |8:
+
+ return 1;
+}
+
+static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info, op2_info, val_info;
+ zend_jit_addr op1_addr, op2_addr, op3_addr, res_addr;
+
+ if (opline->op1_type != IS_CV) {
+ goto fallback;
+ }
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ val_info = OP1_DATA_INFO();
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+ op3_addr = zend_jit_decode_op(op_array, (opline+1)->op1_type, (opline+1)->op1, opline+1, NULL, -1);
+ if (opline->result_type == IS_UNUSED) {
+ res_addr = 0;
+ } else {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+ }
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG2a, FCARG1a
+ | IF_NOT_TYPE byte [FCARG2a + offsetof(zend_reference, val) + offsetof(zval, u1.v.type)], IS_ARRAY, >2
+ | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)]
+ | jmp >3
+ |.cold_code
+ |2:
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_prepare_assign_dim_ref, r0
+ | test r0, r0
+ | jz ->exception_handler_undef
+ | mov FCARG1a, r0
+ | jmp >1
+ |.code
+ |1:
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ |3:
+ | SEPARATE_ARRAY op1_addr, op1_info, 1
+ } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | CMP_ZVAL_TYPE op1_addr, IS_FALSE
+ | jg >7
+ }
+ | // ZVAL_ARR(container, zend_new_array(8));
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov T1, Ra(Z_REG(op1_addr)) // save
+ }
+ | EXT_CALL _zend_new_array_0, r0
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(op1_addr)), T1 // restore
+ }
+ | SET_ZVAL_LVAL op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX
+ | mov FCARG1a, r0
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ |6:
+ if (opline->op2_type == IS_UNUSED) {
+ | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | EXT_CALL zend_hash_next_index_insert, r0
+ | // if (UNEXPECTED(!var_ptr)) {
+ | test r0, r0
+ | jz >1
+ |.cold_code
+ |1:
+ | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ | CANNOT_ADD_ELEMENT opline
+ | //ZEND_VM_C_GOTO(assign_dim_op_ret_null);
+ | jmp >9
+ |.code
+ | mov FCARG1a, r0
+ } else {
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, op_array, BP_VAR_W, op1_info, op2_info, 8, 8)) {
+ return 0;
+ }
+
+ |8:
+ | mov FCARG1a, r0
+ }
+
+ if (opline->op2_type == IS_UNUSED) {
+ uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
+ zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
+ var_info |= MAY_BE_REF;
+ }
+ if (!zend_jit_simple_assign(Dst, opline, op_array, ssa, var_addr, var_info, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr, 0)) {
+ return 0;
+ }
+ } else {
+ uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
+ zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
+ var_info |= MAY_BE_REF;
+ }
+ | // value = zend_assign_to_variable(variable_ptr, value, OP_DATA_TYPE);
+ if (!zend_jit_assign_to_variable(Dst, opline, op_array, ssa, var_addr, var_info, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr)) {
+ return 0;
+ }
+ }
+ }
+
+ if (((op1_info & MAY_BE_ARRAY) &&
+ (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE))) ||
+ (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)))) {
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ |.cold_code
+ |7:
+ }
+
+ if ((op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) &&
+ (op1_info & MAY_BE_ARRAY)) {
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | CMP_ZVAL_TYPE op1_addr, IS_FALSE
+ | jg >2
+ }
+ | // ZVAL_ARR(container, zend_new_array(8));
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov T1, Ra(Z_REG(op1_addr)) // save
+ }
+ | EXT_CALL _zend_new_array_0, r0
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(op1_addr)), T1 // restore
+ }
+ | SET_ZVAL_LVAL op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX
+ | mov FCARG1a, r0
+ | // ZEND_VM_C_GOTO(assign_dim_op_new_array);
+ | jmp <6
+ |2:
+ }
+
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_UNUSED) {
+ | xor FCARG2a, FCARG2a
+ } else if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ |.if not(X64)
+ | sub r4, 8
+ |.endif
+ if (opline->result_type == IS_UNUSED) {
+ |.if X64
+ | xor CARG4, CARG4
+ |.else
+ | push 0
+ |.endif
+ } else {
+ zend_jit_addr res_addr;
+
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG4, res_addr
+ |.else
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op3_addr
+ |.else
+ | PUSH_ZVAL_ADDR op3_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_assign_dim_helper, r0
+ |.if not(X64)
+ | add r4, 8
+ |.endif
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if (((opline+1)->op1_type & (IS_TMP_VAR|IS_VAR)) && (val_info & MAY_BE_RC1)) {
+ /* ASSIGN_DIM may increase refcount of the value */
+ val_info |= MAY_BE_RCN;
+ }
+#endif
+
+ | FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, op_array, opline
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | jmp >9 // END
+ }
+ |.code
+ }
+ }
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) && (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY|MAY_BE_OBJECT))) {
+ /* ASSIGN_DIM may increase refcount of the key */
+ op2_info |= MAY_BE_RCN;
+ }
+#endif
+
+ |9:
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception(Dst);
+ }
+
+ return 1;
+
+fallback:
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info, op2_info;
+ zend_jit_addr op1_addr, op2_addr, op3_addr, var_addr;
+ int op3_ssa_var;
+
+ if (opline->op1_type != IS_CV || opline->result_type != IS_UNUSED) {
+ goto fallback;
+ }
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op3_ssa_var = ssa->ops ? ssa->ops[opline - op_array->opcodes + 1].op1_use : -1;
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+ op3_addr = zend_jit_decode_op(op_array, (opline+1)->op1_type, (opline+1)->op1, opline+1, NULL, -1);
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG2a, FCARG1a
+ | IF_NOT_TYPE byte [FCARG2a + offsetof(zend_reference, val) + offsetof(zval, u1.v.type)], IS_ARRAY, >2
+ | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)]
+ | jmp >3
+ |.cold_code
+ |2:
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_prepare_assign_dim_ref, r0
+ | test r0, r0
+ | jz ->exception_handler_undef
+ | mov FCARG1a, r0
+ | jmp >1
+ |.code
+ |1:
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ |3:
+ | SEPARATE_ARRAY op1_addr, op1_info, 1
+ }
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
+ if (op1_info & MAY_BE_ARRAY) {
+ |.cold_code
+ |7:
+ }
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | CMP_ZVAL_TYPE op1_addr, IS_FALSE
+ | jg >7
+ }
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ }
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1a, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+ | // ZVAL_ARR(container, zend_new_array(8));
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov T1, Ra(Z_REG(op1_addr)) // save
+ }
+ | EXT_CALL _zend_new_array_0, r0
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(op1_addr)), T1 // restore
+ }
+ | SET_ZVAL_LVAL op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX
+ | mov FCARG1a, r0
+ if (op1_info & MAY_BE_ARRAY) {
+ | jmp >1
+ |.code
+ |1:
+ }
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
+ uint32_t var_def_info = zend_array_element_type(OP1_DEF_INFO(), 1, 0);
+
+ if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
+ var_info |= MAY_BE_REF;
+ }
+ |6:
+ if (opline->op2_type == IS_UNUSED) {
+ | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | EXT_CALL zend_hash_next_index_insert, r0
+ | // if (UNEXPECTED(!var_ptr)) {
+ | test r0, r0
+ | jz >1
+ |.cold_code
+ |1:
+ | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ | CANNOT_ADD_ELEMENT opline
+ | //ZEND_VM_C_GOTO(assign_dim_op_ret_null);
+ | jmp >9
+ |.code
+ | mov FCARG1a, r0
+ } else {
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, op_array, BP_VAR_RW, op1_info, op2_info, 8, 8)) {
+ return 0;
+ }
+
+ |8:
+ | mov FCARG1a, r0
+ if (op1_info & (MAY_BE_ARRAY_OF_REF)) {
+ binary_op_type binary_op = get_binary_op(opline->extended_value);
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
+ | jnz >2
+ | add FCARG1a, offsetof(zend_reference, val)
+ |.cold_code
+ |2:
+ | LOAD_ZVAL_ADDR FCARG2a, op3_addr
+ |.if X64
+ | LOAD_ADDR CARG3, binary_op
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR binary_op, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_assign_op_to_typed_ref, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ zend_jit_check_exception(Dst);
+ | jmp >9
+ |.code
+ |1:
+ }
+ }
+
+ var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ switch (opline->extended_value) {
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_DIV:
+ if (!zend_jit_math_helper(Dst, opline, opline->extended_value, op_array, ssa, IS_CV, opline->op1, var_addr, var_info, (opline+1)->op1_type, (opline+1)->op1, op3_addr, OP1_DATA_INFO(), 0, var_addr, var_def_info, var_info)) {
+ return 0;
+ }
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ if (!zend_jit_long_math_helper(Dst, opline, opline->extended_value, op_array, ssa, IS_CV, opline->op1, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, OP1_DATA_INFO(), op3_ssa_var, 0, var_addr, OP1_DEF_INFO(), var_info)) {
+ return 0;
+ }
+ break;
+ case ZEND_CONCAT:
+ if (!zend_jit_concat_helper(Dst, opline, op_array, ssa, IS_CV, opline->op1, var_addr, var_info, (opline+1)->op1_type, (opline+1)->op1, op3_addr, OP1_DATA_INFO(), var_addr, OP1_DEF_INFO())) {
+ return 0;
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ }
+
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ binary_op_type binary_op;
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ |.cold_code
+ |7:
+ }
+
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_UNUSED) {
+ | xor FCARG2a, FCARG2a
+ } else if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ binary_op = get_binary_op(opline->extended_value);
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op3_addr
+ | LOAD_ADDR CARG4, binary_op
+ |.else
+ | sub r4, 8
+ | PUSH_ADDR binary_op, r0
+ | PUSH_ZVAL_ADDR op3_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_assign_dim_op_helper, r0
+ |.if not(X64)
+ | add r4, 8
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ | jmp >9 // END
+ |.code
+ }
+ }
+
+ |9:
+
+ return 1;
+
+fallback:
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_assign_op(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info, op2_info;
+ zend_jit_addr op1_addr, op2_addr;
+ int op1_ssa_var, op2_ssa_var;
+
+ if (opline->opcode == ZEND_ASSIGN_DIM_OP) {
+ return zend_jit_assign_dim_op(Dst, opline, op_array, ssa);
+ } else if (opline->opcode == ZEND_ASSIGN_OBJ_OP || opline->opcode == ZEND_ASSIGN_STATIC_PROP_OP) {
+ goto fallback;
+ }
+
+ if (opline->op1_type != IS_CV || opline->result_type != IS_UNUSED) {
+ goto fallback;
+ }
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ if (ssa->ops) {
+ op1_ssa_var = ssa->ops[opline - op_array->opcodes].op1_use;
+ op2_ssa_var = ssa->ops[opline - op_array->opcodes].op2_use;
+ } else {
+ op1_ssa_var = op2_ssa_var = -1;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ goto fallback;
+ }
+
+ switch (opline->extended_value) {
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_DIV:
+ if (!(op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) ||
+ !(op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ goto fallback;
+ }
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ if (!(op1_info & MAY_BE_LONG) ||
+ !(op2_info & MAY_BE_LONG)) {
+ goto fallback;
+ }
+ break;
+ case ZEND_CONCAT:
+ if (!(op1_info & MAY_BE_STRING) ||
+ !(op2_info & MAY_BE_STRING)) {
+ goto fallback;
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+
+ if (op1_info & MAY_BE_REF) {
+ binary_op_type binary_op = get_binary_op(opline->extended_value);
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
+ | jnz >2
+ | add FCARG1a, offsetof(zend_reference, val)
+ |.cold_code
+ |2:
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ |.if X64
+ | LOAD_ADDR CARG3, binary_op
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR binary_op, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_assign_op_to_typed_ref, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ zend_jit_check_exception(Dst);
+ | jmp >9
+ |.code
+ |1:
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ int result;
+ switch (opline->extended_value) {
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_DIV:
+ result = zend_jit_math_helper(Dst, opline, opline->extended_value, op_array, ssa, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, opline->op1.var, op1_addr, OP1_DEF_INFO(), op1_info);
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ result = zend_jit_long_math_helper(Dst, opline, opline->extended_value, op_array, ssa, opline->op1_type, opline->op1, op1_addr, op1_info, op1_ssa_var, opline->op2_type, opline->op2, op2_addr, op2_info, op2_ssa_var, opline->op1.var, op1_addr, OP1_DEF_INFO(), op1_info);
+ break;
+ case ZEND_CONCAT:
+ result = zend_jit_concat_helper(Dst, opline, op_array, ssa, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, op1_addr, OP1_DEF_INFO());
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ |9:
+ return result;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_cmp_long_long(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_bool smart_branch)
+{
+ unsigned int target_label;
+ zend_bool swap = 0;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 0) {
+ | test Ra(Z_REG(op1_addr)), Ra(Z_REG(op1_addr))
+ } else {
+ | LONG_OP cmp, Z_REG(op1_addr), op2_addr
+ }
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op1_addr)) == 0) {
+ | test Ra(Z_REG(op2_addr)), Ra(Z_REG(op2_addr))
+ } else {
+ | LONG_OP cmp, Z_REG(op2_addr), op1_addr
+ }
+ swap = 1;
+ } else if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_MODE(op2_addr) != IS_CONST_ZVAL) {
+ | LONG_OP_WITH_CONST cmp, op2_addr, Z_LVAL_P(Z_ZV(op1_addr))
+ swap = 1;
+ } else if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_MODE(op1_addr) != IS_CONST_ZVAL) {
+ | LONG_OP_WITH_CONST cmp, op1_addr, Z_LVAL_P(Z_ZV(op2_addr))
+ } else {
+ | GET_ZVAL_LVAL ZREG_R0, op1_addr
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 0) {
+ | test r0, r0
+ } else {
+ | LONG_OP cmp, ZREG_R0, op2_addr
+ }
+ }
+
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ_EX ||
+ (opline+1)->opcode == ZEND_JMPNZ_EX) {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | setg al
+ } else {
+ | setl al
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setge al
+ } else {
+ | setle al
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if ((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPZ_EX) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jle => target_label
+ } else {
+ | jge => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jl => target_label
+ } else {
+ | jg => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPNZ_EX) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | je => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jne => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jg => target_label
+ } else {
+ | jl => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jge => target_label
+ } else {
+ | jle => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jle => target_label
+ } else {
+ | jge => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jl => target_label
+ } else {
+ | jg => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp => target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | setg al
+ } else {
+ | setl al
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setge al
+ } else {
+ | setle al
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+
+ return 1;
+}
+
+static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_bool swap, zend_bool smart_branch)
+{
+ unsigned int target_label;
+
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ | jp => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp >1
+ | je => target_label
+ |1:
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jbe => target_label
+ } else {
+ | jae => target_label
+ | jp => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jb => target_label
+ } else {
+ | ja => target_label
+ | jp => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jp >1
+ | je => target_label
+ |1:
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jne => target_label
+ | jp => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | ja => target_label
+ } else {
+ | jp >1
+ | jb => target_label
+ |1:
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jae => target_label
+ } else {
+ | jp >1
+ | jbe => target_label
+ |1:
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ unsigned int target_label2 = ssa->cfg.blocks[b].successors[1];
+
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ | jp => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp => target_label2
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jbe => target_label
+ } else {
+ | jae => target_label
+ | jp => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jb => target_label
+ } else {
+ | ja => target_label
+ | jp => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | jmp => target_label2
+ } else if ((opline+1)->opcode == ZEND_JMPZ_EX) {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jne => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | je => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jbe => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jae => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jb => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | ja => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPNZ_EX) {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | je => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jne => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | seta al
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | ja => target_label
+ } else {
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jb => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setae al
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | jae => target_label
+ } else {
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jbe => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jp >1
+ | mov eax, IS_TRUE
+ | je >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp >1
+ | mov eax, IS_FALSE
+ | je >2
+ |1:
+ | mov eax, IS_TRUE
+ |2:
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | seta al
+ | movzx eax, al
+ | add eax, 2
+ } else {
+ | jp >1
+ | mov eax, IS_TRUE
+ | jb >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setae al
+ | movzx eax, al
+ | add eax, 2
+ } else {
+ | jp >1
+ | mov eax, IS_TRUE
+ | jbe >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+
+ return 1;
+}
+
+static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_bool smart_branch)
+{
+ zend_reg tmp_reg = ZREG_XMM0;
+
+ | SSE_GET_ZVAL_LVAL tmp_reg, op1_addr
+ | SSE_AVX_OP ucomisd, vucomisd, tmp_reg, op2_addr
+
+ return zend_jit_cmp_double_common(Dst, opline, b, op_array, ssa, 0, smart_branch);
+}
+
+static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_bool smart_branch)
+{
+ zend_reg tmp_reg = ZREG_XMM0;
+
+ | SSE_GET_ZVAL_LVAL tmp_reg, op2_addr
+ | SSE_AVX_OP ucomisd, vucomisd, tmp_reg, op1_addr
+
+ return zend_jit_cmp_double_common(Dst, opline, b, op_array, ssa, /* swap */ 1, smart_branch);
+}
+
+static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_bool smart_branch)
+{
+ zend_bool swap = 0;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ | SSE_AVX_OP ucomisd, vucomisd, Z_REG(op1_addr), op2_addr
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ | SSE_AVX_OP ucomisd, vucomisd, Z_REG(op2_addr), op1_addr
+ swap = 1;
+ } else {
+ zend_reg tmp_reg = ZREG_XMM0;
+
+ | SSE_GET_ZVAL_DVAL tmp_reg, op1_addr
+ | SSE_AVX_OP ucomisd, vucomisd, tmp_reg, op2_addr
+ }
+
+ return zend_jit_cmp_double_common(Dst, opline, b, op_array, ssa, swap, smart_branch);
+}
+
+static int zend_jit_cmp_slow(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_bool smart_branch)
+{
+ unsigned int target_label;
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | LONG_OP_WITH_CONST cmp, res_addr, Z_L(0)
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ_EX ||
+ (opline+1)->opcode == ZEND_JMPNZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ | setl al
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | setle al
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if ((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPZ_EX) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ | jge => target_label
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | jg => target_label
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPNZ_EX) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | je => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | jne => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ | jl => target_label
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | jle => target_label
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ | jge => target_label
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | jg => target_label
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp => target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ | setl al
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | setle al
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+
+ return 1;
+}
+
+static int zend_jit_cmp(dasm_State **Dst, const zend_op *opline, int b, int *opnum, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ zend_bool smart_branch = 0;
+ uint32_t op1_info, op2_info;
+ zend_bool same_ops = (opline->op1_type == opline->op2_type) && (opline->op1.var == opline->op2.var);
+ zend_bool has_slow;
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ zend_jit_addr op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op2_use : -1);
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPZ_EX ||
+ (opline+1)->opcode == ZEND_JMPNZ_EX ||
+ (opline+1)->opcode == ZEND_JMPZNZ) &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == b) {
+ (*opnum)++;
+ smart_branch = 1;
+ }
+
+ has_slow =
+ (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))));
+
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >4
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9
+ }
+ }
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_LONG))) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >3
+ |.cold_code
+ |3:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ if (!zend_jit_cmp_long_double(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ | jmp >6
+ |.code
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9
+ }
+ }
+ if (!zend_jit_cmp_long_long(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ |4:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >5
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ }
+ if (!zend_jit_cmp_double_double(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ | jmp >6
+ }
+ if (!same_ops) {
+ |5:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9
+ }
+ if (!zend_jit_cmp_double_long(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ | jmp >6
+ }
+ |.code
+ }
+ } else if ((op1_info & MAY_BE_DOUBLE) &&
+ !(op1_info & MAY_BE_LONG) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >3
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ }
+ if (!zend_jit_cmp_double_double(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |3:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9
+ }
+ if (!zend_jit_cmp_double_long(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ | jmp >6
+ |.code
+ }
+ }
+ } else if ((op2_info & MAY_BE_DOUBLE) &&
+ !(op2_info & MAY_BE_LONG) &&
+ (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >3
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9
+ }
+ }
+ if (!zend_jit_cmp_double_double(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |3:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9
+ }
+ if (!zend_jit_cmp_long_double(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ | jmp >6
+ |.code
+ }
+ }
+ }
+
+ if (has_slow ||
+ (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ if (has_slow) {
+ |.cold_code
+ |9:
+ }
+ | SAVE_VALID_OPLINE opline
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ if (opline->op1_type == IS_CV && (op1_info & MAY_BE_UNDEF)) {
+ | IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, >1
+ | mov FCARG1a, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ |1:
+ }
+ if (opline->op2_type == IS_CV && (op2_info & MAY_BE_UNDEF)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_UNDEF, >1
+ | mov T1, FCARG2a // save
+ | mov FCARG1a, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | mov FCARG2a, T1 // restore
+ |.if X64
+ | LOAD_ADDR_ZTS CARG3, executor_globals, uninitialized_zval
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR_ZTS executor_globals, uninitialized_zval, r0
+ |.endif
+ | jmp >2
+ |1:
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ |2:
+ } else {
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ }
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ | EXT_CALL compare_function, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if (opline->opcode != ZEND_CASE) {
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+ }
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ if (!zend_jit_cmp_slow(Dst, opline, b, op_array, ssa, smart_branch)) {
+ return 0;
+ }
+ if (has_slow) {
+ | jmp >6
+ |.code
+ }
+ }
+
+ |6:
+
+ return 1;
+}
+
+static int zend_jit_identical(dasm_State **Dst, const zend_op *opline, int b, int *opnum, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ zend_bool smart_branch = 0;
+ uint32_t identical_label = (uint32_t)-1;
+ uint32_t not_identical_label = (uint32_t)-1;
+ uint32_t op1_info, op2_info;
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ zend_jit_addr op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op2_use : -1);
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPZNZ) &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == b) {
+ (*opnum)++;
+ smart_branch = 1;
+ }
+
+ if (smart_branch) {
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ not_identical_label = ssa->cfg.blocks[b].successors[0];
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ identical_label = ssa->cfg.blocks[b].successors[0];
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ not_identical_label = ssa->cfg.blocks[b].successors[0];
+ identical_label = ssa->cfg.blocks[b].successors[1];
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else if (opline->opcode == ZEND_IS_NOT_IDENTICAL) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ identical_label = ssa->cfg.blocks[b].successors[0];
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ not_identical_label = ssa->cfg.blocks[b].successors[0];
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ identical_label = ssa->cfg.blocks[b].successors[0];
+ not_identical_label = ssa->cfg.blocks[b].successors[1];
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+
+ if ((op1_info & MAY_BE_UNDEF) && (op2_info & MAY_BE_UNDEF)) {
+ op1_info |= MAY_BE_NULL;
+ op2_info |= MAY_BE_NULL;
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_Z_TYPE FCARG1a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | LOAD_ADDR_ZTS FCARG1a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ | IF_Z_TYPE FCARG2a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov aword T1, FCARG1a // save
+ | mov FCARG1d, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | mov FCARG1a, aword T1 // restore
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ } else if (op1_info & MAY_BE_UNDEF) {
+ op1_info |= MAY_BE_NULL;
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_Z_TYPE FCARG1a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | LOAD_ADDR_ZTS FCARG1a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ if (opline->op2_type != IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ } else if (op2_info & MAY_BE_UNDEF) {
+ op2_info |= MAY_BE_NULL;
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ | IF_Z_TYPE FCARG2a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ if (opline->op1_type != IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ } else {
+ if (opline->op1_type != IS_CONST) {
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type != IS_CONST) {
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ }
+ if (opline->op1_type & (IS_CV|IS_VAR)) {
+ | ZVAL_DEREF FCARG1a, op1_info
+ }
+ if (opline->op2_type & (IS_CV|IS_VAR)) {
+ | ZVAL_DEREF FCARG2a, op2_info
+ }
+
+ if ((op1_info & op2_info & MAY_BE_ANY) == 0) {
+ if (((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) ||
+ ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)))) {
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ }
+ if (smart_branch) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_FALSE : IS_TRUE)
+ zend_jit_check_exception(Dst);
+ }
+ } else if (has_concrete_type(op1_info) &&
+ has_concrete_type(op2_info) &&
+ concrete_type(op1_info) == concrete_type(op2_info) &&
+ concrete_type(op1_info) <= IS_TRUE) {
+ if (smart_branch) {
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_TRUE : IS_FALSE)
+ }
+ } else if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ if (zend_is_identical(Z_ZV(op1_addr), Z_ZV(op2_addr))) {
+ if (smart_branch) {
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_TRUE : IS_FALSE)
+ }
+ } else {
+ if (smart_branch) {
+ if (not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_FALSE : IS_TRUE)
+ }
+ }
+ } else if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_TYPE_P(Z_ZV(op1_addr)) <= IS_TRUE) {
+ zval *val = Z_ZV(op1_addr);
+
+ | cmp byte [FCARG2a + offsetof(zval, u1.v.type)], Z_TYPE_P(val)
+ if (smart_branch) {
+ if (opline->op2_type == IS_VAR && (op2_info & MAY_BE_REF)) {
+ | jne >8
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ } else {
+ | jmp >9
+ }
+ |8:
+ } else if (identical_label != (uint32_t)-1) {
+ | je =>identical_label
+ } else {
+ | je >9
+ }
+ } else {
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ | sete al
+ } else {
+ | setne al
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ if (smart_branch && not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_TYPE_P(Z_ZV(op2_addr)) <= IS_TRUE) {
+ zval *val = Z_ZV(op2_addr);
+
+ | cmp byte [FCARG1a + offsetof(zval, u1.v.type)], Z_TYPE_P(val)
+ if (smart_branch) {
+ if (opline->op1_type == IS_VAR && (op1_info & MAY_BE_REF)) {
+ | jne >8
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ } else {
+ | jmp >9
+ }
+ |8:
+ } else if (identical_label != (uint32_t)-1) {
+ | je =>identical_label
+ } else {
+ | je >9
+ }
+ } else {
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ | sete al
+ } else {
+ | setne al
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ if (smart_branch && not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else if ((op1_info & MAY_BE_ANY) == MAY_BE_LONG &&
+ (op2_info & MAY_BE_ANY) == MAY_BE_LONG) {
+ if (!zend_jit_cmp_long_long(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ } else if ((op1_info & MAY_BE_ANY) == MAY_BE_DOUBLE &&
+ (op2_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ if (!zend_jit_cmp_double_double(Dst, opline, b, op_array, ssa, op1_addr, op2_addr, smart_branch)) {
+ return 0;
+ }
+ } else {
+ if (opline->op1_type == IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ | EXT_CALL zend_is_identical, r0
+ if (((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) ||
+ ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)))) {
+ | mov aword T1, r0 // save
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ | mov r0, aword T1 // restore
+ }
+ if (smart_branch) {
+ | test al, al
+ if (not_identical_label != (uint32_t)-1) {
+ | jz =>not_identical_label
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ }
+ } else if (identical_label != (uint32_t)-1) {
+ | jnz =>identical_label
+ }
+ } else {
+ | movzx eax, al
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ | lea eax, [eax + 2]
+ } else {
+ | neg eax
+ | lea eax, [eax + 3]
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ }
+
+ |9:
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception(Dst);
+ }
+
+ return 1;
+}
+
+static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info = OP1_INFO();
+ uint32_t true_label = -1;
+ uint32_t false_label = -1;
+ zend_bool set_bool = 0;
+ zend_bool set_bool_not = 0;
+ zend_bool jmp_done = 0;
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ zend_jit_addr res_addr = 0;
+
+ if (opline->opcode == ZEND_JMPZ) {
+ false_label = ssa->cfg.blocks[b].successors[0];
+ } else if (opline->opcode == ZEND_JMPNZ) {
+ true_label = ssa->cfg.blocks[b].successors[0];
+ } else if (opline->opcode == ZEND_JMPZNZ) {
+ true_label = ssa->cfg.blocks[b].successors[1];
+ false_label = ssa->cfg.blocks[b].successors[0];
+ } else if (opline->opcode == ZEND_BOOL) {
+ set_bool = 1;
+ } else if (opline->opcode == ZEND_BOOL_NOT) {
+ set_bool = 1;
+ set_bool_not = 1;
+ } else if (opline->opcode == ZEND_JMPZ_EX) {
+ set_bool = 1;
+ false_label = ssa->cfg.blocks[b].successors[0];
+ } else if (opline->opcode == ZEND_JMPNZ_EX) {
+ set_bool = 1;
+ true_label = ssa->cfg.blocks[b].successors[0];
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ if (set_bool) {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+ }
+
+ if (Z_MODE(op1_addr) == IS_CONST_ZVAL) {
+ if (zend_is_true(Z_ZV(op1_addr))) {
+ /* Always TRUE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ }
+ if (true_label != (uint32_t)-1) {
+ | jmp =>true_label;
+ }
+ } else {
+ /* Always FALSE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ }
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label;
+ }
+ }
+ return 1;
+ }
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE)) {
+ if (!(op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)-MAY_BE_TRUE))) {
+ /* Always TRUE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ }
+ if (true_label != (uint32_t)-1) {
+ | jmp =>true_label;
+ }
+ } else {
+ if (!(op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE)))) {
+ /* Always FALSE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ }
+ } else {
+ | CMP_ZVAL_TYPE op1_addr, IS_TRUE
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
+ if ((op1_info & MAY_BE_LONG) &&
+ !(op1_info & MAY_BE_UNDEF) &&
+ !set_bool) {
+ if (false_label != (uint32_t)-1) {
+ | jl =>false_label
+ } else {
+ | jl >9
+ }
+ jmp_done = 1;
+ } else {
+ | jg >2
+ }
+ }
+ if (!(op1_info & MAY_BE_TRUE)) {
+ /* It's FALSE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ }
+ } else {
+ if (true_label != (uint32_t)-1 || false_label != (uint32_t)-1) {
+ if (set_bool) {
+ | jne >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ if (true_label != (uint32_t)-1) {
+ | jmp =>true_label
+ } else {
+ | jmp >9
+ }
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else {
+ if (true_label != (uint32_t)-1) {
+ | je =>true_label
+ } else if (!(op1_info & (MAY_BE_UNDEF|MAY_BE_LONG))) {
+ | jne =>false_label
+ jmp_done = 1;
+ } else {
+ | je >9
+ }
+ }
+ } else if (set_bool) {
+ | sete al
+ | movzx eax, al
+ if (set_bool_not) {
+ | neg eax
+ | add eax, 3
+ } else {
+ | add eax, 2
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ }
+ }
+
+ /* It's FALSE, but may be UNDEF */
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & MAY_BE_ANY) {
+ | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+ | mov FCARG1d, opline->op1.var
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception_undef_result(Dst, opline)) {
+ return 0;
+ }
+ }
+
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ }
+ if (op1_info & MAY_BE_ANY) {
+ if (false_label == (uint32_t)-1) {
+ | jmp >9
+ }
+ |.code
+ }
+ }
+
+ if (!jmp_done) {
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ } else if (op1_info & MAY_BE_LONG) {
+ | jmp >9
+ }
+ }
+ }
+ }
+
+ if (op1_info & MAY_BE_LONG) {
+ |2:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >2
+ }
+ if (Z_MODE(op1_addr) == IS_REG) {
+ | test Ra(Z_REG(op1_addr)), Ra(Z_REG(op1_addr))
+ } else {
+ | LONG_OP_WITH_CONST, cmp, op1_addr, Z_L(0)
+ }
+ if (set_bool) {
+ | setne al
+ | movzx eax, al
+ if (set_bool_not) {
+ | neg eax
+ | add eax, 3
+ } else {
+ | lea eax, [eax + 2]
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if (true_label != (uint32_t)-1 || false_label != (uint32_t)-1) {
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ }
+ } else {
+ | je =>false_label
+ }
+ }
+ }
+
+ if ((op1_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | vxorps xmm0, xmm0, xmm0
+ } else {
+ | xorps xmm0, xmm0
+ }
+ | SSE_AVX_OP ucomisd, vucomisd, ZREG_XMM0, op1_addr
+
+ if (set_bool) {
+ if (false_label != (uint32_t)-1) { // JMPZ_EX
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jp >1
+ | je => false_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ |1:
+ } else if (true_label != (uint32_t)-1) { // JMPNZ_EX
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jne => true_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else if (set_bool_not) { // BOOL_NOT
+ | jp >1
+ | mov eax, IS_TRUE
+ | je >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ } else { // BOOL
+ | jp >1
+ | mov eax, IS_TRUE
+ | jne >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ } else {
+ ZEND_ASSERT(true_label != (uint32_t)-1 || false_label != (uint32_t)-1);
+ if (false_label != (uint32_t)-1) {
+ | jp =>false_label
+ } else {
+ | jp >1
+ }
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ }
+ } else {
+ | je =>false_label
+ }
+ |1:
+ }
+ } else if (op1_info & (MAY_BE_ANY - (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG))) {
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ |.cold_code
+ |2:
+ }
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_is_true, r0
+
+ if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
+
+ | IF_NOT_ZVAL_REFCOUNTED op1_addr, >3
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ | jnz >3
+ | mov aword T1, r0 // save
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov r0, aword T1 // restore
+ |3:
+ }
+ if (zend_may_throw(opline, op_array, ssa)) {
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r1
+ | jne ->exception_handler_undef
+ }
+
+ if (set_bool) {
+ if (set_bool_not) {
+ | neg eax
+ | add eax, 3
+ } else {
+ | add eax, 2
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ if (true_label != (uint32_t)-1 || false_label != (uint32_t)-1) {
+ | CMP_ZVAL_TYPE res_addr, IS_FALSE
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ }
+ } else {
+ | je =>false_label
+ }
+ }
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ |.code
+ }
+ } else {
+ | test r0, r0
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ }
+ } else {
+ | je =>false_label
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ }
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ |.code
+ }
+ }
+ }
+
+ |9:
+
+ return 1;
+}
+
+static int zend_jit_qm_assign(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info = OP1_INFO();
+ zend_jit_addr op1_addr, res_addr;
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+
+ if (ra
+ && ssa->ops[opline - op_array->opcodes].op1_def >= 0
+ && !ssa->vars[ssa->ops[opline - op_array->opcodes].op1_def].no_val) {
+ zend_jit_addr op1_def_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ssa->ops[opline - op_array->opcodes].op1_def);
+
+ if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, op1_info, ra[ssa->ops[opline - op_array->opcodes].op1_use])) {
+ return 0;
+ }
+ }
+
+ if (!zend_jit_simple_assign(Dst, opline, op_array, ssa, res_addr, -1, opline->op1_type, opline->op1, op1_addr, op1_info, 0, 0)) {
+ return 0;
+ }
+ if (ra && !zend_jit_store_ssa_var_if_necessary(Dst, ssa, ra, res_addr, ssa->ops[opline - op_array->opcodes].result_def, ssa->ops[opline - op_array->opcodes].result_use)) {
+ return 0;
+ }
+ return 1;
+}
+
+static int zend_jit_assign(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info, op2_info;
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+
+ if (opline->op1_type != IS_CV) {
+ goto fallback;
+ }
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_def : -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op2_use : -1);
+ if (opline->result_type == IS_UNUSED) {
+ res_addr = 0;
+ } else {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].result_def : -1);
+ }
+
+ if (ra
+ && ssa->ops[opline - op_array->opcodes].op2_def >= 0
+ && !ssa->vars[ssa->ops[opline - op_array->opcodes].op2_def].no_val) {
+ zend_jit_addr op2_def_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, ra, ssa->ops[opline - op_array->opcodes].op2_def);
+
+ if (!zend_jit_update_regs(Dst, op2_addr, op2_def_addr, op2_info, ra[ssa->ops[opline - op_array->opcodes].op2_use])) {
+ return 0;
+ }
+ }
+
+ if (!zend_jit_assign_to_variable(Dst, opline, op_array, ssa, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, res_addr)) {
+ return 0;
+ }
+
+ if (zend_may_throw(opline, op_array, ssa)) {
+ zend_jit_check_exception(Dst);
+ }
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_function *func)
+{
+ uint32_t used_stack;
+
+ if (func) {
+ used_stack = zend_vm_calc_used_stack(opline->extended_value, func);
+ } else {
+ used_stack = (ZEND_CALL_FRAME_SLOT + opline->extended_value) * sizeof(zval);
+
+ | // if (EXPECTED(ZEND_USER_CODE(func->type))) {
+ | test byte [r0 + offsetof(zend_function, type)], 1
+ | mov FCARG1a, used_stack
+ | jnz >1
+ | // used_stack += (func->op_array.last_var + func->op_array.T - MIN(func->op_array.num_args, num_args)) * sizeof(zval);
+ | mov edx, opline->extended_value
+ | cmp edx, dword [r0 + offsetof(zend_function, op_array.num_args)]
+ | cmova edx, dword [r0 + offsetof(zend_function, op_array.num_args)]
+ | sub edx, dword [r0 + offsetof(zend_function, op_array.last_var)]
+ | sub edx, dword [r0 + offsetof(zend_function, op_array.T)]
+ | shl edx, 5
+ |.if X64
+ | movsxd r2, edx
+ |.endif
+ | sub FCARG1a, r2
+ |1:
+ }
+
+ zend_jit_start_reuse_ip();
+
+ | // if (UNEXPECTED(used_stack > (size_t)(((char*)EG(vm_stack_end)) - (char*)call))) {
+ | MEM_OP2_2_ZTS mov, RX, aword, executor_globals, vm_stack_top, RX
+ | // Check Stack Overflow
+ | MEM_OP2_2_ZTS mov, r2, aword, executor_globals, vm_stack_end, r2
+ | sub r2, RX
+ if (func) {
+ | cmp r2, used_stack
+ } else {
+ | cmp r2, FCARG1a
+ }
+ | jb >1
+ | // EG(vm_stack_top) = (zval*)((char*)call + used_stack);
+ |.cold_code
+ |1:
+ if (func) {
+ | mov FCARG1d, used_stack
+ }
+#ifdef _WIN32
+ if (0) {
+#else
+ if (func && func->type == ZEND_INTERNAL_FUNCTION) {
+#endif
+ | EXT_CALL zend_jit_int_extend_stack_helper, r0
+ } else {
+ | mov FCARG2a, r0
+ | EXT_CALL zend_jit_extend_stack_helper, r0
+ }
+ | mov RX, r0
+ | jmp >1
+ |.code
+
+ if (func) {
+ | MEM_OP2_1_ZTS add, aword, executor_globals, vm_stack_top, used_stack, r2
+ } else {
+ | MEM_OP2_1_ZTS add, aword, executor_globals, vm_stack_top, FCARG1a, r2
+ }
+ | // zend_vm_init_call_frame(call, call_info, func, num_args, called_scope, object);
+ | // ZEND_SET_CALL_INFO(call, 0, call_info);
+ | mov dword EX:RX->This.u1.type_info, (IS_UNDEF | ZEND_CALL_NESTED_FUNCTION)
+ | // call->func = func;
+#ifdef _WIN32
+ if (0) {
+#else
+ if (func && func->type == ZEND_INTERNAL_FUNCTION) {
+#endif
+ |1:
+ | ADDR_OP2_2 mov, aword EX:RX->func, func, r1
+ } else {
+ | mov aword EX:RX->func, r0
+ |1:
+ }
+ | // Z_CE(call->This) = called_scope;
+ | mov aword EX:RX->This.value.ptr, 0
+ | // ZEND_CALL_NUM_ARGS(call) = num_args;
+ | mov dword EX:RX->This.u2.num_args, opline->extended_value
+ return 1;
+}
+
+static int zend_jit_needs_call_chain(zend_call_info *call_info, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, const zend_op *opline)
+{
+ int skip;
+
+ if (!call_info) {
+ const zend_op *end = op_array->opcodes + op_array->last;
+
+ opline++;
+ skip = 1;
+ while (opline != end) {
+ if (!skip) {
+ if (zend_may_throw(opline, op_array, ssa)) {
+ return 1;
+ }
+ }
+ switch (opline->opcode) {
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAL_EX:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_FUNC_ARG:
+ case ZEND_SEND_REF:
+ case ZEND_SEND_VAR_NO_REF:
+ case ZEND_SEND_VAR_NO_REF_EX:
+ skip = 0;
+ break;
+ case ZEND_SEND_ARRAY:
+ case ZEND_SEND_USER:
+ case ZEND_SEND_UNPACK:
+ case ZEND_INIT_FCALL:
+ case ZEND_INIT_METHOD_CALL:
+ case ZEND_INIT_STATIC_METHOD_CALL:
+ case ZEND_INIT_FCALL_BY_NAME:
+ case ZEND_INIT_NS_FCALL_BY_NAME:
+ case ZEND_INIT_DYNAMIC_CALL:
+ case ZEND_NEW:
+ case ZEND_INIT_USER_CALL:
+ case ZEND_FAST_CALL:
+ case ZEND_JMP:
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_ASSERT_CHECK:
+ case ZEND_CATCH:
+ case ZEND_DECLARE_ANON_CLASS:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ return 1;
+ case ZEND_DO_ICALL:
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_DO_FCALL:
+ end = opline;
+ if (end - op_array->opcodes >= ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len) {
+ /* INIT_FCALL and DO_FCALL in different BasicBlocks */
+ return 1;
+ }
+ return 0;
+ }
+ opline++;
+ }
+
+ return 1;
+ } else {
+ const zend_op *end = call_info->caller_call_opline;
+
+ if (end - op_array->opcodes >= ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len) {
+ /* INIT_FCALL and DO_FCALL in different BasicBlocks */
+ return 1;
+ }
+
+ opline++;
+ skip = 1;
+ while (opline != end) {
+ if (skip) {
+ switch (opline->opcode) {
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAL_EX:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_FUNC_ARG:
+ case ZEND_SEND_REF:
+ case ZEND_SEND_VAR_NO_REF:
+ case ZEND_SEND_VAR_NO_REF_EX:
+ skip = 0;
+ break;
+ case ZEND_SEND_ARRAY:
+ case ZEND_SEND_USER:
+ case ZEND_SEND_UNPACK:
+ return 1;
+ }
+ } else {
+ if (zend_may_throw(opline, op_array, ssa)) {
+ return 1;
+ }
+ }
+ opline++;
+ }
+
+ return 0;
+ }
+}
+
+static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, int call_level)
+{
+ zend_func_info *info = ZEND_FUNC_INFO(op_array);
+ zend_call_info *call_info = NULL;
+ zend_function *func = NULL;
+
+ if (delayed_call_chain) {
+ if (!zend_jit_save_call_chain(Dst, delayed_call_level)) {
+ return 0;
+ }
+ }
+
+ if (info) {
+ call_info = info->callee_info;
+ while (call_info && call_info->caller_init_opline != opline) {
+ call_info = call_info->next_callee;
+ }
+ if (call_info && call_info->callee_func) {
+ func = call_info->callee_func;
+ }
+ }
+
+#ifdef _WIN32
+ if (0) {
+#else
+ if (func && func->type == ZEND_INTERNAL_FUNCTION) {
+#endif
+ /* load constant address later */
+ } else if (func && op_array == &func->op_array) {
+ /* recursive call */
+ | mov r0, EX->func
+ } else {
+ | // if (CACHED_PTR(opline->result.num))
+ | mov r0, EX->run_time_cache
+ | mov r0, aword [r0 + opline->result.num]
+ | test r0, r0
+ | jz >1
+ |.cold_code
+ |1:
+ if (func && func->type == ZEND_USER_FUNCTION && (func->op_array.fn_flags & ZEND_ACC_IMMUTABLE)) {
+ | LOAD_ADDR FCARG1a, func
+ | EXT_CALL zend_jit_init_func_run_time_cache_helper, r0
+ | mov r1, EX->run_time_cache
+ | mov aword [r1 + opline->result.num], r0
+ | jmp >3
+ } else {
+ zval *zv = RT_CONSTANT(opline, opline->op2);
+
+ if (opline->opcode == ZEND_INIT_FCALL) {
+ | LOAD_ADDR FCARG1a, Z_STR_P(zv);
+ } else if (opline->opcode == ZEND_INIT_FCALL_BY_NAME) {
+ | LOAD_ADDR FCARG1a, Z_STR_P(zv + 1);
+ } else {
+ ZEND_ASSERT(0);
+ }
+ | EXT_CALL zend_jit_find_func_helper, r0
+ | // CACHE_PTR(opline->result.num, fbc);
+ | mov r1, EX->run_time_cache
+ | mov aword [r1 + opline->result.num], r0
+ | test r0, r0
+ | jnz >3
+ | // SAVE_OPLINE();
+ | SAVE_VALID_OPLINE opline
+ | jmp ->undefined_function
+ }
+ |.code
+ |3:
+ }
+
+ if (!zend_jit_push_call_frame(Dst, opline, op_array, func)) {
+ return 0;
+ }
+
+ if (zend_jit_needs_call_chain(call_info, b, op_array, ssa, opline)) {
+ if (!zend_jit_save_call_chain(Dst, call_level)) {
+ return 0;
+ }
+ } else {
+ delayed_call_chain = 1;
+ delayed_call_level = call_level;
+ }
+
+ return 1;
+}
+
+static uint32_t skip_valid_arguments(const zend_op_array *op_array, zend_ssa *ssa, zend_call_info *call_info)
+{
+ uint32_t num_args = 0;
+ zend_function *func = call_info->callee_func;
+
+ while (num_args < call_info->num_args) {
+ zend_arg_info *arg_info = func->op_array.arg_info + num_args;
+
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ if (ZEND_TYPE_IS_MASK(arg_info->type)) {
+ uint32_t type_mask = ZEND_TYPE_MASK(arg_info->type);
+ uint32_t info = _ssa_op1_info(op_array, ssa, call_info->arg_info[num_args].opline);
+ if ((info & (MAY_BE_ANY|MAY_BE_UNDEF)) & ~type_mask) {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+ num_args++;
+ }
+ return num_args;
+}
+
+static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, int call_level, unsigned int next_block)
+{
+ zend_func_info *info = ZEND_FUNC_INFO(op_array);
+ zend_call_info *call_info = NULL;
+ zend_function *func = NULL;
+ uint32_t i;
+ zend_jit_addr res_addr;
+
+ if (RETURN_VALUE_USED(opline)) {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+ } else {
+#ifdef _WIN64
+ /* Reuse reserved arguments stack */
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R4, 0x20);
+#else
+ /* CPU stack alocated temorary zval */
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R4, 8);
+#endif
+ }
+
+ if (info) {
+ call_info = info->callee_info;
+ while (call_info && call_info->caller_call_opline != opline) {
+ call_info = call_info->next_callee;
+ }
+ if (call_info && call_info->callee_func) {
+ func = call_info->callee_func;
+ }
+ }
+ if (!func) {
+ /* resolve function ar run time */
+ } else if (func->type == ZEND_USER_FUNCTION) {
+ ZEND_ASSERT(opline->opcode != ZEND_DO_ICALL);
+ if (call_info->num_args > func->op_array.num_args ||
+ (opline-1)->opcode == ZEND_SEND_UNPACK ||
+ (opline-1)->opcode == ZEND_SEND_ARRAY) {
+ goto fallback;
+ }
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
+ ZEND_ASSERT(opline->opcode != ZEND_DO_UCALL);
+#if ZEND_DEBUG
+ if (func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ goto fallback;
+ }
+#endif
+ if ((opline-1)->opcode == ZEND_SEND_UNPACK || (opline-1)->opcode == ZEND_SEND_ARRAY) {
+ goto fallback;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ zend_jit_stop_reuse_ip();
+
+ | // fbc = call->func;
+ | // mov r2, EX:RX->func ???
+ | // SAVE_OPLINE();
+ | SAVE_VALID_OPLINE opline
+
+ if (!delayed_call_chain) {
+ if (call_level == 1) {
+ | mov aword EX->call, 0
+ } else {
+ | //EX(call) = call->prev_execute_data;
+ | mov r0, EX:RX->prev_execute_data
+ | mov EX->call, r0
+ }
+ }
+ delayed_call_chain = 0;
+
+ | //call->prev_execute_data = execute_data;
+ | mov EX:RX->prev_execute_data, EX
+
+ if (!func) {
+ | mov r0, EX:RX->func
+ }
+
+ if (opline->opcode == ZEND_DO_FCALL) {
+ if (!func) {
+ | test dword [r0 + offsetof(zend_op_array, fn_flags)], ZEND_ACC_DEPRECATED
+ | jnz >1
+ |.cold_code
+ |1:
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ | jmp >1
+ |.code
+ |1:
+ } else if (func->common.fn_flags & ZEND_ACC_DEPRECATED) {
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ }
+ }
+
+ if (!func
+ && opline->opcode != ZEND_DO_UCALL
+ && opline->opcode != ZEND_DO_ICALL) {
+ | cmp byte [r0 + offsetof(zend_function, type)], ZEND_USER_FUNCTION
+ | jne >8
+ }
+
+ if ((!func || func->type == ZEND_USER_FUNCTION)
+ && opline->opcode != ZEND_DO_ICALL) {
+ | // EX(call) = NULL;
+ | mov aword EX:RX->call, 0
+
+ if (RETURN_VALUE_USED(opline)) {
+ | // EX(return_value) = EX_VAR(opline->result.var);
+ | LOAD_ZVAL_ADDR r2, res_addr
+ | mov aword EX:RX->return_value, r2
+ } else {
+ | // EX(return_value) = 0;
+ | mov aword EX:RX->return_value, 0
+ }
+
+ if (func) {
+ for (i = call_info->num_args; i < func->op_array.last_var; i++) {
+ uint32_t n = (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, i);
+ | SET_Z_TYPE_INFO RX + n, IS_UNDEF
+ }
+ }
+
+ //EX_LOAD_RUN_TIME_CACHE(op_array);
+ if (!func || func->op_array.cache_size) {
+ if (func && op_array == &func->op_array) {
+ /* recursive call */
+ if (func->op_array.cache_size > sizeof(void*)) {
+ | mov r2, EX->run_time_cache
+ | mov EX:RX->run_time_cache, r2
+ }
+ } else {
+ if (func) {
+ | mov r0, EX:RX->func
+ }
+ | mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
+#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
+ | mov r2, aword [r2]
+#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
+ | xor r1, r1
+ | test r2, 1
+ | jz >1
+ | MEM_OP2_2_ZTS mov, r1, aword, compiler_globals, map_ptr_base, r1
+ | sub r1, 1
+ |1:
+ | mov r2, aword [r1 + r2]
+#else
+# error "Unknown ZEND_MAP_PTR_KIND"
+#endif
+ | mov EX:RX->run_time_cache, r2
+ }
+ }
+
+ | // EG(current_execute_data) = execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
+ | mov FP, RX
+
+ | // opline = op_array->opcodes;
+ if (func) {
+ uint32_t num_args;
+
+ if (func->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ num_args = skip_valid_arguments(op_array, ssa, call_info);
+ } else {
+ num_args = call_info->num_args;
+ }
+ if (func && zend_accel_in_shm(func->op_array.opcodes)) {
+ | LOAD_IP_ADDR (func->op_array.opcodes + num_args)
+ } else {
+ if (func) {
+ | mov r0, EX->func
+ }
+ if (GCC_GLOBAL_REGS) {
+ | mov IP, aword [r0 + offsetof(zend_op_array, opcodes)]
+ if (num_args) {
+ | add IP, (num_args * sizeof(zend_op))
+ }
+ } else {
+ | mov FCARG1a, aword [r0 + offsetof(zend_op_array, opcodes)]
+ if (num_args) {
+ | add FCARG1a, (num_args * sizeof(zend_op))
+ }
+ | mov aword EX->opline, FCARG1a
+ }
+ }
+
+ if (op_array == &func->op_array) {
+ /* recursive call */
+#ifdef CONTEXT_THREADED_JIT
+ | call >1
+ |.cold_code
+ |1:
+ | pop r0
+ | jmp =>num_args
+ |.code
+#else
+ | jmp =>num_args
+#endif
+ return 1;
+ }
+ } else {
+ | // opline = op_array->opcodes
+ if (GCC_GLOBAL_REGS) {
+ | mov IP, aword [r0 + offsetof(zend_op_array, opcodes)]
+ } else {
+ | mov FCARG1a, aword [r0 + offsetof(zend_op_array, opcodes)]
+ | mov aword EX->opline, FCARG1a
+ }
+ | // first_extra_arg = op_array->num_args;
+ | mov edx, dword [r0 + offsetof(zend_op_array, num_args)]
+ | // num_args = EX_NUM_ARGS();
+ | mov ecx, dword [FP + offsetof(zend_execute_data, This.u2.num_args)]
+ | // if (UNEXPECTED(num_args > first_extra_arg))
+ | cmp edx, ecx
+ | jl >1
+ |.cold_code
+ |1:
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, FP
+ }
+ | EXT_CALL zend_jit_copy_extra_args_helper, r0
+ | mov r0, EX->func // reload
+ | mov ecx, dword [FP + offsetof(zend_execute_data, This.u2.num_args)] // reload
+ | jmp >1
+ |.code
+ | // if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0))
+ | test dword [r0 + offsetof(zend_op_array, fn_flags)], ZEND_ACC_HAS_TYPE_HINTS
+ | jnz >1
+ | // opline += num_args;
+ |.if X64
+ | movsxd r2, ecx
+ | imul r2, r2, sizeof(zend_op)
+ |.else
+ | imul r2, ecx, sizeof(zend_op)
+ |.endif
+ | ADD_IP r2
+ |1:
+ | // if (EXPECTED((int)num_args < op_array->last_var)) {
+ | mov edx, dword [r0 + offsetof(zend_op_array, last_var)]
+ | sub edx, ecx
+ | jle >3 //???
+ | // zval *var = EX_VAR_NUM(num_args);
+ |.if X64
+ | movsxd r1, ecx
+ |.endif
+ | shl r1, 4
+ | lea r1, [FP + r1 + (ZEND_CALL_FRAME_SLOT * sizeof(zval))]
+ |2:
+ | SET_Z_TYPE_INFO r1, IS_UNDEF
+ | sub edx, 1
+ | lea r1, [r1 + 16]
+ | jne <2
+ |3:
+ }
+
+#ifdef CONTEXT_THREADED_JIT
+ | call ->context_threaded_call
+ if (!func && (opline->opcode != ZEND_DO_UCALL)) {
+ | jmp >9
+ }
+#else
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ | JMP_IP
+ } else {
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 1 // ZEND_VM_ENTER
+ | ret
+ }
+#endif
+ }
+
+ if ((!func || func->type == ZEND_INTERNAL_FUNCTION)
+ && (opline->opcode != ZEND_DO_UCALL)) {
+ if (!func && (opline->opcode != ZEND_DO_ICALL)) {
+ |8:
+ }
+ if (opline->opcode == ZEND_DO_FCALL_BY_NAME) {
+ if (!func) {
+ | test dword [r0 + offsetof(zend_op_array, fn_flags)], ZEND_ACC_DEPRECATED
+ | jnz >1
+ |.cold_code
+ |1:
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ | jmp >1
+ |.code
+ |1:
+ } else if (func->common.fn_flags & ZEND_ACC_DEPRECATED) {
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ }
+ }
+
+ if (!RETURN_VALUE_USED(opline)) {
+ |.if not(X64WIN)
+ | sub r4, 16 /* alloca() */
+ |.endif
+ }
+
+ | // ZVAL_NULL(EX_VAR(opline->result.var));
+ | LOAD_ZVAL_ADDR FCARG2a, res_addr
+ | SET_Z_TYPE_INFO FCARG2a, IS_NULL
+
+ | // EG(current_execute_data) = execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
+
+ zend_jit_reset_opline(Dst, NULL);
+
+ | // fbc->internal_function.handler(call, ret);
+ | mov FCARG1a, RX
+ if (func) {
+ | EXT_CALL func->internal_function.handler, r0
+ } else {
+ | call aword [r0 + offsetof(zend_internal_function, handler)]
+ }
+
+ | // EG(current_execute_data) = execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, FP, r0
+
+ | // zend_vm_stack_free_args(call);
+ if (func) {
+ for (i = 0; i < call_info->num_args; i++ ) {
+ uint32_t offset = (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, i);
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_RX, offset), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN, 0, 1, 1, opline
+ }
+ } else {
+ | mov FCARG1a, RX
+ | EXT_CALL zend_jit_vm_stack_free_args_helper, r0
+ }
+
+ |8:
+ if (opline->opcode == ZEND_DO_FCALL) {
+ // TODO: optimize ???
+ | // if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS))
+ | test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 2], (ZEND_CALL_RELEASE_THIS >> 16)
+ | jnz >1
+ |.cold_code
+ |1:
+ | GET_Z_PTR r0, RX + offsetof(zend_execute_data, This)
+ | // OBJ_RELEASE(object);
+ | OBJ_RELEASE r0, ecx, >2
+ | jmp >2
+ |.code
+ |2:
+ }
+
+ | // zend_vm_stack_free_call_frame(call);
+ | test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 2], (ZEND_CALL_ALLOCATED >> 16)
+ | jnz >1
+ |.cold_code
+ |1:
+ | mov FCARG1a, RX
+ | EXT_CALL zend_jit_free_call_frame, r0
+ | jmp >1
+ |.code
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, vm_stack_top, RX, r0
+ |1:
+
+ if (!RETURN_VALUE_USED(opline)) {
+ uint32_t func_info = call_info ?
+ zend_get_func_info(call_info, ssa) :
+ (MAY_BE_ANY|MAY_BE_REF|MAY_BE_RC1|MAY_BE_RCN);
+
+ if (func_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ | ZVAL_PTR_DTOR res_addr, func_info, 1, 1, 0, opline
+ }
+ |.if not(X64WIN)
+ | add r4, 16 /* revert alloca() */
+ |.endif
+ }
+
+ | // if (UNEXPECTED(EG(exception) != NULL)) {
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne >1
+ |.cold_code
+ |1:
+ | LOAD_IP_ADDR opline
+ | jmp ->icall_throw_handler
+ |.code
+
+ // TODO: Can we avoid checking for interrupts after each call ???
+ if (!zend_jit_check_timeout(Dst, opline + 1)) {
+ return 0;
+ }
+ if (opline->opcode != ZEND_DO_ICALL) {
+ | LOAD_IP_ADDR (opline + 1)
+ }
+ }
+
+ if (!func) {
+ |9:
+ }
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ if (opline->opcode == ZEND_DO_FCALL ||
+ opline->opcode == ZEND_DO_UCALL ||
+ opline->opcode == ZEND_DO_FCALL_BY_NAME ){
+ return zend_jit_call(Dst, opline, next_block);
+ } else {
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+ }
+}
+
+static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info;
+ uint32_t arg_num = opline->op2.num;
+ zend_jit_addr op1_addr, arg_addr;
+
+ if (opline->opcode == ZEND_SEND_VAL_EX && arg_num > MAX_ARG_FLAG_NUM) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+
+ if (opline->opcode == ZEND_SEND_VAL_EX) {
+ uint32_t mask = ZEND_SEND_BY_REF << ((arg_num + 3) * 2);
+
+ | mov r0, EX:RX->func
+ if (arg_num <= MAX_ARG_FLAG_NUM) {
+ | test dword [r0 + offsetof(zend_function, quick_arg_flags)], mask
+ | jnz >1
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | jmp ->throw_cannot_pass_by_ref
+ |.code
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ arg_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, opline->result.var);
+
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+
+ | ZVAL_COPY_CONST arg_addr, -1, zv, r0
+ if (Z_REFCOUNTED_P(zv)) {
+ | ADDREF_CONST zv, r0
+ }
+ } else {
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ }
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_send_ref(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, int cold)
+{
+ uint32_t op1_info;
+ zend_jit_addr op1_addr, arg_addr, ref_addr;
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ arg_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, opline->result.var);
+ op1_info = OP1_INFO();
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+
+ if (opline->op1_type == IS_VAR) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | // if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
+ | IF_NOT_Z_TYPE r0, IS_INDIRECT, >1
+ | // ret = Z_INDIRECT_P(ret);
+ | GET_Z_PTR r0, r0
+ |1:
+ } else if (opline->op1_type == IS_CV) {
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_NULL
+ | jmp >2
+ |1:
+ }
+ op1_info &= ~MAY_BE_UNDEF;
+ op1_info |= MAY_BE_NULL;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) {
+ if (op1_info & MAY_BE_REF) {
+ if (opline->op1_type == IS_VAR) {
+ | IF_NOT_Z_TYPE r0, IS_REFERENCE, >2
+ | GET_Z_PTR r1, r0
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_REFERENCE, >2
+ | GET_ZVAL_PTR r1, op1_addr
+ }
+ | GC_ADDREF r1
+ | SET_ZVAL_PTR arg_addr, r1
+ | SET_ZVAL_TYPE_INFO arg_addr, IS_REFERENCE_EX
+ | jmp >6
+ }
+ |2:
+ | // ZVAL_NEW_REF(arg, varptr);
+ if (opline->op1_type == IS_VAR) {
+ | mov aword T1, r0 // save
+ }
+ | EMALLOC sizeof(zend_reference), op_array, opline
+ | mov dword [r0], 2
+ | mov dword [r0 + offsetof(zend_reference, gc.u.type_info)], IS_REFERENCE
+ | mov aword [r0 + offsetof(zend_reference, sources.ptr)], 0
+ ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 8);
+ if (opline->op1_type == IS_VAR) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R1, 0);
+
+ | mov r1, aword T1 // restore
+ | ZVAL_COPY_VALUE ref_addr, -1, val_addr, op1_info, ZREG_R2, ZREG_R2
+ | SET_ZVAL_PTR val_addr, r0
+ | SET_ZVAL_TYPE_INFO val_addr, IS_REFERENCE_EX
+ } else {
+ | ZVAL_COPY_VALUE ref_addr, -1, op1_addr, op1_info, ZREG_R1, ZREG_R2
+ | SET_ZVAL_PTR op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_REFERENCE_EX
+ }
+ | SET_ZVAL_PTR arg_addr, r0
+ | SET_ZVAL_TYPE_INFO arg_addr, IS_REFERENCE_EX
+ }
+
+ |6:
+ | FREE_OP opline->op1_type, opline->op1, op1_info, !cold, op_array, opline
+ |7:
+
+ return 1;
+}
+
+static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info;
+ uint32_t arg_num = opline->op2.num;
+ zend_jit_addr op1_addr, arg_addr;
+
+ if ((opline->opcode == ZEND_SEND_VAR_EX ||
+ opline->opcode == ZEND_SEND_VAR_NO_REF_EX) &&
+ arg_num > MAX_ARG_FLAG_NUM) {
+ goto fallback;
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ arg_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, opline->result.var);
+ op1_info = OP1_INFO();
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+
+ if (opline->opcode == ZEND_SEND_VAR_EX || opline->opcode == ZEND_SEND_VAR_NO_REF_EX) {
+ uint32_t mask = (ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF) << ((arg_num + 3) * 2);
+
+ | mov r0, EX:RX->func
+ if (arg_num <= MAX_ARG_FLAG_NUM) {
+ | test dword [r0 + offsetof(zend_function, quick_arg_flags)], mask
+ | jnz >1
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ |.cold_code
+ |1:
+
+ if (opline->opcode == ZEND_SEND_VAR_EX) {
+ if (!zend_jit_send_ref(Dst, opline, op_array, ssa, 1)) {
+ return 0;
+ }
+ } else if (opline->opcode == ZEND_SEND_VAR_NO_REF_EX) {
+ mask = ZEND_SEND_PREFER_REF << ((arg_num + 3) * 2);
+
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R1, ZREG_R2
+ if (op1_info & MAY_BE_REF) {
+ | cmp cl, IS_REFERENCE
+ | je >7
+ }
+ | test dword [r0 + offsetof(zend_function, quick_arg_flags)], mask
+ | jnz >7
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG1a, arg_addr
+ | EXT_CALL zend_jit_only_vars_by_reference, r0
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ | jmp >7
+ |.code
+ }
+
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | SET_ZVAL_TYPE_INFO arg_addr, IS_NULL
+
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | jmp >7
+ |.code
+ }
+ }
+
+ if (opline->opcode == ZEND_SEND_VAR_NO_REF) {
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R1, ZREG_R2
+ if (op1_info & MAY_BE_REF) {
+ | cmp cl, IS_REFERENCE
+ | je >7
+ }
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG1a, arg_addr
+ | EXT_CALL zend_jit_only_vars_by_reference, r0
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ } else if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ if (op1_info & MAY_BE_REF) {
+ if (opline->op1_type == IS_CV) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ | ZVAL_COPY_VALUE arg_addr, -1, val_addr, op1_info, ZREG_R0, ZREG_R2
+ | TRY_ADDREF op1_info, ah, r2
+ } else {
+ zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 8);
+
+ | IF_ZVAL_TYPE op1_addr, IS_REFERENCE, >1
+ |.cold_code
+ |1:
+ | // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | // ZVAL_COPY_VALUE(return_value, &ref->value);
+ | ZVAL_COPY_VALUE arg_addr, -1, ref_addr, op1_info, ZREG_R0, ZREG_R2
+ | GC_DELREF FCARG1a
+ | je >1
+ | IF_NOT_REFCOUNTED ah, >2
+ | GC_ADDREF r2
+ | jmp >2
+ |1:
+ | EFREE_REG_24 op_array, opline
+ | jmp >2
+ |.code
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ |2:
+ }
+ } else {
+ if (ra
+ && ssa->ops[opline - op_array->opcodes].op1_def >= 0
+ && !ssa->vars[ssa->ops[opline - op_array->opcodes].op1_def].no_val) {
+ zend_jit_addr op1_def_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ssa->ops[opline - op_array->opcodes].op1_def);
+
+ if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, op1_info, ra[ssa->ops[opline - op_array->opcodes].op1_use])) {
+ return 0;
+ }
+ if (Z_MODE(op1_def_addr) == IS_REG && Z_MODE(op1_addr) != IS_REG) {
+ op1_addr= op1_def_addr;
+ }
+ }
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ if (opline->op1_type == IS_CV) {
+ | TRY_ADDREF op1_info, ah, r2
+ }
+ }
+ }
+ |7:
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, int jmp, zend_bool smart_branch)
+{
+ uint32_t target_label;
+
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ if (jmp) {
+ | jmp >7
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | jmp =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ if (jmp) {
+ | jmp >7
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int b, const zend_op_array *op_array, zend_ssa *ssa, int jmp, zend_bool smart_branch)
+{
+ uint32_t target_label;
+
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | jmp =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ if (jmp) {
+ | jmp >7
+ }
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ if (jmp) {
+ | jmp >7
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, int b, int *opnum, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ zend_bool smart_branch = 0;
+ uint32_t defined_label = (uint32_t)-1;
+ uint32_t undefined_label = (uint32_t)-1;
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ zend_jit_addr res_addr;
+
+ if (((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPZNZ) &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == b) {
+ (*opnum)++;
+ smart_branch = 1;
+ }
+
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ undefined_label = ssa->cfg.blocks[b].successors[0];
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ defined_label = ssa->cfg.blocks[b].successors[0];
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ undefined_label = ssa->cfg.blocks[b].successors[0];
+ defined_label = ssa->cfg.blocks[b].successors[1];
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+
+ | // if (CACHED_PTR(opline->extended_value)) {
+ | mov r0, EX->run_time_cache
+ | mov r0, aword [r0 + opline->extended_value]
+ | test r0, r0
+ | jz >1
+ | test r0, 0x1
+ | jnz >4
+ |.cold_code
+ |4:
+ | MEM_OP2_2_ZTS mov, FCARG1a, aword, executor_globals, zend_constants, FCARG1a
+ | shr r0, 1
+ | cmp dword [FCARG1a + offsetof(HashTable, nNumOfElements)], eax
+ if (smart_branch) {
+ if (undefined_label != (uint32_t)-1) {
+ | jz =>undefined_label
+ } else {
+ | jz >3
+ }
+ } else {
+ | jz >2
+ }
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ADDR FCARG1a, zv
+ | EXT_CALL zend_jit_check_constant, r0
+ | test r0, r0
+ if (smart_branch) {
+ if (undefined_label != (uint32_t)-1) {
+ | jnz =>undefined_label
+ } else {
+ | jnz >3
+ }
+ if (defined_label != (uint32_t)-1) {
+ | jmp =>defined_label
+ } else {
+ | jmp >3
+ }
+ } else {
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+ | jz >1
+ |2:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jmp >3
+ }
+ |.code
+ if (smart_branch) {
+ if (defined_label != (uint32_t)-1) {
+ | jmp =>defined_label
+ }
+ } else {
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ |3:
+
+ return 1;
+}
+
+static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, int b, int *opnum, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info, mask;
+ uint32_t target_label;
+ zend_uchar type;
+ zend_bool smart_branch = 0;
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+
+ if (opline->extended_value & MAY_BE_RESOURCE) {
+ // TODO: support for is_resource() ???
+ goto fallback;
+ }
+
+ if (((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPZNZ) &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == b) {
+ (*opnum)++;
+ smart_branch = 1;
+ }
+
+ op1_info = OP1_INFO();
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (opline->extended_value & MAY_BE_NULL) {
+ if (!zend_jit_smart_true(Dst, opline, b, op_array, ssa, (op1_info & (MAY_BE_ANY|MAY_BE_REF)) != 0, smart_branch)) {
+ return 0;
+ }
+ } else {
+ if (!zend_jit_smart_false(Dst, opline, b, op_array, ssa, (op1_info & (MAY_BE_ANY|MAY_BE_REF)) != 0, smart_branch)) {
+ return 0;
+ }
+ }
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ |.code
+ }
+ }
+
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ mask = opline->extended_value;
+ switch (mask) {
+ case MAY_BE_NULL: type = IS_NULL; break;
+ case MAY_BE_FALSE: type = IS_FALSE; break;
+ case MAY_BE_TRUE: type = IS_TRUE; break;
+ case MAY_BE_LONG: type = IS_LONG; break;
+ case MAY_BE_DOUBLE: type = IS_DOUBLE; break;
+ case MAY_BE_STRING: type = IS_STRING; break;
+ case MAY_BE_ARRAY: type = IS_ARRAY; break;
+ case MAY_BE_OBJECT: type = IS_OBJECT; break;
+ default:
+ type = 0;
+ }
+
+ if (!(op1_info & (MAY_BE_ANY - mask))) {
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ if (!zend_jit_smart_true(Dst, opline, b, op_array, ssa, 0, smart_branch)) {
+ return 0;
+ }
+ } else if (!(op1_info & mask)) {
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ if (!zend_jit_smart_false(Dst, opline, b, op_array, ssa, 0, smart_branch)) {
+ return 0;
+ }
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | ZVAL_DEREF r0, op1_info
+ }
+ if (type == 0) {
+ if (smart_branch &&
+ (opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | // if (Z_REFCOUNTED_P(cv)) {
+ | IF_ZVAL_REFCOUNTED op1_addr, >1
+ |.cold_code
+ |1:
+ }
+ | // if (!Z_DELREF_P(cv)) {
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ if (RC_MAY_BE_1(op1_info)) {
+ if (RC_MAY_BE_N(op1_info)) {
+ | jnz >3
+ }
+ if (op1_info & MAY_BE_REF) {
+ | mov al, byte [r0 + 8]
+ } else {
+ | mov al, byte [FP + opline->op1.var + 8]
+ }
+ | mov byte T1, al // save
+ | // zval_dtor_func(r);
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov cl, byte T1 // restore
+ |jmp >2
+ }
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if (!RC_MAY_BE_1(op1_info)) {
+ | jmp >3
+ }
+ |.code
+ }
+ |3:
+ if (op1_info & MAY_BE_REF) {
+ | mov cl, byte [r0 + 8]
+ } else {
+ | mov cl, byte [FP + opline->op1.var + 8]
+ }
+ |2:
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | mov cl, byte [r0 + 8]
+ } else {
+ | mov cl, byte [FP + opline->op1.var + 8]
+ }
+ }
+ | mov eax, 1
+ | shl eax, cl
+ | test eax, mask
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | je =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | jne =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | je =>target_label
+ target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | setne al
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ }
+ } else {
+ if (smart_branch &&
+ (opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | // if (Z_REFCOUNTED_P(cv)) {
+ | IF_ZVAL_REFCOUNTED op1_addr, >1
+ |.cold_code
+ |1:
+ }
+ | // if (!Z_DELREF_P(cv)) {
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ if (RC_MAY_BE_1(op1_info)) {
+ if (RC_MAY_BE_N(op1_info)) {
+ | jnz >3
+ }
+ if (op1_info & MAY_BE_REF) {
+ | mov al, byte [r0 + 8]
+ } else {
+ | mov al, byte [FP + opline->op1.var + 8]
+ }
+ | mov byte T1, al // save
+ | // zval_dtor_func(r);
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov cl, byte T1 // restore
+ |jmp >2
+ }
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if (!RC_MAY_BE_1(op1_info)) {
+ | jmp >3
+ }
+ |.code
+ }
+ |3:
+ if (op1_info & MAY_BE_REF) {
+ | mov cl, byte [r0 + 8]
+ } else {
+ | mov cl, byte [FP + opline->op1.var + 8]
+ }
+ |2:
+ | cmp cl, type
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | cmp byte [r0 + 8], type
+ } else {
+ | cmp byte [FP + opline->op1.var + 8], type
+ }
+ }
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | jne =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | je =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ target_label = ssa->cfg.blocks[b].successors[0];
+ | jne =>target_label
+ target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | sete al
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ }
+ }
+ }
+ }
+
+ |7:
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_free_compiled_variables(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t i, j, info;
+
+ // Use type inference to avoid useless zval_ptr_dtor()
+ for (i = 0 ; i < op_array->last_var; i++) {
+ if (ssa->vars && ssa->var_info) {
+ info = ssa->var_info[i].type;
+ for (j = op_array->last_var; j < ssa->vars_count; j++) {
+ if (ssa->vars[j].var == i) {
+ info |= ssa->var_info[j].type;
+ }
+ }
+ } else {
+ info = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_UNDEF;
+ }
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ /* Refcount may be increased by RETRUN opcode */
+ if ((info & MAY_BE_RC1) && !(info & MAY_BE_RCN)) {
+ for (j = 0; j < ssa->cfg.blocks_count; j++) {
+ if ((ssa->cfg.blocks[j].flags & ZEND_BB_REACHABLE) &&
+ ssa->cfg.blocks[j].len > 0) {
+ const zend_op *opline = op_array->opcodes + ssa->cfg.blocks[j].start + ssa->cfg.blocks[j].len - 1;
+
+ if (opline->opcode == ZEND_RETURN) {
+ if (opline->op1_type == IS_CV &&
+ opline->op1.var == (uint32_t)(uintptr_t)(ZEND_CALL_VAR_NUM(NULL, i))) {
+ info |= MAY_BE_RCN;
+ break;
+ }
+ }
+ }
+ }
+ }
+#endif
+
+ if (info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ uint32_t offset = (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, i);
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_FP, offset), info, 1, 1, 1, opline
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_leave_func(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ // Avoid multiple leave sequnces
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ return 1;
+ }
+
+ jit_return_label = ssa->cfg.blocks_count * 2;
+
+ |=>jit_return_label:
+
+ // i_free_compiled_variables(execute_data);
+ if (!zend_jit_free_compiled_variables(Dst, opline, op_array, ssa)) {
+ return 0;
+ }
+
+ /* ZEND_CALL_FAKE_CLOSURE handled on slow path to eliminate check for ZEND_CALL_CLOSURE on fast path */
+ | mov FCARG1d, dword [FP + offsetof(zend_execute_data, This.u1.type_info)]
+ | test FCARG1d, (ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED|ZEND_CALL_FAKE_CLOSURE)
+ | jnz ->leave_function_handler
+
+ if ((op_array->scope && !(op_array->fn_flags & ZEND_ACC_STATIC)) ||
+ (op_array->fn_flags & ZEND_ACC_CLOSURE)) {
+ | // EG(current_execute_data) = EX(prev_execute_data);
+ | mov r0, EX->prev_execute_data
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, r0, r2
+ if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
+ | // OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ | mov r0, EX->func
+ | sub r0, sizeof(zend_object)
+ | OBJ_RELEASE r0, ecx, >4
+ } else if (op_array->scope && !(op_array->fn_flags & ZEND_ACC_STATIC)) {
+ | // if (call_info & ZEND_CALL_RELEASE_THIS)
+ | test FCARG1d, ZEND_CALL_RELEASE_THIS
+ | je >4
+ | // zend_object *object = Z_OBJ(execute_data->This);
+ | mov r0, EX->This.value.obj
+ | // OBJ_RELEASE(object);
+ | OBJ_RELEASE r0, ecx, >4
+ }
+ |4:
+ | // EG(vm_stack_top) = (zval*)execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, vm_stack_top, FP, r0
+ | // execute_data = EX(prev_execute_data);
+ | mov FP, EX->prev_execute_data
+ } else {
+ | // EG(vm_stack_top) = (zval*)execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, vm_stack_top, FP, r0
+ | // execute_data = EX(prev_execute_data);
+ | mov FP, EX->prev_execute_data
+ | // EG(current_execute_data) = execute_data
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, FP, r0
+ }
+ | // if (EG(exception))
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | LOAD_OPLINE
+ | jne ->leave_throw_handler
+ | // opline = EX(opline) + 1
+ | ADD_IP sizeof(zend_op)
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+#ifdef CONTEXT_THREADED_JIT
+ | push aword [IP]
+ | ret
+#else
+ | JMP_IP
+#endif
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+#ifdef CONTEXT_THREADED_JIT
+ | push aword [IP]
+ | ret
+#else
+ | JMP_IP
+#endif
+ } else {
+#ifdef CONTEXT_THREADED_JIT
+ ZEND_ASSERT(0);
+ // TODO: context threading can't work without GLOBAL REGS because we have to change
+ // the value of execute_data in execute_ex()
+ | mov FCARG1a, FP
+ | mov r0, aword [FP]
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | push aword [r0]
+ | ret
+#else
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 2 // ZEND_VM_LEAVE
+ | ret
+#endif
+ }
+
+ return 1;
+}
+
+static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval **ra)
+{
+ uint32_t op1_info;
+ zend_jit_addr op1_addr, ret_addr;
+
+ if (op_array->type == ZEND_EVAL_CODE || !op_array->function_name) {
+ // TODO: support for top-level code
+ return zend_jit_tail_handler(Dst, opline);
+ }
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ return zend_jit_tail_handler(Dst, opline);
+ }
+
+ op1_info = OP1_INFO();
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, ra, ra ? ssa->ops[opline - op_array->opcodes].op1_use : -1);
+ if (opline->op1_type == IS_CV && (op1_info & MAY_BE_UNDEF)) {
+ // TODO: support for IS_UNDEF ???
+ return zend_jit_tail_handler(Dst, opline);
+ }
+
+ // if (!EX(return_value))
+ if (Z_MODE(op1_addr) == IS_REG && Z_REG(op1_addr) == ZREG_R1) {
+ | mov r2, EX->return_value
+ | test r2, r2
+ ret_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 0);
+ } else {
+ | mov r1, EX->return_value
+ | test r1, r1
+ ret_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R1, 0);
+ }
+ if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | jz >1
+ |.cold_code
+ |1:
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if (jit_return_label >= 0) {
+ | IF_NOT_ZVAL_REFCOUNTED op1_addr, =>jit_return_label
+ } else {
+ | IF_NOT_ZVAL_REFCOUNTED op1_addr, >9
+ }
+ }
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ if (RC_MAY_BE_1(op1_info)) {
+ if (RC_MAY_BE_N(op1_info)) {
+ if (jit_return_label >= 0) {
+ | jnz =>jit_return_label
+ } else {
+ | jnz >9
+ }
+ }
+ | //SAVE_OPLINE()
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | //????mov r1, EX->return_value // reload ???
+ }
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ } else {
+ | jmp >9
+ }
+ |.code
+ } else {
+ if (jit_return_label >= 0) {
+ | jz =>jit_return_label
+ } else {
+ | jz >9
+ }
+ }
+
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ | ZVAL_COPY_CONST ret_addr, -1, zv, r0
+ if (Z_REFCOUNTED_P(zv)) {
+ | ADDREF_CONST zv, r0
+ }
+ } else if (opline->op1_type == IS_TMP_VAR) {
+ | ZVAL_COPY_VALUE ret_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ } else if (opline->op1_type == IS_CV) {
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | ZVAL_DEREF r0, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
+ }
+ | ZVAL_COPY_VALUE ret_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ | // TODO: JIT: if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr); ???
+ | TRY_ADDREF op1_info, ah, r2
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, offsetof(zend_reference, val));
+
+ | IF_ZVAL_TYPE op1_addr, IS_REFERENCE, >1
+ |.cold_code
+ |1:
+ | // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
+ | GET_ZVAL_PTR r0, op1_addr
+ | // ZVAL_COPY_VALUE(return_value, &ref->value);
+ | ZVAL_COPY_VALUE ret_addr, -1, ref_addr, op1_info, ZREG_R2, ZREG_R2
+ | GC_DELREF r0
+ | je >2
+ | // if (IS_REFCOUNTED())
+ if (jit_return_label >= 0) {
+ | IF_NOT_REFCOUNTED dh, =>jit_return_label
+ } else {
+ | IF_NOT_REFCOUNTED dh, >9
+ }
+ | // ADDREF
+ | GET_ZVAL_PTR r2, ret_addr // reload
+ | GC_ADDREF r2
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ } else {
+ | jmp >9
+ }
+ |2:
+ | EFREE_24 r0, op_array, opline
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ } else {
+ | jmp >9
+ }
+ |.code
+ }
+ | ZVAL_COPY_VALUE ret_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ }
+
+ |9:
+ //JIT: ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ return zend_jit_leave_func(Dst, opline, op_array, ssa);
+}
+
+static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info, op2_info, res_info;
+ zend_jit_addr op1_addr, orig_op1_addr, op2_addr, res_addr;
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ res_info = RES_INFO();
+
+ op1_addr = orig_op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ | GET_ZVAL_LVAL ZREG_FCARG1a, op1_addr
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, op_array, (opline->opcode == ZEND_FETCH_DIM_R) ? BP_VAR_R : BP_VAR_IS, op1_info, op2_info, 8, 9)) {
+ return 0;
+ }
+ }
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) {
+ if (op1_info & MAY_BE_ARRAY) {
+ |.cold_code
+ |7:
+ }
+
+ if (op1_info & MAY_BE_STRING) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >6
+ }
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ if (opline->opcode == ZEND_FETCH_DIM_R) {
+ | EXT_CALL zend_jit_fetch_dim_str_r_helper, r0
+ } else if (opline->opcode == ZEND_FETCH_DIM_IS) {
+ | EXT_CALL zend_jit_fetch_dim_str_is_helper, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if ((op1_info & MAY_BE_ARRAY) ||
+ (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING)))) {
+ | jmp >9 // END
+ }
+ |6:
+ }
+
+ if (op1_info & MAY_BE_OBJECT) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, >6
+ }
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ if (opline->opcode == ZEND_FETCH_DIM_R) {
+ | EXT_CALL zend_jit_fetch_dim_obj_r_helper, r0
+ } else if (opline->opcode == ZEND_FETCH_DIM_IS) {
+ | EXT_CALL zend_jit_fetch_dim_obj_is_helper, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if ((op1_info & MAY_BE_ARRAY) ||
+ (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT)))) {
+ | jmp >9 // END
+ }
+ |6:
+ }
+
+ if ((opline->opcode != ZEND_FETCH_DIM_IS && (op1_info & MAY_BE_UNDEF)) || (op2_info & MAY_BE_UNDEF)) {
+ | SAVE_VALID_OPLINE opline
+ if (opline->opcode != ZEND_FETCH_DIM_IS && (op1_info & MAY_BE_UNDEF)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+
+ if (op2_info & MAY_BE_UNDEF) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_UNDEF, >1
+ | mov FCARG1d, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+ }
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT))) {
+ if (opline->opcode != ZEND_FETCH_DIM_IS) {
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG1a, orig_op1_addr
+ | EXT_CALL zend_jit_invalid_array_access, r0
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ if (op1_info & MAY_BE_ARRAY) {
+ | jmp >9 // END
+ }
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ |.code
+ }
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
+
+ |8:
+ if (op1_info & MAY_BE_ARRAY_OF_REF) {
+ | // ZVAL_COPY_DEREF
+ | IF_NOT_ZVAL_REFCOUNTED val_addr, >2
+ | IF_NOT_ZVAL_TYPE val_addr, IS_REFERENCE, >1
+ | GET_Z_PTR r0, r0
+ | add r0, offsetof(zend_reference, val)
+ | IF_NOT_ZVAL_REFCOUNTED val_addr, >2
+ |1:
+ | GET_Z_PTR r1, r0
+ | GC_ADDREF r1
+ |2:
+ | ZVAL_COPY_VALUE res_addr, -1, val_addr, MAY_BE_ANY, ZREG_R1, ZREG_R2
+ } else {
+ | // ZVAL_COPY
+ | ZVAL_COPY_VALUE res_addr, -1, val_addr, MAY_BE_ANY, ZREG_R1, ZREG_R2
+ | TRY_ADDREF res_info, ch, r2
+ }
+ }
+ |9: // END
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) && (op1_info & MAY_BE_OBJECT)) {
+ /* Magic offsetGet() may increase refcount of the key */
+ op2_info |= MAY_BE_RCN;
+ }
+#endif
+
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, int b, int *opnum, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ zend_bool smart_branch = 0;
+ uint32_t op1_info, op2_info;
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+
+ if ((opline->extended_value & ZEND_ISEMPTY)) {
+ // TODO: support for empty() ???
+ goto fallback;
+ }
+
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ goto fallback;
+ }
+
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (((opline+1)->opcode == ZEND_JMPZ ||
+ (opline+1)->opcode == ZEND_JMPNZ ||
+ (opline+1)->opcode == ZEND_JMPZNZ) &&
+ (opline+1)->op1_type == IS_TMP_VAR &&
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == b) {
+ (*opnum)++;
+ smart_branch = 1;
+ }
+
+ op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ op2_addr = zend_jit_decode_op(op_array, opline->op2_type, opline->op2, opline, NULL, -1);
+ res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ | GET_ZVAL_LVAL ZREG_FCARG1a, op1_addr
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, op_array, BP_JIT_IS, op1_info, op2_info, 8, 9)) {
+ return 0;
+ }
+ }
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) {
+ if (op1_info & MAY_BE_ARRAY) {
+ |.cold_code
+ |7:
+ }
+
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ | EXT_CALL zend_jit_isset_dim_helper, r0
+ | test r0, r0
+ | jz >9
+ | jmp >8
+
+ if (op1_info & MAY_BE_ARRAY) {
+ |.code
+ }
+ }
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) && (op1_info & MAY_BE_OBJECT)) {
+ /* Magic offsetExists() may increase refcount of the key */
+ op2_info |= MAY_BE_RCN;
+ }
+#endif
+
+ |8:
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception_undef_result(Dst, opline)) {
+ return 0;
+ }
+ }
+ if (!(opline->extended_value & ZEND_ISEMPTY)) {
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ unsigned int target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ unsigned int target_label = ssa->cfg.blocks[b].successors[0];
+ | jmp =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ unsigned int target_label = ssa->cfg.blocks[b].successors[1];
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jmp >8
+ }
+ } else {
+ | //????
+ | int3
+ }
+
+ |9: // not found
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception_undef_result(Dst, opline)) {
+ return 0;
+ }
+ }
+ if (!(opline->extended_value & ZEND_ISEMPTY)) {
+ if (smart_branch) {
+ if ((opline+1)->opcode == ZEND_JMPZ) {
+ unsigned int target_label = ssa->cfg.blocks[b].successors[0];
+ | jmp =>target_label
+ } else if ((opline+1)->opcode == ZEND_JMPNZ) {
+ } else if ((opline+1)->opcode == ZEND_JMPZNZ) {
+ unsigned int target_label = ssa->cfg.blocks[b].successors[0];
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ } else {
+ | //????
+ | int3
+ }
+
+ |8:
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info;
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ zval *varname = RT_CONSTANT(opline, opline->op2);
+
+ if (!ssa->ops || !ssa->var_info) {
+ op1_info = MAY_BE_ANY|MAY_BE_REF;
+ } else {
+ op1_info = OP1_INFO();
+ }
+
+ //idx = (uint32_t)(uintptr_t)CACHED_PTR(opline->extended_value) - 1;
+ | mov r0, EX->run_time_cache
+ | mov r0, aword [r0 + opline->extended_value]
+ | sub r0, 1
+ //if (EXPECTED(idx < EG(symbol_table).nNumUsed))
+ | MEM_OP2_2_ZTS cmp, eax, dword, executor_globals, symbol_table.nNumUsed, r1
+ | jae >9
+ //Bucket *p = EG(symbol_table).arData + idx;
+ |.if X64
+ | shl r0, 5
+ |.else
+ | imul r0, sizeof(Bucket)
+ |.endif
+ | MEM_OP2_2_ZTS add, r0, aword, executor_globals, symbol_table.arData, r1
+ | IF_Z_TYPE r0, IS_UNDEF, >9
+ // (EXPECTED(p->key == Z_STR_P(varname))
+ | ADDR_OP2_2 cmp, aword [r0 + offsetof(Bucket, key)], Z_PTR_P(varname), r1
+ | jne >1
+ |.cold_code
+ |1:
+ //(EXPECTED(p->h == ZSTR_H(Z_STR_P(varname)))
+ | ADDR_OP2_2 cmp, aword [r0 + offsetof(Bucket, h)], ZSTR_H(Z_STR_P(varname)), r1
+ | jne >9
+ //EXPECTED(p->key != NULL)
+ | mov r1, [r0 + offsetof(Bucket, key)]
+ | test r1, r1
+ | jz >9
+ //EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(varname))
+ | ADDR_OP2_2 cmp, aword [r1 + offsetof(zend_string, len)], Z_STRLEN_P(varname), r2
+ | jne >9
+ //EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)
+ | add r1, offsetof(zend_string, val)
+ | mov T1, r0
+ |.if X64
+ | mov CARG1, r1
+ | LOAD_ADDR CARG2, Z_STRVAL_P(varname)
+ | mov CARG3, Z_STRLEN_P(varname)
+ | EXT_CALL memcmp, r0
+ |.else
+ | sub r4, 4
+ | push Z_STRLEN_P(varname)
+ | push Z_STRVAL_P(varname)
+ | push r1
+ | call &memcmp
+ | add r4, 16
+ |.endif
+ | test al, al
+ | mov r0, aword T1
+ | jnz >9
+ | jmp >2
+ |.code
+ |2:
+ // if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT))
+ | mov cl, byte [r0 + 8]
+ | cmp cl, IS_INDIRECT
+ | je >1
+ |.cold_code
+ |1:
+ //value = Z_INDIRECT_P(value)
+ | mov r0, [r0]
+ | mov cl, byte [r0 + 8]
+ | test cl, cl // cmp cl, IS_UNDEF
+ | jne >2
+ | SET_Z_TYPE_INFO r0, IS_NULL
+ | jmp >8
+ |.code
+ |2:
+ | cmp cl, IS_REFERENCE
+ | jne >8
+ |1:
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ //stash this for later use
+ | mov r2, r0
+ }
+ | GET_Z_PTR r0, r0
+ | GC_ADDREF r0
+ //if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr)))
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ if (op1_info & (MAY_BE_ANY - (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | IF_ZVAL_REFCOUNTED op1_addr, >2
+ }
+ |.cold_code
+ //zval_dtor_func(Z_COUNTED_P(variable_ptr))
+ |2:
+ //if (EXPECTED(variable_ptr != value))
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | cmp FCARG1a, r2
+ | je >4
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | GC_DELREF FCARG1a
+ if (op1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
+ | jnz >3
+ }
+ | mov aword T1, r0 // save
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov r0, aword T1 // restore
+ | jmp >5
+ if (op1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
+ |3:
+ // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
+ | IF_GC_MAY_NOT_LEAK FCARG1a, edx, >5
+ | mov aword T1, r0 //save
+ | EXT_CALL gc_possible_root, r1
+ | mov r0, aword T1 // restore
+ | jmp >5
+ }
+ |4:
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | GC_DELREF FCARG1a
+ | jmp >5
+ |.code
+ }
+ |5:
+ //ZVAL_REF(variable_ptr, ref)
+ | SET_ZVAL_PTR op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_REFERENCE_EX
+ //END of handler
+
+ |.cold_code
+ |8:
+ | mov FCARG1a, r0
+ | EXT_CALL zend_jit_new_ref_helper, r0
+ | jmp <1
+ |9:
+ | mov FCARG1a, FP
+ | LOAD_ADDR FCARG2a, (ptrdiff_t)varname
+ |.if X64
+ | mov CARG3, opline->extended_value
+ |.else
+ | sub r4, 12
+ | push opline->extended_value
+ |.endif
+ | EXT_CALL zend_jit_fetch_global_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | jmp <1
+ |.code
+
+ return 1;
+}
+
+static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t arg_num = opline->op1.num;
+
+ | cmp dword EX->This.u2.num_args, arg_num
+ | jb >1
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1a, FP
+ | EXT_CALL zend_missing_arg_error, r0
+ | jmp ->exception_handler
+ |.code
+
+ if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ zend_arg_info *arg_info = NULL;
+
+ if (EXPECTED(arg_num <= op_array->num_args)) {
+ arg_info = &op_array->arg_info[arg_num-1];
+ } else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ }
+ if (arg_info) {
+ zend_type type = arg_info->type;
+
+ if (ZEND_TYPE_IS_SET(type)) {
+ // Type check
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | LOAD_ZVAL_ADDR r0, res_addr
+ if (arg_info->pass_by_reference) {
+ | GET_Z_PTR r0, r0
+ | add r0, offsetof(zend_reference, val)
+ }
+ if (!ZEND_TYPE_IS_CLASS(type)) {
+ uint32_t type_mask = ZEND_TYPE_MASK(type);
+ if (is_power_of_two(type_mask)) {
+ uint32_t type_code = concrete_type(type_mask);
+ | cmp byte [r0 + 8], type_code
+ | jne >8
+ } else {
+ | mov edx, 1
+ | mov cl, byte [r0 + 8]
+ | shl edx, cl
+ | test edx, type_mask
+ | je >8
+ }
+ } else {
+ | SAVE_VALID_OPLINE opline
+ | cmp byte [r0 + 8], IS_OBJECT
+ | jne >9
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | add r0, opline->extended_value
+ | LOAD_ADDR FCARG2a, (ptrdiff_t)op_array
+ |.if X64WIN
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov aword A5, r0
+ | EXT_CALL zend_jit_verify_arg_object, r0
+ |.elif X64
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov CARG5, r0
+ | EXT_CALL zend_jit_verify_arg_object, r0
+ |.else
+ | sub r4, 4
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | push arg_num
+ | EXT_CALL zend_jit_verify_arg_object, r0
+ | add r4, 4
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+
+ |.cold_code
+ |8:
+ | SAVE_VALID_OPLINE opline
+ |9:
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | add r0, opline->extended_value
+ | LOAD_ADDR FCARG2a, (ptrdiff_t)op_array
+ |.if X64WIN
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov aword A5, r0
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.elif X64
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov CARG5, r0
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.else
+ | sub r4, 4
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | push arg_num
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ | add r4, 4
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ | jmp >1
+ |.code
+ |1:
+
+ if ((opline+1)->opcode != ZEND_RECV && (opline+1)->opcode != ZEND_RECV_INIT) {
+ last_valid_opline = NULL;
+ if (!zend_jit_set_valid_ip(Dst, opline + 1)) {
+ return 0;
+ }
+ }
+
+ return 1;
+ }
+ }
+ }
+
+ if ((opline+1)->opcode != ZEND_RECV && (opline+1)->opcode != ZEND_RECV_INIT) {
+ last_valid_opline = NULL;
+ if (!zend_jit_set_valid_ip(Dst, opline + 1)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_bool is_last, zend_ssa *ssa)
+{
+ zend_arg_info *arg_info = NULL;
+ zend_bool has_slow = 0;
+ uint32_t arg_num = opline->op1.num;
+ zval *zv = RT_CONSTANT(opline, opline->op2);
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+
+ | cmp dword EX->This.u2.num_args, arg_num
+ | jae >5
+ | ZVAL_COPY_CONST res_addr, -1, zv, r0
+ if (Z_REFCOUNTED_P(zv)) {
+ | ADDREF_CONST zv, r0
+ }
+ if (Z_CONSTANT_P(zv)) {
+ has_slow = 1;
+ | SAVE_VALID_OPLINE opline
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG1, res_addr
+ | mov r0, EX->func
+ | mov CARG2, [r0 + offsetof(zend_op_array, scope)]
+ | EXT_CALL zval_update_constant_ex, r0
+ |.else
+ | sub r4, 8
+ | mov r0, EX->func
+ | push dword [r0 + offsetof(zend_op_array, scope)]
+ | LOAD_ZVAL_ADDR r0, res_addr
+ | push r0
+ | EXT_CALL zval_update_constant_ex, r0
+ | add r4, 16
+ |.endif
+ | test al, al
+ | jnz >7
+ }
+ |5:
+ if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ do {
+ if (arg_num <= op_array->num_args) {
+ arg_info = &op_array->arg_info[arg_num-1];
+ } else if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ } else {
+ break;
+ }
+ if (!ZEND_TYPE_IS_SET(arg_info->type)) {
+ break;
+ }
+ has_slow += 2;
+ | LOAD_ZVAL_ADDR r0, res_addr
+ | ZVAL_DEREF r0, MAY_BE_REF
+ if (!ZEND_TYPE_IS_CLASS(arg_info->type)) {
+ uint32_t type_mask = ZEND_TYPE_MASK(arg_info->type);
+ if (is_power_of_two(type_mask)) {
+ uint32_t type_code = concrete_type(type_mask);
+ | cmp byte [r0 + 8], type_code
+ | jne >8
+ } else {
+ | mov edx, 1
+ | mov cl, byte [r0 + 8]
+ | shl edx, cl
+ | test edx, type_mask
+ | je >8
+ }
+ } else {
+ | cmp byte [r0 + 8], IS_OBJECT
+ | jne >8
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | lea r0, [r0 + opline->extended_value]
+ | LOAD_ADDR FCARG2a, (ptrdiff_t)op_array
+ |.if X64WIN
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov aword A5, r0
+ | EXT_CALL zend_jit_verify_arg_object, r0
+ |.elif X64
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov CARG5, r0
+ | EXT_CALL zend_jit_verify_arg_object, r0
+ |.else
+ | sub r4, 4
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | push arg_num
+ | EXT_CALL zend_jit_verify_arg_object, r0
+ | add r4, 4
+ |.endif
+ }
+ } while (0);
+ }
+ |9:
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ if (is_last) {
+ | LOAD_IP_ADDR (opline + 1)
+ last_valid_opline = (opline + 1);
+ }
+
+ if (has_slow) {
+ |.cold_code
+ if (has_slow & 1) {
+ |7:
+ | ZVAL_PTR_DTOR res_addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN, 1, 0, 0, opline
+ | SET_ZVAL_TYPE_INFO res_addr, IS_UNDEF
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ | jmp <5
+ }
+ if (has_slow & 2) {
+ |8:
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | lea r0, [r0 + opline->extended_value]
+ | LOAD_ADDR FCARG2a, (ptrdiff_t)op_array
+ |.if X64WIN
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov aword A5, r0
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.elif X64
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov CARG5, r0
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.else
+ | sub r4, 4
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | push arg_num
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ | add r4, 4
+ |.endif
+ | jmp <9
+ }
+ |.code
+ }
+
+ return 1;
+}
+
+#define ZEND_WRONG_PROPERTY_OFFSET 0
+
+static uint32_t zend_get_known_property_offset(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename)
+{
+ zend_property_info *info;
+
+ if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || (ce->ce_flags & ZEND_ACC_TRAIT)) {
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ if (ce->info.user.filename != filename) {
+ /* class declaration might be changed infdependently */
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ if (ce->ce_flags & ZEND_ACC_INHERITED) {
+ if (!ce->parent) {
+ /* propery offests may be changed by inheritance */
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ } else {
+ zend_class_entry *parent = ce->parent;
+
+ do {
+ if (parent->type == ZEND_INTERNAL_CLASS) {
+ break;
+ } else if (parent->info.user.filename != filename) {
+ /* some of parents class declarations might be changed infdependently */
+ /* TODO: this check may be not enough, because even
+ * in the same it's possible to conditionnaly define
+ * few classes with the same name, and "parent" may
+ * change from request to request.
+ */
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+ parent = parent->parent;
+ } while (parent);
+ }
+ }
+
+ info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
+ if (info == NULL ||
+ info->offset == ZEND_WRONG_PROPERTY_OFFSET ||
+ (info->flags & ZEND_ACC_STATIC)) {
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ if (!(info->flags & ZEND_ACC_PUBLIC) &&
+ (!on_this || info->ce != ce)) {
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ return info->offset;
+}
+
+static zend_bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename)
+{
+ zend_property_info *info;
+
+ if (!ce || (ce->ce_flags & ZEND_ACC_TRAIT)) {
+ return 1;
+ }
+
+ if (ce->info.user.filename != filename) {
+ /* class declaration might be changed infdependently */
+ return 1;
+ }
+
+ info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
+ if (info == NULL ||
+ info->offset == ZEND_WRONG_PROPERTY_OFFSET ||
+ (info->flags & ZEND_ACC_STATIC)) {
+ return 1;
+ }
+
+ if (!(info->flags & ZEND_ACC_PUBLIC) &&
+ (!on_this || info->ce != ce)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+static int zend_jit_fetch_obj_read(dasm_State **Dst, zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, zend_bitset checked_this)
+{
+ uint32_t op1_info;
+ zend_class_entry *ce = NULL;
+ zval *member;
+ uint32_t offset;
+ zend_bool may_be_dynamic = 1;
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ zend_jit_addr res_addr = zend_jit_decode_op(op_array, opline->result_type, opline->result, opline, NULL, -1);
+ zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This));
+ zend_jit_addr prop_addr;
+
+ if (opline->op2_type != IS_CONST) {
+ goto fallback;
+ }
+
+ member = RT_CONSTANT(opline, opline->op2);
+ if (Z_TYPE_P(member) != IS_STRING || Z_STRVAL_P(member)[0] == '\0') {
+ goto fallback;
+ }
+
+ if (opline->op1_type == IS_UNUSED) {
+ op1_info = MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN;
+ ce = op_array->scope;
+ } else {
+ op1_info = OP1_INFO();
+ if (ssa->var_info && ssa->ops) {
+ zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes];
+ if (ssa_op->op1_use >= 0) {
+ zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
+ if (op1_ssa->ce && !op1_ssa->is_instanceof && !op1_ssa->ce->create_object) {
+ ce = op1_ssa->ce;
+ }
+ }
+ }
+ }
+
+ if (!(op1_info & MAY_BE_OBJECT)) {
+ goto fallback;
+ }
+
+ offset = zend_get_known_property_offset(ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename);
+
+ if (opline->op1_type == IS_UNUSED) {
+ if (!checked_this || !zend_bitset_in(checked_this, (opline - op_array->opcodes))) {
+ | IF_ZVAL_TYPE this_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | jmp ->not_obj
+ |.code
+ }
+ | GET_ZVAL_PTR FCARG1a, this_addr
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | ZVAL_DEREF r0, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
+ }
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)- MAY_BE_OBJECT)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, >7
+ }
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ }
+
+ if (offset == ZEND_WRONG_PROPERTY_OFFSET) {
+ | mov r0, EX->run_time_cache
+ | mov r2, aword [r0 + (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)]
+ | cmp r2, aword [FCARG1a + offsetof(zend_object, ce)]
+ | jne >5
+ | mov r0, aword [r0 + (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) + sizeof(void*)]
+ may_be_dynamic = zend_may_be_dynamic_property(ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename);
+ if (may_be_dynamic) {
+ | test r0, r0
+ | jl >8 // dynamic property
+ }
+ | mov edx, dword [FCARG1a + r0 + 8]
+ | IF_TYPE dl, IS_UNDEF, >5
+ | add FCARG1a, r0
+ prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ } else {
+ prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, offset);
+ | mov edx, dword [FCARG1a + offset + 8]
+ | IF_TYPE dl, IS_UNDEF, >5
+ }
+ | GET_ZVAL_PTR r0, prop_addr
+ | IF_NOT_REFCOUNTED dh, >2
+ if (opline->opcode == ZEND_FETCH_OBJ_R || opline->opcode == ZEND_FETCH_OBJ_IS) {
+ | IF_TYPE dl, IS_REFERENCE, >6
+ }
+ |1:
+ | GC_ADDREF r0
+ |2:
+ |.if X64
+ | SET_ZVAL_PTR res_addr, r0
+ |.else
+ | SET_ZVAL_PTR res_addr, r0
+ | GET_ZVAL_W2 r0, prop_addr
+ | SET_ZVAL_W2 res_addr, r0
+ |.endif
+ | SET_ZVAL_TYPE_INFO res_addr, edx
+
+ |.cold_code
+ |5:
+ | LOAD_ADDR FCARG2a, member
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ | mov CARG4, (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ |.else
+ | sub r4, 8
+ | push (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ if (opline->opcode == ZEND_FETCH_OBJ_R) {
+ | EXT_CALL zend_jit_fetch_obj_r_slow, r0
+ } else if (opline->opcode == ZEND_FETCH_OBJ_IS) {
+ | EXT_CALL zend_jit_fetch_obj_is_slow, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 8
+ |.endif
+ | jmp >9
+
+ if (opline->opcode == ZEND_FETCH_OBJ_R || opline->opcode == ZEND_FETCH_OBJ_IS) {
+ |6:
+ if (offset == ZEND_WRONG_PROPERTY_OFFSET) {
+ | mov FCARG2a, FCARG1a
+ } else {
+ | lea FCARG2a, [FCARG1a + offset]
+ }
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ | EXT_CALL zend_jit_zval_copy_deref_helper, r0
+ | jmp >9
+ }
+
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)- MAY_BE_OBJECT)) {
+ |7:
+ if (opline->opcode == ZEND_FETCH_OBJ_R) {
+ | SAVE_VALID_OPLINE opline
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & MAY_BE_ANY) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ }
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+ |.if X64
+ | mov CARG1, E_WARNING
+ | LOAD_ADDR CARG2, "Trying to get property '%s' of non-object"
+ | LOAD_ADDR CARG3, Z_STRVAL_P(member)
+ | EXT_CALL zend_error, r0
+ |.else
+ | sub r4, 4
+ | push Z_STRVAL_P(member)
+ | push "Trying to get property '%s' of non-object"
+ | push E_WARNING
+ | EXT_CALL zend_error, r0
+ | add r4, 16
+ |.endif
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ | jmp >9
+ }
+
+ if (offset == ZEND_WRONG_PROPERTY_OFFSET && may_be_dynamic) {
+ |8:
+ | mov FCARG2a, r0
+ |.if X64WIN
+ | LOAD_ADDR CARG3, member
+ | LOAD_ZVAL_ADDR CARG4, res_addr
+ | mov aword A5, (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ |.elif X64
+ | LOAD_ADDR CARG3, member
+ | LOAD_ZVAL_ADDR CARG4, res_addr
+ | mov CARG5, (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ |.else
+ | sub r4, 4
+ | push (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ | PUSH_ZVAL_ADDR res_addr, r0
+ | PUSH_ADDR member, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ if (opline->opcode == ZEND_FETCH_OBJ_R) {
+ | EXT_CALL zend_jit_fetch_obj_r_dynamic, r0
+ } else if (opline->opcode == ZEND_FETCH_OBJ_IS) {
+ | EXT_CALL zend_jit_fetch_obj_is_dynamic, r0
+ }
+ |.if not(X64)
+ | add r4, 4
+ |.endif
+ | jmp >9
+ }
+
+ |.code;
+ |9: // END
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+}
+
+static int zend_jit_free(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t op1_info = OP1_INFO();
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ if (zend_may_throw(opline, op_array, ssa)) {
+ | SAVE_VALID_OPLINE, opline
+ }
+ if (opline->opcode == ZEND_FE_FREE && (op1_info & (MAY_BE_OBJECT|MAY_BE_REF))) {
+ if (op1_info & MAY_BE_ARRAY) {
+ | IF_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ | mov FCARG1d, dword [FP + opline->op1.var + offsetof(zval, u2.fe_iter_idx)]
+ | cmp FCARG1d, -1
+ | je >7
+ | EXT_CALL zend_hash_iterator_del, r0
+ |7:
+ }
+ | ZVAL_PTR_DTOR op1_addr, op1_info, 0, 0, 0, opline
+ if (zend_may_throw(opline, op_array, ssa)) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_echo(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+
+ if (Z_TYPE_P(zv) == IS_STRING) {
+ size_t len = Z_STRLEN_P(zv);
+
+ if (len > 0) {
+ const char *str = Z_STRVAL_P(zv);
+
+ | SAVE_VALID_OPLINE opline
+ |.if X64
+ | LOAD_ADDR CARG1, str
+ | LOAD_ADDR CARG2, len
+ | EXT_CALL zend_write, r0
+ |.else
+ | sub r4, 8
+ | push len
+ | push str
+ | EXT_CALL zend_write, r0
+ | add r4, 16
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ return 1;
+ }
+ }
+
+ if (!zend_jit_handler(Dst, opline, 1)) {
+ return 0;
+ }
+
+ return 1;
+}
+
+static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ HashTable *jumptable = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
+
+ if (sizeof(void*) == 8 && !IS_32BIT(dasm_end)) {
+ // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ return 1;
+ }
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ zval *jump_zv;
+ int b;
+
+ if (opline->opcode == ZEND_SWITCH_LONG) {
+ if (Z_TYPE_P(zv) == IS_LONG) {
+ jump_zv = zend_hash_index_find(jumptable, Z_LVAL_P(zv));
+ if (jump_zv != NULL) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(jump_zv)) - op_array->opcodes];
+ } else {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) - op_array->opcodes];
+ }
+ | jmp =>b
+ }
+ } else if (opline->opcode == ZEND_SWITCH_STRING) {
+ if (Z_TYPE_P(zv) == IS_STRING) {
+ jump_zv = zend_hash_find_ex(jumptable, Z_STR_P(zv), 1);
+ if (jump_zv != NULL) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(jump_zv)) - op_array->opcodes];
+ } else {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) - op_array->opcodes];
+ }
+ | jmp =>b
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ uint32_t op1_info = OP1_INFO();
+ zend_jit_addr op1_addr = zend_jit_decode_op(op_array, opline->op1_type, opline->op1, opline, NULL, -1);
+ int b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) - op_array->opcodes];
+ zval *val;
+
+ if (opline->opcode == ZEND_SWITCH_LONG) {
+ if (op1_info & MAY_BE_LONG) {
+ if (op1_info & MAY_BE_REF) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >1
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op1_addr
+ |.cold_code
+ |1:
+ | // ZVAL_DEREF(op)
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_REFERENCE, >3
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ | IF_NOT_Z_TYPE FCARG2a + offsetof(zend_reference, val), IS_LONG, >3
+ | mov FCARG2a, aword [FCARG2a + offsetof(zend_reference, val.value.lval)]
+ | jmp >2
+ |.code
+ |2:
+ } else {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >3
+ }
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op1_addr
+ }
+ if (HT_IS_PACKED(jumptable)) {
+ uint32_t count = jumptable->nNumUsed;
+ Bucket *p = jumptable->arData;
+
+ | cmp FCARG2a, jumptable->nNumUsed
+ | jae >3
+ |.if X64
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | movsxd r0, dword [FCARG2a * 4 + >4]
+ | jmp r0
+ |.else
+ | jmp aword [FCARG2a * 4 + >4]
+ |.endif
+ |3:
+ |.cold_code
+ |4:
+ p = jumptable->arData;
+ do {
+ if (Z_TYPE(p->val) == IS_UNDEF) {
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | .aword =>b
+ } else {
+ int b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL(p->val)) - op_array->opcodes];
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | .aword =>b
+ }
+ p++;
+ count--;
+ } while (count);
+ |.code
+ } else {
+ | LOAD_ADDR FCARG1a, jumptable
+ | EXT_CALL zend_hash_index_find, r0
+ | test r0, r0
+ | jz =>b
+ | LOAD_ADDR FCARG1a, jumptable
+ | sub r0, aword [FCARG1a + offsetof(HashTable, arData)]
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | mov FCARG1a, (sizeof(Bucket) / sizeof(uint32_t))
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ | idiv FCARG1a
+ |.if X64
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | movsxd r0, dword [r0 + >4]
+ | jmp r0
+ |.else
+ | jmp dword [r0 + >4]
+ |.endif
+ |3:
+ |.cold_code
+ |4:
+ ZEND_HASH_FOREACH_VAL(jumptable, val) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(val)) - op_array->opcodes];
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | .aword =>b
+ } ZEND_HASH_FOREACH_END();
+ |.code
+ }
+ }
+ } else if (opline->opcode == ZEND_SWITCH_STRING) {
+ if (op1_info & MAY_BE_STRING) {
+ if (op1_info & MAY_BE_REF) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >1
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ |.cold_code
+ |1:
+ | // ZVAL_DEREF(op)
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_REFERENCE, >3
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ | IF_NOT_Z_TYPE FCARG2a + offsetof(zend_reference, val), IS_STRING, >3
+ | mov FCARG2a, aword [FCARG2a + offsetof(zend_reference, val.value.ptr)]
+ | jmp >2
+ |.code
+ |2:
+ } else {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_STRING)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >3
+ }
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ }
+ | LOAD_ADDR FCARG1a, jumptable
+ | EXT_CALL zend_hash_find, r0
+ | test r0, r0
+ | jz =>b
+ | LOAD_ADDR FCARG1a, jumptable
+ | sub r0, aword [FCARG1a + offsetof(HashTable, arData)]
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | mov FCARG1a, (sizeof(Bucket) / sizeof(uint32_t))
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ | idiv FCARG1a
+ |.if X64
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | movsxd r0, dword [r0 + >4]
+ | jmp r0
+ |.else
+ | jmp dword [r0 + >4]
+ |.endif
+ |3:
+ |.cold_code
+ |4:
+ ZEND_HASH_FOREACH_VAL(jumptable, val) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(val)) - op_array->opcodes];
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ |.if X64
+ | .aword =>b
+ |.else
+ | .aword =>b
+ |.endif
+ } ZEND_HASH_FOREACH_END();
+ |.code
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+ return 1;
+}
+
+static zend_bool zend_jit_may_reuse_reg(const zend_op_array *op_array, zend_ssa *ssa, uint32_t position, int def_var, int use_var)
+{
+ if (ssa->var_info[def_var].type != ssa->var_info[use_var].type) {
+ return 0;
+ }
+
+ switch (op_array->opcodes[position].opcode) {
+ case ZEND_QM_ASSIGN:
+ case ZEND_SEND_VAR:
+ case ZEND_ASSIGN:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ return 1;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ if (def_var == ssa->ops[position].result_def &&
+ use_var == ssa->ops[position].op1_use) {
+ return 1;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static zend_bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa *ssa, zend_op *opline, int var)
+{
+ uint32_t op1_info, op2_info;
+
+ switch (opline->opcode) {
+ case ZEND_QM_ASSIGN:
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAL_EX:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_CASE:
+ case ZEND_RETURN:
+ return 1;
+ case ZEND_ASSIGN:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ return
+ opline->op1_type == IS_CV &&
+ !(op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_RESOURCE|MAY_BE_REF)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)));
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info | op2_info) & MAY_BE_UNDEF) {
+ return 0;
+ }
+ return (op1_info & op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) != 0;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info | op2_info) & MAY_BE_UNDEF) {
+ return 0;
+ }
+ return (op1_info & op2_info & MAY_BE_LONG) != 0;
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ op1_info = OP1_INFO();
+ return
+ opline->op1_type == IS_CV &&
+ (op1_info & MAY_BE_LONG);
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ return 1;
+ }
+ return 0;
+}
+
+static zend_bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa *ssa, int var)
+{
+ if (ssa->vars[var].no_val) {
+ /* we don't need the value */
+ return 0;
+ }
+
+ if (zend_jit_reg_alloc < ZEND_JIT_REG_ALLOC_GLOBAL) {
+ /* Disable global register allocation,
+ * register allocation forSAA variables connected through Phi functions
+ */
+ if (ssa->vars[var].definition_phi) {
+ return 0;
+ }
+ if (ssa->vars[var].phi_use_chain) {
+ zend_ssa_phi *phi = ssa->vars[var].phi_use_chain;
+ do {
+ if (!ssa->vars[phi->ssa_var].no_val) {
+ return 0;
+ }
+ phi = zend_ssa_next_use_phi(ssa, var, phi);
+ } while (phi);
+ }
+ }
+
+ if (((ssa->var_info[var].type & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) &&
+ ((ssa->var_info[var].type & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG)) {
+ /* bad type */
+ return 0;
+ }
+
+ if (ssa->vars[var].definition >= 0) {
+ if (!zend_jit_opline_supports_reg(op_array, ssa, op_array->opcodes + ssa->vars[var].definition, var)) {
+ return 0;
+ }
+ }
+
+ if (ssa->vars[var].use_chain >= 0) {
+ int use = ssa->vars[var].use_chain;
+
+ do {
+ if (!zend_ssa_is_no_val_use(op_array->opcodes + use, ssa->ops + use, var) &&
+ !zend_jit_opline_supports_reg(op_array, ssa, op_array->opcodes + use, var)) {
+ return 0;
+ }
+ use = zend_ssa_next_use(ssa->ops, var, use);
+ } while (use >= 0);
+ }
+
+ return 1;
+}
+
+static zend_bool zend_needs_extra_reg_for_const(const zend_op_array *op_array, const zend_op *opline, zend_uchar op_type, znode_op op)
+{
+|.if X64
+|| if (op_type == IS_CONST) {
+|| zval *zv = RT_CONSTANT(opline, op);
+|| if (Z_TYPE_P(zv) == IS_DOUBLE && Z_DVAL_P(zv) != 0 && !IS_32BIT(zv)) {
+|| return 1;
+|| }
+|| }
+|.endif
+ return 0;
+}
+
+static zend_regset zend_jit_get_scratch_regset(const zend_op_array *op_array, zend_ssa *ssa, uint32_t line, int current_var)
+{
+ const zend_op *opline = op_array->opcodes + line;
+ uint32_t op1_info, op2_info, res_info;
+ zend_regset regset = ZEND_REGSET_SCRATCH;
+
+ switch (opline->opcode) {
+ case ZEND_NOP:
+ case ZEND_OP_DATA:
+ case ZEND_JMP:
+ case ZEND_RETURN:
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ case ZEND_QM_ASSIGN:
+ if (ssa->ops[line].op1_def == current_var ||
+ ssa->ops[line].result_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ /* break missing intentionally */
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAL_EX:
+ if (ssa->ops[line].op1_use == current_var) {
+ regset = ZEND_REGSET(ZREG_R0);
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (!(op1_info & MAY_BE_UNDEF)) {
+ if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ } else if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_LONG) {
+ regset = ZEND_REGSET(ZREG_R0);
+ } else {
+ regset = ZEND_REGSET_UNION(ZEND_REGSET(ZREG_R0), ZEND_REGSET(ZREG_R2));
+ }
+ }
+ break;
+ case ZEND_SEND_VAR:
+ if (ssa->ops[line].op1_use == current_var ||
+ ssa->ops[line].op1_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (!(op1_info & MAY_BE_UNDEF)) {
+ if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ } else if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_LONG) {
+ } else {
+ regset = ZEND_REGSET_UNION(ZEND_REGSET(ZREG_R0), ZEND_REGSET(ZREG_R2));
+ if (op1_info & MAY_BE_REF) {
+ ZEND_REGSET_INCL(regset, ZREG_R1);
+ }
+ }
+ }
+ break;
+ case ZEND_ASSIGN:
+ if (ssa->ops[line].op2_use == current_var ||
+ ssa->ops[line].op2_def == current_var ||
+ ssa->ops[line].op1_def == current_var ||
+ ssa->ops[line].result_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (opline->op1_type == IS_CV
+ && !(op2_info & MAY_BE_UNDEF)
+ && !(op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_RESOURCE|MAY_BE_REF))) {
+ if ((op2_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ } else if ((op2_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_LONG) {
+ regset = ZEND_REGSET(ZREG_R0);
+ } else {
+ regset = ZEND_REGSET_UNION(ZEND_REGSET(ZREG_R0), ZEND_REGSET(ZREG_R2));
+ }
+ }
+ break;
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ if (ssa->ops[line].op1_use == current_var ||
+ ssa->ops[line].op1_def == current_var ||
+ ssa->ops[line].result_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (opline->op1_type == IS_CV
+ && (op1_info & MAY_BE_LONG)
+ && !(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (op1_info & MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ }
+ }
+ break;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ op1_info = OP1_INFO();
+ op2_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+
+ regset = ZEND_REGSET_EMPTY;
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) {
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ res_info = OP1_INFO();
+ if (res_info & MAY_BE_DOUBLE) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ ZEND_REGSET_INCL(regset, ZREG_XMM1);
+ }
+ }
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_DOUBLE)) {
+ if (ssa->ops[line].result_def != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_LONG)) {
+ if (zend_is_commutative(opline->opcode)) {
+ if (ssa->ops[line].result_def != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ } else {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM1);
+ }
+ }
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_DOUBLE)) {
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ }
+ if (zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op1) ||
+ zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op2)) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ op1_info = OP1_INFO();
+ op2_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_SL:
+ case ZEND_SR:
+ op1_info = OP1_INFO();
+ op2_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ if (opline->op2_type != IS_CONST && ssa->ops[line].op2_use != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_R1);
+ }
+ }
+ break;
+ case ZEND_MOD:
+ op1_info = OP1_INFO();
+ op2_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (opline->op2_type == IS_CONST &&
+ Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) == IS_LONG &&
+ zend_long_is_power_of_two(Z_LVAL_P(RT_CONSTANT(opline, opline->op2)))) {
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ } else {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ ZEND_REGSET_INCL(regset, ZREG_R1);
+ }
+ }
+ break;
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_CASE:
+ op1_info = OP1_INFO();
+ op2_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ regset = ZEND_REGSET_EMPTY;
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG) &&
+ opline->op1_type != IS_CONST && opline->op2_type != IS_CONST) {
+ if (ssa->ops[line].op1_use != current_var &&
+ ssa->ops[line].op2_use != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_DOUBLE)) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_LONG)) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_DOUBLE)) {
+ if (ssa->ops[line].op1_use != current_var &&
+ ssa->ops[line].op2_use != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ }
+ if (zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op1) ||
+ zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op2)) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ op1_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (op1_info & MAY_BE_DOUBLE) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ if (opline->opcode == ZEND_BOOL ||
+ opline->opcode == ZEND_BOOL_NOT ||
+ opline->opcode == ZEND_JMPZ_EX ||
+ opline->opcode == ZEND_JMPNZ_EX) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_INCLUDE_OR_EVAL:
+ case ZEND_GENERATOR_CREATE:
+ case ZEND_YIELD:
+ case ZEND_YIELD_FROM:
+ regset = ZEND_REGSET_UNION(ZEND_REGSET_GP, ZEND_REGSET_FP);
+ break;
+ default:
+ break;
+ }
+
+#if ZTS
+ /* %r0 is used to check EG(vm_interrupt) */
+ {
+ uint32_t b = ssa->cfg.map[line];
+
+ if ((ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) != 0
+ && ssa->cfg.blocks[b].start == line) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+#endif
+
+ return regset;
+}
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/ext/opcache/jit/zend_jit_x86.h b/ext/opcache/jit/zend_jit_x86.h
new file mode 100644
index 0000000000..4df6c0e258
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_x86.h
@@ -0,0 +1,256 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef HAVE_JIT_X86_H
+#define HAVE_JIT_X86_H
+
+typedef enum _zend_reg {
+ ZREG_NONE = -1,
+
+ ZREG_R0,
+ ZREG_R1,
+ ZREG_R2,
+ ZREG_R3,
+ ZREG_R4,
+ ZREG_R5,
+ ZREG_R6,
+ ZREG_R7,
+
+#if defined(__x86_64__) || defined(_WIN64)
+ ZREG_R8,
+ ZREG_R9,
+ ZREG_R10,
+ ZREG_R11,
+ ZREG_R12,
+ ZREG_R13,
+ ZREG_R14,
+ ZREG_R15,
+#endif
+
+ ZREG_XMM0,
+ ZREG_XMM1,
+ ZREG_XMM2,
+ ZREG_XMM3,
+ ZREG_XMM4,
+ ZREG_XMM5,
+ ZREG_XMM6,
+ ZREG_XMM7,
+
+#if defined(__x86_64__) || defined(_WIN64)
+ ZREG_XMM8,
+ ZREG_XMM9,
+ ZREG_XMM10,
+ ZREG_XMM11,
+ ZREG_XMM12,
+ ZREG_XMM13,
+ ZREG_XMM14,
+ ZREG_XMM15,
+#endif
+
+ ZREG_NUM
+} zend_reg;
+
+#define ZREG_RAX ZREG_R0
+#define ZREG_RCX ZREG_R1
+#define ZREG_RDX ZREG_R2
+#define ZREG_RBX ZREG_R3
+#define ZREG_RSP ZREG_R4
+#define ZREG_RBP ZREG_R5
+#define ZREG_RSI ZREG_R6
+#define ZREG_RDI ZREG_R7
+
+#ifdef _WIN64
+# define ZREG_FP ZREG_R14
+# define ZREG_IP ZREG_R15
+# define ZREG_RX ZREG_IP
+# define ZREG_FCARG1a ZREG_RCX
+# define ZREG_FCARG2a ZREG_RDX
+#elif defined(__x86_64__)
+# define ZREG_FP ZREG_R14
+# define ZREG_IP ZREG_R15
+# define ZREG_RX ZREG_IP
+# define ZREG_FCARG1a ZREG_RDI
+# define ZREG_FCARG2a ZREG_RSI
+#else
+# define ZREG_FP ZREG_RSI
+# define ZREG_IP ZREG_RDI
+# define ZREG_RX ZREG_IP
+# define ZREG_FCARG1a ZREG_RCX
+# define ZREG_FCARG2a ZREG_RDX
+#endif
+
+extern const char *zend_reg_name[];
+
+typedef uint32_t zend_regset;
+
+#define ZEND_REGSET_EMPTY 0
+
+#define ZEND_REGSET_IS_EMPTY(regset) \
+ (regset == ZEND_REGSET_EMPTY)
+
+#define ZEND_REGSET(reg) \
+ (1u << (reg))
+
+#define ZEND_REGSET_INTERVAL(reg1, reg2) \
+ (((1u << ((reg2) - (reg1) + 1)) - 1) << (reg1))
+
+#define ZEND_REGSET_IN(regset, reg) \
+ (((regset) & ZEND_REGSET(reg)) != 0)
+
+#define ZEND_REGSET_INCL(regset, reg) \
+ (regset) |= ZEND_REGSET(reg)
+
+#define ZEND_REGSET_EXCL(regset, reg) \
+ (regset) &= ~ZEND_REGSET(reg)
+
+#define ZEND_REGSET_UNION(set1, set2) \
+ ((set1) | (set2))
+
+#define ZEND_REGSET_INTERSECTION(set1, set2) \
+ ((set1) & (set2))
+
+#define ZEND_REGSET_DIFFERENCE(set1, set2) \
+ ((set1) & ~(set2))
+
+#ifdef _WIN64
+# define ZEND_REGSET_FIXED \
+ (ZEND_REGSET(ZREG_RSP) | ZEND_REGSET(ZREG_R14) | ZEND_REGSET(ZREG_R15))
+# define ZEND_REGSET_GP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_R0, ZREG_R15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_FP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_XMM0, ZREG_XMM15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_SCRATCH \
+ (ZEND_REGSET(ZREG_RAX) | ZEND_REGSET(ZREG_RDX) | ZEND_REGSET(ZREG_RCX) | ZEND_REGSET_INTERVAL(ZREG_R8, ZREG_R11) | ZEND_REGSET_FP)
+# define ZEND_REGSET_PRESERVED \
+ (ZEND_REGSET(ZREG_RBX) | ZEND_REGSET(ZREG_RBP) | ZEND_REGSET(ZREG_R12) | ZEND_REGSET(ZREG_R13) | ZEND_REGSET(ZREG_RDI) | ZEND_REGSET(ZREG_RSI))
+#elif defined(__x86_64__)
+# define ZEND_REGSET_FIXED \
+ (ZEND_REGSET(ZREG_RSP) | ZEND_REGSET(ZREG_R14) | ZEND_REGSET(ZREG_R15))
+# define ZEND_REGSET_GP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_R0, ZREG_R15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_FP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_XMM0, ZREG_XMM15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_SCRATCH \
+ (ZEND_REGSET(ZREG_RAX) | ZEND_REGSET(ZREG_RDI) | ZEND_REGSET(ZREG_RSI) | ZEND_REGSET(ZREG_RDX) | ZEND_REGSET(ZREG_RCX) | ZEND_REGSET_INTERVAL(ZREG_R8, ZREG_R11) | ZEND_REGSET_FP)
+# define ZEND_REGSET_PRESERVED \
+ (ZEND_REGSET(ZREG_RBX) | ZEND_REGSET(ZREG_RBP) | ZEND_REGSET(ZREG_R12) | ZEND_REGSET(ZREG_R13))
+#else
+# define ZEND_REGSET_FIXED \
+ (ZEND_REGSET(ZREG_RSP) | ZEND_REGSET(ZREG_RSI) | ZEND_REGSET(ZREG_RDI))
+# define ZEND_REGSET_GP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_R0, ZREG_R7), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_FP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_XMM0, ZREG_XMM7), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_SCRATCH \
+ (ZEND_REGSET(ZREG_RAX) | ZEND_REGSET(ZREG_RCX) | ZEND_REGSET(ZREG_RDX) | ZEND_REGSET_FP)
+# define ZEND_REGSET_PRESERVED \
+ (ZEND_REGSET(ZREG_RBX) | ZEND_REGSET(ZREG_RBP))
+#endif
+
+#ifndef _WIN32
+#define ZEND_REGSET_FIRST(set) ((zend_reg)__builtin_ctz(set))
+#define ZEND_REGSET_LAST(set) ((zend_reg)(__builtin_clz(set)^31)))
+#else
+#include <intrin.h>
+uint32_t __inline __zend_jit_ctz( uint32_t value ) {
+ DWORD trailing_zero = 0;
+ if (_BitScanForward(&trailing_zero, value)) {
+ return trailing_zero;
+ }
+ return 32;
+}
+uint32_t __inline __zend_jit_clz(uint32_t value) {
+ DWORD leading_zero = 0;
+ if (_BitScanReverse(&leading_zero, value)) {
+ return 31 - leading_zero;
+ }
+ return 32;
+}
+#define ZEND_REGSET_FIRST(set) ((zend_reg)__zend_jit_ctz(set))
+#define ZEND_REGSET_LAST(set) ((zend_reg)(__zend_jit_clz(set)^31)))
+#endif
+
+#define ZEND_REGSET_FOREACH(set, reg) \
+ do { \
+ zend_regset _tmp = (set); \
+ while (!ZEND_REGSET_IS_EMPTY(_tmp)) { \
+ zend_reg _reg = ZEND_REGSET_FIRST(_tmp); \
+ ZEND_REGSET_EXCL(_tmp, _reg); \
+ reg = _reg; \
+
+#define ZEND_REGSET_FOREACH_END() \
+ } \
+ } while (0)
+
+typedef uintptr_t zend_jit_addr;
+
+#define IS_CONST_ZVAL 0
+#define IS_MEM_ZVAL 1
+#define IS_REG 2
+
+#define _ZEND_ADDR_MODE_MASK 0x3
+#define _ZEND_ADDR_REG_SHIFT 2
+#define _ZEND_ADDR_REG_MASK 0x3f
+#define _ZEND_ADDR_OFFSET_SHIFT 8
+
+#define ZEND_ADDR_CONST_ZVAL(zv) \
+ (((zend_jit_addr)(uintptr_t)(zv)) | IS_CONST_ZVAL)
+#define ZEND_ADDR_MEM_ZVAL(reg, offset) \
+ ((((zend_jit_addr)(uintptr_t)(offset)) << _ZEND_ADDR_OFFSET_SHIFT) | \
+ (((zend_jit_addr)(uintptr_t)(reg)) << _ZEND_ADDR_REG_SHIFT) | \
+ IS_MEM_ZVAL)
+#define ZEND_ADDR_REG(reg) \
+ ((((zend_jit_addr)(uintptr_t)(reg)) << _ZEND_ADDR_REG_SHIFT) | \
+ IS_REG)
+
+#define Z_MODE(addr) (((addr) & _ZEND_ADDR_MODE_MASK))
+#define Z_ZV(addr) ((zval*)(addr))
+#define Z_OFFSET(addr) ((uint32_t)((addr)>>_ZEND_ADDR_OFFSET_SHIFT))
+#define Z_REG(addr) ((zend_reg)(((addr)>>_ZEND_ADDR_REG_SHIFT) & _ZEND_ADDR_REG_MASK))
+
+static zend_always_inline zend_jit_addr zend_jit_decode_op(const zend_op_array *op_array, zend_uchar op_type, znode_op op, const zend_op *opline, zend_lifetime_interval **ra, int ssa_var)
+{
+ if (op_type == IS_CONST) {
+#if ZEND_USE_ABS_CONST_ADDR
+ return ZEND_ADDR_CONST_ZVAL(op.zv);
+#else
+ return ZEND_ADDR_CONST_ZVAL(RT_CONSTANT(opline, op));
+#endif
+ } else {
+ if (ra && ssa_var >= 0 && ra[ssa_var]) {
+ zend_lifetime_interval *ival = ra[ssa_var];
+ zend_life_range *range = &ival->range;
+ uint32_t line = opline - op_array->opcodes;
+
+ do {
+ if (line >= range->start && line <= range->end) {
+ return ZEND_ADDR_REG(ival->reg);
+ }
+ range = range->next;
+ } while (range);
+ }
+ return ZEND_ADDR_MEM_ZVAL(ZREG_FP, op.var);
+ }
+}
+
+static zend_always_inline zend_bool zend_jit_same_addr(zend_jit_addr addr1, zend_jit_addr addr2)
+{
+ return (addr1 == addr2);
+}
+
+#endif /* ZEND_JIT_X86_H */
diff --git a/ext/opcache/opcache.stub.php b/ext/opcache/opcache.stub.php
new file mode 100644
index 0000000000..4dd312a6cd
--- /dev/null
+++ b/ext/opcache/opcache.stub.php
@@ -0,0 +1,15 @@
+<?php
+
+function opcache_reset(): bool {}
+
+/** @return array|false */
+function opcache_get_status(bool $fetch_scripts = true) {}
+
+function opcache_compile_file(string $file): bool {}
+
+function opcache_invalidate(string $script, bool $force = false): bool {}
+
+/** @return array|false */
+function opcache_get_configuration() {}
+
+function opcache_is_script_cached(string $script): bool {}
diff --git a/ext/opcache/opcache_arginfo.h b/ext/opcache/opcache_arginfo.h
new file mode 100644
index 0000000000..7f80ba4b69
--- /dev/null
+++ b/ext/opcache/opcache_arginfo.h
@@ -0,0 +1,24 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_reset, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, fetch_scripts, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_compile_file, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_invalidate, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, script, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, force, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_configuration, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_is_script_cached, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, script, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/opcache/shared_alloc_mmap.c b/ext/opcache/shared_alloc_mmap.c
index dc02d038f5..8f900c1590 100644
--- a/ext/opcache/shared_alloc_mmap.c
+++ b/ext/opcache/shared_alloc_mmap.c
@@ -39,17 +39,10 @@
static int create_segments(size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in)
{
zend_shared_segment *shared_segment;
-
- *shared_segments_count = 1;
- *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment) + sizeof(void *));
- if (!*shared_segments_p) {
- *error_in = "calloc";
- return ALLOC_FAILURE;
- }
- shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
- (*shared_segments_p)[0] = shared_segment;
-
+ void *p;
#ifdef MAP_HUGETLB
+ size_t huge_page_size = 2 * 1024 * 1024;
+
/* Try to allocate huge pages first to reduce dTLB misses.
* OSes has to be configured properly
* on Linux
@@ -60,21 +53,56 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
* sysctl vm.pmap.pg_ps_enabled entry
* (boot time config only, but enabled by default on most arches).
*/
- shared_segment->p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0);
- if (shared_segment->p != MAP_FAILED) {
- shared_segment->pos = 0;
- shared_segment->size = requested_size;
+ if (requested_size >= huge_page_size && requested_size % huge_page_size == 0) {
+# if defined(__x86_64__) && defined(MAP_32BIT)
+ /* to got HUGE PAGES in low 32-bit address we have to reserve address
+ space and then remap it using MAP_HUGETLB */
- return ALLOC_SUCCESS;
+ p = mmap(NULL, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
+ if (p != MAP_FAILED) {
+ munmap(p, requested_size);
+ p = (void*)(ZEND_MM_ALIGNED_SIZE_EX((ptrdiff_t)p, huge_page_size));
+ p = mmap(p, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT|MAP_HUGETLB|MAP_FIXED, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
+ } else {
+ p = mmap(NULL, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
+ }
+ }
+ }
+# endif
+ p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
+ }
+ }
+#elif defined(PREFER_MAP_32BIT) && defined(__x86_64__) && defined(MAP_32BIT)
+ p = mmap(NULL, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
}
#endif
- shared_segment->p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
- if (shared_segment->p == MAP_FAILED) {
+ p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
+ if (p == MAP_FAILED) {
*error_in = "mmap";
return ALLOC_FAILURE;
}
+success: ZEND_ATTRIBUTE_UNUSED;
+ *shared_segments_count = 1;
+ *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment) + sizeof(void *));
+ if (!*shared_segments_p) {
+ munmap(p, requested_size);
+ *error_in = "calloc";
+ return ALLOC_FAILURE;
+ }
+ shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
+ (*shared_segments_p)[0] = shared_segment;
+
+ shared_segment->p = p;
shared_segment->pos = 0;
shared_segment->size = requested_size;
diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c
index 35abe367cf..c172f17273 100644
--- a/ext/opcache/shared_alloc_win32.c
+++ b/ext/opcache/shared_alloc_win32.c
@@ -196,7 +196,7 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
return ALLOC_FAILURE;
}
- mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, 0, wanted_mapping_base);
+ mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS|FILE_MAP_EXECUTE, 0, 0, 0, wanted_mapping_base);
if (mapping_base == NULL) {
err = GetLastError();
@@ -205,7 +205,16 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
return ALLOC_FAILURE;
}
return ALLOC_FAIL_MAPPING;
+ } else {
+ DWORD old;
+
+ if (!VirtualProtect(mapping_base, requested_size, PAGE_READWRITE, &old)) {
+ err = GetLastError();
+ zend_win_error_message(ACCEL_LOG_FATAL, "VirtualProtect() failed", err);
+ return ALLOC_FAIL_MAPPING;
+ }
}
+
smm_shared_globals = (zend_smm_shared_globals *) mapping_base;
return SUCCESSFULLY_REATTACHED;
@@ -236,7 +245,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
can be called before the child process is killed. In this case, the map will fail
and we have to sleep some time (until the child releases the mapping object) and retry.*/
do {
- memfile = OpenFileMapping(FILE_MAP_WRITE, 0, create_name_with_username(ACCEL_FILEMAP_NAME));
+ memfile = OpenFileMapping(FILE_MAP_READ|FILE_MAP_WRITE|FILE_MAP_EXECUTE, 0, create_name_with_username(ACCEL_FILEMAP_NAME));
if (memfile == NULL) {
err = GetLastError();
break;
@@ -280,7 +289,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
(*shared_segments_p)[0] = shared_segment;
- memfile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, size_high, size_low,
+ memfile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_EXECUTE_READWRITE | SEC_COMMIT, size_high, size_low,
create_name_with_username(ACCEL_FILEMAP_NAME));
if (memfile == NULL) {
err = GetLastError();
@@ -310,7 +319,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
}
do {
- shared_segment->p = mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, 0, *wanted_mapping_base);
+ shared_segment->p = mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS|FILE_MAP_EXECUTE, 0, 0, 0, *wanted_mapping_base);
if (*wanted_mapping_base == NULL) { /* Auto address (NULL) is the last option on the array */
break;
}
@@ -324,9 +333,18 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
*error_in = "MapViewOfFile";
return ALLOC_FAILURE;
} else {
- char *mmap_base_file = get_mmap_base_file();
+ char *mmap_base_file;
void *execute_ex_base = (void *)execute_ex;
- FILE *fp = fopen(mmap_base_file, "w");
+ FILE *fp;
+ DWORD old;
+
+ if (!VirtualProtect(mapping_base, requested_size, PAGE_READWRITE, &old)) {
+ err = GetLastError();
+ zend_win_error_message(ACCEL_LOG_FATAL, "VirtualProtect() failed", err);
+ return ALLOC_FAILURE;
+ }
+ mmap_base_file = get_mmap_base_file();
+ fp = fopen(mmap_base_file, "w");
if (!fp) {
err = GetLastError();
zend_shared_alloc_unlock_win32();
diff --git a/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt b/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
index c89d0bea62..2c07051778 100644
--- a/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
+++ b/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
@@ -8,13 +8,13 @@ function test() {
$ary[0]->y += 2;
var_dump(is_object($ary[0]));
}
-test();
+try {
+ test();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-
-Notice: Undefined property: stdClass::$y in %s on line %d
-bool(true)
+Attempt to assign property 'y' of non-object
diff --git a/ext/opcache/tests/block_pass_001.phpt b/ext/opcache/tests/block_pass_001.phpt
index c024b81ce8..7fab78bbe8 100644
--- a/ext/opcache/tests/block_pass_001.phpt
+++ b/ext/opcache/tests/block_pass_001.phpt
@@ -9,4 +9,4 @@ Block pass: Bugs in BOOL/QM_ASSIGN elision
(bool) new stdClass;
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/ext/opcache/tests/bug66251.phpt b/ext/opcache/tests/bug66251.phpt
index daa5a89bb2..42c6e2f606 100644
--- a/ext/opcache/tests/bug66251.phpt
+++ b/ext/opcache/tests/bug66251.phpt
@@ -5,7 +5,7 @@ opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
-<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
+<?php if (!extension_loaded('Zend OPcache')) die("skip Zend OPcache extension not loaded"); ?>
--FILE--
<?php
printf ("A=%s\n", getA());
@@ -13,5 +13,8 @@ const A="hello";
function getA() {return A;}
?>
--EXPECTF--
-Warning: Use of undefined constant A - assumed 'A' (this will throw an Error in a future version of PHP) in %sbug66251.php on line 4
-A=A
+Fatal error: Uncaught Error: Undefined constant 'A' in %s:%d
+Stack trace:
+#0 %s(%d): getA()
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/opcache/tests/bug66338.phpt b/ext/opcache/tests/bug66338.phpt
index 5cd9693793..40f5634465 100644
--- a/ext/opcache/tests/bug66338.phpt
+++ b/ext/opcache/tests/bug66338.phpt
@@ -3,7 +3,7 @@ Bug #66338 (Optimization binding of class constants is not safely opcacheable)
--INI--
opcache.enable=0
--SKIPIF--
-<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
+<?php if (!extension_loaded('Zend OPcache')) die("skip Zend OPcache extension not loaded"); ?>
--CONFLICTS--
server
--FILE--
diff --git a/ext/opcache/tests/bug68252.phpt b/ext/opcache/tests/bug68252.phpt
deleted file mode 100644
index bc2e5a0fb6..0000000000
--- a/ext/opcache/tests/bug68252.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #68252 (segfault in Zend/zend_hash.c in function _zend_hash_del_el)
---INI--
-opcache.enable=1
-opcache.enable_cli=1
-opcache.fast_shutdown=1
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-/* run this test script with valgrind */
-function a() {
- echo "okey";
-}
-
-create_function('', 'var_dump("22");');
-
-a();
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-okey
diff --git a/ext/opcache/tests/bug68644.phpt b/ext/opcache/tests/bug68644.phpt
deleted file mode 100644
index 1a967facaf..0000000000
--- a/ext/opcache/tests/bug68644.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #68644 strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache
---INI--
-opcache.enable=1
-opcache.enable_cli=1
-mbstring.func_overload=2
---SKIPIF--
-<?php if (!extension_loaded('Zend OPcache') || !extension_loaded("mbstring")) die("skip"); ?>
---FILE--
-<?php
-var_dump(strlen("中国, 北京"));
-var_dump(mb_strlen("中国, 北京"));
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-int(6)
-int(6)
diff --git a/ext/opcache/tests/bug70207.phpt b/ext/opcache/tests/bug70207.phpt
index c684ee6d33..2b6e48a2d4 100644
--- a/ext/opcache/tests/bug70207.phpt
+++ b/ext/opcache/tests/bug70207.phpt
@@ -14,7 +14,9 @@ function bar() {
}
function foo() {
try { return bar(); }
- finally { @fclose(null); }
+ finally {
+ @fopen("non-existent", 'r');
+ }
}
var_dump(foo());
diff --git a/ext/opcache/tests/bug71843.phpt b/ext/opcache/tests/bug71843.phpt
index 924fb873fe..0a193425dd 100644
--- a/ext/opcache/tests/bug71843.phpt
+++ b/ext/opcache/tests/bug71843.phpt
@@ -8,18 +8,15 @@ opcache.optimization_level=0xFFFFBFFF
<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
--FILE--
<?php
+define('E', 'E');
+define('R', 'R');
+define('See', 'See');
0 & ~E & ~R;
6 && ~See
?>
okey
--EXPECTF--
-Warning: Use of undefined constant E - assumed 'E' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
-
Warning: A non-numeric value encountered in %s on line %d
-Warning: Use of undefined constant R - assumed 'R' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
-
Warning: A non-numeric value encountered in %s on line %d
-
-Warning: Use of undefined constant See - assumed 'See' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
okey
diff --git a/ext/opcache/tests/bug73668.phpt b/ext/opcache/tests/bug73668.phpt
index 379ba4a5ac..b2a0508aa5 100644
--- a/ext/opcache/tests/bug73668.phpt
+++ b/ext/opcache/tests/bug73668.phpt
@@ -7,4 +7,4 @@ Bug #73668: "SIGFPE Arithmetic exception" in opcache when divide by minus 1
$a/-1;
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
diff --git a/ext/opcache/tests/bug75729.phpt b/ext/opcache/tests/bug75729.phpt
deleted file mode 100644
index 52b004c75a..0000000000
--- a/ext/opcache/tests/bug75729.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #75729: opcache segfault when installing Bitrix
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php if (!extension_loaded('mbstring')) die('skip mbstring not loaded'); ?>
---INI--
-opcache.enable_cli=1
-mbstring.func_overload=2
---FILE--
-<?php
-
-var_dump(strpos("foo", "o"));
-var_dump(substr("foo", 1));
-var_dump(substr("foo", 1, 1));
-
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-int(1)
-string(2) "oo"
-string(1) "o"
diff --git a/ext/opcache/tests/bug75893.phpt b/ext/opcache/tests/bug75893.phpt
deleted file mode 100644
index 9ca713b121..0000000000
--- a/ext/opcache/tests/bug75893.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #75893: file_get_contents $http_response_header variable bugged with opcache
---INI--
-opcache.enable_cli=1
-track_errors=1
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-
-function test() {
- echo $undef;
- $foo = $php_errormsg;
- var_dump($foo[0]);
-}
-
-test();
-
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: undef in %s on line %d
-string(1) "U"
diff --git a/ext/opcache/tests/bug76446.phpt b/ext/opcache/tests/bug76446.phpt
index dfb676f4ba..98b1d3dc56 100644
--- a/ext/opcache/tests/bug76446.phpt
+++ b/ext/opcache/tests/bug76446.phpt
@@ -18,5 +18,5 @@ function test()
var_dump(test());
?>
--EXPECTF--
-Notice: Undefined variable: addlang in %sbug76446.php on line %d
+Warning: Undefined variable: addlang in %s on line %d
int(0)
diff --git a/ext/opcache/tests/bug77058.phpt b/ext/opcache/tests/bug77058.phpt
index a1962b7ade..22a36d1e3d 100644
--- a/ext/opcache/tests/bug77058.phpt
+++ b/ext/opcache/tests/bug77058.phpt
@@ -18,5 +18,5 @@ myfunc();
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
'2' is expected to be 2
diff --git a/ext/opcache/tests/bug78015.phpt b/ext/opcache/tests/bug78015.phpt
index 0a03c9834f..aa4ba4db4b 100644
--- a/ext/opcache/tests/bug78015.phpt
+++ b/ext/opcache/tests/bug78015.phpt
@@ -103,7 +103,7 @@ array(1) {
}
bool(true)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(11) "Arrayfoobar"
int(2)
array(2) {
diff --git a/ext/opcache/tests/issue0115.phpt b/ext/opcache/tests/issue0115.phpt
index bc86d0f4fc..b8df30a164 100644
--- a/ext/opcache/tests/issue0115.phpt
+++ b/ext/opcache/tests/issue0115.phpt
@@ -7,7 +7,6 @@ phar.readonly=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php if (!extension_loaded("phar")) die("skip"); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--CONFLICTS--
server
--FILE--
diff --git a/ext/opcache/tests/issue0140.phpt b/ext/opcache/tests/issue0140.phpt
index 3ca9b50d3c..78f711fce9 100644
--- a/ext/opcache/tests/issue0140.phpt
+++ b/ext/opcache/tests/issue0140.phpt
@@ -7,7 +7,6 @@ opcache.revalidate_freq=0
opcache.file_update_protection=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
<?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow tests excluded by request") ?>
--FILE--
<?php
diff --git a/ext/opcache/tests/issue0149.phpt b/ext/opcache/tests/issue0149.phpt
index da3b778ef5..0896e39d0c 100644
--- a/ext/opcache/tests/issue0149.phpt
+++ b/ext/opcache/tests/issue0149.phpt
@@ -7,7 +7,6 @@ phar.readonly=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php if (!extension_loaded("phar")) die("skip"); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--CONFLICTS--
server
--FILE--
diff --git a/ext/opcache/tests/jit/assign_001.phpt b/ext/opcache/tests/jit/assign_001.phpt
new file mode 100644
index 0000000000..b52824b900
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT ASSIGN: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $c = $a;
+ $a = 1;
+ $x = $a;
+ var_dump($x, $b, $c);
+}
+foo();
+--EXPECT--
+int(1)
+array(0) {
+}
+array(0) {
+}
diff --git a/ext/opcache/tests/jit/assign_002.phpt b/ext/opcache/tests/jit/assign_002.phpt
new file mode 100644
index 0000000000..34ed996928
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_002.phpt
@@ -0,0 +1,29 @@
+--TEST--
+JIT ASSIGN: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $ref1 = 2.3;
+ $ref2 =& $ref1;
+ $a = array();
+ $b = $a;
+ $c = $a;
+ $a = $ref1;
+ $x = $a;
+ var_dump($x, $b, $c);
+}
+foo();
+--EXPECT--
+float(2.3)
+array(0) {
+}
+array(0) {
+}
diff --git a/ext/opcache/tests/jit/assign_003.phpt b/ext/opcache/tests/jit/assign_003.phpt
new file mode 100644
index 0000000000..f096d0b811
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_003.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(); // [rc1, array]
+ $a = 1; // [rc1, long, reg]
+ $x = $a;
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_004.phpt b/ext/opcache/tests/jit/assign_004.phpt
new file mode 100644
index 0000000000..23314fa55b
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_004.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = null;
+ $b = $a;
+ $c = null;
+ $d = $c;
+ $a = 1;
+ $c = $a;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_005.phpt b/ext/opcache/tests/jit/assign_005.phpt
new file mode 100644
index 0000000000..6975cd41ed
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_005.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 005
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $c = array();
+ $d = $c;
+ $a = 1;
+ $c = $a;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_006.phpt b/ext/opcache/tests/jit/assign_006.phpt
new file mode 100644
index 0000000000..680c2f96f4
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_006.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 006
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $c = array();
+ $a = 1;
+ $c = $a;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_007.phpt b/ext/opcache/tests/jit/assign_007.phpt
new file mode 100644
index 0000000000..2e6ab218f4
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_007.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 007
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1.0;
+ $c = 2.0;
+ $a = 1;
+ var_dump($a);
+}
+foo();
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_008.phpt b/ext/opcache/tests/jit/assign_008.phpt
new file mode 100644
index 0000000000..b4fa5f15bb
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_008.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 008
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1.0;
+ $c = 2.0;
+ $c = $a;
+ var_dump($a);
+}
+foo();
+--EXPECT--
+float(1)
diff --git a/ext/opcache/tests/jit/assign_009.phpt b/ext/opcache/tests/jit/assign_009.phpt
new file mode 100644
index 0000000000..24ba9892f1
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_009.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 009
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $a = $b;
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_010.phpt b/ext/opcache/tests/jit/assign_010.phpt
new file mode 100644
index 0000000000..f8e20b3fa0
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_010.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 010
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b =& $a;
+ $a = $b;
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_011.phpt b/ext/opcache/tests/jit/assign_011.phpt
new file mode 100644
index 0000000000..5de684aa25
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_011.phpt
@@ -0,0 +1,28 @@
+--TEST--
+JIT ASSIGN: 011
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $c = 2;
+ $d = 3;
+ if ($a) {
+ $b = array();
+ } else {
+ $b =& $c;
+ }
+ $b = $d;
+ var_dump($b, $c);
+}
+foo();
+--EXPECT--
+int(3)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_012.phpt b/ext/opcache/tests/jit/assign_012.phpt
new file mode 100644
index 0000000000..192d770db0
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_012.phpt
@@ -0,0 +1,28 @@
+--TEST--
+JIT ASSIGN: 012
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 0;
+ $c = 2;
+ $d = 3;
+ if ($a) {
+ $b = array();
+ } else {
+ $b =& $c;
+ }
+ $b = $d;
+ var_dump($b, $c);
+}
+foo();
+--EXPECT--
+int(3)
+int(3)
diff --git a/ext/opcache/tests/jit/assign_013.phpt b/ext/opcache/tests/jit/assign_013.phpt
new file mode 100644
index 0000000000..94bd11b6f4
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_013.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 013
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_014.phpt b/ext/opcache/tests/jit/assign_014.phpt
new file mode 100644
index 0000000000..9d14511163
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_014.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 014
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $b = array();
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+array(0) {
+}
diff --git a/ext/opcache/tests/jit/assign_015.phpt b/ext/opcache/tests/jit/assign_015.phpt
new file mode 100644
index 0000000000..4211f83503
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_015.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 015
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_016.phpt b/ext/opcache/tests/jit/assign_016.phpt
new file mode 100644
index 0000000000..7598709cb9
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_016.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 016
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_017.phpt b/ext/opcache/tests/jit/assign_017.phpt
new file mode 100644
index 0000000000..6fa9c562e4
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_017.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 017
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = 2;
+ $c = $a = $b;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_018.phpt b/ext/opcache/tests/jit/assign_018.phpt
new file mode 100644
index 0000000000..74258fbb15
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_018.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT ASSIGN: 018
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $c = array();
+ $d = $c;
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c, $d);
+}
+foo();
+--EXPECT--
+int(2)
+array(0) {
+}
+
diff --git a/ext/opcache/tests/jit/assign_019.phpt b/ext/opcache/tests/jit/assign_019.phpt
new file mode 100644
index 0000000000..4c01164dcf
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_019.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 019
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $c = array();
+ $d =& $c;
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c, $d);
+}
+foo();
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_020.phpt b/ext/opcache/tests/jit/assign_020.phpt
new file mode 100644
index 0000000000..24ef6fcfc9
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_020.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 020
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $c = array();
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_021.phpt b/ext/opcache/tests/jit/assign_021.phpt
new file mode 100644
index 0000000000..52e20d1aac
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_021.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 021
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $c = 1;
+ $d = $a = $c;
+ var_dump($b, $d);
+}
+foo();
+--EXPECT--
+array(0) {
+}
+int(1)
diff --git a/ext/opcache/tests/jit/assign_022.phpt b/ext/opcache/tests/jit/assign_022.phpt
new file mode 100644
index 0000000000..ebe153f140
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_022.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 022
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1);
+ $a[0] = $undef;
+ for($i=0; $i<6; $i++) {
+ $undef = 1;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: undef in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_023.phpt b/ext/opcache/tests/jit/assign_023.phpt
new file mode 100644
index 0000000000..ebe5ff288f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_023.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 023
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1);
+ $a = $undef;
+ for($i=0; $i<6; $i++) {
+ $undef = 1;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: undef in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_024.phpt b/ext/opcache/tests/jit/assign_024.phpt
new file mode 100644
index 0000000000..4f48a3e75c
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_024.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT ASSIGN: 024
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = $undef;
+ for($i=0; $i<6; $i++) {
+ $undef = 1;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: undef in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_025.phpt b/ext/opcache/tests/jit/assign_025.phpt
new file mode 100644
index 0000000000..36b76dba09
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_025.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 025
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $arr[0][0] = $ref;
+ for($cnt=0;$cnt<6;$cnt++) {
+ $ref = 1;
+ $arr[0][0] = $ref;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: ref in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_026.phpt b/ext/opcache/tests/jit/assign_026.phpt
new file mode 100644
index 0000000000..4ea0e773e4
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_026.phpt
@@ -0,0 +1,25 @@
+--TEST--
+JIT ASSIGN: 026
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1,2,3);
+ $b=&$a;
+ $b=1;
+ $a = new stdClass;
+ $a->a=1;
+ $a->b=2;
+ $b=&$a;
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_027.phpt b/ext/opcache/tests/jit/assign_027.phpt
new file mode 100644
index 0000000000..20e4f65442
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_027.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 027
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $persons = 2;
+ for ($i=0; $i<$persons; $i++) {
+ $children = 2;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_028.phpt b/ext/opcache/tests/jit/assign_028.phpt
new file mode 100644
index 0000000000..95f076b206
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_028.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 028
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ var_dump($i=1);
+ return $i;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
+int(1)
diff --git a/ext/opcache/tests/jit/assign_029.phpt b/ext/opcache/tests/jit/assign_029.phpt
new file mode 100644
index 0000000000..d79d235c7f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_029.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 029
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $i = 1;
+ var_dump($i=2);
+ return $i;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_030.phpt b/ext/opcache/tests/jit/assign_030.phpt
new file mode 100644
index 0000000000..4f87b10f11
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_030.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT ASSIGN: 030
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $i = 1;
+ $x = 2;
+ var_dump($i=$x);
+ return $i;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_031.phpt b/ext/opcache/tests/jit/assign_031.phpt
new file mode 100644
index 0000000000..7a2b3ad582
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_031.phpt
@@ -0,0 +1,19 @@
+--TEST--
+JIT ASSIGN: 031
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$c =& $a;
+$b = $a;
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_032.phpt b/ext/opcache/tests/jit/assign_032.phpt
new file mode 100644
index 0000000000..448f924aed
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_032.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT ASSIGN: 032
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$var = "intergalactic";
+$var1 = "space";
+$var2 = &$var1;
+$var = $var2;
+var_dump($var);
+var_dump($var1);
+var_dump($var2);
+echo "Done\n";
+?>
+--EXPECT--
+string(5) "space"
+string(5) "space"
+string(5) "space"
+Done
diff --git a/ext/opcache/tests/jit/assign_033.phpt b/ext/opcache/tests/jit/assign_033.phpt
new file mode 100644
index 0000000000..5bda1f0192
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_033.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 033
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo()
+{
+ $mode = 0;
+ $working = 0;
+ while ($mode == 0) {
+ $working = $mode = 1;
+ }
+}
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_034.phpt b/ext/opcache/tests/jit/assign_034.phpt
new file mode 100644
index 0000000000..b444dd9c07
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_034.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 034
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function bar() {
+ $a = strlen("a");
+ $a++;
+ return $a;
+}
+var_dump(bar());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_035.phpt b/ext/opcache/tests/jit/assign_035.phpt
new file mode 100644
index 0000000000..c51b773727
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_035.phpt
@@ -0,0 +1,39 @@
+--TEST--
+JIT ASSIGN: Segfault & memleak if no RC info
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class A {
+
+ public function test() {
+ $closure = function() { return "string"; };
+
+ $arr = [
+ 'a' => $closure(),
+ 'b' => [$closure() => [],],
+ ];
+
+ $x = $arr;
+ unset($x['b'][$closure()]['d']);
+
+ $x = $arr;
+ $x['a'] = $closure();
+
+ return "okey";
+ }
+}
+
+$a = new A();
+echo $a->test();
+?>
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/assign_036.phpt b/ext/opcache/tests/jit/assign_036.phpt
new file mode 100644
index 0000000000..a35516d6ea
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_036.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT ASSIGN: Assign with INTERNED string(no RC)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public $result = "string";
+ function __set($propName, $propValue)
+ {
+ $oldType = \gettype($this->$propName);
+ $newType = \gettype($propValue);
+ if ($propValue === 'false')
+ {
+ $newType = 'boolean';
+ $propValue = \false;
+ }
+ elseif ($propValue === 'true')
+ {
+ $newType = 'boolean';
+ $propValue = \true;
+ }
+ if ($oldType !== $newType)
+ {
+ $tmp = $propValue;
+ \settype($tmp, $newType);
+ }
+ $this->propName = $propValue;
+ }
+}
+$a = new A;
+$a->result = "okey";
+echo $a->result;
+?>
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt
new file mode 100644
index 0000000000..845414b7bb
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_dim_002.phpt
@@ -0,0 +1,137 @@
+--TEST--
+JIT ASSIGN_DIM: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $var[] = 1;
+ var_dump($var);
+}
+foo();
+
+function foo1() {
+ $var1[] = true;
+ var_dump($var1);
+}
+foo1();
+
+function foo2() {
+ $var2[] = array();
+ var_dump($var2);
+}
+foo2();
+
+function foo3() {
+ $array = array(PHP_INT_MAX => "dummy");
+ try {
+ $array[] = array();
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $array = new ArrayObject();
+ $array[index()] = 1;
+ $array[offset()] = 2;
+
+ var_dump($array);
+}
+foo3();
+
+function index() {
+ return 2;
+}
+
+function offset() {
+ return "a";
+}
+
+function foo4() {
+ $array = array();
+ $array[] = array();
+ $array[0][] = 1;
+ $array[0][1] = 1;
+ var_dump($array);
+
+ try {
+ $array[function() {}] = 2;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($array);
+
+ $array2[][] = 3;
+ var_dump($array);
+}
+foo4();
+
+function foo5() {
+ $a = 1;
+ try {
+ $a[2] = 1;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ return $a;
+}
+var_dump(foo5());
+
+--EXPECTF--
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ bool(true)
+}
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+Cannot add element to the array as the next element is already occupied
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ [2]=>
+ int(1)
+ ["a"]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+Illegal offset type
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+Cannot use a scalar value as an array
+int(1)
diff --git a/ext/opcache/tests/jit/bug77857.phpt b/ext/opcache/tests/jit/bug77857.phpt
new file mode 100644
index 0000000000..028ea04aa8
--- /dev/null
+++ b/ext/opcache/tests/jit/bug77857.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #77857 (Wrong result if executed with JIT)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=64
+opcache.jit=1205
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function test() {
+ $arr = array_fill(0, 1, 1.0);
+ $y = 0.0;
+ foreach ($arr as $v) {
+ $tmp = 1.0 * $v;
+ var_dump($tmp);
+ $y = $tmp/1.0;
+ }
+ return $y;
+}
+var_dump(test());
+?>
+--EXPECTF--
+float(1)
+float(1)
diff --git a/ext/opcache/tests/jit/cmp_001.phpt b/ext/opcache/tests/jit/cmp_001.phpt
new file mode 100644
index 0000000000..7cbe312ca1
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT CMP: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$a = 0;
+$b = 0.0;
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
diff --git a/ext/opcache/tests/jit/cmp_002.phpt b/ext/opcache/tests/jit/cmp_002.phpt
new file mode 100644
index 0000000000..8b02c975cd
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_002.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT CMP: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$a = 0;
+$b = 0.0;
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
+?>
+--EXPECT--
+int(0)
+int(0)
+int(1)
+int(1)
diff --git a/ext/opcache/tests/jit/cmp_003.phpt b/ext/opcache/tests/jit/cmp_003.phpt
new file mode 100644
index 0000000000..342d794c2e
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_003.phpt
@@ -0,0 +1,194 @@
+--TEST--
+JIT CMP: 003 Comparisoin with NaN
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function t() {
+ echo "!";
+ return true;
+}
+function f() {
+ echo "!";
+ return false;
+}
+$a = 0.0;
+$i = 0;
+$b = NAN;
+$c = true;
+$d = false;
+var_dump($a == $b);
+var_dump($a != $b);
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+var_dump($a == $b ? 1 : 0);
+var_dump($a != $b ? 1 : 0);
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
+if ($a == $b) {
+} else {
+ echo "1\n";
+}
+if ($a != $b) {
+} else {
+ echo "2\n";
+}
+if ($a < $b) {
+} else {
+ echo "3\n";
+}
+if ($a > $b) {
+} else {
+ echo "4\n";
+}
+if ($a <= $b) {
+} else {
+ echo "5\n";
+}
+if ($a >= $b) {
+} else {
+ echo "6\n";
+}
+var_dump($i == $b ? 1 : 0);
+var_dump($i != $b ? 1 : 0);
+var_dump($i < $b ? 1 : 0);
+var_dump($i > $b ? 1 : 0);
+var_dump($i <= $b ? 1 : 0);
+var_dump($i >= $b ? 1 : 0);
+if ($i == $b) {
+} else {
+ echo "1\n";
+}
+if ($i != $b) {
+} else {
+ echo "2\n";
+}
+if ($i < $b) {
+} else {
+ echo "3\n";
+}
+if ($i > $b) {
+} else {
+ echo "4\n";
+}
+if ($i <= $b) {
+} else {
+ echo "5\n";
+}
+if ($i >= $b) {
+} else {
+ echo "6\n";
+}
+var_dump($a == $b && t());
+var_dump($a != $b && t());
+var_dump($a < $b && t());
+var_dump($a > $b && t());
+var_dump($a <= $b && t());
+var_dump($a >= $b && t());
+var_dump($a == $b || f());
+var_dump($a != $b || f());
+var_dump($a < $b || f());
+var_dump($a > $b || f());
+var_dump($a <= $b || f());
+var_dump($a >= $b || f());
+var_dump($i == $b && t());
+var_dump($i != $b && t());
+var_dump($i < $b && t());
+var_dump($i > $b && t());
+var_dump($i <= $b && t());
+var_dump($i >= $b && t());
+var_dump($i == $b || f());
+var_dump($i != $b || f());
+var_dump($i < $b || f());
+var_dump($i > $b || f());
+var_dump($i <= $b || f());
+var_dump($i >= $b || f());
+$a=NAN;
+var_dump($a == $b);
+var_dump($a != $b);
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+var_dump($a == $b ? 1 : 0);
+var_dump($a != $b ? 1 : 0);
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
+?>
+--EXPECT--
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+1
+3
+4
+5
+6
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+1
+3
+4
+5
+6
+bool(false)
+!bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+!bool(false)
+bool(true)
+!bool(false)
+!bool(false)
+!bool(false)
+!bool(false)
+bool(false)
+!bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+!bool(false)
+bool(true)
+!bool(false)
+!bool(false)
+!bool(false)
+!bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
diff --git a/ext/opcache/tests/jit/cmp_004.phpt b/ext/opcache/tests/jit/cmp_004.phpt
new file mode 100644
index 0000000000..3d1fb97b85
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_004.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT CMP: 004 Comparisons inside conditional statement
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo(bool $test, int $x) {
+ if (($test ? $x >= 1 : $x > 1)) {
+ return 1;
+ }
+ return 0;
+}
+var_dump(foo(true, 9));
+?>
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/const_001.phpt b/ext/opcache/tests/jit/const_001.phpt
new file mode 100644
index 0000000000..ef97b45c23
--- /dev/null
+++ b/ext/opcache/tests/jit/const_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT CONST: defined
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function define_const() {
+ define("CUSTOM_CONSTANT", 1);
+}
+function test_defined() {
+ var_dump(defined("CUSTOM_CONSTANT"));
+ define_const();
+ var_dump(defined("CUSTOM_CONSTANT"));
+}
+
+test_defined();
+?>
+--EXPECT--
+bool(false)
+bool(true)
diff --git a/ext/opcache/tests/jit/defined_001.phpt b/ext/opcache/tests/jit/defined_001.phpt
new file mode 100644
index 0000000000..43eaf7f59b
--- /dev/null
+++ b/ext/opcache/tests/jit/defined_001.phpt
@@ -0,0 +1,38 @@
+--TEST--
+JIT DEFINED: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.jit=1235
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($i) {
+ $a = defined("X");
+ $b = defined("X");
+ if (defined("X")) {
+ $c = 1;
+ } else {
+ $c = 0;
+ }
+ if (!defined("X")) {
+ $d = 0;
+ } else {
+ $d = 1;
+ }
+ if ($a || $b || $c || $d) {
+
+ die("Error on $i-th iteration\n");
+ }
+
+}
+for ($i = 0; $i < 10000; $i++) {
+ foo($i);
+}
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt b/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt
new file mode 100644
index 0000000000..a1ac1d35cc
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT FETCH_DIM_FUNC_ARG: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+namespace A;
+
+class A {
+ public function change(array $config) {
+ $config['keys'] = array_keys($config["a"]);;
+ }
+}
+
+$a = new A();
+
+$a->change($a = array("a" => range(1, 5)));
+?>
+okey
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/fetch_dim_r_001.phpt b/ext/opcache/tests/jit/fetch_dim_r_001.phpt
new file mode 100644
index 0000000000..d38cf6096d
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+JIT FETCH_DIM_R: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6);
+ var_dump($a[0]);
+ var_dump($a[2]);
+ var_dump($a[1.0]);
+ var_dump($a["0"]);
+ var_dump($a["2"]);
+ var_dump($a[false]);
+ var_dump($a[true]);
+ var_dump($a[null]);
+ var_dump($a["ab"]);
+ $x = "a";
+ $y = "b";
+ var_dump($a[$x . $y]);
+ var_dump($a["2x"]);
+ $x = "2";
+ $y = "x";
+ var_dump($a[$x . $y]);
+}
+foo();
+--EXPECT--
+int(1)
+int(3)
+int(2)
+int(1)
+int(3)
+int(1)
+int(2)
+int(4)
+int(5)
+int(5)
+int(6)
+int(6)
diff --git a/ext/opcache/tests/jit/fetch_dim_r_002.phpt b/ext/opcache/tests/jit/fetch_dim_r_002.phpt
new file mode 100644
index 0000000000..36ec162ce5
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_002.phpt
@@ -0,0 +1,45 @@
+--TEST--
+JIT FETCH_DIM_R: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($n) {
+ $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6);
+ var_dump($a[$n]);
+}
+foo(0);
+foo(2);
+foo(1.0);
+foo("0");
+foo("2");
+foo(false);
+foo(true);
+foo(null);
+foo("ab");
+$x="a";
+$y="b";
+foo($x.$y);
+foo("2x");
+$x=2;
+$y="x";
+foo($x.$y);
+--EXPECT--
+int(1)
+int(3)
+int(2)
+int(1)
+int(3)
+int(1)
+int(2)
+int(4)
+int(5)
+int(5)
+int(6)
+int(6)
diff --git a/ext/opcache/tests/jit/fetch_dim_r_003.phpt b/ext/opcache/tests/jit/fetch_dim_r_003.phpt
new file mode 100644
index 0000000000..2e82cb926c
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_003.phpt
@@ -0,0 +1,61 @@
+--TEST--
+JIT FETCH_DIM_R: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = "ABCDEF";
+ var_dump($a[0]);
+ var_dump($a[2]);
+ var_dump($a[1.0]);
+ var_dump($a["0"]);
+ var_dump($a["2"]);
+ var_dump($a[false]);
+ var_dump($a[true]);
+ var_dump($a[null]);
+ var_dump($a["ab"]);
+ $x = "a";
+ $y = "b";
+ var_dump($a[$x . $y]);
+ var_dump($a["2x"]);
+ $x = "2";
+ $y = "x";
+ var_dump($a[$x . $y]);
+}
+foo();
+--EXPECTF--
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_003.php on line 12
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_003.php on line 15
+string(1) "A"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 16
+string(1) "C"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 19
+string(1) "C"
diff --git a/ext/opcache/tests/jit/fetch_dim_r_004.phpt b/ext/opcache/tests/jit/fetch_dim_r_004.phpt
new file mode 100644
index 0000000000..66a88977d9
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_004.phpt
@@ -0,0 +1,61 @@
+--TEST--
+JIT FETCH_DIM_R: 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($n) {
+ $a = "ABCDEF";
+ var_dump($a[$n]);
+}
+foo(0);
+foo(2);
+foo(1.0);
+foo("0");
+foo("2");
+foo(false);
+foo(true);
+foo(null);
+foo("ab");
+$x="a";
+$y="b";
+foo($x.$y);
+foo("2x");
+$x=2;
+$y="x";
+foo($x.$y);
+--EXPECTF--
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_004.php on line 4
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_004.php on line 4
+string(1) "A"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
+string(1) "C"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
+string(1) "C"
diff --git a/ext/opcache/tests/jit/fetch_dim_rw_001.phpt b/ext/opcache/tests/jit/fetch_dim_rw_001.phpt
new file mode 100644
index 0000000000..a828e0a5ea
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_rw_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT FETCH_DIM_RW: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a[0][0] += 2;
+ return $a[0];
+}
+var_dump(foo());
+--EXPECTF--
+Warning: Undefined variable: a in %s on line %d
+
+Notice: Undefined offset: 0 in %sfetch_dim_rw_001.php on line 3
+
+Notice: Undefined offset: 0 in %sfetch_dim_rw_001.php on line 3
+array(1) {
+ [0]=>
+ int(2)
+}
diff --git a/ext/opcache/tests/jit/fetch_obj_001.phpt b/ext/opcache/tests/jit/fetch_obj_001.phpt
new file mode 100644
index 0000000000..2fa44d69ca
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_001.phpt
@@ -0,0 +1,137 @@
+--TEST--
+JIT: FETCH_OBJ
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo(&$a) {
+ $a = 2;
+}
+
+function foo2(&$a) {
+ $a = array();
+}
+
+function foo3(&$a, $var) {
+ $a = $var;
+}
+
+$obj = new stdClass;
+foo($obj->a);
+var_dump($obj);
+foo2($obj->b);
+var_dump($obj);
+foo3($obj->a, "2" . "3");
+foo3($obj->a, $obj->b);
+var_dump($obj);
+
+$a = &$obj->a;
+$a = fopen(__FILE__, "r");
+var_dump($obj);
+
+function bar() {
+ $obj = new stdClass;
+ foo($obj->a);
+ var_dump($obj);
+ foo2($obj->b);
+ var_dump($obj);
+ foo3($obj->a, "2" . "3");
+ foo3($obj->a, $obj->b);
+ var_dump($obj);
+
+ $a = &$obj->a;
+ $a = fopen(__FILE__, "r");
+ var_dump($obj);
+
+ $d = array();
+ try {
+ foo($d->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
+ var_dump($d);
+
+ $e = NULL;
+ try {
+ foo($e->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
+ var_dump($e);
+
+ $f = "";
+ try {
+ foo($f->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
+ var_dump($f);
+}
+
+bar();
+?>
+--EXPECTF--
+object(stdClass)#%d (1) {
+ ["a"]=>
+ int(2)
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ array(0) {
+ }
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &resource(5) of type (stream)
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (1) {
+ ["a"]=>
+ int(2)
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ array(0) {
+ }
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &resource(6) of type (stream)
+ ["b"]=>
+ array(0) {
+ }
+}
+Attempt to modify property 'abc' of non-object
+array(0) {
+}
+Attempt to modify property 'abc' of non-object
+NULL
+Attempt to modify property 'abc' of non-object
+string(0) ""
diff --git a/ext/opcache/tests/jit/fetch_obj_002.phpt b/ext/opcache/tests/jit/fetch_obj_002.phpt
new file mode 100644
index 0000000000..463ff01b26
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_002.phpt
@@ -0,0 +1,41 @@
+--TEST--
+JIT: FETCH_OBJ 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public $x = 2;
+}
+
+class B {
+ public $x = 3;
+ public function __get($name) {
+ var_dump("__get");
+ }
+}
+
+function bar() {
+ $a = new A();
+ var_dump($a->x);
+ var_dump($a->y);
+ $b = new B();
+ var_dump($b->x);
+ unset($b->x);
+ $b->x;
+}
+
+bar();
+?>
+--EXPECTF--
+int(2)
+
+Warning: Undefined property: A::$y in %s on line %d
+NULL
+int(3)
+string(5) "__get"
diff --git a/ext/opcache/tests/jit/fetch_obj_003.phpt b/ext/opcache/tests/jit/fetch_obj_003.phpt
new file mode 100644
index 0000000000..9232ccd64b
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_003.phpt
@@ -0,0 +1,46 @@
+--TEST--
+JIT: FETCH_OBJ 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class C {
+ var $a = 0;
+}
+function foo() {
+ $x = new C;
+ $x->a = 1;
+ unset($x->a);
+ $x->a += 2;
+ var_dump($x);
+}
+function bar() {
+ $x = new C;
+ $x->a = 1;
+ $x->b = 2;
+ unset($x->a);
+ $x->a += 2;
+ var_dump($x);
+}
+foo();
+bar();
+?>
+--EXPECTF--
+Warning: Undefined property: C::$a in %s on line %d
+object(C)#1 (1) {
+ ["a"]=>
+ int(2)
+}
+
+Warning: Undefined property: C::$a in %s on line %d
+object(C)#1 (2) {
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ int(2)
+}
diff --git a/ext/opcache/tests/jit/fetch_obj_004.phpt b/ext/opcache/tests/jit/fetch_obj_004.phpt
new file mode 100644
index 0000000000..10e459b093
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_004.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT: FETCH_OBJ 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class C {
+ var $a = 0;
+}
+function foo() {
+ $x = new C;
+ $x->a = 1;
+ unset($x->a);
+ $x->a = 3;
+ var_dump($x);
+}
+function bar() {
+ $x = new C;
+ $x->a = 1;
+ $x->b = 2;
+ unset($x->a);
+ $x->a = 3;
+ var_dump($x);
+}
+foo();
+bar();
+?>
+--EXPECT--
+object(C)#1 (1) {
+ ["a"]=>
+ int(3)
+}
+object(C)#1 (2) {
+ ["a"]=>
+ int(3)
+ ["b"]=>
+ int(2)
+}
diff --git a/ext/opcache/tests/jit/inc_001.phpt b/ext/opcache/tests/jit/inc_001.phpt
new file mode 100644
index 0000000000..7010533e6b
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ ++$x; // mem -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_002.phpt b/ext/opcache/tests/jit/inc_002.phpt
new file mode 100644
index 0000000000..a6962d1cac
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ ++$x; // reg -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_003.phpt b/ext/opcache/tests/jit/inc_003.phpt
new file mode 100644
index 0000000000..d0a022d635
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_003.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ ++$x; // mem -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_004.phpt b/ext/opcache/tests/jit/inc_004.phpt
new file mode 100644
index 0000000000..5c560fc95f
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_004.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ ++$x; // reg -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_005.phpt b/ext/opcache/tests/jit/inc_005.phpt
new file mode 100644
index 0000000000..99c2b2b858
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_005.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT INC: 005
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ var_dump(++$x); // mem -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/inc_006.phpt b/ext/opcache/tests/jit/inc_006.phpt
new file mode 100644
index 0000000000..3cb61691ed
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_006.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 006
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ var_dump(++$x); // reg -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/inc_007.phpt b/ext/opcache/tests/jit/inc_007.phpt
new file mode 100644
index 0000000000..4ca3f44400
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_007.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 007
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ return ++$x; // mem -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_008.phpt b/ext/opcache/tests/jit/inc_008.phpt
new file mode 100644
index 0000000000..1c1daae827
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_008.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 008
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_009.phpt b/ext/opcache/tests/jit/inc_009.phpt
new file mode 100644
index 0000000000..06920f7bde
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_009.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 009
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ ++$x; // mem -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_010.phpt b/ext/opcache/tests/jit/inc_010.phpt
new file mode 100644
index 0000000000..0d4800efac
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_010.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 010
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ ++$x; // reg -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_011.phpt b/ext/opcache/tests/jit/inc_011.phpt
new file mode 100644
index 0000000000..2cf9678af3
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_011.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 011
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ ++$x; // mem -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_012.phpt b/ext/opcache/tests/jit/inc_012.phpt
new file mode 100644
index 0000000000..bbae1ed78f
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_012.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 012
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ ++$x; // reg -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_013.phpt b/ext/opcache/tests/jit/inc_013.phpt
new file mode 100644
index 0000000000..c07bddc66c
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_013.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT INC: 013
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ var_dump(++$x); // mem -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
+float(2)
diff --git a/ext/opcache/tests/jit/inc_014.phpt b/ext/opcache/tests/jit/inc_014.phpt
new file mode 100644
index 0000000000..d026fae27f
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_014.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 014
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ var_dump(++$x); // reg -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
+float(2)
diff --git a/ext/opcache/tests/jit/inc_015.phpt b/ext/opcache/tests/jit/inc_015.phpt
new file mode 100644
index 0000000000..acbc8050c7
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_015.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 015
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ return ++$x; // mem -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_016.phpt b/ext/opcache/tests/jit/inc_016.phpt
new file mode 100644
index 0000000000..2deabbdd5a
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_016.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 016
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_017.phpt b/ext/opcache/tests/jit/inc_017.phpt
new file mode 100644
index 0000000000..5da8842fc2
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_017.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 017
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = true;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+bool(true)
diff --git a/ext/opcache/tests/jit/inc_018.phpt b/ext/opcache/tests/jit/inc_018.phpt
new file mode 100644
index 0000000000..6ddb4c3174
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_018.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 018
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = false;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+bool(false)
diff --git a/ext/opcache/tests/jit/inc_019.phpt b/ext/opcache/tests/jit/inc_019.phpt
new file mode 100644
index 0000000000..42e83cc93e
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_019.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT INC: 019
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function bar($b) {
+ if ($b) {
+ $a = 1;
+ } else {
+ $a = 2;
+ }
+ isset($a);
+ var_dump($a++);
+ return $a;
+}
+var_dump(bar(0));
+--EXPECT--
+int(2)
+int(3)
diff --git a/ext/opcache/tests/jit/inc_020.phpt b/ext/opcache/tests/jit/inc_020.phpt
new file mode 100644
index 0000000000..60a98f5c20
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_020.phpt
@@ -0,0 +1,28 @@
+--TEST--
+JIT INC: 020
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($row) {
+ foreach ($row as $key => $value) {
+ if (is_int($key)) {
+ $key++;
+ }
+ if (isset($row[$key])) {
+ return false;
+ }
+ }
+ return true;
+}
+?>
+OK
+--EXPECT--
+OK \ No newline at end of file
diff --git a/ext/opcache/tests/jit/jmpz_001.phpt b/ext/opcache/tests/jit/jmpz_001.phpt
new file mode 100644
index 0000000000..46aa0f8825
--- /dev/null
+++ b/ext/opcache/tests/jit/jmpz_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT JMPZ: JMPZ may require code for "smart branch" and at the same time be a target of another JMP.
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+namespace A;
+
+function test() {
+
+ $modelData = array();
+ $ret = false ||
+ ((is_array($modelData) || $modelData instanceof \Countable) && true) || false;
+ return $ret;
+}
+
+var_dump(test());
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/opcache/tests/jit/jmpz_ex_001.phpt b/ext/opcache/tests/jit/jmpz_ex_001.phpt
new file mode 100644
index 0000000000..c001fb9b69
--- /dev/null
+++ b/ext/opcache/tests/jit/jmpz_ex_001.phpt
@@ -0,0 +1,32 @@
+--TEST--
+JIT JMPZ_EX: Operand needs to be freed even if same as result
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Test {
+ public $prop;
+ public function method() {
+ return $this->prop && $this->prop->method2();
+ }
+}
+
+class Test2 {
+ public function method2() {
+ return true;
+ }
+};
+
+$test = new Test;
+$test->prop = new Test2;
+var_dump($test->method());
+
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/opcache/tests/jit/mod_001.phpt b/ext/opcache/tests/jit/mod_001.phpt
new file mode 100644
index 0000000000..88d8bfc767
--- /dev/null
+++ b/ext/opcache/tests/jit/mod_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+JIT MOD: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function mod(int $a, int $b) {
+ return $a % $b;
+}
+var_dump(mod(125, 33));
+var_dump(mod(125, 32));
+var_dump(mod(-125, 33));
+var_dump(mod(-125, 32));
+var_dump(mod(125, -33));
+var_dump(mod(-125, -33));
+try {
+ var_dump(mod(125, -1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(mod(125, 0));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(26)
+int(29)
+int(-26)
+int(-29)
+int(26)
+int(-26)
+int(0)
+Exception (DivisionByZeroError): Modulo by zero
diff --git a/ext/opcache/tests/jit/mod_002.phpt b/ext/opcache/tests/jit/mod_002.phpt
new file mode 100644
index 0000000000..d06645f783
--- /dev/null
+++ b/ext/opcache/tests/jit/mod_002.phpt
@@ -0,0 +1,53 @@
+--TEST--
+JIT MOD: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function mod33(int $a) {
+ return $a % 33;
+}
+function mod32(int $a) {
+ return $a % 32;
+}
+function modNeg33(int $a) {
+ return $a % -33;
+}
+function modNeg1(int $a) {
+ return $a % -1;
+}
+function mod0(int $a) {
+ return $a % 0;
+}
+var_dump(mod33(125));
+var_dump(mod32(125));
+var_dump(mod33(-125));
+var_dump(mod32(-125));
+var_dump(modNeg33(125));
+var_dump(modNeg33(-125));
+try {
+ var_dump(modNeg1(125));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(mod0(125));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(26)
+int(29)
+int(-26)
+int(-29)
+int(26)
+int(-26)
+int(0)
+Exception (DivisionByZeroError): Modulo by zero
diff --git a/ext/opcache/tests/jit/noval_001.phpt b/ext/opcache/tests/jit/noval_001.phpt
new file mode 100644
index 0000000000..f3aa4a0d0e
--- /dev/null
+++ b/ext/opcache/tests/jit/noval_001.phpt
@@ -0,0 +1,34 @@
+--TEST--
+JIT NOVAL: 001 (bug in zend_jit_compute_false_dependencies())
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Foo {
+ const X = false;
+
+ static function bar() {
+ $count = 0;
+ if (self::X) {
+ $count = intval(9223372036854775807);
+ }
+ if (self::X) {
+ $count = 2;
+ }
+ if ($count != 0) {
+ return "bug";
+ }
+ return "ok";
+ }
+}
+var_dump(Foo::bar());
+--EXPECT--
+string(2) "ok"
+
diff --git a/ext/opcache/tests/jit/recv_001.phpt b/ext/opcache/tests/jit/recv_001.phpt
new file mode 100644
index 0000000000..1f02ff3381
--- /dev/null
+++ b/ext/opcache/tests/jit/recv_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT RECV: infinite loop
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+function test(array $args, $short_options, $long_options = null)
+{
+ echo "okey";
+}
+
+test(array(), "d:e", 222, 3434);
+
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/reg_alloc_001.phpt b/ext/opcache/tests/jit/reg_alloc_001.phpt
new file mode 100644
index 0000000000..609ed8e27f
--- /dev/null
+++ b/ext/opcache/tests/jit/reg_alloc_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Register Alloction 001: Spilling in "identical" code
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Caster
+{
+ const EXCLUDE_PUBLIC = 8;
+ const EXCLUDE_PRIVATE = 32;
+ const EXCLUDE_STRICT = 512;
+
+ public static function filter(array $a, $filter)
+ {
+ foreach ($a as $k => $v) {
+ if (!isset($k[1])) {
+ $type |= self::EXCLUDE_PUBLIC;
+ } else {
+ $type |= self::EXCLUDE_PRIVATE;
+ }
+
+ if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) {
+ }
+ }
+
+ return $a;
+ }
+
+}
+?>
+OK
+--EXPECT--
+OK
diff --git a/ext/opcache/tests/jit/reg_alloc_002.phpt b/ext/opcache/tests/jit/reg_alloc_002.phpt
new file mode 100644
index 0000000000..e93c4f3d5b
--- /dev/null
+++ b/ext/opcache/tests/jit/reg_alloc_002.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Register Alloction 002: SEND_VAL_EX uses %r0 as a temporay register
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public function process($call) {
+ $i = 0;
+ foreach (array("a", "b", "c") as $attr) {
+ $call($i++, "xxx");
+ }
+ }
+}
+
+$a = new A();
+$a->process(function($i, $v) { var_dump($i); });
+?>
+--EXPECT--
+int(0)
+int(1)
+int(2)
diff --git a/ext/opcache/tests/jit/reg_alloc_003.phpt b/ext/opcache/tests/jit/reg_alloc_003.phpt
new file mode 100644
index 0000000000..21a7779c79
--- /dev/null
+++ b/ext/opcache/tests/jit/reg_alloc_003.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Register Alloction 003: Reuse temporay register
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function test($char_code) {
+ if ($char_code == !($char_code & 0xffffff80)) {
+ return "correct";
+ } else {
+ return "wrong";
+ }
+}
+echo test(65), "\n";
+?>
+--EXPECT--
+correct
diff --git a/ext/opcache/tests/jit/send_val_001.phpt b/ext/opcache/tests/jit/send_val_001.phpt
new file mode 100644
index 0000000000..1293df7dec
--- /dev/null
+++ b/ext/opcache/tests/jit/send_val_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT SEND_VAL: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($type) {
+ $key = md5(
+ is_array($type) ? \implode('_', $type) : $type .
+ "ops"
+ );
+ return $key;
+}
+var_dump(foo("int"));
+var_dump(foo(["int"]));
+--EXPECT--
+string(32) "253a948ecc9192cb47e492f692aa63a8"
+string(32) "fa7153f7ed1cb6c0fcf2ffb2fac21748"
diff --git a/ext/opcache/tests/jit/send_var_ex_001.phpt b/ext/opcache/tests/jit/send_var_ex_001.phpt
new file mode 100644
index 0000000000..2e2a19152c
--- /dev/null
+++ b/ext/opcache/tests/jit/send_var_ex_001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+JIT SEND_VAR_EX fails on SHOULD_SEND_BY_REF checking
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+namespace A;
+
+class A {
+ private $evalParameters;
+ public function evaluate() {
+ $this->evalParameters = array("a" => "okey");
+ extract($this->evalParameters, EXTR_SKIP);
+ echo $a;
+ return false;
+ }
+}
+
+$a = new A();
+
+$a->evaluate();
+?>
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/shift_left_001.phpt b/ext/opcache/tests/jit/shift_left_001.phpt
new file mode 100644
index 0000000000..b0328b1765
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_left_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+JIT Shift Left: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shl(int $a, int $b) {
+ return $a << $b;
+}
+var_dump(shl(1, 0));
+var_dump(shl(1, 1));
+var_dump(shl(1, 2));
+var_dump(shl(-1, 2));
+try {
+ var_dump(shl(1, 64));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shl(1, -1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(1)
+int(2)
+int(4)
+int(-4)
+int(0)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_left_002.phpt b/ext/opcache/tests/jit/shift_left_002.phpt
new file mode 100644
index 0000000000..4b617530c5
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_left_002.phpt
@@ -0,0 +1,49 @@
+--TEST--
+JIT Shift Left: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shl0(int $a) {
+ return $a << 0;
+}
+function shl1(int $a) {
+ return $a << 1;
+}
+function shl2(int $a) {
+ return $a << 2;
+}
+function shl64(int $a) {
+ return $a << 64;
+}
+function shlNEG(int $a) {
+ return $a << -1;
+}
+var_dump(shl0(1));
+var_dump(shl1(1));
+var_dump(shl2(1));
+var_dump(shl2(-1));
+try {
+ var_dump(shl64(1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shlNEG(1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(1)
+int(2)
+int(4)
+int(-4)
+int(0)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_right_001.phpt b/ext/opcache/tests/jit/shift_right_001.phpt
new file mode 100644
index 0000000000..9a5f2eb6d5
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_right_001.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT Shift Right: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shr(int $a, int $b) {
+ return $a >> $b;
+}
+var_dump(shr(256, 0));
+var_dump(shr(256, 1));
+var_dump(shr(256, 2));
+var_dump(shr(-8, 2));
+try {
+ var_dump(shr(1, 64));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shr(-1, 64));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shr(1, -1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(256)
+int(128)
+int(64)
+int(-2)
+int(0)
+int(-1)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_right_002.phpt b/ext/opcache/tests/jit/shift_right_002.phpt
new file mode 100644
index 0000000000..1fea4e1c4b
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_right_002.phpt
@@ -0,0 +1,55 @@
+--TEST--
+JIT Shift Right: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shr0(int $a) {
+ return $a >> 0;
+}
+function shr1(int $a) {
+ return $a >> 1;
+}
+function shr2(int $a) {
+ return $a >> 2;
+}
+function shr64(int $a) {
+ return $a >> 64;
+}
+function shrNEG(int $a) {
+ return $a >> -1;
+}
+var_dump(shr0(256));
+var_dump(shr1(256));
+var_dump(shr2(256));
+var_dump(shr2(-8));
+try {
+ var_dump(shr64(1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shr64(-1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shrNEG(1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(256)
+int(128)
+int(64)
+int(-2)
+int(0)
+int(-1)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_right_003.phpt b/ext/opcache/tests/jit/shift_right_003.phpt
new file mode 100644
index 0000000000..7fdf601d64
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_right_003.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT Shift Right: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function encodeDynamicInteger(int $int): string {
+ $out = "";
+ for ($i = 0; ($int >> $i) > 0x80; $i += 7) {
+ $out .= \chr(0x80 | (($int >> $i) & 0x7f));
+ }
+ return $out . \chr($int >> $i);
+}
+$s = encodeDynamicInteger(235);
+var_dump(strlen($s), ord($s[0]), ord($s[1]));
+?>
+--EXPECT--
+int(2)
+int(235)
+int(1)
diff --git a/ext/opcache/tests/jit/skipif.inc b/ext/opcache/tests/jit/skipif.inc
new file mode 100644
index 0000000000..c5a8181039
--- /dev/null
+++ b/ext/opcache/tests/jit/skipif.inc
@@ -0,0 +1,3 @@
+<?php
+ if (!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not available');
+?>
diff --git a/ext/opcache/tests/jit/switch_jumptable.phpt b/ext/opcache/tests/jit/switch_jumptable.phpt
new file mode 100644
index 0000000000..df59a48c14
--- /dev/null
+++ b/ext/opcache/tests/jit/switch_jumptable.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Switch jumptable generation
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+function test1(string $val) {
+ switch ($val) {
+ case 'str1':
+ case 'str2':
+ echo "correct\n";
+ return;
+ }
+ echo "wrong\n";
+}
+function test2(int $val) {
+ switch ($val) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ echo "correct\n";
+ return;
+ }
+ echo "wrong\n";
+}
+test1("str1");
+test2(1);
+
+?>
+--EXPECT--
+correct
+correct
diff --git a/ext/opcache/tests/jit/unreachable_block.phpt b/ext/opcache/tests/jit/unreachable_block.phpt
new file mode 100644
index 0000000000..d452484a3f
--- /dev/null
+++ b/ext/opcache/tests/jit/unreachable_block.phpt
@@ -0,0 +1,25 @@
+--TEST--
+JIT unreachable_block with block order
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public function Value()
+ {
+ switch ($this->returnType) {
+ case 'float': return $this->returnTypeNullable ? null : 0;
+ default: return;
+ }
+ }
+}
+?>
+okey
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jmpz_jmp_elim.phpt b/ext/opcache/tests/jmpz_jmp_elim.phpt
index 8a343512dd..434897bf80 100644
--- a/ext/opcache/tests/jmpz_jmp_elim.phpt
+++ b/ext/opcache/tests/jmpz_jmp_elim.phpt
@@ -14,5 +14,5 @@ echo "done\n";
?>
--EXPECTF--
-Notice: Undefined variable: undef in %s on line %d
+Warning: Undefined variable: undef in %s on line %d
done
diff --git a/ext/opcache/tests/opt/block_pass_001.phpt b/ext/opcache/tests/opt/block_pass_001.phpt
new file mode 100644
index 0000000000..788994ea4e
--- /dev/null
+++ b/ext/opcache/tests/opt/block_pass_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Block Pass 001: QM_ASSIGN and DECLARE_LAMBDA_FUNCTION
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+abstract class Broadcaster {
+ protected function normalizeChannelHandlerToCallable($callback)
+ {
+ return is_callable($callback) ? $callback : function (...$args) use ($callback) {
+ return Container::getInstance()
+ ->make($callback)
+ ->join(...$args);
+ };
+ }
+}
+?>
+OK
+--EXPECT--
+OK
diff --git a/ext/opcache/tests/opt/block_pass_002.phpt b/ext/opcache/tests/opt/block_pass_002.phpt
new file mode 100644
index 0000000000..ef7bf479c5
--- /dev/null
+++ b/ext/opcache/tests/opt/block_pass_002.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Block Pass 002: QM_ASSIGN and INIT_ARRAY
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($key, $value, array $attributes) {
+ return is_array($value)
+ ? [$key, array_merge($value, $attributes)]
+ : [$value, $attributes];
+}
+?>
+OK
+--EXPECT--
+OK
diff --git a/ext/opcache/tests/optimize_static_001.phpt b/ext/opcache/tests/optimize_static_001.phpt
index d4e2c58062..8279ecacf5 100644
--- a/ext/opcache/tests/optimize_static_001.phpt
+++ b/ext/opcache/tests/optimize_static_001.phpt
@@ -11,9 +11,13 @@ opcache.optimization_level=-1
function foo() {
static $a = UNDEFINED_CONST;
}
-foo();
+try {
+ foo();
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+}
?>
OK
---EXPECTF--
-Warning: Use of undefined constant UNDEFINED_CONST - assumed 'UNDEFINED_CONST' (this will throw an Error in a future version of PHP) in %s on line %d
+--EXPECT--
+Exception: Undefined constant 'UNDEFINED_CONST'
OK \ No newline at end of file
diff --git a/ext/opcache/tests/revalidate_path_01.phpt b/ext/opcache/tests/revalidate_path_01.phpt
index d982613103..e64dd44cdc 100644
--- a/ext/opcache/tests/revalidate_path_01.phpt
+++ b/ext/opcache/tests/revalidate_path_01.phpt
@@ -6,7 +6,6 @@ opcache.enable_cli=1
opcache.revalidate_path=1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--CONFLICTS--
server
--FILE--
diff --git a/ext/opcache/tests/wrong_inlining_002.phpt b/ext/opcache/tests/wrong_inlining_002.phpt
index 4e71a96d10..9aaa60c534 100644
--- a/ext/opcache/tests/wrong_inlining_002.phpt
+++ b/ext/opcache/tests/wrong_inlining_002.phpt
@@ -20,10 +20,7 @@ class Foo {
Foo::test();
?>
--EXPECTF--
-Deprecated: Non-static method Foo::test() should not be called statically in %swrong_inlining_002.php on line 11
-
-Fatal error: Uncaught Error: Using $this when not in object context in %swrong_inlining_002.php:7
+Fatal error: Uncaught Error: Non-static method Foo::test() cannot be called statically in %s:%d
Stack trace:
-#0 %swrong_inlining_002.php(11): Foo::test()
-#1 {main}
- thrown in %swrong_inlining_002.php on line 7
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/opcache/tests/wrong_inlining_003.phpt b/ext/opcache/tests/wrong_inlining_003.phpt
index a7e4a11b76..c83a4efc36 100644
--- a/ext/opcache/tests/wrong_inlining_003.phpt
+++ b/ext/opcache/tests/wrong_inlining_003.phpt
@@ -19,5 +19,5 @@ function test() {
test();
?>
--EXPECTF--
-Notice: Undefined variable: undef in %swrong_inlining_003.php on line 7
+Warning: Undefined variable: undef in %s on line %d
int(42)
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 7d04e49f32..9faec50386 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -31,6 +31,11 @@
#include "zend_virtual_cwd.h"
#include "ext/standard/info.h"
#include "ext/standard/php_filestat.h"
+#include "opcache_arginfo.h"
+
+#if HAVE_JIT
+#include "jit/zend_jit.h"
+#endif
#define STRING_NOT_NULL(s) (NULL == (s)?"":s)
#define MIN_ACCEL_FILES 200
@@ -41,26 +46,6 @@ static zif_handler orig_file_exists = NULL;
static zif_handler orig_is_file = NULL;
static zif_handler orig_is_readable = NULL;
-ZEND_BEGIN_ARG_INFO(arginfo_opcache_none, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0)
- ZEND_ARG_INFO(0, fetch_scripts)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_compile_file, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1)
- ZEND_ARG_INFO(0, script)
- ZEND_ARG_INFO(0, force)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_is_script_cached, 0, 0, 1)
- ZEND_ARG_INFO(0, script)
-ZEND_END_ARG_INFO()
-
/* User functions */
static ZEND_FUNCTION(opcache_reset);
static ZEND_FUNCTION(opcache_invalidate);
@@ -73,12 +58,12 @@ static ZEND_FUNCTION(opcache_get_configuration);
static const zend_function_entry accel_functions[] = {
/* User functions */
- ZEND_FE(opcache_reset, arginfo_opcache_none)
+ ZEND_FE(opcache_reset, arginfo_opcache_reset)
ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate)
ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file)
ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached)
/* Private functions */
- ZEND_FE(opcache_get_configuration, arginfo_opcache_none)
+ ZEND_FE(opcache_get_configuration, arginfo_opcache_get_configuration)
ZEND_FE(opcache_get_status, arginfo_opcache_get_status)
ZEND_FE_END
};
@@ -327,6 +312,12 @@ ZEND_INI_BEGIN()
#if ZEND_WIN32
STD_PHP_INI_ENTRY("opcache.cache_id" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.cache_id, zend_accel_globals, accel_globals)
#endif
+#ifdef HAVE_JIT
+ STD_PHP_INI_ENTRY("opcache.jit" , ZEND_JIT_DEFAULT, PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit, zend_accel_globals, accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_buffer_size" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_buffer_size, zend_accel_globals, accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_debug" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_debug, zend_accel_globals, accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_bisect_limit" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_bisect_limit, zend_accel_globals, accel_globals)
+#endif
ZEND_INI_END()
static int filename_is_in_cache(zend_string *filename)
@@ -457,6 +448,15 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
} else {
php_info_print_table_row(2, "File Cache", "Disabled");
}
+#if HAVE_JIT
+ if (ZCG(jit_enabled)) {
+ php_info_print_table_row(2, "JIT", "Enabled");
+ } else {
+ php_info_print_table_row(2, "JIT", "Disabled");
+ }
+#else
+ php_info_print_table_row(2, "JIT", "Not Available");
+#endif
if (file_cache_only) {
if (!accel_startup_ok || zps_api_failure_reason) {
php_info_print_table_row(2, "Startup Failed", zps_api_failure_reason);
@@ -699,6 +699,9 @@ static ZEND_FUNCTION(opcache_get_status)
add_assoc_zval(return_value, "scripts", &scripts);
}
}
+#if HAVE_JIT
+ zend_jit_status(return_value);
+#endif
}
static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value)
@@ -780,6 +783,12 @@ static ZEND_FUNCTION(opcache_get_configuration)
#if ZEND_WIN32
add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id));
#endif
+#ifdef HAVE_JIT
+ add_assoc_long(&directives, "opcache.jit", ZCG(accel_directives).jit);
+ add_assoc_long(&directives, "opcache.jit_buffer_size", ZCG(accel_directives).jit_buffer_size);
+ add_assoc_long(&directives, "opcache.jit_debug", ZCG(accel_directives).jit_debug);
+ add_assoc_long(&directives, "opcache.jit_bisect_limit", ZCG(accel_directives).jit_bisect_limit);
+#endif
add_assoc_zval(return_value, "directives", &directives);
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 6d49b8b950..697bb10b0d 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -885,6 +885,13 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
#endif
void *mem, *buf;
+#ifdef HAVE_JIT
+ /* FIXME: dump jited codes out to file cache? */
+ if (ZCG(jit_enabled)) {
+ return FAILURE;
+ }
+#endif
+
filename = zend_file_cache_get_bin_file_path(script->script.filename);
if (zend_file_cache_mkdir(filename, strlen(ZCG(accel_directives).file_cache)) != SUCCESS) {
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 1571093419..a2fb94d7f6 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -29,6 +29,10 @@
#include "zend_operators.h"
#include "zend_interfaces.h"
+#ifdef HAVE_JIT
+# include "jit/zend_jit.h"
+#endif
+
#define zend_set_str_gc_flags(str) do { \
if (file_cache_only) { \
GC_TYPE_INFO(str) = IS_STRING | (IS_STR_INTERNED << GC_FLAGS_SHIFT); \
@@ -535,6 +539,14 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
}
ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE(zend_extensions_op_array_persist(op_array, ZCG(mem))));
+
+#ifdef HAVE_JIT
+ if (ZCG(jit_enabled) &&
+ ZEND_JIT_LEVEL(ZCG(accel_directives).jit) <= ZEND_JIT_LEVEL_OPT_FUNCS &&
+ !ZCG(current_persistent_script)->corrupted) {
+ zend_jit_op_array(op_array, ZCG(current_persistent_script) ? &ZCG(current_persistent_script)->script : NULL);
+ }
+#endif
}
static void zend_persist_op_array(zval *zv)
@@ -1069,6 +1081,12 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
script->arena_mem = ZCG(arena_mem) = ZCG(mem);
ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
+#ifdef HAVE_JIT
+ if (ZCG(jit_enabled) && for_shm) {
+ zend_jit_unprotect();
+ }
+#endif
+
zend_map_ptr_extend(ZCSG(map_ptr_last));
zend_accel_persist_class_table(&script->script.class_table);
@@ -1082,6 +1100,15 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
ZCSG(map_ptr_last) = CG(map_ptr_last);
+#ifdef HAVE_JIT
+ if (ZCG(jit_enabled) && for_shm) {
+ if (ZEND_JIT_LEVEL(ZCG(accel_directives).jit) >= ZEND_JIT_LEVEL_OPT_SCRIPT) {
+ zend_jit_script(&script->script);
+ }
+ zend_jit_protect();
+ }
+#endif
+
script->corrupted = 0;
ZCG(current_persistent_script) = NULL;
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 8e75cda333..d32a70b7e8 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -145,7 +145,7 @@ static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, siz
return ALLOC_FAILURE;
}
-int zend_shared_alloc_startup(size_t requested_size)
+int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
{
zend_shared_segment **tmp_shared_segments;
size_t shared_segments_array_size;
@@ -153,13 +153,13 @@ int zend_shared_alloc_startup(size_t requested_size)
char *error_in = NULL;
const zend_shared_memory_handler_entry *he;
int res = ALLOC_FAILURE;
-
+ int i;
/* shared_free must be valid before we call zend_shared_alloc()
* - make it temporarily point to a local variable
*/
smm_shared_globals = &tmp_shared_globals;
- ZSMMG(shared_free) = requested_size; /* goes to tmp_shared_globals.shared_free */
+ ZSMMG(shared_free) = requested_size - reserved_size; /* goes to tmp_shared_globals.shared_free */
#ifndef ZEND_WIN32
zend_shared_alloc_create_lock(ZCG(accel_directives).lockfile_path);
@@ -220,10 +220,15 @@ int zend_shared_alloc_startup(size_t requested_size)
}
#endif
+ for (i = 0; i < ZSMMG(shared_segments_count); i++) {
+ ZSMMG(shared_segments)[i]->end = ZSMMG(shared_segments)[i]->size;
+ }
+
shared_segments_array_size = ZSMMG(shared_segments_count) * S_H(segment_type_size)();
/* move shared_segments and shared_free to shared memory */
ZCG(locked) = 1; /* no need to perform a real lock at this point */
+
p_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals));
if (!p_tmp_shared_globals) {
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
@@ -251,6 +256,18 @@ int zend_shared_alloc_startup(size_t requested_size)
return ALLOC_FAILURE;
}
+ if (reserved_size) {
+ i = ZSMMG(shared_segments_count) - 1;
+ if (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= reserved_size) {
+ ZSMMG(shared_segments)[i]->end = ZSMMG(shared_segments)[i]->size - reserved_size;
+ ZSMMG(reserved) = (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->end;
+ ZSMMG(reserved_size) = reserved_size;
+ } else {
+ zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+ return ALLOC_FAILURE;
+ }
+ }
+
ZCG(locked) = 0;
return res;
@@ -298,7 +315,7 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
size_t largest_block_size = 0;
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
- size_t block_size = ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos;
+ size_t block_size = ZSMMG(shared_segments)[i]->end - ZSMMG(shared_segments)[i]->pos;
if (block_size>largest_block_size) {
largest_block_size = block_size;
@@ -331,7 +348,7 @@ void *zend_shared_alloc(size_t size)
return NULL;
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
- if (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */
+ if (ZSMMG(shared_segments)[i]->end - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */
void *retval = (void *) (((char *) ZSMMG(shared_segments)[i]->p) + ZSMMG(shared_segments)[i]->pos);
ZSMMG(shared_segments)[i]->pos += block_size;
@@ -596,7 +613,7 @@ void zend_accel_shared_protect(int mode)
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
- mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode);
+ mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode);
}
#elif defined(ZEND_WIN32)
int i;
@@ -613,7 +630,7 @@ void zend_accel_shared_protect(int mode)
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
DWORD oldProtect;
- if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode, &oldProtect)) {
+ if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode, &oldProtect)) {
zend_accel_error(ACCEL_LOG_ERROR, "Failed to protect memory");
}
}
@@ -630,7 +647,7 @@ int zend_accel_in_shm(void *ptr)
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
if ((char*)ptr >= (char*)ZSMMG(shared_segments)[i]->p &&
- (char*)ptr < (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->size) {
+ (char*)ptr < (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->end) {
return 1;
}
}
diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h
index 2a77dfbef7..1dbc88d42e 100644
--- a/ext/opcache/zend_shared_alloc.h
+++ b/ext/opcache/zend_shared_alloc.h
@@ -75,6 +75,7 @@
typedef struct _zend_shared_segment {
size_t size;
+ size_t end;
size_t pos; /* position for simple stack allocator */
void *p;
} zend_shared_segment;
@@ -113,6 +114,9 @@ typedef struct _zend_smm_shared_globals {
zend_shared_memory_state shared_memory_state;
/* Pointer to the application's shared data structures */
void *app_shared_globals;
+ /* Reserved shared memory */
+ void *reserved;
+ size_t reserved_size;
} zend_smm_shared_globals;
extern zend_smm_shared_globals *smm_shared_globals;
@@ -121,10 +125,11 @@ extern zend_smm_shared_globals *smm_shared_globals;
#define SHARED_ALLOC_REATTACHED (SUCCESS+1)
-int zend_shared_alloc_startup(size_t requested_size);
+int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size);
void zend_shared_alloc_shutdown(void);
/* allocate shared memory block */
+void *zend_shared_alloc_pages(size_t requested_size);
void *zend_shared_alloc(size_t size);
/* copy into shared memory */
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index f566d4e6ed..912c57f709 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.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, |
@@ -27,6 +25,7 @@
#include "php.h"
#include "php_ini.h"
+#include "openssl_arginfo.h"
#include "php_openssl.h"
#include "zend_exceptions.h"
@@ -131,54 +130,6 @@ PHP_FUNCTION(openssl_pkey_derive);
PHP_FUNCTION(openssl_random_pseudo_bytes);
/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 0, 2)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, outfilename)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(1, out)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0)
- ZEND_ARG_INFO(0, cert)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_verify, 0)
- ZEND_ARG_INFO(0, cert)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, shortname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_checkpurpose, 0, 0, 2)
- ZEND_ARG_INFO(0, x509cert)
- ZEND_ARG_INFO(0, purpose)
- ZEND_ARG_INFO(0, cainfo) /* array */
- ZEND_ARG_INFO(0, untrustedfile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_read, 0)
- ZEND_ARG_INFO(0, cert)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_free, 0)
- ZEND_ARG_INFO(0, x509)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs12_export_to_file, 0, 0, 4)
ZEND_ARG_INFO(0, x509)
ZEND_ARG_INFO(0, filename)
@@ -1675,6 +1626,10 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
Retrieve an array mapping available certificate locations */
PHP_FUNCTION(openssl_get_cert_locations)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
add_assoc_string(return_value, "default_cert_file", (char *) X509_get_default_cert_file());
@@ -1856,7 +1811,9 @@ PHP_FUNCTION(openssl_spki_new)
pkey = php_openssl_evp_from_zval(zpkey, 0, challenge, challenge_len, 1, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to use supplied private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Unable to use supplied private key");
+ }
goto cleanup;
}
@@ -2864,7 +2821,9 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ }
goto cleanup;
}
if (!X509_check_private_key(cert, priv_key)) {
@@ -2957,7 +2916,9 @@ PHP_FUNCTION(openssl_pkcs12_export)
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ }
goto cleanup;
}
if (!X509_check_private_key(cert, priv_key)) {
@@ -3367,7 +3328,9 @@ PHP_FUNCTION(openssl_csr_export_to_file)
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ }
return;
}
@@ -3416,7 +3379,9 @@ PHP_FUNCTION(openssl_csr_export)
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ }
return;
}
@@ -3467,7 +3432,9 @@ PHP_FUNCTION(openssl_csr_sign)
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ }
return;
}
if (zcert) {
@@ -3479,7 +3446,9 @@ PHP_FUNCTION(openssl_csr_sign)
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ }
goto cleanup;
}
if (cert && !X509_check_private_key(cert, priv_key)) {
@@ -4607,7 +4576,9 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource);
if (key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1");
+ }
RETURN_FALSE;
}
@@ -4692,7 +4663,9 @@ PHP_FUNCTION(openssl_pkey_export)
key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource);
if (key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1");
+ }
RETURN_FALSE;
}
@@ -5571,7 +5544,9 @@ PHP_FUNCTION(openssl_pkcs7_sign)
privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, 0, &keyresource);
if (privkey == NULL) {
- php_error_docref(NULL, E_WARNING, "error getting private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "error getting private key");
+ }
goto clean_exit;
}
@@ -5683,7 +5658,9 @@ PHP_FUNCTION(openssl_pkcs7_decrypt)
key = php_openssl_evp_from_zval(recipkey ? recipkey : recipcert, 0, "", 0, 0, &keyresval);
if (key == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to get private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "unable to get private key");
+ }
goto clean_exit;
}
@@ -5751,7 +5728,9 @@ PHP_FUNCTION(openssl_private_encrypt)
pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key param is not a valid private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key param is not a valid private key");
+ }
RETURN_FALSE;
}
@@ -5812,7 +5791,9 @@ PHP_FUNCTION(openssl_private_decrypt)
pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key");
+ }
RETURN_FALSE;
}
@@ -5879,7 +5860,9 @@ PHP_FUNCTION(openssl_public_encrypt)
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ }
RETURN_FALSE;
}
@@ -5941,7 +5924,9 @@ PHP_FUNCTION(openssl_public_decrypt)
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ }
RETURN_FALSE;
}
@@ -6040,7 +6025,9 @@ PHP_FUNCTION(openssl_sign)
}
pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a private key");
+ }
RETURN_FALSE;
}
@@ -6125,7 +6112,9 @@ PHP_FUNCTION(openssl_verify)
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a public key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a public key");
+ }
RETURN_FALSE;
}
@@ -6205,7 +6194,9 @@ PHP_FUNCTION(openssl_seal)
ZEND_HASH_FOREACH_VAL(pubkeysht, pubkey) {
pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, 0, &key_resources[i]);
if (pkeys[i] == NULL) {
- php_error_docref(NULL, E_WARNING, "not a public key (%dth member of pubkeys)", i+1);
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "not a public key (%dth member of pubkeys)", i+1);
+ }
RETVAL_FALSE;
goto clean_exit;
}
@@ -6303,7 +6294,9 @@ PHP_FUNCTION(openssl_open)
pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to coerce parameter 4 into a private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "unable to coerce parameter 4 into a private key");
+ }
RETURN_FALSE;
}
diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php
new file mode 100644
index 0000000000..23acc5f47c
--- /dev/null
+++ b/ext/openssl/openssl.stub.php
@@ -0,0 +1,24 @@
+<?php
+
+function openssl_x509_export_to_file($x509, string $outfilename, bool $notext = true): bool {}
+
+function openssl_x509_export($x509 , &$out, bool $notext = true): bool {}
+
+/** @return string|false */
+function openssl_x509_fingerprint($x509, string $method = 'sha1', bool $raw_output = false) {}
+
+function openssl_x509_check_private_key($cert, $key): bool {}
+
+function openssl_x509_verify($cert, $key): int {}
+
+/** @return array|false */
+function openssl_x509_parse($x509, bool $shortname = true) {}
+
+/** @return bool|int */
+function openssl_x509_checkpurpose($x509cert, int $purpose, ?array $cainfo = [], string $untrustedfile = UNKNOWN) {}
+
+/** @return resource|false */
+function openssl_x509_read($cert) {}
+
+/** @return false|void */
+function openssl_x509_free($x509) {}
diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h
new file mode 100644
index 0000000000..ed104a2ffa
--- /dev/null
+++ b/ext/openssl/openssl_arginfo.h
@@ -0,0 +1,49 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_INFO(1, out)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_check_private_key, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, cert)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_verify, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, cert)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_parse, 0, 0, 1)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, shortname, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_checkpurpose, 0, 0, 2)
+ ZEND_ARG_INFO(0, x509cert)
+ ZEND_ARG_TYPE_INFO(0, purpose, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cainfo, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, untrustedfile, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, cert)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_free, 0, 0, 1)
+ ZEND_ARG_INFO(0, x509)
+ZEND_END_ARG_INFO()
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index 7926b475e7..69af414617 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.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/ext/openssl/tests/bug38255.phpt b/ext/openssl/tests/bug38255.phpt
index f49b77485c..03f9f29a03 100644
--- a/ext/openssl/tests/bug38255.phpt
+++ b/ext/openssl/tests/bug38255.phpt
@@ -20,11 +20,6 @@ $t = new test;
var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5));
-var_dump(openssl_verify());
-var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000));
echo "Done\n";
@@ -37,19 +32,4 @@ bool(false)
Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
bool(false)
-
-Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects parameter 1 to be string, object given in %s on line %d
-NULL
Done
diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt
index e6e345d5ea..b6b3f4c609 100644
--- a/ext/openssl/tests/bug38261.phpt
+++ b/ext/openssl/tests/bug38261.phpt
@@ -17,7 +17,6 @@ $t = new test;
var_dump(openssl_x509_parse("foo"));
var_dump(openssl_x509_parse($t));
var_dump(openssl_x509_parse(array()));
-var_dump(openssl_x509_parse());
var_dump(openssl_x509_parse($cert));
try {
var_dump(openssl_x509_parse(new stdClass));
@@ -30,8 +29,5 @@ try {
bool(false)
bool(false)
bool(false)
-
-Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d
-NULL
bool(false)
Object of class stdClass could not be converted to string
diff --git a/ext/openssl/tests/bug68912.phpt b/ext/openssl/tests/bug68912.phpt
index 724a96017a..0b796b7683 100644
--- a/ext/openssl/tests/bug68912.phpt
+++ b/ext/openssl/tests/bug68912.phpt
@@ -12,9 +12,11 @@ $var1=fopen(__FILE__, 'r');
$var2=2;
$var3=3;
-openssl_spki_new($var1, $var2, $var3);
+try {
+ openssl_spki_new($var1, $var2, $var3);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource in %sbug68912.php on line %d
-
-Warning: openssl_spki_new(): Unable to use supplied private key in %sbug68912.php on line %d
+--EXPECT--
+openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource
diff --git a/ext/openssl/tests/openssl_csr_export_bacis.phpt b/ext/openssl/tests/openssl_csr_export_bacis.phpt
index 228a173764..3a252d8a8f 100644
--- a/ext/openssl/tests/openssl_csr_export_bacis.phpt
+++ b/ext/openssl/tests/openssl_csr_export_bacis.phpt
@@ -27,22 +27,20 @@ $args = array(
$privkey = openssl_pkey_new($config_arg);
$csr = openssl_csr_new($dn, $privkey, $args);
var_dump(openssl_csr_export($csr, $output));
-var_dump(openssl_csr_export($wrong, $output));
-var_dump(openssl_csr_export($privkey, $output));
-var_dump(openssl_csr_export(array(), $output));
+try {
+ var_dump(openssl_csr_export($wrong, $output));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(openssl_csr_export($privkey, $output));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(openssl_csr_export($csr, $output, false));
?>
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: openssl_csr_export() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
-
-Warning: openssl_csr_export(): cannot get CSR from parameter 1 in %s on line %d
-bool(false)
-
-Warning: openssl_csr_export() expects parameter 1 to be resource, array given in %s on line %d
-NULL
+openssl_csr_export() expects parameter 1 to be resource, string given
+openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource
bool(true)
diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
index 7404bd28e3..57092293db 100644
--- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
@@ -36,9 +36,16 @@ $privkey_file = 'file://' . __DIR__ . '/private_rsa_2048.key';
$csr = openssl_csr_new($dn, $privkey_file, $args);
var_dump(openssl_csr_export_to_file($csr, $csrfile));
var_dump(file_get_contents($csrfile));
-var_dump(openssl_csr_export_to_file($wrong, $csrfile));
-var_dump(openssl_csr_export_to_file($dh, $csrfile));
-var_dump(openssl_csr_export_to_file(array(), $csrfile));
+try {
+ var_dump(openssl_csr_export_to_file($wrong, $csrfile));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(openssl_csr_export_to_file($dh, $csrfile));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(openssl_csr_export_to_file($csr, $csrfile, false));
?>
--CLEAN--
@@ -48,7 +55,7 @@ if (file_exists($csrfile)) {
unlink($csrfile);
}
?>
---EXPECTF--
+--EXPECT--
bool(true)
string(1086) "-----BEGIN CERTIFICATE REQUEST-----
MIIC6jCCAdICAQAwgaQxCzAJBgNVBAYTAkJSMRowGAYDVQQIExFSaW8gR3JhbmRl
@@ -69,15 +76,6 @@ sfBgVeqg0P4SWez5fHXqBNcjMdMI5f0bikcDZSIfTHS8FX+PMurLBC8UPB0YNIOl
JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR
-----END CERTIFICATE REQUEST-----
"
-
-Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
-
-Warning: openssl_csr_export_to_file(): cannot get CSR from parameter 1 in %s on line %d
-bool(false)
-
-Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, array given in %s on line %d
-NULL
+openssl_csr_export_to_file() expects parameter 1 to be resource, string given
+openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource
bool(true)
diff --git a/ext/openssl/tests/openssl_csr_new_basic.phpt b/ext/openssl/tests/openssl_csr_new_basic.phpt
index 83a056b061..6774245dad 100644
--- a/ext/openssl/tests/openssl_csr_new_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_new_basic.phpt
@@ -5,9 +5,6 @@ openssl_csr_new() tests
--FILE--
<?php
-$a = 1;
-var_dump(openssl_csr_new(1,$a));
-var_dump(openssl_csr_new(1,$a,1,1));
$a = array();
$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
@@ -26,12 +23,6 @@ var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions"
echo "Done\n";
?>
--EXPECTF--
-Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d
diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt
index 969a8e1073..01306599ad 100644
--- a/ext/openssl/tests/openssl_csr_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt
@@ -35,13 +35,10 @@ var_dump(openssl_csr_sign($csr, $cert, $priv, 365, $config_arg));
var_dump(openssl_csr_sign($csr, openssl_x509_read($cert), $priv, 365, $config_arg));
var_dump(openssl_csr_sign($csr, $wrong, $privkey, 365));
var_dump(openssl_csr_sign($csr, null, $wrong, 365));
-var_dump(openssl_csr_sign($csr, null, $privkey, $wrong));
-var_dump(openssl_csr_sign($csr, null, $privkey, 365, $wrong));
var_dump(openssl_csr_sign($wrong, null, $privkey, 365));
var_dump(openssl_csr_sign(array(), null, $privkey, 365));
var_dump(openssl_csr_sign($csr, array(), $privkey, 365));
var_dump(openssl_csr_sign($csr, null, array(), 365));
-var_dump(openssl_csr_sign($csr, null, $privkey, array()));
var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg));
?>
--EXPECTF--
@@ -56,12 +53,6 @@ bool(false)
Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d
bool(false)
-Warning: openssl_csr_sign() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_sign() expects parameter 5 to be array, string given in %s on line %d
-NULL
-
Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in %s on line %d
bool(false)
@@ -75,7 +66,4 @@ Warning: openssl_csr_sign(): key array must be of the form array(0 => key, 1 =>
Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d
bool(false)
-
-Warning: openssl_csr_sign() expects parameter 4 to be int, array given in %s on line %d
-NULL
resource(%d) of type (OpenSSL X.509)
diff --git a/ext/openssl/tests/openssl_decrypt_error.phpt b/ext/openssl/tests/openssl_decrypt_error.phpt
index be40f8080f..5f79cd86c2 100644
--- a/ext/openssl/tests/openssl_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_decrypt_error.phpt
@@ -19,9 +19,6 @@ var_dump(openssl_decrypt($wrong, $method, $password));
var_dump(openssl_decrypt($wrong, $wrong, $password));
var_dump(openssl_decrypt($encrypted, $wrong, $wrong));
var_dump(openssl_decrypt($wrong, $wrong, $wrong));
-var_dump(openssl_decrypt(array(), $method, $password));
-var_dump(openssl_decrypt($encrypted, array(), $password));
-var_dump(openssl_decrypt($encrypted, $method, array()));
// invalid using of an authentication tag
var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong));
@@ -45,14 +42,5 @@ bool(false)
Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d
bool(false)
-Warning: openssl_decrypt() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_decrypt() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_decrypt() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d
string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM="
diff --git a/ext/openssl/tests/openssl_encrypt_error.phpt b/ext/openssl/tests/openssl_encrypt_error.phpt
index ea39bff604..53bc371f46 100644
--- a/ext/openssl/tests/openssl_encrypt_error.phpt
+++ b/ext/openssl/tests/openssl_encrypt_error.phpt
@@ -14,12 +14,6 @@ $arr = array(1);
// wrong parameters tests
var_dump(openssl_encrypt($data, $wrong, $password));
-var_dump(openssl_encrypt($object, $method, $password));
-var_dump(openssl_encrypt($data, $object, $password));
-var_dump(openssl_encrypt($data, $method, $object));
-var_dump(openssl_encrypt($arr, $method, $object));
-var_dump(openssl_encrypt($data, $arr, $object));
-var_dump(openssl_encrypt($data, $method, $arr));
// invalid using of an authentication tag
var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong));
@@ -31,24 +25,6 @@ var_dump(openssl_encrypt($data, $method, $password, OPENSSL_DONT_ZERO_PAD_KEY, $
Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d
bool(false)
-Warning: openssl_encrypt() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 2 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 3 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d
string(44) "iPR4HulskuaP5Z6me5uImk6BqVyJG73+63tkPauVZYk="
diff --git a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
index 08e56d92a5..c6082bc645 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
@@ -30,7 +30,11 @@ var_dump(count($opts)); // should be 3 certificates, priv, pub, extra optional c
var_dump(openssl_pkcs12_export($invalid, $output, $invalid, $pass));
var_dump(openssl_pkcs12_export($invalid_path, $output, $invalid_path, $pass));
-var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass));
+try {
+ var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//var_dump(openssl_pkcs12_export($cert, $output, $priv, $pass, array("foo")));
?>
--EXPECTF--
@@ -50,7 +54,5 @@ bool(false)
Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export(): supplied resource is not a valid OpenSSL X.509 resource in %s on line %d
-
Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d
-bool(false)
+openssl_pkcs12_export(): supplied resource is not a valid OpenSSL X.509 resource
diff --git a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
index ccc9104d34..f079ec8aac 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
@@ -30,7 +30,11 @@ var_dump(openssl_pkcs12_read(file_get_contents($pkcsfile), $opts, $pass));
var_dump(openssl_pkcs12_export_to_file($invalid, $pkcsfile, $invalid, $pass));
var_dump(openssl_pkcs12_export_to_file($invalid_path, $pkcsfile, $invalid_path, $pass));
-var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass));
+try {
+ var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--CLEAN--
<?php
@@ -55,7 +59,5 @@ bool(false)
Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export_to_file(): supplied resource is not a valid OpenSSL X.509 resource in %s on line %d
-
Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d
-bool(false)
+openssl_pkcs12_export_to_file(): supplied resource is not a valid OpenSSL X.509 resource
diff --git a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
index f823462f9e..ef9b25e70b 100644
--- a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
@@ -26,13 +26,11 @@ var_dump(openssl_pkcs7_encrypt($infile, $outfile, openssl_x509_read($single_cert
var_dump(openssl_pkcs7_decrypt($outfile, $outfile2, $single_cert, $privkey));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $assoc_headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty_headers));
-var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $wrong));
var_dump(openssl_pkcs7_encrypt($wrong, $outfile, $single_cert, $headers));
var_dump(openssl_pkcs7_encrypt($empty, $outfile, $single_cert, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $empty, $single_cert, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $wrong, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $empty, $headers));
-var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $multi_certs, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, array_map('openssl_x509_read', $multi_certs) , $headers));
@@ -45,23 +43,17 @@ if (file_exists($outfile2)) {
unlink($outfile2);
}
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
-
-Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d
-bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d
-bool(false)
bool(true)
bool(true)
true
diff --git a/ext/openssl/tests/openssl_pkcs7_read_basic.phpt b/ext/openssl/tests/openssl_pkcs7_read_basic.phpt
index ac3f1ad34f..bd82e2d937 100644
--- a/ext/openssl/tests/openssl_pkcs7_read_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_read_basic.phpt
@@ -8,19 +8,12 @@ $infile = file_get_contents(__DIR__ . "/cert.p7b");
$certfile = file_get_contents(__DIR__ . "/cert.crt");
$result = [];
-var_dump(openssl_pkcs7_read());
-var_dump(openssl_pkcs7_read(""));
var_dump(openssl_pkcs7_read("", $result));
var_dump(openssl_pkcs7_read($certfile, $result));
var_dump(openssl_pkcs7_read($infile, $result));
var_dump($result);
?>
---EXPECTF--
-Warning: openssl_pkcs7_read() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: openssl_pkcs7_read() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
bool(false)
bool(true)
diff --git a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
index c11e5135f9..08c96f8069 100644
--- a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
@@ -22,13 +22,11 @@ var_dump(openssl_pkcs7_sign($infile, $outfile, openssl_x509_read($single_cert),
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $assoc_headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty_headers));
-var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $wrong));
var_dump(openssl_pkcs7_sign($wrong, $outfile, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($empty, $outfile, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $empty, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $wrong, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $empty, $privkey, $headers));
-var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $wrong, $headers));
if (file_exists($outfile)) {
@@ -42,9 +40,6 @@ bool(true)
bool(true)
bool(true)
-Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d
-NULL
-
Warning: openssl_pkcs7_sign(): error opening input file %s in %s on line %d
bool(false)
@@ -60,9 +55,6 @@ bool(false)
Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
bool(false)
-Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d
-NULL
-
Warning: openssl_pkcs7_sign(): error getting private key in %s on line %d
bool(false)
true
diff --git a/ext/openssl/tests/openssl_pkey_new_error.phpt b/ext/openssl/tests/openssl_pkey_new_error.phpt
index c7dc193d53..9249f252d8 100644
--- a/ext/openssl/tests/openssl_pkey_new_error.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_error.phpt
@@ -11,13 +11,23 @@ $rsa = array("rsa" => array());
$dsa = array("dsa" => array());
$dh = array("dh" => array());
-openssl_pkey_get_details(openssl_pkey_new($rsa));
-openssl_pkey_get_details(openssl_pkey_new($dsa));
-openssl_pkey_get_details(openssl_pkey_new($dh));
+try {
+ openssl_pkey_get_details(openssl_pkey_new($rsa));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ openssl_pkey_get_details(openssl_pkey_new($dsa));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ openssl_pkey_get_details(openssl_pkey_new($dh));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d
+--EXPECT--
+openssl_pkey_get_details() expects parameter 1 to be resource, bool given
+openssl_pkey_get_details() expects parameter 1 to be resource, bool given
+openssl_pkey_get_details() expects parameter 1 to be resource, bool given
diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt
index 111bf6f094..18d3808745 100644
--- a/ext/openssl/tests/openssl_seal_basic.phpt
+++ b/ext/openssl/tests/openssl_seal_basic.phpt
@@ -12,8 +12,6 @@ $d = array(1);
var_dump(openssl_seal($a, $b, $c, $d));
var_dump(openssl_seal($a, $a, $a, array()));
-var_dump(openssl_seal($c, $c, $c, 1));
-var_dump(openssl_seal($b, $b, $b, ""));
// tests with cert
$data = "openssl_open() test";
@@ -23,7 +21,6 @@ $wrong = "wrong";
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key))); // no output
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key))); // no output
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong)));
-var_dump(openssl_seal($data, $sealed, $ekeys, $pub_key));
var_dump(openssl_seal($data, $sealed, $ekeys, array()));
var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong)));
@@ -35,21 +32,12 @@ bool(false)
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
-
-Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
-NULL
int(19)
int(19)
Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
bool(false)
-Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
-NULL
-
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/openssl_sign_basic.phpt b/ext/openssl/tests/openssl_sign_basic.phpt
index bb2c403903..c88d79f323 100644
--- a/ext/openssl/tests/openssl_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_sign_basic.phpt
@@ -10,13 +10,9 @@ $wrong = "wrong";
var_dump(openssl_sign($data, $sign, $privkey)); // no output
var_dump(openssl_sign($data, $sign, $wrong));
-var_dump(openssl_sign(array(), $sign, $privkey));
?>
--EXPECTF--
bool(true)
Warning: openssl_sign(): supplied key param cannot be coerced into a private key in %s on line %d
bool(false)
-
-Warning: openssl_sign() expects parameter 1 to be string, array given in %s on line %d
-NULL
diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
index bc6715f375..b2a87faa83 100644
--- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
@@ -7,9 +7,6 @@ openssl_x509_fingerprint() tests
$cert = "file://" . __DIR__ . "/cert.crt";
-echo "** Testing with no parameters **\n";
-var_dump(openssl_x509_fingerprint());
-
echo "** Testing default functionality **\n";
var_dump(openssl_x509_fingerprint($cert));
@@ -29,10 +26,6 @@ echo "** Testing bad hash method **\n";
var_dump(openssl_x509_fingerprint($cert, 'xx45'));
?>
--EXPECTF--
-** Testing with no parameters **
-
-Warning: openssl_x509_fingerprint() expects at least 1 parameter, 0 given in %s on line %d
-NULL
** Testing default functionality **
string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c"
** Testing hash method md5 **
diff --git a/ext/openssl/tests/openssl_x509_free_basic.phpt b/ext/openssl/tests/openssl_x509_free_basic.phpt
index 378b0e5e0a..6fc28f1e75 100644
--- a/ext/openssl/tests/openssl_x509_free_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_free_basic.phpt
@@ -7,10 +7,7 @@ openssl_x509_free() tests
var_dump($res = openssl_x509_read("file://" . __DIR__ . "/cert.crt"));
openssl_x509_free($res);
var_dump($res);
-openssl_x509_free(false);
?>
--EXPECTF--
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (Unknown)
-
-Warning: openssl_x509_free() expects parameter 1 to be resource, bool given in %s on line %d
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 25472959d7..b898c2b308 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.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/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index cd85080c9b..254c025ef8 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.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, |
@@ -33,6 +31,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_pcntl.h"
+#include "pcntl_arginfo.h"
#include "php_signal.h"
#include "php_ticks.h"
@@ -58,132 +57,13 @@
ZEND_DECLARE_MODULE_GLOBALS(pcntl)
static PHP_GINIT_FUNCTION(pcntl);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_pcntl_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_waitpid, 0, 0, 2)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(1, status)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(1, rusage)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wait, 0, 0, 1)
- ZEND_ARG_INFO(1, status)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(1, rusage)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal, 0, 0, 2)
- ZEND_ARG_INFO(0, signo)
- ZEND_ARG_INFO(0, handler)
- ZEND_ARG_INFO(0, restart_syscalls)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal_get_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, signo)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigprocmask, 0, 0, 2)
- ZEND_ARG_INFO(0, how)
- ZEND_ARG_INFO(0, set)
- ZEND_ARG_INFO(1, oldset)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_STRUCT_SIGINFO_T
-# if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigwaitinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, set)
- ZEND_ARG_INFO(1, info)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigtimedwait, 0, 0, 1)
- ZEND_ARG_INFO(0, set)
- ZEND_ARG_INFO(1, info)
- ZEND_ARG_INFO(0, seconds)
- ZEND_ARG_INFO(0, nanoseconds)
-ZEND_END_ARG_INFO()
-# endif
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexited, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifstopped, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_WCONTINUED
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifcontinued, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifsignaled, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexitstatus, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wtermsig, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wstopsig, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_exec, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, args)
- ZEND_ARG_INFO(0, envs)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_alarm, 0, 0, 1)
- ZEND_ARG_INFO(0, seconds)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETPRIORITY
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_getpriority, 0, 0, 0)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, process_identifier)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_SETPRIORITY
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_setpriority, 0, 0, 1)
- ZEND_ARG_INFO(0, priority)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, process_identifier)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_strerror, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_async_signals, 0, 0, 1)
- ZEND_ARG_INFO(0, on)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_UNSHARE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_unshare, 0, 0, 1)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
static const zend_function_entry pcntl_functions[] = {
- PHP_FE(pcntl_fork, arginfo_pcntl_void)
+ PHP_FE(pcntl_fork, arginfo_pcntl_fork)
PHP_FE(pcntl_waitpid, arginfo_pcntl_waitpid)
PHP_FE(pcntl_wait, arginfo_pcntl_wait)
PHP_FE(pcntl_signal, arginfo_pcntl_signal)
PHP_FE(pcntl_signal_get_handler, arginfo_pcntl_signal_get_handler)
- PHP_FE(pcntl_signal_dispatch, arginfo_pcntl_void)
+ PHP_FE(pcntl_signal_dispatch, arginfo_pcntl_signal_dispatch)
PHP_FE(pcntl_wifexited, arginfo_pcntl_wifexited)
PHP_FE(pcntl_wifstopped, arginfo_pcntl_wifstopped)
PHP_FE(pcntl_wifsignaled, arginfo_pcntl_wifsignaled)
@@ -192,8 +72,8 @@ static const zend_function_entry pcntl_functions[] = {
PHP_FE(pcntl_wstopsig, arginfo_pcntl_wstopsig)
PHP_FE(pcntl_exec, arginfo_pcntl_exec)
PHP_FE(pcntl_alarm, arginfo_pcntl_alarm)
- PHP_FE(pcntl_get_last_error, arginfo_pcntl_void)
- PHP_FALIAS(pcntl_errno, pcntl_get_last_error, NULL)
+ PHP_FE(pcntl_get_last_error, arginfo_pcntl_get_last_error)
+ PHP_FALIAS(pcntl_errno, pcntl_get_last_error, arginfo_pcntl_get_last_error)
PHP_FE(pcntl_strerror, arginfo_pcntl_strerror)
#ifdef HAVE_GETPRIORITY
PHP_FE(pcntl_getpriority, arginfo_pcntl_getpriority)
@@ -642,6 +522,10 @@ PHP_FUNCTION(pcntl_fork)
{
pid_t id;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
id = fork();
if (id == -1) {
PCNTL_G(last_error) = errno;
@@ -658,10 +542,11 @@ PHP_FUNCTION(pcntl_alarm)
{
zend_long seconds;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE) {
return;
+ }
- RETURN_LONG ((zend_long) alarm(seconds));
+ RETURN_LONG((zend_long) alarm(seconds));
}
/* }}} */
@@ -807,17 +692,17 @@ PHP_FUNCTION(pcntl_wait)
Returns true if the child status code represents a successful exit */
PHP_FUNCTION(pcntl_wifexited)
{
-#ifdef WIFEXITED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
- if (WIFEXITED(int_status_word))
+#ifdef WIFEXITED
+ int int_status_word = (int) status_word;
+ if (WIFEXITED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
RETURN_FALSE;
@@ -828,18 +713,19 @@ PHP_FUNCTION(pcntl_wifexited)
Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */
PHP_FUNCTION(pcntl_wifstopped)
{
-#ifdef WIFSTOPPED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
- if (WIFSTOPPED(int_status_word))
+#ifdef WIFSTOPPED
+ int int_status_word = (int) status_word;
+ if (WIFSTOPPED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
+
RETURN_FALSE;
}
/* }}} */
@@ -848,18 +734,19 @@ PHP_FUNCTION(pcntl_wifstopped)
Returns true if the child status code represents a process that was terminated due to a signal */
PHP_FUNCTION(pcntl_wifsignaled)
{
-#ifdef WIFSIGNALED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
- if (WIFSIGNALED(int_status_word))
+#ifdef WIFSIGNALED
+ int int_status_word = (int) status_word;
+ if (WIFSIGNALED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
+
RETURN_FALSE;
}
/* }}} */
@@ -867,17 +754,17 @@ PHP_FUNCTION(pcntl_wifsignaled)
Returns true if the child status code represents a process that was resumed due to a SIGCONT signal */
PHP_FUNCTION(pcntl_wifcontinued)
{
-#ifdef HAVE_WCONTINUED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
- if (WIFCONTINUED(int_status_word))
+#ifdef HAVE_WCONTINUED
+ int int_status_word = (int) status_word;
+ if (WIFCONTINUED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
RETURN_FALSE;
}
@@ -888,15 +775,14 @@ PHP_FUNCTION(pcntl_wifcontinued)
Returns the status code of a child's exit */
PHP_FUNCTION(pcntl_wexitstatus)
{
-#ifdef WEXITSTATUS
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
+#ifdef WEXITSTATUS
+ int int_status_word = (int) status_word;
RETURN_LONG(WEXITSTATUS(int_status_word));
#else
RETURN_FALSE;
@@ -908,15 +794,14 @@ PHP_FUNCTION(pcntl_wexitstatus)
Returns the number of the signal that terminated the process who's status code is passed */
PHP_FUNCTION(pcntl_wtermsig)
{
-#ifdef WTERMSIG
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
+#ifdef WTERMSIG
+ int int_status_word = (int) status_word;
RETURN_LONG(WTERMSIG(int_status_word));
#else
RETURN_FALSE;
@@ -928,15 +813,14 @@ PHP_FUNCTION(pcntl_wtermsig)
Returns the number of the signal that caused the process to stop who's status code is passed */
PHP_FUNCTION(pcntl_wstopsig)
{
-#ifdef WSTOPSIG
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ return;
}
- int_status_word = (int) status_word;
+#ifdef WSTOPSIG
+ int int_status_word = (int) status_word;
RETURN_LONG(WSTOPSIG(int_status_word));
#else
RETURN_FALSE;
@@ -1151,6 +1035,10 @@ PHP_FUNCTION(pcntl_signal_get_handler)
Dispatch signals to signal handlers */
PHP_FUNCTION(pcntl_signal_dispatch)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
pcntl_signal_dispatch();
RETURN_TRUE;
}
@@ -1352,7 +1240,7 @@ PHP_FUNCTION(pcntl_getpriority)
int pri;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &pid, &who) == FAILURE) {
- RETURN_FALSE;
+ return;
}
/* needs to be cleared, since any returned value is valid */
@@ -1425,7 +1313,11 @@ PHP_FUNCTION(pcntl_setpriority)
Retrieve the error number set by the last pcntl function which failed. */
PHP_FUNCTION(pcntl_get_last_error)
{
- RETURN_LONG(PCNTL_G(last_error));
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ RETURN_LONG(PCNTL_G(last_error));
}
/* }}} */
@@ -1433,13 +1325,13 @@ PHP_FUNCTION(pcntl_get_last_error)
Retrieve the system error message associated with the given errno. */
PHP_FUNCTION(pcntl_strerror)
{
- zend_long error;
+ zend_long error;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) {
- RETURN_FALSE;
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) {
+ return;
+ }
- RETURN_STRING(strerror(error));
+ RETURN_STRING(strerror(error));
}
/* }}} */
@@ -1545,7 +1437,7 @@ void pcntl_signal_dispatch()
sigprocmask(SIG_SETMASK, &old_mask, NULL);
}
-/* {{{ proto bool pcntl_async_signals([bool on[)
+/* {{{ proto bool pcntl_async_signals([bool on])
Enable/disable asynchronous signal handling and return the old setting. */
PHP_FUNCTION(pcntl_async_signals)
{
diff --git a/ext/pcntl/pcntl.stub.php b/ext/pcntl/pcntl.stub.php
new file mode 100644
index 0000000000..1bb1f69709
--- /dev/null
+++ b/ext/pcntl/pcntl.stub.php
@@ -0,0 +1,74 @@
+<?php
+
+function pcntl_fork(): int {}
+
+function pcntl_waitpid(int $pid, &$status, int $options = 0, &$rusage = []): int {}
+
+function pcntl_wait(&$status, int $options = 0, &$rusage = []): int {}
+
+/**
+ * @param callable|int $handler
+ */
+function pcntl_signal(int $signo, $handler, bool $restart_syscalls = true): bool {}
+
+/** @return mixed */
+function pcntl_signal_get_handler(int $signo) {}
+
+function pcntl_signal_dispatch(): bool {}
+
+#ifdef HAVE_SIGPROCMASK
+function pcntl_sigprocmask(int $how, array $set, &$oldset = null): bool {}
+#endif
+
+#ifdef HAVE_STRUCT_SIGINFO_T
+#if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
+/** @return int|false */
+function pcntl_sigwaitinfo(array $set, &$info = []) {}
+
+/** @return int|false */
+function pcntl_sigtimedwait(array $set, &$info = [], int $seconds = 0, int $nanoseconds = 0) {}
+#endif
+#endif
+
+function pcntl_wifexited(int $status): bool {}
+
+function pcntl_wifstopped(int $status): bool {}
+
+#ifdef HAVE_WCONTINUED
+function pcntl_wifcontinued(int $status): bool {}
+#endif
+
+function pcntl_wifsignaled(int $status): bool {}
+
+/** @return int|false */
+function pcntl_wifexitstatus(int $status) {}
+
+/** @return int|false */
+function pcntl_wtermsig(int $status) {}
+
+/** @return int|false */
+function pcntl_wstopsig(int $status) {}
+
+/** @return false */
+function pcntl_exec(string $path, array $args = [], array $envs = []): bool {}
+
+function pcntl_alarm(int $seconds): int {}
+
+function pcntl_get_last_error(): int {}
+
+#ifdef HAVE_GETPRIORITY
+/** @return int|false */
+function pcntl_getpriority(int $pid = UNKNOWN, int $process_identifier = PRIO_PROCESS) {}
+#endif
+
+#ifdef HAVE_SETPRIORITY
+function pcntl_setpriority(int $priority, int $pid = UNKNOWN, int $process_identifier = PRIO_PROCESS): bool{}
+#endif
+
+function pcntl_strerror(int $errno): string {}
+
+function pcntl_async_signals(bool $on = UNKNOWN): bool {}
+
+#ifdef HAVE_UNSHARE
+function pcntl_unshare(int $flags): bool {}
+#endif
diff --git a/ext/pcntl/pcntl_arginfo.h b/ext/pcntl/pcntl_arginfo.h
new file mode 100644
index 0000000000..21a1c6aabd
--- /dev/null
+++ b/ext/pcntl/pcntl_arginfo.h
@@ -0,0 +1,117 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_waitpid, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_INFO(1, status)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(1, rusage)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wait, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(1, status)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(1, rusage)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_signal, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, signo, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handler)
+ ZEND_ARG_TYPE_INFO(0, restart_syscalls, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal_get_handler, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, signo, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_signal_dispatch, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SIGPROCMASK)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_sigprocmask, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, oldset)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_STRUCT_SIGINFO_T) && HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigwaitinfo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, info)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_STRUCT_SIGINFO_T) && HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigtimedwait, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, info)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, nanoseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wifexited, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pcntl_wifstopped arginfo_pcntl_wifexited
+
+#if defined(HAVE_WCONTINUED)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wifcontinued, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_pcntl_wifsignaled arginfo_pcntl_wifexited
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexitstatus, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pcntl_wtermsig arginfo_pcntl_wifexitstatus
+
+#define arginfo_pcntl_wstopsig arginfo_pcntl_wifexitstatus
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_exec, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, envs, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_alarm, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pcntl_get_last_error arginfo_pcntl_fork
+
+#if defined(HAVE_GETPRIORITY)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_getpriority, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, process_identifier, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SETPRIORITY)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_setpriority, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, process_identifier, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_strerror, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_async_signals, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, on, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_UNSHARE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_unshare, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index 90ce2aea96..bbb07bc896 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.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/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 93a42f45d1..ba65996c1d 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.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/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
index b392b25d6e..21dbf0d254 100644
--- a/ext/pcntl/php_signal.h
+++ b/ext/pcntl/php_signal.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/ext/pcntl/tests/pcntl_alarm.phpt b/ext/pcntl/tests/pcntl_alarm.phpt
index a9cae1616b..337ba3ad4b 100644
--- a/ext/pcntl/tests/pcntl_alarm.phpt
+++ b/ext/pcntl/tests/pcntl_alarm.phpt
@@ -8,7 +8,6 @@ max_execution_time=0
<?php
pcntl_signal(SIGALRM, function(){});
-var_dump(pcntl_alarm());
pcntl_alarm(0);
var_dump(pcntl_alarm(60));
var_dump(pcntl_alarm(1) > 0);
@@ -16,8 +15,6 @@ $siginfo = array();
var_dump(pcntl_sigtimedwait(array(SIGALRM),$siginfo,2) === SIGALRM);
?>
--EXPECTF--
-Warning: pcntl_alarm() expects exactly 1 parameter, 0 given in %s
-NULL
int(0)
bool(true)
bool(true)
diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt
index 5349381d92..7d7f6b5271 100644
--- a/ext/pcntl/tests/pcntl_exec_3.phpt
+++ b/ext/pcntl/tests/pcntl_exec_3.phpt
@@ -4,14 +4,10 @@ pcntl_exec() 3
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
--FILE--
<?php
-var_dump(pcntl_exec());
$file = tempnam(sys_get_temp_dir(),"php");
var_dump(pcntl_exec($file, array("foo","bar"), array("foo" => "bar")));
unlink($file);
?>
--EXPECTF--
-Warning: pcntl_exec() expects at least 1 parameter, 0 given %s
-NULL
-
Warning: pcntl_exec(): Error has occurred: (errno %d) %s
bool(false)
diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt
index a6441935c1..5bba18c2a0 100644
--- a/ext/pcntl/tests/pcntl_signal.phpt
+++ b/ext/pcntl/tests/pcntl_signal.phpt
@@ -17,7 +17,6 @@ pcntl_signal(SIGUSR1, function($signo, $siginfo){
posix_kill(posix_getpid(), SIGUSR1);
pcntl_signal_dispatch();
-var_dump(pcntl_signal());
var_dump(pcntl_signal(SIGALRM, SIG_IGN));
var_dump(pcntl_signal(-1, -1));
var_dump(pcntl_signal(-1, function(){}));
@@ -31,9 +30,6 @@ echo "ok\n";
--EXPECTF--
signal dispatched
got signal from %r\d+|nobody%r
-
-Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-NULL
bool(true)
Warning: pcntl_signal(): Invalid signal %s
diff --git a/ext/pcntl/tests/pcntl_wait.phpt b/ext/pcntl/tests/pcntl_wait.phpt
index d5ab709b76..c745a21dc7 100644
--- a/ext/pcntl/tests/pcntl_wait.phpt
+++ b/ext/pcntl/tests/pcntl_wait.phpt
@@ -20,15 +20,6 @@ if ($pid == -1) {
var_dump(pcntl_wexitstatus($status));
var_dump(pcntl_wait($status, WNOHANG | WUNTRACED));
- var_dump(pcntl_wait());
- var_dump(pcntl_waitpid());
-
- var_dump(pcntl_wifexited());
- var_dump(pcntl_wifstopped());
- var_dump(pcntl_wifsignaled());
- var_dump(pcntl_wexitstatus());
- var_dump(pcntl_wtermsig());
- var_dump(pcntl_wstopsig());
} else {
posix_kill(posix_getpid(), SIGSTOP);
exit(42);
@@ -40,27 +31,3 @@ bool(false)
bool(false)
int(42)
int(-1)
-
-Warning: pcntl_wait() expects at least 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_waitpid() expects at least 2 parameters, 0 given in %s
-NULL
-
-Warning: pcntl_wifexited() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wifstopped() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wifsignaled() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wexitstatus() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wtermsig() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wstopsig() expects exactly 1 parameter, 0 given in %s
-NULL
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
index 86298bbe1b..cbc8cf4517 100644
--- a/ext/pcre/config.w32
+++ b/ext/pcre/config.w32
@@ -6,7 +6,6 @@ ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');
-AC_DEFINE('HAVE_PCRE', 1, 'Have PCRE library');
AC_DEFINE('PCRE2_CODE_UNIT_WIDTH', 8, 'Have PCRE library');
AC_DEFINE("PCRE2_STATIC", 1, "");
PHP_PCRE="yes";
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 714a8d57e8..36f896ad2a 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -19,7 +19,6 @@ if test "$PHP_EXTERNAL_PCRE" != "no"; then
PHP_EVAL_INCLINE($PCRE2_CFLAGS)
PHP_EVAL_LIBLINE($PCRE2_LIBS)
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
- AC_DEFINE(HAVE_PCRE, 1, [ ])
if test "$PHP_PCRE_JIT" != "no"; then
AC_CACHE_CHECK([for JIT support in PCRE2], ac_cv_have_pcre2_jit, [
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index d19c7960a6..1e5f6105ea 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.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, |
@@ -20,6 +18,7 @@
#include "php_ini.h"
#include "php_globals.h"
#include "php_pcre.h"
+#include "php_pcre_arginfo.h"
#include "ext/standard/info.h"
#include "ext/standard/basic_functions.h"
#include "zend_smart_str.h"
@@ -50,7 +49,6 @@ struct _pcre_cache_entry {
uint32_t capture_count;
uint32_t name_count;
uint32_t compile_options;
- uint32_t extra_compile_options;
uint32_t refcount;
};
@@ -167,7 +165,6 @@ static void php_pcre_free(void *block, void *data)
pefree(block, 1);
}/*}}}*/
-#define PHP_PCRE_DEFAULT_EXTRA_COPTIONS PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL
#define PHP_PCRE_PREALLOC_MDATA_SIZE 32
static void php_pcre_init_pcre2(uint8_t jit)
@@ -188,12 +185,6 @@ static void php_pcre_init_pcre2(uint8_t jit)
}
}
- /* XXX The 'X' modifier is the default behavior in PCRE2. This option is
- called dangerous in the manual, as typos in patterns can cause
- unexpected results. We might want to to switch to the default PCRE2
- behavior, too, thus causing a certain BC break. */
- pcre2_set_compile_extra_options(cctx, PHP_PCRE_DEFAULT_EXTRA_COPTIONS);
-
if (!mctx) {
mctx = pcre2_match_context_create(gctx);
if (!mctx) {
@@ -569,7 +560,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
{
pcre2_code *re = NULL;
uint32_t coptions = 0;
- uint32_t extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS;
PCRE2_UCHAR error[128];
PCRE2_SIZE erroffset;
int errnumber;
@@ -703,8 +693,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
case 'A': coptions |= PCRE2_ANCHORED; break;
case 'D': coptions |= PCRE2_DOLLAR_ENDONLY;break;
case 'S': /* Pass. */ break;
+ case 'X': /* Pass. */ break;
case 'U': coptions |= PCRE2_UNGREEDY; break;
- case 'X': extra_coptions &= ~PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL; break;
case 'u': coptions |= PCRE2_UTF;
/* In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII
characters, even in UTF-8 mode. However, this can be changed by setting
@@ -768,19 +758,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
pcre2_set_character_tables(cctx, tables);
}
- /* Set extra options for the compile context. */
- if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions) {
- pcre2_set_compile_extra_options(cctx, extra_coptions);
- }
-
/* Compile pattern and display a warning if compilation failed. */
re = pcre2_compile((PCRE2_SPTR)pattern, pattern_len, coptions, &errnumber, &erroffset, cctx);
- /* Reset the compile context extra options to default. */
- if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions) {
- pcre2_set_compile_extra_options(cctx, PHP_PCRE_DEFAULT_EXTRA_COPTIONS);
- }
-
if (re == NULL) {
if (key != regex) {
zend_string_release_ex(key, 0);
@@ -830,7 +810,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
new_entry.re = re;
new_entry.preg_options = poptions;
new_entry.compile_options = coptions;
- new_entry.extra_compile_options = extra_coptions;
new_entry.refcount = 0;
rc = pcre2_pattern_info(re, PCRE2_INFO_CAPTURECOUNT, &new_entry.capture_count);
@@ -1114,7 +1093,7 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
Z_PARAM_ZVAL(subpats)
Z_PARAM_LONG(flags)
Z_PARAM_LONG(start_offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) {
@@ -2273,8 +2252,8 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, int is_filter)
}
} else {
if (Z_TYPE_P(regex) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array");
- RETURN_FALSE;
+ zend_type_error("Parameter mismatch, pattern is a string while replacement is an array");
+ return;
}
}
@@ -2475,7 +2454,7 @@ static PHP_FUNCTION(preg_split)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(limit_val)
Z_PARAM_LONG(flags)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) {
@@ -2945,70 +2924,6 @@ static PHP_FUNCTION(preg_last_error)
/* {{{ module definition structures */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, subpatterns) /* array */
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match_all, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, subpatterns) /* array */
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, regex)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(1, count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback, 0, 0, 3)
- ZEND_ARG_INFO(0, regex)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(1, count)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback_array, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(1, count)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_split, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_quote, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, delim_char)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_grep, 0, 0, 2)
- ZEND_ARG_INFO(0, regex)
- ZEND_ARG_INFO(0, input) /* array */
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_preg_last_error, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry pcre_functions[] = {
PHP_FE(preg_match, arginfo_preg_match)
PHP_FE(preg_match_all, arginfo_preg_match_all)
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index b375981df3..3c2fff4251 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.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/ext/pcre/php_pcre.stub.php b/ext/pcre/php_pcre.stub.php
new file mode 100644
index 0000000000..8a97cb4516
--- /dev/null
+++ b/ext/pcre/php_pcre.stub.php
@@ -0,0 +1,52 @@
+<?php
+
+/** @return int|false */
+function preg_match(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0) {}
+
+/** @return int|false */
+function preg_match_all(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0) {}
+
+/**
+ * @param string|array $regex
+ * @param string|array $replace
+ * @param string|array $subject
+ * @return string|array|null
+ */
+function preg_replace($regex, $replace, $subject, int $limit = -1, &$count = null) {}
+
+/**
+ * @param string|array $regex
+ * @param string|array $replace
+ * @param string|array $subject
+ * @return string|array|null
+ */
+function preg_filter($regex, $replace, $subject, int $limit = -1, &$count = null) {}
+
+/**
+ * @param string|array $regex
+ * @param string|array $subject
+ * @return string|array|null
+ *
+ * TODO: $callback should be `callable`
+ */
+function preg_replace_callback($regex, $callback, $subject, int $limit = -1, &$count = null, int $flags = 0) {}
+
+/**
+ * @param string|array $subject
+ * @return string|array|null
+ */
+function preg_replace_callback_array(array $pattern, $subject, int $limit = -1, &$count = null, int $flags = 0) {}
+
+/**
+ * @return array|false
+ */
+function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0) {}
+
+
+function preg_quote(string $str, ?string $delim_char = null): string {}
+
+/** @return array|false */
+function preg_grep(string $regex, array $input, int $flags = 0) {}
+
+
+function preg_last_error(): int {}
diff --git a/ext/pcre/php_pcre_arginfo.h b/ext/pcre/php_pcre_arginfo.h
new file mode 100644
index 0000000000..aff71e652a
--- /dev/null
+++ b/ext/pcre/php_pcre_arginfo.h
@@ -0,0 +1,59 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_INFO(1, subpatterns)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_preg_match_all arginfo_preg_match
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace, 0, 0, 3)
+ ZEND_ARG_INFO(0, regex)
+ ZEND_ARG_INFO(0, replace)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_INFO(1, count)
+ZEND_END_ARG_INFO()
+
+#define arginfo_preg_filter arginfo_preg_replace
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback, 0, 0, 3)
+ ZEND_ARG_INFO(0, regex)
+ ZEND_ARG_INFO(0, callback)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_INFO(1, count)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback_array, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_INFO(1, count)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_split, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_preg_quote, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, delim_char, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_grep, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_preg_last_error, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt
index d4780447bc..073a7a8d56 100644
--- a/ext/pcre/tests/002.phpt
+++ b/ext/pcre/tests/002.phpt
@@ -3,11 +3,8 @@ preg_* with bogus vals
--FILE--
<?php
-var_dump(preg_match());
-var_dump(preg_match_all());
var_dump(preg_match_all('//', '', $dummy, 0xdead));
-var_dump(preg_quote());
var_dump(preg_quote(''));
var_dump(preg_replace('/(.)/', '${1}${1', 'abc'));
@@ -16,22 +13,13 @@ var_dump(preg_replace('/(.)/e', 'for ($', 'abc'));
?>
--EXPECTF--
-Warning: preg_match() expects at least 2 parameters, 0 given in %s002.php on line 3
-bool(false)
-
-Warning: preg_match_all() expects at least 2 parameters, 0 given in %s002.php on line 4
-bool(false)
-
-Warning: preg_match_all(): Invalid flags specified in %s002.php on line 5
-NULL
-
-Warning: preg_quote() expects at least 1 parameter, 0 given in %s002.php on line 7
+Warning: preg_match_all(): Invalid flags specified in %s002.php on line %d
NULL
string(0) ""
string(12) "a${1b${1c${1"
-Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line 11
+Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line %d
NULL
-Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line 12
+Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line %d
NULL
diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt
index 3dfc41e19f..629e015a06 100644
--- a/ext/pcre/tests/bug21732.phpt
+++ b/ext/pcre/tests/bug21732.phpt
@@ -1,7 +1,5 @@
--TEST--
Bug #21732 (preg_replace() segfaults with invalid parameters)
---INI--
-error_reporting=0
--FILE--
<?php
class foo {
@@ -11,11 +9,15 @@ class foo {
}
}
-var_dump(preg_replace('', array(), ''));
+try {
+ var_dump(preg_replace('', array(), ''));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
?>
--EXPECT--
-bool(false)
+Parameter mismatch, pattern is a string while replacement is an array
array(4) {
[0]=>
string(5) "abcde"
diff --git a/ext/pcre/tests/bug44925.phpt b/ext/pcre/tests/bug44925.phpt
index f6e0db4253..c495331b4b 100644
--- a/ext/pcre/tests/bug44925.phpt
+++ b/ext/pcre/tests/bug44925.phpt
@@ -45,11 +45,11 @@ array(9) {
&string(1) "b"
}
-Notice: Array to string conversion in %sbug44925.php on line 9
+Warning: Array to string conversion in %s on line %d
array(0) {
}
-Notice: Array to string conversion in %sbug44925.php on line 11
+Warning: Array to string conversion in %s on line %d
array(7) {
[0]=>
string(1) "1"
diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt
index 4c6f9b155f..9721dfbd9e 100644
--- a/ext/pcre/tests/grep2.phpt
+++ b/ext/pcre/tests/grep2.phpt
@@ -7,8 +7,6 @@ pcre.jit=1
--FILE--
<?php
-var_dump(preg_grep(1,array(),3,4));
-var_dump(preg_grep(1, 2));
var_dump(preg_grep('/+/', array()));
$array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20');
@@ -23,13 +21,7 @@ var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
?>
--EXPECTF--
-Warning: preg_grep() expects at most 3 parameters, 4 given in %sgrep2.php on line 3
-NULL
-
-Warning: preg_grep() expects parameter 2 to be array, int given in %sgrep2.php on line 4
-NULL
-
-Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line 5
+Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line %d
bool(false)
array(3) {
[5]=>
diff --git a/ext/pcre/tests/pcre_extra.phpt b/ext/pcre/tests/pcre_extra.phpt
index 4c5930f975..730c729939 100644
--- a/ext/pcre/tests/pcre_extra.phpt
+++ b/ext/pcre/tests/pcre_extra.phpt
@@ -1,5 +1,5 @@
--TEST--
-X (PCRE_EXTRA) modifier
+X (PCRE_EXTRA) modifier is ignored (no error, no change)
--FILE--
<?php
@@ -8,7 +8,8 @@ var_dump(preg_match('/\y/X', '\y'));
?>
--EXPECTF--
-int(1)
+Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 3
+bool(false)
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 4
bool(false)
diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt
index fcc36e7d91..1bf23bb640 100644
--- a/ext/pcre/tests/preg_grep_error1.phpt
+++ b/ext/pcre/tests/preg_grep_error1.phpt
@@ -6,7 +6,6 @@ Test preg_grep() function : error conditions - bad regular expressions
* proto array preg_grep(string regex, array input [, int flags])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_grep reacts to being passed bad regexes
*/
@@ -19,11 +18,19 @@ $values = array('abcdef', //Regex without delimiter
);
$array = array(123, 'abc', 'test');
foreach($values as $value) {
- print "\nArg value is $value\n";
- var_dump(preg_grep($value, $array));
+ @print "\nArg value is $value\n";
+ try {
+ var_dump(preg_grep($value, $array));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$value = new stdclass(); //Object
-var_dump(preg_grep($value, $array));
+try {
+ var_dump(preg_grep($value, $array));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
--EXPECTF--
@@ -50,9 +57,7 @@ Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d
bool(false)
Arg value is Array
-
-Warning: preg_grep() expects parameter 1 to be string, array given in %spreg_grep_error1.php on line %d
-NULL
+preg_grep() expects parameter 1 to be string, array given
Arg value is /[a-zA-Z]/
array(2) {
@@ -61,7 +66,5 @@ array(2) {
[2]=>
string(4) "test"
}
-
-Warning: preg_grep() expects parameter 1 to be string, object given in %spreg_grep_error1.php on line %d
-NULL
+preg_grep() expects parameter 1 to be string, object given
Done
diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt
index 95ab905d7d..6a5a0055a9 100644
--- a/ext/pcre/tests/preg_match_all_error1.phpt
+++ b/ext/pcre/tests/preg_match_all_error1.phpt
@@ -6,7 +6,6 @@ Test preg_match_all() function : error conditions - bad regular expressions
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match_all reacts to being passed the wrong type of regex argument
*/
@@ -19,12 +18,20 @@ $regex_array = array('abcdef', //Regex without delimiter
);
$subject = 'test';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
- var_dump(preg_match_all($regex_value, $subject, $matches1));
+ @print "\nArg value is $regex_value\n";
+ try {
+ var_dump(preg_match_all($regex_value, $subject, $matches1));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump($matches1);
}
$regex_value = new stdclass(); //Object
-var_dump(preg_match_all($regex_value, $subject, $matches));
+try {
+ var_dump(preg_match_all($regex_value, $subject, $matches));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($matches);
?>
--EXPECTF--
@@ -55,9 +62,7 @@ bool(false)
NULL
Arg value is Array
-
-Warning: preg_match_all() expects parameter 1 to be string, array given in %spreg_match_all_error1.php on line %d
-bool(false)
+preg_match_all() expects parameter 1 to be string, array given
NULL
Arg value is /[a-zA-Z]/
@@ -75,7 +80,5 @@ array(1) {
string(1) "t"
}
}
-
-Warning: preg_match_all() expects parameter 1 to be string, object given in %spreg_match_all_error1.php on line %d
-bool(false)
+preg_match_all() expects parameter 1 to be string, object given
NULL
diff --git a/ext/pcre/tests/preg_match_all_error2.phpt b/ext/pcre/tests/preg_match_all_error2.phpt
index 1c55cce64e..29762739c4 100644
--- a/ext/pcre/tests/preg_match_all_error2.phpt
+++ b/ext/pcre/tests/preg_match_all_error2.phpt
@@ -6,19 +6,19 @@ Test preg_match_all() function : error conditions - wrong arg types
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match_all reacts to being passed the wrong type of input argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
-$value = new stdclass(); //Object
-var_dump(preg_match_all($regex, $value, $matches));
-var_dump($matches);
$input = array(array('this is', 'a subarray'), 'test',);
foreach($input as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_match_all($regex, $value, $matches));
+ @print "\nArg value is: $value\n";
+ try {
+ var_dump(preg_match_all($regex, $value, $matches));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump($matches);
}
echo "Done";
@@ -26,14 +26,8 @@ echo "Done";
--EXPECTF--
*** Testing preg_match_all() : error conditions ***
-Warning: preg_match_all() expects parameter 2 to be string, object given in %spreg_match_all_error2.php on line %d
-bool(false)
-NULL
-
Arg value is: Array
-
-Warning: preg_match_all() expects parameter 2 to be string, array given in %spreg_match_all_error2.php on line %d
-bool(false)
+preg_match_all() expects parameter 2 to be string, array given
NULL
Arg value is: test
diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt
index 42bb5abd27..2f1b39d67f 100644
--- a/ext/pcre/tests/preg_match_error1.phpt
+++ b/ext/pcre/tests/preg_match_error1.phpt
@@ -6,7 +6,6 @@ Test preg_match() function : error conditions - bad regular expressions
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match reacts to being passed the wrong type of regex argument
*/
@@ -19,11 +18,19 @@ $regex_array = array('abcdef', //Regex without delimiter
);
$subject = 'this is a test';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
- var_dump(preg_match($regex_value, $subject));
+ @print "\nArg value is $regex_value\n";
+ try {
+ var_dump(preg_match($regex_value, $subject));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$regex_value = new stdclass(); //Object
-var_dump(preg_match($regex_value, $subject));
+try {
+ var_dump(preg_match($regex_value, $subject));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
*** Testing preg_match() : error conditions ***
@@ -49,12 +56,8 @@ Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line %
bool(false)
Arg value is Array
-
-Warning: preg_match() expects parameter 1 to be string, array given in %spreg_match_error1.php on line %d
-bool(false)
+preg_match() expects parameter 1 to be string, array given
Arg value is /[a-zA-Z]/
int(1)
-
-Warning: preg_match() expects parameter 1 to be string, object given in %spreg_match_error1.php on line %d
-bool(false)
+preg_match() expects parameter 1 to be string, object given
diff --git a/ext/pcre/tests/preg_match_error2.phpt b/ext/pcre/tests/preg_match_error2.phpt
index cb0917a228..18a42c6445 100644
--- a/ext/pcre/tests/preg_match_error2.phpt
+++ b/ext/pcre/tests/preg_match_error2.phpt
@@ -6,7 +6,6 @@ Test preg_match() function : error conditions - wrong arg types
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match reacts to being passed the wrong type of subject argument
*/
@@ -14,11 +13,19 @@ echo "*** Testing preg_match() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$input = array('this is a string', array('this is', 'a subarray'),);
foreach($input as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_match($regex, $value));
+ @print "\nArg value is: $value\n";
+ try {
+ var_dump(preg_match($regex, $value));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$value = new stdclass(); //Object
-var_dump(preg_match($regex, $value));
+try {
+ var_dump(preg_match($regex, $value));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
--EXPECTF--
@@ -28,10 +35,6 @@ Arg value is: this is a string
int(1)
Arg value is: Array
-
-Warning: preg_match() expects parameter 2 to be string, array given in %spreg_match_error2.php on line %d
-bool(false)
-
-Warning: preg_match() expects parameter 2 to be string, object given in %spreg_match_error2.php on line %d
-bool(false)
+preg_match() expects parameter 2 to be string, array given
+preg_match() expects parameter 2 to be string, object given
Done
diff --git a/ext/pcre/tests/preg_replace2.phpt b/ext/pcre/tests/preg_replace2.phpt
index 4a191f3331..13696827fb 100644
--- a/ext/pcre/tests/preg_replace2.phpt
+++ b/ext/pcre/tests/preg_replace2.phpt
@@ -9,8 +9,6 @@ if (@preg_match('/./u', '') === false) {
--FILE--
<?php
-var_dump(preg_replace('', array(), ''));
-
var_dump(preg_replace(array('/\da(.)/ui', '@..@'), '$1', '12Abc'));
var_dump(preg_replace(array('/\da(.)/ui', '@(.)@'), '$1', array('x','a2aA', '1av2Ab')));
@@ -21,9 +19,7 @@ var_dump(preg_replace(array('/\s+/', '~[b-d]~'), array('$'), array('x y', 'bd bc
echo "==done==\n";
?>
---EXPECTF--
-Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace2.php on line 3
-bool(false)
+--EXPECT--
string(1) "c"
array(3) {
[0]=>
diff --git a/ext/pcre/tests/preg_replace_callback2.phpt b/ext/pcre/tests/preg_replace_callback2.phpt
index 1fe78d59ee..6dab1a0cf2 100644
--- a/ext/pcre/tests/preg_replace_callback2.phpt
+++ b/ext/pcre/tests/preg_replace_callback2.phpt
@@ -31,7 +31,7 @@ array(3) {
string(9) "'aa' 'bb'"
}
-Notice: Array to string conversion in %spreg_replace_callback2.php on line 17
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
string(7) "'A'rray"
diff --git a/ext/pcre/tests/preg_replace_callback3.phpt b/ext/pcre/tests/preg_replace_callback3.phpt
index f5c87176f9..842dfacb39 100644
--- a/ext/pcre/tests/preg_replace_callback3.phpt
+++ b/ext/pcre/tests/preg_replace_callback3.phpt
@@ -3,30 +3,14 @@ preg_replace_callback() 3
--FILE--
<?php
-var_dump(preg_replace_callback());
-var_dump(preg_replace_callback(1));
-var_dump(preg_replace_callback(1,2));
var_dump(preg_replace_callback(1,2,3));
var_dump(preg_replace_callback(1,2,3,4));
$a = 5;
var_dump(preg_replace_callback(1,2,3,4,$a));
-$a = "";
-var_dump(preg_replace_callback("","","","",$a));
-$a = array();
-var_dump(preg_replace_callback($a,$a,$a,$a,$a));
echo "Done\n";
?>
--EXPECTF--
-Warning: preg_replace_callback() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d
string(1) "3"
@@ -35,10 +19,4 @@ string(1) "3"
Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d
string(1) "3"
-
-Warning: preg_replace_callback() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d
-NULL
Done
diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt
index f2f20ef645..03d7a60eee 100644
--- a/ext/pcre/tests/preg_replace_callback_array2.phpt
+++ b/ext/pcre/tests/preg_replace_callback_array2.phpt
@@ -3,19 +3,8 @@ preg_replace_callback_array() errors
--FILE--
<?php
-var_dump(preg_replace_callback_array());
-var_dump(preg_replace_callback_array(1));
-var_dump(preg_replace_callback_array(1,2));
-var_dump(preg_replace_callback_array(1,2,3));
-$a = 5;
-var_dump(preg_replace_callback_array(1,2,3,$a));
-$a = "";
-var_dump(preg_replace_callback_array(array("" => ""),"","",$a));
$a = array();
$b = "";
-var_dump(preg_replace_callback($a, $a, $a, $a, $b));
-var_dump($b);
-$b = "";
var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b));
var_dump($b);
function f() {
@@ -34,28 +23,6 @@ try {
echo "Done\n";
?>
--EXPECTF--
-Warning: preg_replace_callback_array() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d
-NULL
-string(0) ""
-
Warning: preg_replace_callback_array(): 's' is not a valid callback in %spreg_replace_callback_array2.php on line %d
array(0) {
}
diff --git a/ext/pcre/tests/preg_replace_callback_error1.phpt b/ext/pcre/tests/preg_replace_callback_error1.phpt
index 313064eab8..cf069692e8 100644
--- a/ext/pcre/tests/preg_replace_callback_error1.phpt
+++ b/ext/pcre/tests/preg_replace_callback_error1.phpt
@@ -6,7 +6,6 @@ Test preg_replace_callback() function : error
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace_callback reacts to being passed the wrong type of regex argument
*/
@@ -15,7 +14,7 @@ $regex_array = array('abcdef', //Regex without delimiters
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
-'[A-Z]', '[0-9]'), '/[a-zA-Z]/'); //Regex string
+'[A-Z]', '[0-9]'), '/[0-9]/'); //Regex string
$replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
function integer_word($matches) {
global $replacement;
@@ -23,7 +22,7 @@ function integer_word($matches) {
}
$subject = 'number 1.';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
+ @print "\nArg value is $regex_value\n";
var_dump(preg_replace_callback($regex_value, 'integer_word', $subject));
}
?>
@@ -54,6 +53,6 @@ NULL
Arg value is Array
string(9) "number 1."
-Arg value is /[a-zA-Z]/
-string(3) " 1."
+Arg value is /[0-9]/
+string(11) "number one."
===Done===
diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt
index 780556956a..669a5c6c4e 100644
--- a/ext/pcre/tests/preg_replace_error1.phpt
+++ b/ext/pcre/tests/preg_replace_error1.phpt
@@ -6,7 +6,6 @@ Test preg_replace() function : error - bad regular expressions
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace reacts to being passed the wrong type of regex argument
*/
@@ -20,7 +19,7 @@ $regex_array = array('abcdef', //Regex without delimiter
$replace = 1;
$subject = 'a';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
+ @print "\nArg value is $regex_value\n";
var_dump(preg_replace($regex_value, $replace, $subject));
}
$regex_value = new stdclass(); //Object
diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt
index a334b2fefd..eeff2fae54 100644
--- a/ext/pcre/tests/preg_replace_error2.phpt
+++ b/ext/pcre/tests/preg_replace_error2.phpt
@@ -6,7 +6,6 @@ Test preg_replace() function : error conditions - wrong arg types
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace reacts to being passed the wrong type of replacement argument
*/
@@ -15,8 +14,12 @@ $regex = '/[a-zA-Z]/';
$replace = array('this is a string', array('this is', 'a subarray'),);
$subject = 'test';
foreach($replace as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_replace($regex, $value, $subject));
+ @print "\nArg value is: $value\n";
+ try {
+ var_dump(preg_replace($regex, $value, $subject));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$value = new stdclass(); //Object
try {
@@ -33,8 +36,6 @@ Arg value is: this is a string
string(64) "this is a stringthis is a stringthis is a stringthis is a string"
Arg value is: Array
-
-Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace_error2.php on line %d
-bool(false)
+Parameter mismatch, pattern is a string while replacement is an array
Object of class stdClass could not be converted to string
Done
diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt
index 79942a9480..b69caf1aed 100644
--- a/ext/pcre/tests/preg_split_error1.phpt
+++ b/ext/pcre/tests/preg_split_error1.phpt
@@ -6,7 +6,6 @@ Test preg_split() function : error conditions - bad regular expressions
* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_split reacts to being passed the wrong type of regex argument
*/
@@ -19,11 +18,19 @@ $regex_array = array('abcdef', //Regex without delimiter
);
$subject = '1 2 a 3 4 b 5 6';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
- var_dump(preg_split($regex_value, $subject));
+ @print "\nArg value is $regex_value\n";
+ try {
+ var_dump(preg_split($regex_value, $subject));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$regex_value = new stdclass(); //Object
-var_dump(preg_split($regex_value, $subject));
+try {
+ var_dump(preg_split($regex_value, $subject));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
*** Testing preg_split() : error conditions ***
@@ -49,9 +56,7 @@ Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line %
bool(false)
Arg value is Array
-
-Warning: preg_split() expects parameter 1 to be string, array given in %spreg_split_error1.php on line %d
-bool(false)
+preg_split() expects parameter 1 to be string, array given
Arg value is /[a-zA-Z]/
array(3) {
@@ -62,6 +67,4 @@ array(3) {
[2]=>
string(4) " 5 6"
}
-
-Warning: preg_split() expects parameter 1 to be string, object given in %spreg_split_error1.php on line %d
-bool(false)
+preg_split() expects parameter 1 to be string, object given
diff --git a/ext/pcre/tests/split.phpt b/ext/pcre/tests/split.phpt
index c87d1b03a9..df4b9af92f 100644
--- a/ext/pcre/tests/split.phpt
+++ b/ext/pcre/tests/split.phpt
@@ -3,7 +3,6 @@ preg_split()
--FILE--
<?php
-var_dump(preg_split());
var_dump(preg_split('/*/', 'x'));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz'));
@@ -17,10 +16,7 @@ var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY));
?>
--EXPECTF--
-Warning: preg_split() expects at least 2 parameters, 0 given in %ssplit.php on line 3
-bool(false)
-
-Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line 4
+Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line %d
bool(false)
array(3) {
[0]=>
diff --git a/ext/pcre/tests/split2.phpt b/ext/pcre/tests/split2.phpt
index 5c77c6d1bc..5fafee3b87 100644
--- a/ext/pcre/tests/split2.phpt
+++ b/ext/pcre/tests/split2.phpt
@@ -13,7 +13,6 @@ var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPL
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
-var_dump(preg_last_error(1));
ini_set('pcre.recursion_limit', 1);
var_dump(preg_last_error() == PREG_NO_ERROR);
var_dump(preg_split('/(\d*)/', 'ab2c3u'));
@@ -306,9 +305,6 @@ array(6) {
int(5)
}
}
-
-Warning: preg_last_error() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
bool(true)
bool(false)
bool(true)
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index 88839bf61f..1d81e4c547 100644
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.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/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index aa0edbbb47..873aa2d681 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.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, |
@@ -209,7 +207,7 @@ static PHP_METHOD(PDO, dbh_constructor)
int call_factory = 1;
zend_error_handling zeh;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 4)
+ ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_STRING(data_source, data_source_len)
Z_PARAM_OPTIONAL
Z_PARAM_STRING_EX(username, usernamelen, 1, 0)
@@ -419,13 +417,13 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */
{
zval query_string;
- zval z_key;
+ zend_string *key;
ZVAL_STRINGL(&query_string, stmt->query_string, stmt->query_stringlen);
- ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString") - 1);
- zend_std_write_property(object, &z_key, &query_string, NULL);
+ key = zend_string_init("queryString", sizeof("queryString") - 1, 0);
+ zend_std_write_property(Z_OBJ_P(object), key, &query_string, NULL);
zval_ptr_dtor(&query_string);
- zval_ptr_dtor(&z_key);
+ zend_string_release_ex(key, 0);
if (dbstmt_ce->constructor) {
zend_fcall_info fci;
@@ -471,7 +469,7 @@ static PHP_METHOD(PDO, prepare)
Z_PARAM_STRING(statement, statement_len)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -824,7 +822,7 @@ static PHP_METHOD(PDO, setAttribute)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(attr)
Z_PARAM_ZVAL(value)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -845,7 +843,7 @@ static PHP_METHOD(PDO, getAttribute)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(attr)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -912,7 +910,7 @@ static PHP_METHOD(PDO, exec)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(statement, statement_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!statement_len) {
pdo_raise_impl_error(dbh, NULL, "HY000", "trying to execute an empty query");
@@ -941,7 +939,7 @@ static PHP_METHOD(PDO, lastInsertId)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_STRING_EX(name, namelen, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -1136,7 +1134,7 @@ static PHP_METHOD(PDO, quote)
Z_PARAM_STRING(str, str_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(paramtype)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -1350,9 +1348,9 @@ static int dbh_compare(zval *object1, zval *object2)
return -1;
}
-static HashTable *dbh_get_gc(zval *object, zval **gc_data, int *gc_count)
+static HashTable *dbh_get_gc(zend_object *object, zval **gc_data, int *gc_count)
{
- pdo_dbh_t *dbh = Z_PDO_DBH_P(object);
+ pdo_dbh_t *dbh = php_pdo_dbh_fetch_inner(object);
*gc_data = &dbh->def_stmt_ctor_args;
*gc_count = 1;
return zend_std_get_properties(object);
@@ -1377,7 +1375,7 @@ void pdo_dbh_init(void)
pdo_dbh_object_handlers.free_obj = pdo_dbh_free_storage;
pdo_dbh_object_handlers.clone_obj = NULL;
pdo_dbh_object_handlers.get_method = dbh_method_get;
- pdo_dbh_object_handlers.compare_objects = dbh_compare;
+ pdo_dbh_object_handlers.compare = dbh_compare;
pdo_dbh_object_handlers.get_gc = dbh_get_gc;
REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (zend_long)PDO_PARAM_BOOL);
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 71d41002cf..31da8ffdf9 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -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/ext/pdo/pdo_sqlstate.c b/ext/pdo/pdo_sqlstate.c
index 0b3fe7172c..7df2f9c87a 100644
--- a/ext/pdo/pdo_sqlstate.c
+++ b/ext/pdo/pdo_sqlstate.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/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 67fce95137..4acfcb0003 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.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, |
@@ -101,6 +99,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_setfetchmode, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_INFO(0, param)
ZEND_ARG_INFO(0, params)
ZEND_END_ARG_INFO()
/* }}} */
@@ -425,7 +424,7 @@ static PHP_METHOD(PDOStatement, execute)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_EX(input_params, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1252,7 +1251,7 @@ static PHP_METHOD(PDOStatement, fetch)
Z_PARAM_LONG(how)
Z_PARAM_LONG(ori)
Z_PARAM_LONG(off)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1285,7 +1284,7 @@ static PHP_METHOD(PDOStatement, fetchObject)
Z_PARAM_OPTIONAL
Z_PARAM_STR_EX(class_name, 1, 0)
Z_PARAM_ARRAY(ctor_args)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1344,7 +1343,7 @@ static PHP_METHOD(PDOStatement, fetchColumn)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(col_n)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1374,7 +1373,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
Z_PARAM_LONG(how)
Z_PARAM_ZVAL(arg2)
Z_PARAM_ZVAL(ctor_args)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!pdo_stmt_verify_mode(stmt, how, 1)) {
RETURN_FALSE;
@@ -1695,7 +1694,7 @@ static PHP_METHOD(PDOStatement, setAttribute)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(attr)
Z_PARAM_ZVAL_EX(value, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!stmt->methods->set_attribute) {
goto fail;
@@ -1736,7 +1735,7 @@ static PHP_METHOD(PDOStatement, getAttribute)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(attr)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!stmt->methods->get_attribute) {
if (!generic_stmt_attr_get(stmt, return_value, attr)) {
@@ -1790,7 +1789,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(colno)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if(colno < 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "42P10", "column number must be non-negative");
@@ -2169,34 +2168,26 @@ const zend_function_entry pdo_dbstmt_functions[] = {
};
/* {{{ overloaded handlers for PDOStatement class */
-static zval *dbstmt_prop_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *dbstmt_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
- if (!try_convert_to_string(member)) {
- return value;
- }
-
- if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
return value;
} else {
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
-static void dbstmt_prop_delete(zval *object, zval *member, void **cache_slot)
+static void dbstmt_prop_delete(zend_object *object, zend_string *name, void **cache_slot)
{
- pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
-
- if (!try_convert_to_string(member)) {
- return;
- }
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
- if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
} else {
- zend_std_unset_property(object, member, cache_slot);
+ zend_std_unset_property(object, name, cache_slot);
}
}
@@ -2436,12 +2427,44 @@ const zend_function_entry pdo_row_functions[] = {
PHP_FE_END
};
-static zval *row_prop_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *row_prop_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
+ pdo_stmt_t *stmt = row->stmt;
+ int colno = -1;
+ zend_long lval;
+
+ ZVAL_NULL(rv);
+ if (stmt) {
+ if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ if (lval >= 0 && lval < stmt->column_count) {
+ fetch_value(stmt, rv, lval, NULL);
+ }
+ } else {
+ /* TODO: replace this with a hash of available column names to column
+ * numbers */
+ for (colno = 0; colno < stmt->column_count; colno++) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
+ fetch_value(stmt, rv, colno, NULL);
+ return rv;
+ }
+ }
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
+ //zval_ptr_dtor(rv);
+ return zend_std_read_property(&stmt->std, name, type, cache_slot, rv);
+ }
+ }
+ }
+
+ return rv;
+}
+
+static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv)
+{
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
int colno = -1;
- zval zobj;
zend_long lval;
ZVAL_NULL(rv);
@@ -2470,9 +2493,8 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
}
}
if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
- ZVAL_OBJ(&zobj, &stmt->std);
//zval_ptr_dtor(rv);
- return zend_std_read_property(&zobj, member, type, cache_slot, rv);
+ return zend_std_read_property(&stmt->std, Z_STR_P(member), type, NULL, rv);
}
}
}
@@ -2480,25 +2502,52 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
return rv;
}
-static zval *row_dim_read(zval *object, zval *member, int type, zval *rv)
+static zval *row_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- return row_prop_read(object, member, type, NULL, rv);
+ php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
+ return value;
}
-static zval *row_prop_write(zval *object, zval *member, zval *value, void **cache_slot)
+static void row_dim_write(zend_object *object, zval *member, zval *value)
{
php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
- return value;
}
-static void row_dim_write(zval *object, zval *member, zval *value)
+static int row_prop_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
+ pdo_row_t *row = (pdo_row_t *)object;
+ pdo_stmt_t *stmt = row->stmt;
+ int colno = -1;
+ zend_long lval;
+
+ if (stmt) {
+ if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ return lval >=0 && lval < stmt->column_count;
+ }
+
+ /* TODO: replace this with a hash of available column names to column
+ * numbers */
+ for (colno = 0; colno < stmt->column_count; colno++) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
+ int res;
+ zval val;
+
+ fetch_value(stmt, &val, colno, NULL);
+ res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL;
+ zval_ptr_dtor_nogc(&val);
+
+ return res;
+ }
+ }
+ }
+
+ return 0;
}
-static int row_prop_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int row_dim_exists(zend_object *object, zval *member, int check_empty)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
int colno = -1;
zend_long lval;
@@ -2536,24 +2585,19 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
return 0;
}
-static int row_dim_exists(zval *object, zval *member, int check_empty)
-{
- return row_prop_exists(object, member, check_empty, NULL);
-}
-
-static void row_prop_delete(zval *object, zval *offset, void **cache_slot)
+static void row_prop_delete(zend_object *object, zend_string *offset, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow");
}
-static void row_dim_delete(zval *object, zval *offset)
+static void row_dim_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow");
}
-static HashTable *row_get_properties_for(zval *object, zend_prop_purpose purpose)
+static HashTable *row_get_properties_for(zend_object *object, zend_prop_purpose purpose)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
HashTable *props;
int i;
@@ -2594,11 +2638,6 @@ static zend_function *row_method_get(
return fbc;
}
-static int row_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
static zend_function *row_get_ctor(zend_object *object)
{
zend_throw_exception_ex(php_pdo_get_exception(), 0, "You may not create a PDORow manually");
@@ -2653,7 +2692,7 @@ void pdo_stmt_init(void)
pdo_dbstmt_object_handlers.write_property = dbstmt_prop_write;
pdo_dbstmt_object_handlers.unset_property = dbstmt_prop_delete;
pdo_dbstmt_object_handlers.get_method = dbstmt_method_get;
- pdo_dbstmt_object_handlers.compare_objects = dbstmt_compare;
+ pdo_dbstmt_object_handlers.compare = dbstmt_compare;
pdo_dbstmt_object_handlers.clone_obj = NULL;
INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions);
@@ -2677,8 +2716,7 @@ void pdo_stmt_init(void)
pdo_row_object_handlers.unset_dimension = row_dim_delete;
pdo_row_object_handlers.get_properties_for = row_get_properties_for;
pdo_row_object_handlers.get_method = row_method_get;
- pdo_row_object_handlers.call_method = row_call_method;
pdo_row_object_handlers.get_constructor = row_get_ctor;
pdo_row_object_handlers.get_class_name = row_get_classname;
- pdo_row_object_handlers.compare_objects = row_compare;
+ pdo_row_object_handlers.compare = row_compare;
}
diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h
index 27c9c984d6..9d9e73915d 100644
--- a/ext/pdo/php_pdo.h
+++ b/ext/pdo/php_pdo.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/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index d057857fa6..7f4861db20 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.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/ext/pdo/php_pdo_error.h b/ext/pdo/php_pdo_error.h
index b9702833dd..d93960317e 100644
--- a/ext/pdo/php_pdo_error.h
+++ b/ext/pdo/php_pdo_error.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/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h
index 20c373bd24..00131cdf6b 100644
--- a/ext/pdo/php_pdo_int.h
+++ b/ext/pdo/php_pdo_int.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/ext/pdo/tests/bug_44173.phpt b/ext/pdo/tests/bug_44173.phpt
index abf9ac7275..c5ced633a4 100644
--- a/ext/pdo/tests/bug_44173.phpt
+++ b/ext/pdo/tests/bug_44173.phpt
@@ -18,11 +18,6 @@ $db->exec("CREATE TABLE test (x int)");
$db->exec("INSERT INTO test VALUES (1)");
-// Bug entry [1]
-$stmt = $db->query();
-var_dump($stmt);
-
-
// Bug entry [2] -- 1 is PDO::FETCH_LAZY
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_LAZY, 0, 0);
var_dump($stmt);
@@ -55,9 +50,6 @@ var_dump($stmt);
?>
--EXPECTF--
-Warning: PDO::query() expects at least 1 parameter, 0 given in %s
-bool(false)
-
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode doesn't allow any extra arguments in %s
bool(false)
diff --git a/ext/pdo/tests/pdo_drivers_error.phpt b/ext/pdo/tests/pdo_drivers_error.phpt
deleted file mode 100644
index 5a371f02bc..0000000000
--- a/ext/pdo/tests/pdo_drivers_error.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Test that PDO::getAvailableDrivers / pdo_drivers does not accept any parameters
---CREDITS--
-Amo Chohan <amo.chohan@gmail.com>
---SKIPIF--
-<?php
-if (!extension_loaded('pdo')) die('skip');
---FILE--
-<?php
-PDO::getAvailableDrivers('fail');
-pdo_drivers('fail');
---EXPECTF--
-Warning: PDO::getAvailableDrivers() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: pdo_drivers() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index f36451afee..85473c2ac1 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.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/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index b05bbfdc4a..d8608c1d46 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.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/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 0272a12585..d5670cc86f 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.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/ext/pdo_dblib/php_pdo_dblib.h b/ext/pdo_dblib/php_pdo_dblib.h
index 3ae70668ea..af4e845624 100644
--- a/ext/pdo_dblib/php_pdo_dblib.h
+++ b/ext/pdo_dblib/php_pdo_dblib.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/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index 52ee3aafd9..ed82ada40e 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.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/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index 8b2a128963..c31a32bd37 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.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/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 75d7221923..e84ad7c4f0 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.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/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c
index 71dec4add2..0291310abb 100644
--- a/ext/pdo_firebird/pdo_firebird.c
+++ b/ext/pdo_firebird/pdo_firebird.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/ext/pdo_firebird/php_pdo_firebird.h b/ext/pdo_firebird/php_pdo_firebird.h
index 48ff715e8c..deff3f10c5 100644
--- a/ext/pdo_firebird/php_pdo_firebird.h
+++ b/ext/pdo_firebird/php_pdo_firebird.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/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h
index 3694d362c0..f846922eb4 100644
--- a/ext/pdo_firebird/php_pdo_firebird_int.h
+++ b/ext/pdo_firebird/php_pdo_firebird_int.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/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4
index 6f0302feab..622c1e55b8 100644
--- a/ext/pdo_mysql/config.m4
+++ b/ext/pdo_mysql/config.m4
@@ -58,7 +58,7 @@ if test "$PHP_PDO_MYSQL" != "no"; then
if test "x$SED" = "x"; then
AC_PATH_PROG(SED, sed)
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
PDO_MYSQL_LIBNAME=mysqlclient_r
PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs_r | $SED -e "s/'//g"`
else
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index 2f85d8dbb7..0b5ef64b22 100644
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.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/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 9b880ea1fa..e99a11c715 100644
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.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/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index 54e1c931ce..e69e857ef0 100644
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.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/ext/pdo_mysql/php_pdo_mysql.h b/ext/pdo_mysql/php_pdo_mysql.h
index fa34e70f3a..69ddff6b40 100644
--- a/ext/pdo_mysql/php_pdo_mysql.h
+++ b/ext/pdo_mysql/php_pdo_mysql.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/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index edded8dea9..f90a92d6a4 100644
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.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/ext/pdo_mysql/tests/bug44327.phpt b/ext/pdo_mysql/tests/bug44327.phpt
index 27a926295c..f457c97aeb 100644
--- a/ext/pdo_mysql/tests/bug44327.phpt
+++ b/ext/pdo_mysql/tests/bug44327.phpt
@@ -60,5 +60,5 @@ object(PDORow)#%d (2) {
string(19) "SELECT id FROM test"
----------------------------------
-Notice: Trying to get property 'queryString' of non-object in %s on line %d
+Warning: Trying to get property 'queryString' of non-object in %s on line %d
NULL
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
index ddc76d4b60..237f03af38 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
@@ -16,9 +16,6 @@ $db = MySQLPDOTest::factory();
$default = $db->getAttribute(PDO::ATTR_STATEMENT_CLASS);
var_dump($default);
- if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS)))
- printf("[001] Expecting boolean/false got %s\n", var_export($tmp, true));
-
if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, 'foo')))
printf("[002] Expecting boolean/false got %s\n", var_export($tmp, true));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
index 529858fc2b..5ac683ea48 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
@@ -30,22 +30,11 @@ try {
printf("[002] Expecting false got %s\n", var_export($tmp, true));
$stmt->execute();
- // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in
- if (false !== ($tmp = @$stmt->getColumnMeta()))
- printf("[003] Expecting false got %s\n", var_export($tmp, true));
// invalid offset
if (false !== ($tmp = @$stmt->getColumnMeta(-1)))
printf("[004] Expecting false got %s\n", var_export($tmp, true));
- // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in
- if (false !== ($tmp = @$stmt->getColumnMeta(array())))
- printf("[005] Expecting false got %s\n", var_export($tmp, true));
-
- // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in
- if (false !== ($tmp = @$stmt->getColumnMeta(1, 1)))
- printf("[006] Expecting false got %s\n", var_export($tmp, true));
-
$emulated = $stmt->getColumnMeta(0);
printf("Testing native PS...\n");
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 386789e069..58a63f58cb 100644
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.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/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index 5d01ae1dab..6a7be25c09 100644
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.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/ext/pdo_oci/pdo_oci.c b/ext/pdo_oci/pdo_oci.c
index 5fcefbe799..e9be6cd0a6 100644
--- a/ext/pdo_oci/pdo_oci.c
+++ b/ext/pdo_oci/pdo_oci.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/ext/pdo_oci/php_pdo_oci.h b/ext/pdo_oci/php_pdo_oci.h
index 7d49e1d775..f5215d914e 100644
--- a/ext/pdo_oci/php_pdo_oci.h
+++ b/ext/pdo_oci/php_pdo_oci.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/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h
index 683ef037cf..ee56720e19 100644
--- a/ext/pdo_oci/php_pdo_oci_int.h
+++ b/ext/pdo_oci/php_pdo_oci_int.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/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 9e10c4c446..d0441e98a9 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index e67acbc6e8..799ef02e48 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index 5f0eb26df3..51af17055c 100644
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
@@ -66,13 +64,6 @@ zend_ulong pdo_odbc_pool_on = SQL_CP_OFF;
zend_ulong pdo_odbc_pool_mode = SQL_CP_ONE_PER_HENV;
#endif
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("pdo_odbc.db2_instance_name", NULL, PHP_INI_SYSTEM, NULL)
-PHP_INI_END()
-
-#endif
-
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(pdo_odbc)
{
@@ -84,26 +75,6 @@ PHP_MINIT_FUNCTION(pdo_odbc)
return FAILURE;
}
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
- REGISTER_INI_ENTRIES();
- {
- char *instance = INI_STR("pdo_odbc.db2_instance_name");
- if (instance) {
- char *env = malloc(sizeof("DB2INSTANCE=") + strlen(instance));
-
- php_error_docref(NULL, E_DEPRECATED, "The pdo_odbc.db2_instance_name ini directive is deprecated and will be removed in the future");
-
- if (!env) {
- return FAILURE;
- }
- strcpy(env, "DB2INSTANCE=");
- strcat(env, instance);
- putenv(env);
- /* after this point, we can't free env without breaking the environment */
- }
- }
-#endif
-
#ifdef SQL_ATTR_CONNECTION_POOLING
/* ugh, we don't really like .ini stuff in PDO, but since ODBC connection
* pooling is process wide, we can't set it from within the scope of a
@@ -145,9 +116,6 @@ PHP_MINIT_FUNCTION(pdo_odbc)
*/
PHP_MSHUTDOWN_FUNCTION(pdo_odbc)
{
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
- UNREGISTER_INI_ENTRIES();
-#endif
php_pdo_unregister_driver(&pdo_odbc_driver);
return SUCCESS;
}
@@ -166,9 +134,5 @@ PHP_MINFO_FUNCTION(pdo_odbc)
php_info_print_table_row(2, "ODBC Connection Pooling", "Not supported in this build");
#endif
php_info_print_table_end();
-
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
- DISPLAY_INI_ENTRIES();
-#endif
}
/* }}} */
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
index 9cc748715e..3d6e470994 100644
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ b/ext/pdo_odbc/php_pdo_odbc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
index e6098f4951..5604e86273 100644
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ b/ext/pdo_odbc/php_pdo_odbc_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c
index 8d60fe420b..9cd9dab3b9 100644
--- a/ext/pdo_pgsql/pdo_pgsql.c
+++ b/ext/pdo_pgsql/pdo_pgsql.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/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 9c5df24ab5..68d8ee30f0 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.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/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index d830d57c18..1b728951f5 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.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/ext/pdo_pgsql/php_pdo_pgsql.h b/ext/pdo_pgsql/php_pdo_pgsql.h
index e6d7c17058..950aed79ca 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql.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/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h
index 9b1f60549f..5d80e32205 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql_int.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql_int.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/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index 5c2fd63cdb..4f932cc969 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.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/ext/pdo_sqlite/php_pdo_sqlite.h b/ext/pdo_sqlite/php_pdo_sqlite.h
index 73d8a98675..e9fe2463ff 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite.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/ext/pdo_sqlite/php_pdo_sqlite_int.h b/ext/pdo_sqlite/php_pdo_sqlite_int.h
index c1d3a953a0..31fa7cc9ff 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite_int.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite_int.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/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 120488e229..c0b7bc4a60 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.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, |
@@ -536,7 +534,7 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(argc)
Z_PARAM_LONG(flags)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
@@ -608,7 +606,7 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
Z_PARAM_ZVAL(fini_callback)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
@@ -668,7 +666,7 @@ static PHP_METHOD(SQLite, sqliteCreateCollation)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(collation_name, collation_name_len)
Z_PARAM_ZVAL(callback)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index d95f520088..f937c4263b 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.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/ext/pdo_sqlite/tests/bug43831.phpt b/ext/pdo_sqlite/tests/bug43831.phpt
index 4620559da4..514b8c2b5f 100644
--- a/ext/pdo_sqlite/tests/bug43831.phpt
+++ b/ext/pdo_sqlite/tests/bug43831.phpt
@@ -49,5 +49,5 @@ object(PDO)#%d (0) {
object(MyPDO)#%d (0) {
}
-Notice: Undefined variable: bar in %s on line %d
+Warning: Undefined variable: bar in %s on line %d
NULL
diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
index c452d4c34f..c788b4ee90 100644
--- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
+++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
@@ -117,14 +117,11 @@ array(2) {
string(4) "2---"
}
-Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access private method bar::test2() in %s on line %d
+Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test2() cannot be called statically in %s on line %d
+bool(false)
+
+Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test3() cannot be called statically in %s on line %d
bool(false)
-array(2) {
- [0]=>
- string(7) "1===php"
- [1]=>
- string(4) "2==="
-}
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'bar' does not have a method 'inexistent' in %s on line %d
bool(false)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 9f51256ac5..cb963362e2 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.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/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index cecd2cc95b..978112cf3b 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.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/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt
index aa2e43748f..45062c3b49 100644
--- a/ext/pgsql/tests/01createdb.phpt
+++ b/ext/pgsql/tests/01createdb.phpt
@@ -9,7 +9,7 @@ PostgreSQL create db
include('config.inc');
$db = pg_connect($conn_str);
-if (!@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name)))
+if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q))
{
pg_query($db,$table_def); // Create table here
for ($i=0; $i < $num_test_record; $i++) {
@@ -21,7 +21,7 @@ else {
}
$v = pg_version();
-if (version_compare($v['server'], '9.2', '>=') && !@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name_92)))
+if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q)))
{
pg_query($db,$table_def_92); // Create table here
}
diff --git a/ext/pgsql/tests/bug72197.phpt b/ext/pgsql/tests/bug72197.phpt
index bf9c16978b..7732bfddfc 100644
--- a/ext/pgsql/tests/bug72197.phpt
+++ b/ext/pgsql/tests/bug72197.phpt
@@ -7,7 +7,11 @@ Bug #72197 pg_lo_create arbitrary read
/* This shouldn't crash. */
$var1=-32768;
$var2="12";
-pg_lo_create($var1, $var2);
+try {
+ pg_lo_create($var1, $var2);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* This should work correctly. */
include('config.inc');
@@ -28,7 +32,7 @@ pg_close($conn);
?>
==DONE==
--EXPECTF--
-Warning: pg_lo_create(): supplied resource is not a valid PostgreSQL link resource in %sbug72197.php on line %d%w
+pg_lo_create(): supplied resource is not a valid PostgreSQL link resource%w
int(%d)
int(%d)
==DONE==
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c
index 4710703c70..cb14f9e986 100644
--- a/ext/phar/dirstream.c
+++ b/ext/phar/dirstream.c
@@ -285,10 +285,7 @@ PHAR_ADD_ENTRY:
if (FAILURE != zend_hash_has_more_elements(data)) {
efree(dir);
- if (zend_hash_sort(data, phar_compare_dir_name, 0) == FAILURE) {
- FREE_HASHTABLE(data);
- return NULL;
- }
+ zend_hash_sort(data, phar_compare_dir_name, 0);
return php_stream_alloc(&phar_dir_ops, data, NULL, "r");
} else {
efree(dir);
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 4c49003ceb..aaa27bf001 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -1241,7 +1241,7 @@ PHP_METHOD(Phar, __construct)
ZVAL_STRINGL(&arg1, fname, fname_len);
ZVAL_LONG(&arg2, flags);
- zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj),
+ zend_call_method_with_2_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj),
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
zval_ptr_dtor(&arg1);
@@ -1388,6 +1388,10 @@ PHP_METHOD(Phar, __destruct)
zval *zobj = ZEND_THIS;
phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
if (phar_obj->archive && phar_obj->archive->is_persistent) {
zend_hash_str_del(&PHAR_G(phar_persist_map), (const char *) phar_obj->archive, sizeof(phar_obj->archive));
}
@@ -1748,7 +1752,7 @@ PHP_METHOD(Phar, buildFromDirectory)
ZVAL_STRINGL(&arg, dir, dir_len);
ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
- zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
+ zend_call_method_with_2_params(Z_OBJ(iter), spl_ce_RecursiveDirectoryIterator,
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
zval_ptr_dtor(&arg);
@@ -1764,7 +1768,7 @@ PHP_METHOD(Phar, buildFromDirectory)
RETURN_FALSE;
}
- zend_call_method_with_1_params(&iteriter, spl_ce_RecursiveIteratorIterator,
+ zend_call_method_with_1_params(Z_OBJ(iteriter), spl_ce_RecursiveIteratorIterator,
&spl_ce_RecursiveIteratorIterator->constructor, "__construct", NULL, &iter);
if (EG(exception)) {
@@ -1787,7 +1791,7 @@ PHP_METHOD(Phar, buildFromDirectory)
ZVAL_STRINGL(&arg2, regex, regex_len);
- zend_call_method_with_2_params(&regexiter, spl_ce_RegexIterator,
+ zend_call_method_with_2_params(Z_OBJ(regexiter), spl_ce_RegexIterator,
&spl_ce_RegexIterator->constructor, "__construct", NULL, &iteriter, &arg2);
zval_ptr_dtor(&arg2);
}
@@ -2240,7 +2244,7 @@ its_ok:
ZVAL_STRINGL(&arg1, phar->fname, phar->fname_len);
- zend_call_method_with_1_params(&ret, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ(ret), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
return Z_OBJ(ret);
}
@@ -4024,6 +4028,10 @@ PHP_METHOD(Phar, hasMetadata)
{
PHAR_ARCHIVE_OBJECT();
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETURN_BOOL(Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF);
}
/* }}} */
@@ -4105,6 +4113,10 @@ PHP_METHOD(Phar, delMetadata)
return;
}
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
if (Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF) {
zval_ptr_dtor(&phar_obj->archive->metadata);
ZVAL_UNDEF(&phar_obj->archive->metadata);
@@ -4513,7 +4525,7 @@ PHP_METHOD(PharFileInfo, __construct)
ZVAL_STRINGL(&arg1, fname, fname_len);
- zend_call_method_with_1_params(zobj, Z_OBJCE_P(zobj),
+ zend_call_method_with_1_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj),
&spl_ce_SplFileInfo->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
diff --git a/ext/phar/tests/002.phpt b/ext/phar/tests/002.phpt
index 41cb9be716..cfd8cc5e66 100644
--- a/ext/phar/tests/002.phpt
+++ b/ext/phar/tests/002.phpt
@@ -5,13 +5,17 @@ Phar::mapPhar truncated manifest/improper params
--FILE--
<?php
try {
-Phar::mapPhar(5, 'hio', 'hi');
+ Phar::mapPhar(5, 'hio', 'hi');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-Phar::mapPhar();
+try {
+ Phar::mapPhar();
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage(), "\n";
}
__HALT_COMPILER(); ?>
--EXPECTF--
-Warning: Phar::mapPhar() expects at most 2 parameters, 3 given in %s002.php on line %d
+Phar::mapPhar() expects at most 2 parameters, 3 given
internal corruption of phar "%s002.php" (truncated manifest at manifest length)
diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt
index c5ea1d216f..ad3506ace9 100644
--- a/ext/phar/tests/badparameters.phpt
+++ b/ext/phar/tests/badparameters.phpt
@@ -8,200 +8,263 @@ phar.readonly=0
<?php
ini_set('phar.readonly', 1);
-function print_exception($e) {
- echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
+try {
+ Phar::mungServer('hi');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ Phar::createDefaultStub(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ Phar::loadPhar(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ Phar::canCompress('hi');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-
-Phar::mungServer('hi');
-Phar::createDefaultStub(array());
-Phar::loadPhar(array());
-Phar::canCompress('hi');
try {
$a = new Phar(array());
} catch (TypeError $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
try {
$a = new Phar(__DIR__ . '/files/frontcontroller10.phar');
} catch (PharException $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->convertToExecutable(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->convertToData(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->convertToExecutable(array());
-$a->convertToData(array());
try {
$b = new PharData(__DIR__ . '/whatever.tar');
} catch (PharException $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
try {
$c = new PharData(__DIR__ . '/whatever.zip');
} catch (PharException $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
-$b->delete(array());
try {
-$a->delete('oops');
+ $b->delete(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->delete('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$b->delete('oops');
+ $b->delete('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ echo $a->getPath() . "\n";
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-echo $a->getPath() . "\n";
try {
-$a->setAlias('oops');
+ $a->setAlias('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$b->setAlias('oops');
+ $b->setAlias('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly', 0);
-$a->setAlias(array());
+try {
+ $a->setAlias(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
try {
-$b->stopBuffering();
+ $b->stopBuffering();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$a->setStub('oops');
+ $a->setStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$b->setStub('oops');
+ $b->setStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly', 0);
-$a->setStub(array());
+try {
+ $a->setStub(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
try {
-$b->setDefaultStub('oops');
+ $b->setDefaultStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->setDefaultStub(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->setDefaultStub(array());
try {
-$a->setDefaultStub('oops');
+ $a->setDefaultStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$a->setSignatureAlgorithm(Phar::MD5);
+ $a->setSignatureAlgorithm(Phar::MD5);
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
-$a->compress(array());
try {
-$a->compress(1);
+ $a->compress(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->compress(1);
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->compressFiles(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->compressFiles(array());
try {
-$a->decompressFiles();
+ $a->decompressFiles();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
-$a->copy(array());
try {
-$a->copy('a', 'b');
+ $a->copy(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->copy('a', 'b');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->offsetExists(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->offsetGet(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->offsetExists(array());
-$a->offsetGet(array());
ini_set('phar.readonly', 0);
-$a->offsetSet(array());
+try {
+ $a->offsetSet(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
-$b->offsetUnset(array());
try {
-$a->offsetUnset('a');
+ $b->offsetUnset(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->offsetUnset('a');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->addEmptyDir(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->addFile(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->addEmptyDir(array());
-$a->addFile(array());
-$a->addFromString(array());
try {
-$a->setMetadata('a');
+ $a->addFromString(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->setMetadata('a');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly', 0);
-$a->setMetadata(1,2);
+try {
+ $a->setMetadata(1,2);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
try {
-$a->delMetadata();
+ $a->delMetadata();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
===DONE===
--EXPECTF--
-Warning: Phar::mungServer() expects parameter 1 to be array, string given in %sbadparameters.php on line %d
-
-Warning: Phar::createDefaultStub() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::loadPhar() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::canCompress() expects parameter 1 to be int, string given in %sbadparameters.php on line %d
-
-Exception: Phar::__construct() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::convertToExecutable() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
-
-Warning: Phar::convertToData() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
-
-Warning: PharData::delete() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
+Phar::mungServer() expects parameter 1 to be array, string given
+Phar::createDefaultStub() expects parameter 1 to be a valid path, array given
+Phar::loadPhar() expects parameter 1 to be a valid path, array given
+Phar::canCompress() expects parameter 1 to be int, string given
+Phar::__construct() expects parameter 1 to be a valid path, array given
+Phar::convertToExecutable() expects parameter 1 to be int, array given
+Phar::convertToData() expects parameter 1 to be int, array given
+PharData::delete() expects parameter 1 to be a valid path, array given
Cannot write out phar archive, phar is read-only
Entry oops does not exist and cannot be deleted
-%sfiles/frontcontroller10.phar
+%sfrontcontroller10.phar
Cannot write out phar archive, phar is read-only
A Phar alias cannot be set in a plain tar archive
-
-Warning: Phar::setAlias() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
+Phar::setAlias() expects parameter 1 to be string, array given
Cannot change stub, phar is read-only
A Phar stub cannot be set in a plain tar archive
-
-Warning: Phar::setStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
+Phar::setStub() expects parameter 1 to be string, array given
A Phar stub cannot be set in a plain tar archive
-
-Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
+Phar::setDefaultStub() expects parameter 1 to be string, array given
Cannot change stub: phar.readonly=1
Cannot set signature algorithm, phar is read-only
-
-Warning: Phar::compress() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
+Phar::compress() expects parameter 1 to be int, array given
Cannot compress phar archive, phar is read-only
-
-Warning: Phar::compressFiles() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
+Phar::compressFiles() expects parameter 1 to be int, array given
Phar is readonly, cannot change compression
-
-Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
+Phar::copy() expects exactly 2 parameters, 1 given
Cannot copy "a" to "b", phar is read-only
-
-Warning: Phar::offsetExists() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::offsetGet() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
-
-Warning: PharData::offsetUnset() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
+Phar::offsetExists() expects parameter 1 to be a valid path, array given
+Phar::offsetGet() expects parameter 1 to be a valid path, array given
+Phar::offsetSet() expects exactly 2 parameters, 1 given
+PharData::offsetUnset() expects parameter 1 to be a valid path, array given
Write operations disabled by the php.ini setting phar.readonly
-
-Warning: Phar::addEmptyDir() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::addFile() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
+Phar::addEmptyDir() expects parameter 1 to be a valid path, array given
+Phar::addFile() expects parameter 1 to be a valid path, array given
+Phar::addFromString() expects exactly 2 parameters, 1 given
Write operations disabled by the php.ini setting phar.readonly
-
-Warning: Phar::setMetadata() expects exactly 1 parameter, 2 given in %sbadparameters.php on line %d
+Phar::setMetadata() expects exactly 1 parameter, 2 given
Write operations disabled by the php.ini setting phar.readonly
===DONE===
diff --git a/ext/phar/tests/bug64931/bug64931.phpt b/ext/phar/tests/bug64931/bug64931.phpt
index 4439fcf792..aa2d17182c 100644
--- a/ext/phar/tests/bug64931/bug64931.phpt
+++ b/ext/phar/tests/bug64931/bug64931.phpt
@@ -38,7 +38,7 @@ try {
try {
$phar->addFromString(".phar\0", "gotcha");
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo "CAUGHT: ". $e->getMessage() ."\n";
}
@@ -54,6 +54,5 @@ CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
-
-Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s%ebug64931.php on line %d
+CAUGHT: Phar::addFromString() expects parameter 1 to be a valid path, string given
===DONE===
diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt
index 047e7e3806..4987c19b17 100644
--- a/ext/phar/tests/create_path_error.phpt
+++ b/ext/phar/tests/create_path_error.phpt
@@ -53,7 +53,7 @@ foreach($checks as $check)
{
$phar[$check] = 'error';
}
- catch(Exception $e)
+ catch (TypeError $e)
{
echo 'Exception: ' . $e->getMessage() . "\n";
}
@@ -79,4 +79,5 @@ string(5) "query"
11:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
12:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
13:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-Error: Phar::offsetSet() expects parameter 1 to be a valid path, string given===DONE===
+Exception: Phar::offsetSet() expects parameter 1 to be a valid path, string given
+===DONE===
diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt
index ce3e8980ad..21df0775b0 100644
--- a/ext/phar/tests/fatal_error_webphar.phpt
+++ b/ext/phar/tests/fatal_error_webphar.phpt
@@ -1,5 +1,7 @@
--TEST--
Phar web-based phar with fatal error
+--XFAIL--
+Uses no longer supported __autoload() function, new phar needed
--INI--
default_charset=UTF-8
--SKIPIF--
diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt
index 11916603e3..4a6b367aab 100644
--- a/ext/phar/tests/fgc_edgecases.phpt
+++ b/ext/phar/tests/fgc_edgecases.phpt
@@ -14,7 +14,11 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-file_get_contents(array());
+try {
+ file_get_contents(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
chdir(__DIR__);
file_put_contents($fname, "blah\n");
file_put_contents("fgc_edgecases.txt", "test\n");
@@ -46,7 +50,7 @@ include $pname . '/foo/hi';
<?php rmdir(__DIR__ . '/poo'); ?>
<?php unlink(__DIR__ . '/fgc_edgecases.txt'); ?>
--EXPECTF--
-Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %sfgc_edgecases.php on line %d
+file_get_contents() expects parameter 1 to be a valid path, array given
blah
<?php
echo file_get_contents("foo/" . basename(__FILE__));
diff --git a/ext/phar/tests/fopen.phpt b/ext/phar/tests/fopen.phpt
index 528f5c46df..42175bc037 100644
--- a/ext/phar/tests/fopen.phpt
+++ b/ext/phar/tests/fopen.phpt
@@ -10,7 +10,6 @@ phar.readonly=0
Phar::interceptFileFuncs();
$a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage
fclose($a);
-$a = fopen(); // this satisfies another line of code coverage
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$a = new Phar($fname);
@@ -36,7 +35,6 @@ include $fname;
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: fopen() expects at least 2 parameters, 0 given in %sfopen.php on line %d
hihi
Warning: fopen(notfound.txt): failed to open stream: No such file or directory in phar://%sfopen.phar.php/index.php on line %d
===DONE===
diff --git a/ext/phar/tests/fopen_edgecases2.phpt b/ext/phar/tests/fopen_edgecases2.phpt
index b32755bf9e..840c039d9e 100644
--- a/ext/phar/tests/fopen_edgecases2.phpt
+++ b/ext/phar/tests/fopen_edgecases2.phpt
@@ -10,7 +10,11 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-fopen(array(), 'r');
+try {
+ fopen(array(), 'r');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
chdir(__DIR__);
file_put_contents($fname, "blah\n");
file_put_contents("fopen_edgecases2.txt", "test\n");
@@ -35,7 +39,7 @@ include $pname . '/foo/hi';
<?php rmdir(__DIR__ . '/poo'); ?>
<?php unlink(__DIR__ . '/fopen_edgecases2.txt'); ?>
--EXPECTF--
-Warning: fopen() expects parameter 1 to be a valid path, array given in %sfopen_edgecases2.php on line %d
+fopen() expects parameter 1 to be a valid path, array given
blah
test
diff --git a/ext/phar/tests/open_for_write_existing_b.phpt b/ext/phar/tests/open_for_write_existing_b.phpt
index d7ed20fd06..16b9d0cbbe 100644
--- a/ext/phar/tests/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/open_for_write_existing_b.phpt
@@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/c.php', 'wb'));
include $pname . '/b/c.php';
?>
===DONE===
@@ -29,9 +27,6 @@ include $pname . '/b/c.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
+bool(false)
This is b/c
===DONE===
diff --git a/ext/phar/tests/open_for_write_existing_c.phpt b/ext/phar/tests/open_for_write_existing_c.phpt
index 2809d46c81..4eee2ea25f 100644
--- a/ext/phar/tests/open_for_write_existing_c.phpt
+++ b/ext/phar/tests/open_for_write_existing_c.phpt
@@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/c.php', 'wb'));
include $pname . '/b/c.php';
?>
===DONE===
@@ -29,9 +27,6 @@ include $pname . '/b/c.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
+bool(false)
This is b/c
===DONE===
diff --git a/ext/phar/tests/open_for_write_newfile_b.phpt b/ext/phar/tests/open_for_write_newfile_b.phpt
index 7822492498..576388eb2d 100644
--- a/ext/phar/tests/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/open_for_write_newfile_b.phpt
@@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/new.php', 'wb'));
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
@@ -31,10 +29,7 @@ include $pname . '/b/new.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
+bool(false)
This is b/c
Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d
diff --git a/ext/phar/tests/open_for_write_newfile_c.phpt b/ext/phar/tests/open_for_write_newfile_c.phpt
index aa288d1110..0eb70d63e5 100644
--- a/ext/phar/tests/open_for_write_newfile_c.phpt
+++ b/ext/phar/tests/open_for_write_newfile_c.phpt
@@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/new.php', 'wb'));
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
@@ -31,10 +29,7 @@ include $pname . '/b/new.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
+bool(false)
This is b/c
Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d
diff --git a/ext/phar/tests/opendir_edgecases.phpt b/ext/phar/tests/opendir_edgecases.phpt
index c3303705cb..6270eac224 100644
--- a/ext/phar/tests/opendir_edgecases.phpt
+++ b/ext/phar/tests/opendir_edgecases.phpt
@@ -12,7 +12,11 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-opendir(array());
+try {
+ opendir(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
mkdir(__DIR__ . '/poo');
chdir(__DIR__);
@@ -52,7 +56,7 @@ include $pname . '/foo';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(__DIR__ . '/poo');
--EXPECTF--
-Warning: opendir() expects parameter 1 to be a valid path, array given in %sopendir_edgecases.php on line %d
+opendir() expects parameter 1 to be a valid path, array given
.
..
foo
diff --git a/ext/phar/tests/phar_bz2.phpt b/ext/phar/tests/phar_bz2.phpt
index 8b2d539db0..cb8f07ef0b 100644
--- a/ext/phar/tests/phar_bz2.phpt
+++ b/ext/phar/tests/phar_bz2.phpt
@@ -40,7 +40,6 @@ $b = new Phar($fname2);
var_dump($b->isFileFormat(Phar::PHAR));
var_dump($b->isCompressed() == Phar::BZ2);
// additional code coverage
-$b->isFileFormat(array());
try {
$b->isFileFormat(25);
} catch (Exception $e) {
@@ -58,7 +57,5 @@ string(9) "it worked"
string(%d) "phar://%sphar_bz2.phar/tar_004.php"
bool(true)
bool(true)
-
-Warning: Phar::isFileFormat() expects parameter 1 to be int, array given in %sphar_bz2.php on line %d
Unknown file format specified
===DONE===
diff --git a/ext/phar/tests/phar_commitwrite.phpt b/ext/phar/tests/phar_commitwrite.phpt
index 7e5c6a3998..9723b2e043 100644
--- a/ext/phar/tests/phar_commitwrite.phpt
+++ b/ext/phar/tests/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump(strlen($p->getStub()));
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
@@ -31,10 +30,9 @@ __HALT_COMPILER();
--EXPECTF--
int(6641)
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/phar/tests/phar_create_in_cwd.phpt b/ext/phar/tests/phar_create_in_cwd.phpt
index 4fb142ec2e..f091055596 100644
--- a/ext/phar/tests/phar_create_in_cwd.phpt
+++ b/ext/phar/tests/phar_create_in_cwd.phpt
@@ -13,10 +13,9 @@ try {
$p['file1.txt'] = 'hi';
var_dump(strlen($p->getStub()));
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_create_in_cwd.phar');
include 'phar://phar_create_in_cwd.phar/startup.php';
__HALT_COMPILER();
@@ -34,10 +33,9 @@ unlink(__DIR__ . '/phar_create_in_cwd.phar');
--EXPECTF--
int(6641)
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_create_in_cwd.phar');
include 'phar://phar_create_in_cwd.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/phar/tests/phar_decompress.phpt b/ext/phar/tests/phar_decompress.phpt
index dbd58abd7f..3b16b78f64 100644
--- a/ext/phar/tests/phar_decompress.phpt
+++ b/ext/phar/tests/phar_decompress.phpt
@@ -32,18 +32,17 @@ $unc2 = $gz->decompress();
echo $unc2->getPath() . "\n";
$unc3 = $gz->decompress('hooba.phar');
echo $unc3->getPath() . "\n";
-$gz->decompress(array());
$zip = $phar->convertToData(Phar::ZIP);
ini_set('phar.readonly', 1);
try {
-$gz->decompress();
+ $gz->decompress();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$zip->decompress();
+ $zip->decompress();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
===DONE===
@@ -62,8 +61,6 @@ int(4096)
%sphar_decompress2.phar
%sphar_decompress.phar
%sphar_decompress.hooba.phar
-
-Warning: Phar::decompress() expects parameter 1 to be %string, array given in %sphar_decompress.php on line %d
Cannot decompress phar archive, phar is read-only
Cannot decompress zip-based archives with whole-archive compression
===DONE===
diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt
index b8cdef7c79..d3b4afcf6c 100644
--- a/ext/phar/tests/phar_extract.phpt
+++ b/ext/phar/tests/phar_extract.phpt
@@ -50,7 +50,11 @@ try {
echo $e->getMessage(), "\n";
}
-$a->extractTo(array());
+try {
+ $a->extractTo(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
try {
$a->extractTo('');
@@ -139,8 +143,7 @@ string(3) "hi3"
string(3) "hi2"
bool(false)
Invalid argument, expected a filename (string) or array of filenames
-
-Warning: Phar::extractTo() expects parameter 1 to be a valid path, array given in %sphar_extract.php on line %d
+Phar::extractTo() expects parameter 1 to be a valid path, array given
Invalid argument, extraction path must be non-zero length
Unable to use path "%soops" for extraction, it is a file, must be a directory
Invalid argument, array of filenames to extract contains non-string value
diff --git a/ext/phar/tests/phar_isvalidpharfilename.phpt b/ext/phar/tests/phar_isvalidpharfilename.phpt
index 3a25714556..6e299d08e0 100644
--- a/ext/phar/tests/phar_isvalidpharfilename.phpt
+++ b/ext/phar/tests/phar_isvalidpharfilename.phpt
@@ -7,8 +7,6 @@ phar.readonly=1
--FILE--
<?php
chdir(__DIR__);
-Phar::isValidPharFilename(array());
-echo "*\n";
var_dump(Phar::isValidPharFilename('*'));
var_dump(Phar::isValidPharFilename('*', true));
var_dump(Phar::isValidPharFilename('*', false));
@@ -76,8 +74,6 @@ var_dump(Phar::isValidPharFilename('dir.phar.php', false));
<?php
rmdir(__DIR__ . '/.phar');
--EXPECTF--
-Warning: Phar::isValidPharFilename() expects parameter 1 to be a valid path, array given in %sphar_isvalidpharfilename.php on line %d
-*
bool(false)
bool(false)
bool(false)
diff --git a/ext/phar/tests/phar_oo_006.phpt b/ext/phar/tests/phar_oo_006.phpt
index f595c2e412..412726908b 100644
--- a/ext/phar/tests/phar_oo_006.phpt
+++ b/ext/phar/tests/phar_oo_006.phpt
@@ -23,7 +23,7 @@ try
{
$phar->setFileClass('SplFileInfo');
}
-catch (UnexpectedValueException $e)
+catch (TypeError $e)
{
echo $e->getMessage() . "\n";
}
diff --git a/ext/phar/tests/phar_running.phpt b/ext/phar/tests/phar_running.phpt
index 74f26f0cd6..7b74921a3e 100644
--- a/ext/phar/tests/phar_running.phpt
+++ b/ext/phar/tests/phar_running.phpt
@@ -11,7 +11,6 @@ $pname = 'phar://' . $fname;
$phar = new Phar($fname);
$phar['index.php'] = '<?php
-Phar::running(array());
var_dump(Phar::running());
var_dump(Phar::running(false));
?>';
@@ -22,7 +21,6 @@ var_dump(Phar::running());
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: Phar::running() expects parameter 1 to be bool, array given in phar://%sphar_running.phar.php/index.php on line 2
string(%d) "phar://%sphar_running.phar.php"
string(%d) "%sphar_running.phar.php"
string(0) ""
diff --git a/ext/phar/tests/phar_unlinkarchive.phpt b/ext/phar/tests/phar_unlinkarchive.phpt
index 4597d5aaba..4477719c11 100644
--- a/ext/phar/tests/phar_unlinkarchive.phpt
+++ b/ext/phar/tests/phar_unlinkarchive.phpt
@@ -28,7 +28,11 @@ Phar::unlinkArchive($pdname);
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
-Phar::unlinkArchive(array());
+try {
+ Phar::unlinkArchive(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$pname = 'phar://' . $fname;
$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
@@ -89,8 +93,7 @@ __HALT_COMPILER();
Unknown phar archive ""
Unknown phar archive "%sphar_unlinkarchive.phar"
Unknown phar archive "%sphar_unlinkarchive.phar.tar": internal corruption of phar "%sphar_unlinkarchive.phar.tar" (truncated entry)
-
-Warning: Phar::unlinkArchive() expects parameter 1 to be a valid path, array given in %sphar_unlinkarchive.php on line %d
+Phar::unlinkArchive() expects parameter 1 to be a valid path, array given
bool(false)
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
phar archive "%sphar_unlinkarchive.phar" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()
diff --git a/ext/phar/tests/pharfileinfo_chmod.phpt b/ext/phar/tests/pharfileinfo_chmod.phpt
index 357d21e73b..1c9c355689 100644
--- a/ext/phar/tests/pharfileinfo_chmod.phpt
+++ b/ext/phar/tests/pharfileinfo_chmod.phpt
@@ -19,7 +19,6 @@ $phar['a']->chmod(066);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
-$b->chmod(array());
lstat($pname . '/a/b'); // sets BG(CurrentLStatFile)
$b->chmod(0666);
?>
@@ -28,6 +27,4 @@ $b->chmod(0666);
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
--EXPECTF--
Phar entry "a" is a temporary directory (not an actual entry in the archive), cannot chmod
-
-Warning: PharFileInfo::chmod() expects parameter 1 to be int, array given in %spharfileinfo_chmod.php on line %d
===DONE===
diff --git a/ext/phar/tests/pharfileinfo_compression.phpt b/ext/phar/tests/pharfileinfo_compression.phpt
index 95d212dd7f..c8f236d166 100644
--- a/ext/phar/tests/pharfileinfo_compression.phpt
+++ b/ext/phar/tests/pharfileinfo_compression.phpt
@@ -17,7 +17,6 @@ $phar['a/b'] = 'hi there';
$b = $phar['a/b'];
-$b->isCompressed(array());
try {
$b->isCompressed(25);
} catch (Exception $e) {
@@ -76,7 +75,6 @@ var_dump($b->decompress());
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?>
--EXPECTF--
-Warning: PharFileInfo::isCompressed() expects parameter 1 to be int, array given in %spharfileinfo_compression.php on line 11
Unknown compression type specified
Unknown compression type specified
Cannot compress with Gzip compression, not possible with tar-based phar archives
diff --git a/ext/phar/tests/pharfileinfo_setmetadata.phpt b/ext/phar/tests/pharfileinfo_setmetadata.phpt
index a0915cb1ac..97f3b15ed1 100644
--- a/ext/phar/tests/pharfileinfo_setmetadata.phpt
+++ b/ext/phar/tests/pharfileinfo_setmetadata.phpt
@@ -36,8 +36,6 @@ $b->delMetadata();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
-ini_set('phar.readonly', 0);
-$b->setMetadata(1,2,3);
?>
===DONE===
--CLEAN--
@@ -48,6 +46,4 @@ Phar entry is a temporary directory (not an actual entry in the archive), cannot
Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata
Write operations disabled by the php.ini setting phar.readonly
Write operations disabled by the php.ini setting phar.readonly
-
-Warning: PharFileInfo::setMetadata() expects exactly 1 parameter, 3 given in %spharfileinfo_setmetadata.php on line %d
===DONE===
diff --git a/ext/phar/tests/readfile_edgecases.phpt b/ext/phar/tests/readfile_edgecases.phpt
index 0213f182c6..b4b533e360 100644
--- a/ext/phar/tests/readfile_edgecases.phpt
+++ b/ext/phar/tests/readfile_edgecases.phpt
@@ -10,7 +10,6 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-readfile(array());
chdir(__DIR__);
file_put_contents($fname, "blah\n");
file_put_contents("readfile_edgecases.txt", "test\n");
@@ -35,7 +34,6 @@ include $pname . '/foo/hi';
<?php rmdir(__DIR__ . '/poo'); ?>
<?php unlink(__DIR__ . '/readfile_edgecases.txt'); ?>
--EXPECTF--
-Warning: readfile() expects parameter 1 to be a valid path, array given in %sreadfile_edgecases.php on line %d
blah
<?php
readfile("foo/" . basename(__FILE__));
diff --git a/ext/phar/tests/stat2_5.3.phpt b/ext/phar/tests/stat2_5.3.phpt
index 8962d61aa6..d145cdd21d 100644
--- a/ext/phar/tests/stat2_5.3.phpt
+++ b/ext/phar/tests/stat2_5.3.phpt
@@ -8,8 +8,6 @@ phar.require_hash=0
--FILE--
<?php
Phar::interceptFileFuncs();
-is_file();
-is_link();
var_dump(is_file(__FILE__));
$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar';
@@ -39,9 +37,6 @@ include $fname3;
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?>
--EXPECTF--
-Warning: is_file() expects exactly 1 parameter, 0 given in %sstat2_5.3.php on line %d
-
-Warning: is_link() expects exactly 1 parameter, 0 given in %sstat2_5.3.php on line %d
bool(true)
is_link
bool(false)
diff --git a/ext/phar/tests/tar/open_for_write_existing_b.phpt b/ext/phar/tests/tar/open_for_write_existing_b.phpt
index fda72c36e8..93d40845db 100644
--- a/ext/phar/tests/tar/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/tar/open_for_write_existing_b.phpt
@@ -29,9 +29,7 @@ foreach ($files as $n => $file) {
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
@@ -42,10 +40,7 @@ include $alias . '/b/c.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
+bool(false)
This is b/c
===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_existing_c.phpt b/ext/phar/tests/tar/open_for_write_existing_c.phpt
index 03ebf35912..976c7358b0 100644
--- a/ext/phar/tests/tar/open_for_write_existing_c.phpt
+++ b/ext/phar/tests/tar/open_for_write_existing_c.phpt
@@ -29,9 +29,7 @@ foreach ($files as $n => $file) {
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
@@ -42,10 +40,7 @@ include $alias . '/b/c.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
+bool(false)
This is b/c
===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_newfile_b.phpt b/ext/phar/tests/tar/open_for_write_newfile_b.phpt
index cc4333150a..dd28ff747a 100644
--- a/ext/phar/tests/tar/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/tar/open_for_write_newfile_b.phpt
@@ -29,9 +29,7 @@ foreach ($files as $n => $file) {
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
@@ -43,10 +41,7 @@ include $alias . '/b/new.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
+bool(false)
This is b/c
Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d
diff --git a/ext/phar/tests/tar/open_for_write_newfile_c.phpt b/ext/phar/tests/tar/open_for_write_newfile_c.phpt
index 36b5a423d1..aae6e424d1 100644
--- a/ext/phar/tests/tar/open_for_write_newfile_c.phpt
+++ b/ext/phar/tests/tar/open_for_write_newfile_c.phpt
@@ -29,9 +29,7 @@ foreach ($files as $n => $file) {
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
@@ -42,10 +40,7 @@ include $alias . '/b/new.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
+bool(false)
This is b/c
Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d
diff --git a/ext/phar/tests/tar/phar_commitwrite.phpt b/ext/phar/tests/tar/phar_commitwrite.phpt
index 391be219cc..ec36a60583 100644
--- a/ext/phar/tests/tar/phar_commitwrite.phpt
+++ b/ext/phar/tests/tar/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
@@ -32,10 +31,9 @@ unlink(__DIR__ . '/phar_commitwrite.phar.tar');
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/phar/tests/zip/open_for_write_existing_b.phpt b/ext/phar/tests/zip/open_for_write_existing_b.phpt
index 35bd6cf3ec..9559b1740d 100644
--- a/ext/phar/tests/zip/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/zip/open_for_write_existing_b.phpt
@@ -29,9 +29,7 @@ $phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
?>
===DONE===
@@ -39,9 +37,6 @@ include $alias . '/b/c.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_b.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_b.php on line %d
+bool(false)
This is b/c
===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_existing_c.phpt b/ext/phar/tests/zip/open_for_write_existing_c.phpt
index 8c58025608..2071aaeeef 100644
--- a/ext/phar/tests/zip/open_for_write_existing_c.phpt
+++ b/ext/phar/tests/zip/open_for_write_existing_c.phpt
@@ -29,9 +29,7 @@ $phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
?>
===DONE===
@@ -39,9 +37,6 @@ include $alias . '/b/c.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_c.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
+bool(false)
This is b/c
===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_newfile_b.phpt b/ext/phar/tests/zip/open_for_write_newfile_b.phpt
index d39dffb986..9e851be30a 100644
--- a/ext/phar/tests/zip/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/zip/open_for_write_newfile_b.phpt
@@ -29,9 +29,7 @@ $phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
@@ -42,10 +40,7 @@ include $alias . '/b/new.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
+bool(false)
This is b/c
Warning: include(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.zip" in %sopen_for_write_newfile_b.php on line %d
diff --git a/ext/phar/tests/zip/open_for_write_newfile_c.phpt b/ext/phar/tests/zip/open_for_write_newfile_c.phpt
index f927a618cc..bb46affc07 100644
--- a/ext/phar/tests/zip/open_for_write_newfile_c.phpt
+++ b/ext/phar/tests/zip/open_for_write_newfile_c.phpt
@@ -29,9 +29,7 @@ $phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
@@ -42,10 +40,7 @@ include $alias . '/b/new.php';
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
+bool(false)
This is b/c
Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.zip" in %sopen_for_write_newfile_c.php on line %d
diff --git a/ext/phar/tests/zip/phar_commitwrite.phpt b/ext/phar/tests/zip/phar_commitwrite.phpt
index e95413fb24..04fe255869 100644
--- a/ext/phar/tests/zip/phar_commitwrite.phpt
+++ b/ext/phar/tests/zip/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
@@ -32,10 +31,9 @@ unlink(__DIR__ . '/phar_commitwrite.phar.zip');
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
index 17d8b038c2..3f99c1af5f 100644
--- a/ext/posix/php_posix.h
+++ b/ext/posix/php_posix.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/ext/posix/posix.c b/ext/posix/posix.c
index 98dae1ca3c..7e97f4ae69 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.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, |
@@ -25,7 +23,7 @@
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
#include "php_posix.h"
-
+#include "posix_arginfo.h"
#if HAVE_POSIX
@@ -52,172 +50,6 @@
ZEND_DECLARE_MODULE_GLOBALS(posix)
static PHP_MINFO_FUNCTION(posix);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_kill, 0, 0, 2)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, sig)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getpid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getppid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getuid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setuid, 0, 0, 1)
- ZEND_ARG_INFO(0, uid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_geteuid, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SETEUID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_seteuid, 0, 0, 1)
- ZEND_ARG_INFO(0, uid)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getgid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setgid, 0, 0, 1)
- ZEND_ARG_INFO(0, gid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getegid, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SETEGID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setegid, 0, 0, 1)
- ZEND_ARG_INFO(0, gid)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETGROUPS
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getgroups, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETLOGIN
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getlogin, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getpgrp, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SETSID
-ZEND_BEGIN_ARG_INFO(arginfo_posix_setsid, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setpgid, 0, 0, 2)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, pgid)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETPGID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpgid, 0, 0, 1)
- ZEND_ARG_INFO(0, pid)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETSID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getsid, 0, 0, 1)
- ZEND_ARG_INFO(0, pid)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_uname, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_times, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_CTERMID
-ZEND_BEGIN_ARG_INFO(arginfo_posix_ctermid, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_ttyname, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_isatty, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getcwd, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_MKFIFO
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_mkfifo, 0, 0, 2)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_MKNOD
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_mknod, 0, 0, 2)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, major)
- ZEND_ARG_INFO(0, minor)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_access, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrnam, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrgid, 0, 0, 1)
- ZEND_ARG_INFO(0, gid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwnam, 0, 0, 1)
- ZEND_ARG_INFO(0, username)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwuid, 0, 0, 1)
- ZEND_ARG_INFO(0, uid)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETRLIMIT
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getrlimit, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_SETRLIMIT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setrlimit, 0, 0, 3)
- ZEND_ARG_INFO(0, resource)
- ZEND_ARG_INFO(0, softlimit)
- ZEND_ARG_INFO(0, hardlimit)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_get_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_strerror, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_INITGROUPS
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_initgroups, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, base_group_id)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
/* {{{ posix_functions[]
*/
static const zend_function_entry posix_functions[] = {
@@ -302,7 +134,7 @@ static const zend_function_entry posix_functions[] = {
#endif
PHP_FE(posix_get_last_error, arginfo_posix_get_last_error)
- PHP_FALIAS(posix_errno, posix_get_last_error, arginfo_posix_get_last_error)
+ PHP_FALIAS(posix_errno, posix_get_last_error, arginfo_posix_errno)
PHP_FE(posix_strerror, arginfo_posix_strerror)
#ifdef HAVE_INITGROUPS
PHP_FE(posix_initgroups, arginfo_posix_initgroups)
@@ -446,7 +278,7 @@ ZEND_GET_MODULE(posix)
zend_long val; \
ZEND_PARSE_PARAMETERS_START(1, 1) \
Z_PARAM_LONG(val) \
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); \
+ ZEND_PARSE_PARAMETERS_END(); \
if (func_name(val) < 0) { \
POSIX_G(last_error) = errno; \
RETURN_FALSE; \
@@ -463,7 +295,7 @@ PHP_FUNCTION(posix_kill)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(pid)
Z_PARAM_LONG(sig)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (kill(pid, sig) < 0) {
POSIX_G(last_error) = errno;
@@ -629,7 +461,7 @@ PHP_FUNCTION(posix_setpgid)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(pid)
Z_PARAM_LONG(pgid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (setpgid(pid, pgid) < 0) {
POSIX_G(last_error) = errno;
@@ -649,7 +481,7 @@ PHP_FUNCTION(posix_getpgid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(val)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((val = getpgid(val)) < 0) {
POSIX_G(last_error) = errno;
@@ -669,7 +501,7 @@ PHP_FUNCTION(posix_getsid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(val)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((val = getsid(val)) < 0) {
POSIX_G(last_error) = errno;
@@ -769,7 +601,6 @@ static int php_posix_stream_get_fd(zval *zfp, int *fd) /* {{{ */
php_stream_from_zval_no_verify(stream, zfp);
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "expects argument 1 to be a valid stream resource");
return 0;
}
if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT) == SUCCESS) {
@@ -798,7 +629,7 @@ PHP_FUNCTION(posix_ttyname)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(z_fd)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (Z_TYPE_P(z_fd)) {
case IS_RESOURCE:
@@ -842,7 +673,7 @@ PHP_FUNCTION(posix_isatty)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(z_fd)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (Z_TYPE_P(z_fd)) {
case IS_RESOURCE:
@@ -908,7 +739,7 @@ PHP_FUNCTION(posix_mkfifo)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_PATH_STR(path)
Z_PARAM_LONG(mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir_ex(ZSTR_VAL(path), 0)) {
RETURN_FALSE;
@@ -942,7 +773,7 @@ PHP_FUNCTION(posix_mknod)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(major)
Z_PARAM_LONG(minor)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir_ex(ZSTR_VAL(path), 0)) {
RETURN_FALSE;
@@ -1033,7 +864,7 @@ PHP_FUNCTION(posix_access)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
path = expand_filepath(filename, NULL);
if (!path) {
@@ -1081,7 +912,7 @@ PHP_FUNCTION(posix_getgrnam)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(name, name_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
@@ -1137,7 +968,7 @@ PHP_FUNCTION(posix_getgrgid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(gid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
@@ -1207,7 +1038,7 @@ PHP_FUNCTION(posix_getpwnam)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(name, name_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -1257,7 +1088,7 @@ PHP_FUNCTION(posix_getpwuid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(uid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -1422,7 +1253,7 @@ PHP_FUNCTION(posix_setrlimit)
Z_PARAM_LONG(res)
Z_PARAM_LONG(cur)
Z_PARAM_LONG(max)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
rl.rlim_cur = cur;
rl.rlim_max = max;
@@ -1457,7 +1288,7 @@ PHP_FUNCTION(posix_strerror)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(error)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_STRING(strerror(error));
}
@@ -1477,7 +1308,7 @@ PHP_FUNCTION(posix_initgroups)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(name, name_len)
Z_PARAM_LONG(basegid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (name_len == 0) {
RETURN_FALSE;
diff --git a/ext/posix/posix.stub.php b/ext/posix/posix.stub.php
new file mode 100644
index 0000000000..625a087de6
--- /dev/null
+++ b/ext/posix/posix.stub.php
@@ -0,0 +1,118 @@
+<?php
+
+function posix_kill(int $pid, int $sig): bool {}
+
+function posix_getpid(): int {}
+
+function posix_getppid(): int {}
+
+function posix_getuid(): int {}
+
+function posix_setuid(int $uid): bool {}
+
+function posix_geteuid(): int {}
+
+#ifdef HAVE_SETEUID
+function posix_seteuid(int $uid): bool {}
+#endif
+
+function posix_getgid(): int {}
+
+function posix_setgid(int $gid): bool {}
+
+function posix_getegid(): int {}
+
+#ifdef HAVE_SETEGID
+function posix_setegid(int $gid): bool {}
+#endif
+
+#ifdef HAVE_GETGROUPS
+/** @return array|false */
+function posix_getgroups() {}
+#endif
+
+#ifdef HAVE_GETLOGIN
+/** @return string|false */
+function posix_getlogin() {}
+#endif
+
+function posix_getpgrp(): int {}
+
+#ifdef HAVE_SETSID
+function posix_setsid(): int {}
+#endif
+
+function posix_setpgid(int $pid, int $pgid): bool {}
+
+#ifdef HAVE_GETPGID
+/** @return int|false */
+function posix_getpgid(int $pid) {}
+#endif
+
+#ifdef HAVE_GETSID
+/** @return int|false */
+function posix_getsid(int $pid) {}
+#endif
+
+/** @return array|false */
+function posix_uname() {}
+
+/** @return array|false */
+function posix_times() {}
+
+
+#ifdef HAVE_CTERMID
+/** @return string|false */
+function posix_ctermid() {}
+#endif
+
+/**
+ * @return string|false
+ */
+function posix_ttyname($fd) {}
+
+function posix_isatty($fd): bool {}
+
+/** @return string|false */
+function posix_getcwd() {}
+
+#ifdef HAVE_MKFIFO
+function posix_mkfifo(string $pathname, int $mode): bool {}
+#endif
+
+#ifdef HAVE_MKNOD
+function posix_mknod(string $pathname, int $mode, int $major = 0, int $minor = 0): bool {}
+#endif
+
+function posix_access(string $file, int $mode = 0): bool {}
+
+/** @return array|false */
+function posix_getgrnam(string $name) {}
+
+/** @return array|false */
+function posix_getgrgid(int $gid) {}
+
+/** @return array|false */
+function posix_getpwnam(string $username) {}
+
+/** @return array|false */
+function posix_getpwuid(int $uid) {}
+
+#ifdef HAVE_GETRLIMIT
+/** @return array|false */
+function posix_getrlimit() {}
+#endif
+
+#ifdef HAVE_SETRLIMIT
+function posix_setrlimit(int $resource, int $softlimit, int $hardlimit): bool {}
+#endif
+
+function posix_get_last_error(): int {}
+
+function posix_errno(): int {}
+
+function posix_strerror(int $errno): string {}
+
+#ifdef HAVE_INITGROUPS
+function posix_initgroups(string $name, int $base_group_id): bool {}
+#endif
diff --git a/ext/posix/posix_arginfo.h b/ext/posix/posix_arginfo.h
new file mode 100644
index 0000000000..91042fb692
--- /dev/null
+++ b/ext/posix/posix_arginfo.h
@@ -0,0 +1,158 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, sig, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_getpid, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_getppid arginfo_posix_getpid
+
+#define arginfo_posix_getuid arginfo_posix_getpid
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setuid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_geteuid arginfo_posix_getpid
+
+#if defined(HAVE_SETEUID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_seteuid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_posix_getgid arginfo_posix_getpid
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setgid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_getegid arginfo_posix_getpid
+
+#if defined(HAVE_SETEGID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setegid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETGROUPS)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgroups, 0, 0, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETLOGIN)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getlogin, 0, 0, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_posix_getpgrp arginfo_posix_getpid
+
+#if defined(HAVE_SETSID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setsid, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setpgid, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pgid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GETPGID)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpgid, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETSID)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getsid, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_uname, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_times arginfo_posix_uname
+
+#if defined(HAVE_CTERMID)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_ctermid, 0, 0, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_ttyname, 0, 0, 1)
+ ZEND_ARG_INFO(0, fd)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_isatty, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, fd)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_getcwd arginfo_posix_uname
+
+#if defined(HAVE_MKFIFO)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mkfifo, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_MKNOD)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mknod, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, major, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, minor, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_access, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrnam, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrgid, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwnam, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwuid, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GETRLIMIT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getrlimit, 0, 0, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SETRLIMIT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setrlimit, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, resource, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, softlimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, hardlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_posix_get_last_error arginfo_posix_getpid
+
+#define arginfo_posix_errno arginfo_posix_getpid
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_strerror, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_INITGROUPS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_initgroups, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, base_group_id, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/posix/tests/posix_errno_error.phpt b/ext/posix/tests/posix_errno_error.phpt
deleted file mode 100644
index 0a77fb0009..0000000000
--- a/ext/posix/tests/posix_errno_error.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Test function posix_errno() by calling it with its expected arguments
---SKIPIF--
-<?php
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
-?>
---CREDITS--
-Morten Amundsen mor10am@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-echo "*** Test by calling method or function with more than expected arguments ***\n";
-
-// test without any error
-var_dump(posix_errno('bar'));
-
-?>
---EXPECTF--
-*** Test by calling method or function with more than expected arguments ***
-
-Warning: posix_errno() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/posix/tests/posix_getcwd.phpt b/ext/posix/tests/posix_getcwd.phpt
index 20f7b0372e..f6f180925a 100644
--- a/ext/posix/tests/posix_getcwd.phpt
+++ b/ext/posix/tests/posix_getcwd.phpt
@@ -9,11 +9,7 @@ if (!function_exists('posix_getcwd')) die('skip posix_getcwd() not found');
<?php
var_dump(posix_getcwd());
-var_dump(posix_getcwd(1));
?>
--EXPECTF--
string(%d) "%s"
-
-Warning: posix_getcwd() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/posix/tests/posix_getgrgid_error.phpt b/ext/posix/tests/posix_getgrgid_error.phpt
index ef7fa57a9d..e9dbe2a6ce 100644
--- a/ext/posix/tests/posix_getgrgid_error.phpt
+++ b/ext/posix/tests/posix_getgrgid_error.phpt
@@ -14,17 +14,6 @@ Test posix_getgrgid() function : error conditions
echo "*** Testing posix_getgrgid() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n";
-var_dump( posix_getgrgid() );
-
-//Test posix_getgrgid with one more than the expected number of arguments
-echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n";
-
-$extra_arg = 10;
-$gid = 0;
-var_dump( posix_getgrgid($gid, $extra_arg) );
-
echo "\n-- Testing posix_getgrgid() function with a negative group id --\n";
$gid = -999;
var_dump( posix_getgrgid($gid));
@@ -34,16 +23,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_getgrgid() : error conditions ***
--- Testing posix_getgrgid() function with Zero arguments --
-
-Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_getgrgid() function with more than expected no. of arguments --
-
-Warning: posix_getgrgid() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_getgrgid() function with a negative group id --
bool(false)
Done
diff --git a/ext/posix/tests/posix_getpgid_error.phpt b/ext/posix/tests/posix_getpgid_error.phpt
index 88d68554ee..19e306b2ee 100644
--- a/ext/posix/tests/posix_getpgid_error.phpt
+++ b/ext/posix/tests/posix_getpgid_error.phpt
@@ -16,14 +16,6 @@ if((!extension_loaded("posix")) || (!function_exists("posix_getpgid"))) {
echo "*** Testing posix_getpgid() : error conditions ***\n";
-echo "\n-- Testing posix_getpgid() function no arguments --\n";
-var_dump( posix_getpgid() );
-
-echo "\n-- Testing posix_getpgid() with one extra argument --\n";
-$pid = 10;
-$extra_arg = 20;
-var_dump( posix_getpgid($pid, $extra_arg) );
-
echo "\n-- Testing posix_getpgid() with negative pid --\n";
$pid = -99;
var_dump( posix_getpgid($pid) );
@@ -33,16 +25,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_getpgid() : error conditions ***
--- Testing posix_getpgid() function no arguments --
-
-Warning: posix_getpgid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_getpgid() with one extra argument --
-
-Warning: posix_getpgid() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_getpgid() with negative pid --
bool(false)
Done
diff --git a/ext/posix/tests/posix_getpwuid_error.phpt b/ext/posix/tests/posix_getpwuid_error.phpt
index 440edf6a76..365033b689 100644
--- a/ext/posix/tests/posix_getpwuid_error.phpt
+++ b/ext/posix/tests/posix_getpwuid_error.phpt
@@ -14,14 +14,6 @@ Test posix_getpwuid() function : error conditions
echo "*** Testing posix_getpwuid() : error conditions ***\n";
-echo "\n-- Testing posix_getpwuid() function with Zero arguments --\n";
-var_dump( posix_getpwuid() );
-
-echo "\n-- Testing posix_getpwuid() function with more than expected no. of arguments --\n";
-$uid = posix_getuid();
-$extra_arg = 10;
-var_dump( posix_getpwuid($uid, $extra_arg) );
-
echo "\n-- Testing posix_getpwuid() function negative uid --\n";
$uid = -99;
var_dump( posix_getpwuid($uid) );
@@ -31,16 +23,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_getpwuid() : error conditions ***
--- Testing posix_getpwuid() function with Zero arguments --
-
-Warning: posix_getpwuid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_getpwuid() function with more than expected no. of arguments --
-
-Warning: posix_getpwuid() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_getpwuid() function negative uid --
bool(false)
Done
diff --git a/ext/posix/tests/posix_getsid_error.phpt b/ext/posix/tests/posix_getsid_error.phpt
index 6013a40b96..833ae9a0db 100644
--- a/ext/posix/tests/posix_getsid_error.phpt
+++ b/ext/posix/tests/posix_getsid_error.phpt
@@ -13,16 +13,9 @@ PHP Testfest Berlin 2009-05-10
?>
--FILE--
<?php
-var_dump( posix_getsid() );
-var_dump( posix_getsid(array()) );
var_dump( posix_getsid(-1) );
?>
===DONE===
--EXPECTF--
-Warning: posix_getsid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: posix_getsid() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
bool(false)
===DONE===
diff --git a/ext/posix/tests/posix_initgroups.phpt b/ext/posix/tests/posix_initgroups.phpt
index 5b0ec8adad..20cf8cef8b 100644
--- a/ext/posix/tests/posix_initgroups.phpt
+++ b/ext/posix/tests/posix_initgroups.phpt
@@ -8,11 +8,8 @@ if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found
--FILE--
<?php
-var_dump(posix_initgroups('foo', 'bar'));
var_dump(posix_initgroups(NULL, NULL));
?>
--EXPECTF--
-Warning: posix_initgroups() expects parameter 2 to be int, string given in %s on line %d
-bool(false)
bool(false)
diff --git a/ext/posix/tests/posix_kill_error.phpt b/ext/posix/tests/posix_kill_error.phpt
index 0c8f6ef642..89474c4994 100644
--- a/ext/posix/tests/posix_kill_error.phpt
+++ b/ext/posix/tests/posix_kill_error.phpt
@@ -16,16 +16,6 @@ Test posix_kill() function : error conditions
echo "*** Testing posix_kill() : error conditions ***\n";
-echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
-$pid = posix_getpid();
-$sig = 9;
-$extra_arg = 10;
-var_dump( posix_kill($pid, $sig, $extra_arg) );
-
-echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
-$pid = posix_getpid();
-var_dump( posix_kill($pid) );
-
echo "\n-- Testing posix_kill() function with invalid signal --\n";
$pid = posix_getpid();
$sig = 999;
@@ -41,16 +31,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_kill() : error conditions ***
--- Testing posix_kill() function with more than expected no. of arguments --
-
-Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
--- Testing posix_kill() function with less than expected no. of arguments --
-
-Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
-- Testing posix_kill() function with invalid signal --
bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation4.phpt b/ext/posix/tests/posix_seteuid_variation4.phpt
deleted file mode 100644
index 4224bafa82..0000000000
--- a/ext/posix/tests/posix_seteuid_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test function posix_seteuid() by substituting argument 1 with float values.
---SKIPIF--
-<?php
- PHP_INT_SIZE == 4 or die("skip - 32-bit only");
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
-?>
---CREDITS--
-Marco Fabbri mrfabbri@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with float values ***\n";
-
-$myUid = posix_getuid();
-
-$myUid = $myUid - 1.1;
-
-$variation_array = array(
- 'float '.$myUid => $myUid,
- 'float -'.$myUid => -$myUid,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(posix_seteuid( $var ) );
-}
-?>
---EXPECTF--
-*** Test substituting argument 1 with float values ***
-bool(false)
-bool(false)
-
-Warning: posix_seteuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: posix_seteuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-bool(false)
diff --git a/ext/posix/tests/posix_setgid_variation4.phpt b/ext/posix/tests/posix_setgid_variation4.phpt
deleted file mode 100644
index d85b5a900a..0000000000
--- a/ext/posix/tests/posix_setgid_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test function posix_setgid() by substituting argument 1 with float values.
---SKIPIF--
-<?php
- PHP_INT_SIZE == 4 or die("skip - 32-bit only");
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
-?>
---CREDITS--
-Marco Fabbri mrfabbri@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with float values ***\n";
-
-
-
-$variation_array = array(
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(posix_setgid( $var ) );
-}
-?>
-===DONE===
---EXPECTF--
-*** Test substituting argument 1 with float values ***
-bool(false)
-bool(false)
-
-Warning: posix_setgid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: posix_setgid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/posix/tests/posix_setuid_variation4.phpt b/ext/posix/tests/posix_setuid_variation4.phpt
deleted file mode 100644
index 7423ba324e..0000000000
--- a/ext/posix/tests/posix_setuid_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test function posix_setuid() by substituting argument 1 with float values.
---SKIPIF--
-<?php
- PHP_INT_SIZE == 4 or die("skip - 32-bit only");
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
-?>
---CREDITS--
-Marco Fabbri mrfabbri@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with float values ***\n";
-
-$myUid = posix_getuid();
-
-$myUid = $myUid - 1.1;
-
-$variation_array = array(
- 'float '.$myUid => $myUid,
- 'float -'.$myUid => -$myUid,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(posix_setuid( $var ) );
-}
-?>
---EXPECTF--
-*** Test substituting argument 1 with float values ***
-bool(false)
-bool(false)
-
-Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-bool(false)
diff --git a/ext/posix/tests/posix_strerror_error.phpt b/ext/posix/tests/posix_strerror_error.phpt
index 3007f976c6..60b096656a 100644
--- a/ext/posix/tests/posix_strerror_error.phpt
+++ b/ext/posix/tests/posix_strerror_error.phpt
@@ -14,14 +14,6 @@ Test posix_strerror() function : error conditions
echo "*** Testing posix_strerror() : error conditions ***\n";
-echo "\n-- Testing posix_strerror() function with Zero arguments --\n";
-var_dump( posix_strerror() );
-
-echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n";
-$errno = posix_get_last_error();
-$extra_arg = 10;
-var_dump( posix_strerror($errno, $extra_arg) );
-
echo "\n-- Testing posix_strerror() function with invalid error number --\n";
$errno = -999;
echo gettype( posix_strerror($errno) )."\n";
@@ -31,16 +23,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_strerror() : error conditions ***
--- Testing posix_strerror() function with Zero arguments --
-
-Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_strerror() function with more than expected no. of arguments --
-
-Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_strerror() function with invalid error number --
string
Done
diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
index 158a2d0ca7..4ff7aaf3fe 100644
--- a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
+++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
@@ -3,6 +3,7 @@ Test posix_ttyname() with wrong parameters
--DESCRIPTION--
Gets the absolute path to the current terminal device that is open on a given file descriptor.
Source code: ext/posix/posix.c
+
--CREDITS--
Falko Menge, mail at falko-menge dot de
PHP Testfest Berlin 2009-05-10
@@ -11,27 +12,22 @@ PHP Testfest Berlin 2009-05-10
if (!extension_loaded('posix')) {
die('SKIP - POSIX extension not available');
}
- if (!extension_loaded('gd')) {
- die('SKIP - GD extension not available');
- }
- if (!function_exists('imagecreate')) {
- die('SKIP - Function imagecreate() not available');
+
+ if (!function_exists('curl_init')) {
+ die('SKIP - Function curl_init() not available');
}
?>
--FILE--
<?php
- var_dump(posix_ttyname()); // param missing
- var_dump(posix_ttyname(0)); // param not a ressource
- var_dump(posix_ttyname(imagecreate(1, 1))); // wrong resource type
+var_dump(posix_ttyname(0)); // param not a ressource
+try {
+ var_dump(posix_ttyname(curl_init())); // wrong resource type
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
-Warning: posix_ttyname() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-bool(false)
-
-Warning: posix_ttyname(): supplied resource is not a valid stream resource in %s on line %d
-
-Warning: posix_ttyname(): expects argument 1 to be a valid stream resource in %s on line %d
+--EXPECT--
bool(false)
+posix_ttyname(): supplied resource is not a valid stream resource
===DONE===
diff --git a/ext/posix/tests/posix_ttyname_variation6.phpt b/ext/posix/tests/posix_ttyname_variation6.phpt
index eecae6769e..691c5eea7e 100644
--- a/ext/posix/tests/posix_ttyname_variation6.phpt
+++ b/ext/posix/tests/posix_ttyname_variation6.phpt
@@ -18,7 +18,7 @@ echo "*** Test substituting argument 1 with object values ***\n";
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
if (error_reporting() != 0) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
diff --git a/ext/pspell/php_pspell.h b/ext/pspell/php_pspell.h
index aa0fe0b8e6..85d7eb5b15 100644
--- a/ext/pspell/php_pspell.h
+++ b/ext/pspell/php_pspell.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/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 4e5e34e6b5..36bca739cb 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.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, |
@@ -34,6 +32,7 @@
#include "php_pspell.h"
#include <pspell.h>
#include "ext/standard/info.h"
+#include "pspell_arginfo.h"
#define PSPELL_FAST 1L
#define PSPELL_NORMAL 2L
@@ -68,110 +67,6 @@ static PHP_FUNCTION(pspell_config_data_dir);
static PHP_FUNCTION(pspell_config_repl);
static PHP_FUNCTION(pspell_config_save_repl);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new, 0, 0, 1)
- ZEND_ARG_INFO(0, language)
- ZEND_ARG_INFO(0, spelling)
- ZEND_ARG_INFO(0, jargon)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_personal, 0, 0, 2)
- ZEND_ARG_INFO(0, personal)
- ZEND_ARG_INFO(0, language)
- ZEND_ARG_INFO(0, spelling)
- ZEND_ARG_INFO(0, jargon)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_config, 0, 0, 1)
- ZEND_ARG_INFO(0, config)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_check, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_suggest, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_store_replacement, 0, 0, 3)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, misspell)
- ZEND_ARG_INFO(0, correct)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_add_to_personal, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_add_to_session, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_clear_session, 0, 0, 1)
- ZEND_ARG_INFO(0, pspell)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_save_wordlist, 0, 0, 1)
- ZEND_ARG_INFO(0, pspell)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_create, 0, 0, 1)
- ZEND_ARG_INFO(0, language)
- ZEND_ARG_INFO(0, spelling)
- ZEND_ARG_INFO(0, jargon)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_runtogether, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, runtogether)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_mode, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_ignore, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, ignore)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_personal, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, personal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_dict_dir, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_data_dir, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_repl, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, repl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_save_repl, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, save)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ pspell_functions[]
*/
static const zend_function_entry pspell_functions[] = {
diff --git a/ext/pspell/pspell.stub.php b/ext/pspell/pspell.stub.php
new file mode 100644
index 0000000000..4d33d789f3
--- /dev/null
+++ b/ext/pspell/pspell.stub.php
@@ -0,0 +1,43 @@
+<?php
+
+/** @return int|false */
+function pspell_new(string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, int $mode = 0) {}
+
+/** @return int|false */
+function pspell_new_personal(string $personal, string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, $mode = 0) {}
+
+/** @return int|false */
+function pspell_new_config(int $config) {}
+
+function pspell_check(int $pspell, string $word): bool {}
+
+/** @return array|false */
+function pspell_suggest(int $pspell, string $word) {}
+
+function pspell_store_replacement(int $pspell, string $misspell, string $correct): bool {}
+
+function pspell_add_to_personal(int $pspell, string $word): bool {}
+
+function pspell_add_to_session(int $pspell, string $word): bool {}
+
+function pspell_clear_session(int $pspell): bool {}
+
+function pspell_save_wordlist(int $pspell): bool {}
+
+function pspell_config_create(string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN): int {}
+
+function pspell_config_runtogether(int $conf, bool $runtogether): bool {}
+
+function pspell_config_mode(int $conf, int $mode): bool {}
+
+function pspell_config_ignore(int $conf, int $ignore): bool {}
+
+function pspell_config_personal(int $conf, string $personal): bool {}
+
+function pspell_config_dict_dir(int $conf, string $directory): bool {}
+
+function pspell_config_data_dir(int $conf, string $directory): bool {}
+
+function pspell_config_repl(int $conf, string $repl): bool {}
+
+function pspell_config_save_repl(int $conf, bool $save): bool {}
diff --git a/ext/pspell/pspell_arginfo.h b/ext/pspell/pspell_arginfo.h
new file mode 100644
index 0000000000..e406fb20a8
--- /dev/null
+++ b/ext/pspell/pspell_arginfo.h
@@ -0,0 +1,92 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_personal, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, personal, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_INFO(0, mode)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_config, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_check, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_suggest, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_store_replacement, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, misspell, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, correct, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pspell_add_to_personal arginfo_pspell_check
+
+#define arginfo_pspell_add_to_session arginfo_pspell_check
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_clear_session, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pspell_save_wordlist arginfo_pspell_clear_session
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_create, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_runtogether, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, runtogether, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_mode, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_ignore, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ignore, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_personal, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, personal, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_dict_dir, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pspell_config_data_dir arginfo_pspell_config_dict_dir
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_repl, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, repl, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_save_repl, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/pspell/tests/002.phpt b/ext/pspell/tests/002.phpt
index 1b0dc2cdfa..538775d013 100644
--- a/ext/pspell/tests/002.phpt
+++ b/ext/pspell/tests/002.phpt
@@ -10,15 +10,12 @@ if (!@pspell_new('en')) die('skip English dictionary is not available');
$p = pspell_new('en');
-var_dump(pspell_check('a'));
var_dump(pspell_check($p, 'somebogusword'));
var_dump(pspell_add_to_session($p, ''));
var_dump(pspell_add_to_session($p, 'somebogusword'));
var_dump(pspell_check($p, 'somebogusword'));
-var_dump(pspell_clear_session(new stdclass));
-
$res = @pspell_clear_session($p);
if ($res) {
var_dump($res);
@@ -29,14 +26,9 @@ if ($res) {
}
?>
--EXPECTF--
-Warning: pspell_check() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
bool(false)
bool(false)
bool(true)
bool(true)
-
-Warning: pspell_clear_session() expects parameter 1 to be int, object given in %s on line %d
-NULL
bool(true)
bool(false)
diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h
index 8d55228a7f..28772e79af 100644
--- a/ext/readline/php_readline.h
+++ b/ext/readline/php_readline.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/ext/readline/readline.c b/ext/readline/readline.c
index 174556d4d3..7a1ea53954 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.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, |
@@ -25,6 +23,7 @@
#include "php.h"
#include "php_readline.h"
#include "readline_cli.h"
+#include "readline_arginfo.h"
#if HAVE_LIBREADLINE || HAVE_LIBEDIT
@@ -71,62 +70,6 @@ PHP_MINFO_FUNCTION(readline);
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline, 0, 0, 0)
- ZEND_ARG_INFO(0, prompt)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0)
- ZEND_ARG_INFO(0, varname)
- ZEND_ARG_INFO(0, newvalue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_add_history, 0, 0, 1)
- ZEND_ARG_INFO(0, prompt)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_clear_history, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_HISTORY_LIST
-ZEND_BEGIN_ARG_INFO(arginfo_readline_list_history, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_read_history, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_write_history, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_completion_function, 0, 0, 1)
- ZEND_ARG_INFO(0, funcname)
-ZEND_END_ARG_INFO()
-
-#if HAVE_RL_CALLBACK_READ_CHAR
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_callback_handler_install, 0, 0, 2)
- ZEND_ARG_INFO(0, prompt)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_callback_read_char, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_callback_handler_remove, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_redisplay, 0)
-ZEND_END_ARG_INFO()
-
-#if HAVE_RL_ON_NEW_LINE
-ZEND_BEGIN_ARG_INFO(arginfo_readline_on_new_line, 0)
-ZEND_END_ARG_INFO()
-#endif
-#endif
-/* }}} */
-
/* {{{ module stuff */
static const zend_function_entry php_readline_functions[] = {
PHP_FE(readline, arginfo_readline)
diff --git a/ext/readline/readline.stub.php b/ext/readline/readline.stub.php
new file mode 100644
index 0000000000..ba157b54e4
--- /dev/null
+++ b/ext/readline/readline.stub.php
@@ -0,0 +1,42 @@
+<?php
+
+/** @return string|false */
+function readline(?string $prompt = null) {}
+
+/** @return mixed */
+function readline_info(string $varname = UNKNOWN, string $newvalue = UNKNOWN) {}
+
+function readline_add_history(string $prompt): bool {}
+
+function readline_clear_history(): bool {}
+
+#ifdef HAVE_HISTORY_LIST
+function readline_list_history(): array {}
+#endif
+
+function readline_read_history(string $filename = UNKNOWN): bool {}
+
+function readline_write_history(string $filename = UNKNOWN): bool {}
+
+/**
+ * @param callable $funcname
+ */
+function readline_completion_function($funcname): bool {}
+
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+/**
+ * @param callable $callback
+ */
+function readline_callback_handler_install(string $prompt, $callback): bool {}
+
+function readline_callback_read_char(): void {}
+
+function readline_callback_handler_remove(): bool {}
+
+function readline_redisplay(): void {}
+
+#if HAVE_RL_ON_NEW_LINE
+function readline_on_new_line(): void {}
+#endif
+#endif
diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h
new file mode 100644
index 0000000000..43c8fbccbd
--- /dev/null
+++ b/ext/readline/readline_arginfo.h
@@ -0,0 +1,58 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_readline, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, varname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newvalue, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_add_history, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_clear_history, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_HISTORY_LIST)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_list_history, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_read_history, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_readline_write_history arginfo_readline_read_history
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_completion_function, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, funcname)
+ZEND_END_ARG_INFO()
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_handler_install, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 0)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_read_char, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_handler_remove, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+#define arginfo_readline_redisplay arginfo_readline_callback_read_char
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR && HAVE_RL_ON_NEW_LINE
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_on_new_line, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index d7d96b59e1..cfbf6d564f 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.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/ext/readline/readline_cli.h b/ext/readline/readline_cli.h
index 05c70c1dac..81e73d1e4d 100644
--- a/ext/readline/readline_cli.h
+++ b/ext/readline/readline_cli.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/ext/readline/tests/bug77812-libedit.phpt b/ext/readline/tests/bug77812-libedit.phpt
index 478274a19a..0c68a2d5c8 100644
--- a/ext/readline/tests/bug77812-libedit.phpt
+++ b/ext/readline/tests/bug77812-libedit.phpt
@@ -29,6 +29,9 @@ bar
xx
xxx
-Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in php shell code on line %d
+Warning: Uncaught Error: Undefined constant 'FOO' in php shell code:1
+Stack trace:
+#0 {main}
+ thrown in php shell code on line 1
FOOL1
FOO42
diff --git a/ext/readline/tests/bug77812-readline.phpt b/ext/readline/tests/bug77812-readline.phpt
index 32d9f4d960..a3917ccaba 100644
--- a/ext/readline/tests/bug77812-readline.phpt
+++ b/ext/readline/tests/bug77812-readline.phpt
@@ -40,7 +40,10 @@ xxx
php > FOO
php > ;
-Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in php shell code on line %d
+Warning: Uncaught Error: Undefined constant 'FOO' in php shell code:1
+Stack trace:
+#0 {main}
+ thrown in php shell code on line 1
php > echo <<<FOO
<<< > FOOL
<<< > FOO
diff --git a/ext/readline/tests/libedit_callback_handler_install_001.phpt b/ext/readline/tests/libedit_callback_handler_install_001.phpt
index b5d921e279..fb69ba5cb0 100644
--- a/ext/readline/tests/libedit_callback_handler_install_001.phpt
+++ b/ext/readline/tests/libedit_callback_handler_install_001.phpt
@@ -13,7 +13,6 @@ function foo() {
var_dump(readline_callback_handler_install('testing: ', 'foo'));
var_dump(readline_callback_handler_install('testing: ', 'foobar!'));
-var_dump(readline_callback_handler_install('testing: '));
?>
--EXPECTF--
@@ -21,6 +20,3 @@ bool(true)
Warning: readline_callback_handler_install(): foobar! is not callable in %s on line %d
bool(false)
-
-Warning: readline_callback_handler_install() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_add_history_001.phpt b/ext/readline/tests/readline_add_history_001.phpt
index a4bd524736..fe7c8c406e 100644
--- a/ext/readline/tests/readline_add_history_001.phpt
+++ b/ext/readline/tests/readline_add_history_001.phpt
@@ -10,7 +10,6 @@ var_dump(readline_list_history());
var_dump(readline_add_history(NULL));
var_dump(readline_list_history());
var_dump(readline_clear_history());
-var_dump(readline_add_history());
?>
--EXPECTF--
@@ -27,6 +26,3 @@ array(2) {
string(0) ""
}
bool(true)
-
-Warning: readline_add_history() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_callback_handler_install_001.phpt b/ext/readline/tests/readline_callback_handler_install_001.phpt
index cc054b0aa6..9dd13b4de1 100644
--- a/ext/readline/tests/readline_callback_handler_install_001.phpt
+++ b/ext/readline/tests/readline_callback_handler_install_001.phpt
@@ -13,7 +13,6 @@ function foo() {
var_dump(readline_callback_handler_install('testing: ', 'foo'));
var_dump(readline_callback_handler_install('testing: ', 'foobar!'));
-var_dump(readline_callback_handler_install('testing: '));
?>
--EXPECTF--
@@ -21,6 +20,3 @@ var_dump(readline_callback_handler_install('testing: '));
Warning: readline_callback_handler_install(): foobar! is not callable in %s on line %d
bool(false)
-
-Warning: readline_callback_handler_install() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_clear_history_001.phpt b/ext/readline/tests/readline_clear_history_001.phpt
index 5df1ae77a0..8dea376ccf 100644
--- a/ext/readline/tests/readline_clear_history_001.phpt
+++ b/ext/readline/tests/readline_clear_history_001.phpt
@@ -6,11 +6,7 @@ readline_clear_history(): Basic test
<?php
var_dump(readline_clear_history());
-var_dump(readline_clear_history(1));
?>
--EXPECTF--
bool(true)
-
-Warning: readline_clear_history() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_list_history_001.phpt b/ext/readline/tests/readline_list_history_001.phpt
index 2f6f9525d2..37e1b0af17 100644
--- a/ext/readline/tests/readline_list_history_001.phpt
+++ b/ext/readline/tests/readline_list_history_001.phpt
@@ -6,12 +6,8 @@ readline_list_history(): Basic test
<?php
var_dump(readline_list_history());
-var_dump(readline_list_history(1));
?>
--EXPECTF--
array(0) {
}
-
-Warning: readline_list_history() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 94b2709763..d3e8a04006 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.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, |
@@ -246,9 +244,9 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *reflection_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- reflection_object *intern = Z_REFLECTION_P(obj);
+ reflection_object *intern = reflection_object_from_obj(obj);
*gc_data = &intern->obj;
*gc_data_count = 1;
return zend_std_get_properties(obj);
@@ -445,7 +443,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
smart_str_append_printf(str, "%s }\n", indent);
if (obj && Z_TYPE_P(obj) == IS_OBJECT) {
- HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
zend_string *prop_name;
smart_str prop_str = {0};
@@ -512,7 +510,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
/* {{{ _const_string */
static void _const_string(smart_str *str, char *name, zval *value, char *indent)
{
- char *type = zend_zval_type_name(value);
+ const char *type = zend_zval_type_name(value);
if (Z_TYPE_P(value) == IS_ARRAY) {
smart_str_append_printf(str, "%s Constant [ %s %s ] { Array }\n",
@@ -534,7 +532,7 @@ static void _const_string(smart_str *str, char *name, zval *value, char *indent)
static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char *indent)
{
char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value));
- char *type;
+ const char *type;
zval_update_constant_ex(&c->value, c->ce);
type = zend_zval_type_name(&c->value);
@@ -582,17 +580,10 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_
} else {
smart_str_append_printf(str, "<required> ");
}
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- smart_str_append_printf(str, "%s ",
- ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type)));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
if (arg_info->pass_by_reference) {
smart_str_appendc(str, '&');
@@ -802,17 +793,10 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
smart_str_free(&param_indent);
if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
smart_str_append_printf(str, " %s- Return [ ", indent);
- if (ZEND_TYPE_IS_CLASS(fptr->common.arg_info[-1].type)) {
- smart_str_append_printf(str, "%s ",
- ZSTR_VAL(ZEND_TYPE_NAME(fptr->common.arg_info[-1].type)));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
- } else if (ZEND_TYPE_IS_CODE(fptr->common.arg_info[-1].type)) {
- smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(fptr->common.arg_info[-1].type)));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
+ if (ZEND_TYPE_IS_SET(fptr->common.arg_info[-1].type)) {
+ zend_string *type_str = zend_type_to_string(fptr->common.arg_info[-1].type);
+ smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
smart_str_appends(str, "]\n");
}
@@ -1808,7 +1792,7 @@ ZEND_METHOD(reflection_function, invoke)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0);
}
result = zend_call_function(&fci, &fcc);
@@ -1871,7 +1855,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0);
}
result = zend_call_function(&fci, &fcc);
@@ -2386,9 +2370,7 @@ ZEND_METHOD(reflection_parameter, __construct)
failure:
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
- if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- zend_string_release_ex(fptr->common.function_name, 0);
- }
+ zend_string_release_ex(fptr->common.function_name, 0);
zend_free_trampoline(fptr);
}
if (is_closure) {
@@ -2567,13 +2549,15 @@ ZEND_METHOD(reflection_parameter, isArray)
{
reflection_object *intern;
parameter_reference *param;
+ zend_type type;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_ARRAY);
+ type = ZEND_TYPE_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(ZEND_TYPE_MASK(type) == MAY_BE_ARRAY);
}
/* }}} */
@@ -2583,13 +2567,15 @@ ZEND_METHOD(reflection_parameter, isCallable)
{
reflection_object *intern;
parameter_reference *param;
+ zend_type type;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_CALLABLE);
+ type = ZEND_TYPE_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(ZEND_TYPE_MASK(type) == MAY_BE_CALLABLE);
}
/* }}} */
@@ -2605,7 +2591,8 @@ ZEND_METHOD(reflection_parameter, allowsNull)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_ALLOW_NULL(param->arg_info->type));
+ RETVAL_BOOL(!ZEND_TYPE_IS_SET(param->arg_info->type)
+ || ZEND_TYPE_ALLOW_NULL(param->arg_info->type));
}
/* }}} */
@@ -2819,9 +2806,9 @@ ZEND_METHOD(reflection_type, allowsNull)
}
/* }}} */
-/* {{{ proto public bool ReflectionType::isBuiltin()
- Returns whether parameter is a builtin type */
-ZEND_METHOD(reflection_type, isBuiltin)
+/* {{{ proto public string ReflectionType::__toString()
+ Return the text of the type hint */
+ZEND_METHOD(reflection_type, __toString)
{
reflection_object *intern;
type_reference *param;
@@ -2831,26 +2818,13 @@ ZEND_METHOD(reflection_type, isBuiltin)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type));
-}
-/* }}} */
-
-/* {{{ reflection_type_name */
-static zend_string *reflection_type_name(type_reference *param) {
- if (ZEND_TYPE_IS_NAME(param->type)) {
- return zend_string_copy(ZEND_TYPE_NAME(param->type));
- } else if (ZEND_TYPE_IS_CE(param->type)) {
- return zend_string_copy(ZEND_TYPE_CE(param->type)->name);
- } else {
- char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->type));
- return zend_string_init(name, strlen(name), 0);
- }
+ RETURN_STR(zend_type_to_string(param->type));
}
/* }}} */
-/* {{{ proto public string ReflectionType::__toString()
- Return the text of the type hint */
-ZEND_METHOD(reflection_type, __toString)
+/* {{{ proto public string ReflectionNamedType::getName()
+ Return the name of the type */
+ZEND_METHOD(reflection_named_type, getName)
{
reflection_object *intern;
type_reference *param;
@@ -2860,13 +2834,13 @@ ZEND_METHOD(reflection_type, __toString)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ RETURN_STR(zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(param->type)));
}
/* }}} */
-/* {{{ proto public string ReflectionNamedType::getName()
- Return the text of the type hint */
-ZEND_METHOD(reflection_named_type, getName)
+/* {{{ proto public bool ReflectionNamedType::isBuiltin()
+ Returns whether type is a builtin type */
+ZEND_METHOD(reflection_named_type, isBuiltin)
{
reflection_object *intern;
type_reference *param;
@@ -2876,7 +2850,7 @@ ZEND_METHOD(reflection_named_type, getName)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ RETVAL_BOOL(ZEND_TYPE_IS_MASK(param->type));
}
/* }}} */
@@ -3154,7 +3128,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
}
/* }}} */
-/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, mixed* args)
+/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, [mixed* args])
Invokes the method. */
ZEND_METHOD(reflection_method, invoke)
{
@@ -3727,7 +3701,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
}
- if (!prop || (prop_info->type && Z_ISUNDEF_P(prop))) {
+ if (!prop || (ZEND_TYPE_IS_SET(prop_info->type) && Z_ISUNDEF_P(prop))) {
continue;
}
@@ -3839,7 +3813,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
}
}
- if (prop_info->type && !zend_verify_property_type(prop_info, value, 0)) {
+ if (ZEND_TYPE_IS_SET(prop_info->type) && !zend_verify_property_type(prop_info, value, 0)) {
return;
}
@@ -4156,7 +4130,6 @@ ZEND_METHOD(reflection_class, hasProperty)
zend_property_info *property_info;
zend_class_entry *ce;
zend_string *name;
- zval property;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
return;
@@ -4170,12 +4143,9 @@ ZEND_METHOD(reflection_class, hasProperty)
RETURN_TRUE;
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF) {
- ZVAL_STR_COPY(&property, name);
- if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL)) {
- zval_ptr_dtor(&property);
+ if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) {
RETURN_TRUE;
}
- zval_ptr_dtor(&property);
}
RETURN_FALSE;
}
@@ -4205,7 +4175,7 @@ ZEND_METHOD(reflection_class, getProperty)
}
} else if (Z_TYPE(intern->obj) != IS_UNDEF) {
/* Check for dynamic properties */
- if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj), name)) {
+ if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) {
zend_property_info property_info_tmp;
property_info_tmp.flags = ZEND_ACC_PUBLIC;
property_info_tmp.name = name;
@@ -4324,7 +4294,7 @@ ZEND_METHOD(reflection_class, getProperties)
} ZEND_HASH_FOREACH_END();
if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) {
- HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj);
+ HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj));
zval *prop;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
_adddynproperty(prop, key, ce, return_value);
@@ -4589,7 +4559,7 @@ ZEND_METHOD(reflection_class, isInstance)
}
/* }}} */
-/* {{{ proto public object ReflectionClass::newInstance(mixed* args, ...)
+/* {{{ proto public object ReflectionClass::newInstance([mixed* args], ...)
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstance)
{
@@ -5235,7 +5205,7 @@ ZEND_METHOD(reflection_property, __construct)
&& property_info->ce != ce)) {
/* Check for dynamic properties */
if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) {
- if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) {
+ if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(Z_OBJ_P(classname)), name)) {
dynam_prop = 1;
}
}
@@ -5494,11 +5464,10 @@ ZEND_METHOD(reflection_property, isInitialized)
if (ref->prop.flags & ZEND_ACC_STATIC) {
member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 1);
if (member_p) {
- RETURN_BOOL(!Z_ISUNDEF_P(member_p))
+ RETURN_BOOL(!Z_ISUNDEF_P(member_p));
}
RETURN_FALSE;
} else {
- zval name_zv;
zend_class_entry *old_scope;
int retval;
@@ -5513,8 +5482,7 @@ ZEND_METHOD(reflection_property, isInitialized)
old_scope = EG(fake_scope);
EG(fake_scope) = intern->ce;
- ZVAL_STR(&name_zv, ref->unmangled_name);
- retval = Z_OBJ_HT_P(object)->has_property(object, &name_zv, ZEND_PROPERTY_EXISTS, NULL);
+ retval = Z_OBJ_HT_P(object)->has_property(Z_OBJ_P(object), ref->unmangled_name, ZEND_PROPERTY_EXISTS, NULL);
EG(fake_scope) = old_scope;
RETVAL_BOOL(retval);
@@ -6267,7 +6235,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0)
- ZEND_ARG_INFO(0, args)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0)
@@ -6345,9 +6313,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method___construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invoke, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_invoke, 0, 0, 1)
ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, args)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invokeArgs, 0)
@@ -6441,8 +6409,8 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0)
- ZEND_ARG_INFO(0, args)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstance, 0, 0, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0)
@@ -6653,13 +6621,13 @@ static const zend_function_entry reflection_parameter_functions[] = {
static const zend_function_entry reflection_type_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0)
- ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0)
- ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED)
+ ZEND_ME(reflection_type, __toString, arginfo_reflection__void, 0)
PHP_FE_END
};
static const zend_function_entry reflection_named_type_functions[] = {
ZEND_ME(reflection_named_type, getName, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_named_type, isBuiltin, arginfo_reflection__void, 0)
PHP_FE_END
};
@@ -6729,20 +6697,19 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */
}; /* }}} */
/* {{{ _reflection_write_property */
-static zval *_reflection_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- if ((Z_TYPE_P(member) == IS_STRING)
- && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
- && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
- || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
+ if (zend_hash_exists(&object->ce->properties_info, name)
+ && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name")))
+ || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member));
+ "Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));
return &EG(uninitialized_zval);
}
else
{
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
/* }}} */
@@ -6799,6 +6766,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionType", reflection_type_functions);
reflection_init_class_handlers(&_reflection_entry);
reflection_type_ptr = zend_register_internal_class(&_reflection_entry);
+ reflection_type_ptr->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionNamedType", reflection_named_type_functions);
reflection_init_class_handlers(&_reflection_entry);
diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h
index b1d5717e3f..e4e08c16e6 100644
--- a/ext/reflection/php_reflection.h
+++ b/ext/reflection/php_reflection.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/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt
index 36ae406b43..924c3fe283 100644
--- a/ext/reflection/tests/004.phpt
+++ b/ext/reflection/tests/004.phpt
@@ -4,7 +4,7 @@ ReflectionMethod::invoke() with non object or null value
<?php
class a {
- function a(){
+ function __construct(){
}
}
class b {
@@ -13,7 +13,7 @@ class b {
$b = new b();
$a=new ReflectionClass("a");
-$m=$a->getMethod("a");
+$m=$a->getMethod("__construct");
try {
$m->invoke(null);
@@ -35,9 +35,7 @@ try {
echo $E->getMessage()."\n";
}
-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
-Trying to invoke non static method a::a() without an object
+?>
+--EXPECT--
+Trying to invoke non static method a::__construct() without an object
Given object is not an instance of the class this method was declared in
-===DONE===
diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
index c463bb72c1..7d8a312f51 100644
--- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
@@ -4,7 +4,7 @@ ReflectionClass::__constructor() - bad arguments
<?php
try {
var_dump(new ReflectionClass());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
@@ -34,7 +34,7 @@ try {
try {
var_dump(new ReflectionClass("stdClass", 1));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
@@ -46,21 +46,12 @@ try {
?>
--EXPECTF--
-Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(0) ""
-}
+ReflectionClass::__construct() expects exactly 1 parameter, 0 given
Class does not exist
Class 1 does not exist
Class 1 does not exist
-Notice: Array to string conversion in %s on line 27
+Warning: Array to string conversion in %s on line %d
Class Array does not exist
-
-Warning: ReflectionClass::__construct() expects exactly 1 parameter, 2 given in %s on line 33
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(0) ""
-}
+ReflectionClass::__construct() expects exactly 1 parameter, 2 given
Class X does not exist
diff --git a/ext/reflection/tests/ReflectionClass_export_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
index d9183442c4..784fc6a5fb 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
@@ -50,12 +50,12 @@ Class [ <user> class C extends A ] {
- Parameters [8] {
Parameter #0 [ <required> A $a ]
Parameter #1 [ <required> $b ]
- Parameter #2 [ <optional> C or NULL $c = NULL ]
+ Parameter #2 [ <optional> ?C $c = NULL ]
Parameter #3 [ <optional> $d = '16 chars long -...' ]
Parameter #4 [ <optional> $e = '15 chars long -' ]
Parameter #5 [ <optional> $f = NULL ]
Parameter #6 [ <optional> $g = false ]
- Parameter #7 [ <optional> array or NULL $h = NULL ]
+ Parameter #7 [ <optional> ?array $h = NULL ]
}
}
}
diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
index 5260e719a3..020ac6f7f5 100644
--- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
@@ -8,30 +8,14 @@ class C {
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->getConstant());
-var_dump($rc->getConstant("myConst", "myConst"));
var_dump($rc->getConstant(null));
var_dump($rc->getConstant(1));
var_dump($rc->getConstant(1.5));
var_dump($rc->getConstant(true));
-var_dump($rc->getConstant(array(1,2,3)));
-var_dump($rc->getConstant(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
index 5db9d8f3d3..df6880aedb 100644
--- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
@@ -9,48 +9,7 @@ class NewCtor {
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
-class X {
- function Y() {}
-}
-
-class Y extends X {
-}
-
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
-class B {
- function B() {}
-}
-
-class C extends B {
- function C() {}
-}
-
-class D1 extends C {
- function __construct() {}
-}
-
-class D2 extends C {
-}
-
-$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
- 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
-
+$classes = array('NewCtor', 'ExtendsNewCtor');
foreach ($classes as $class) {
$rc = new ReflectionClass($class);
$rm = $rc->getConstructor();
@@ -63,21 +22,6 @@ foreach ($classes as $class) {
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor 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; B 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
+--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
-Constructor of D1: __construct
-Constructor of D2: C
-No constructor for X
-No constructor for Y
diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
index 1eb084214b..424550f67a 100644
--- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
@@ -13,12 +13,12 @@ $rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
var_dump($rc->getMethod());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getMethod("f", "f"));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -43,32 +43,24 @@ try {
}
try {
var_dump($rc->getMethod(array(1,2,3)));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getMethod(new C));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 0 given in %s on line 9
-NULL
-
-Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 2 given in %s on line 14
-NULL
+ReflectionClass::getMethod() expects exactly 1 parameter, 0 given
+ReflectionClass::getMethod() expects exactly 1 parameter, 2 given
Method does not exist
Method 1 does not exist
Method 1.5 does not exist
Method 1 does not exist
-
-Warning: ReflectionClass::getMethod() expects parameter 1 to be string, array given in %s on line 39
-NULL
-
-Warning: ReflectionClass::getMethod() expects parameter 1 to be string, object given in %s on line 44
-NULL
+ReflectionClass::getMethod() expects parameter 1 to be string, array given
+ReflectionClass::getMethod() expects parameter 1 to be string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getParentClass.phpt b/ext/reflection/tests/ReflectionClass_getParentClass.phpt
index 382948d3d3..ef64de5ecb 100644
--- a/ext/reflection/tests/ReflectionClass_getParentClass.phpt
+++ b/ext/reflection/tests/ReflectionClass_getParentClass.phpt
@@ -10,11 +10,14 @@ class Foo {}
class Bar extends Foo {}
-$rc1 = new ReflectionClass("Bar");
-var_dump($rc1->getParentClass());
+$rc = new ReflectionClass("Bar");
+$parent = $rc->getParentClass();
+$grandParent = $parent->getParentClass();
+var_dump($parent, $grandParent);
?>
--EXPECTF--
object(ReflectionClass)#%d (1) {
["name"]=>
string(3) "Foo"
}
+bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt b/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt
deleted file mode 100644
index be50dbb730..0000000000
--- a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-ReflectionClass::getParentClass()
---CREDITS--
-Robin Fernandes <robinf@php.net>
-Steve Seear <stevseea@php.net>
---FILE--
-<?php
-class A {}
-class B extends A {}
-
-$rc = new ReflectionClass('B');
-$parent = $rc->getParentClass();
-$grandParent = $parent->getParentClass();
-var_dump($parent, $grandParent);
-
-echo "\nTest bad params:\n";
-var_dump($rc->getParentClass(null));
-var_dump($rc->getParentClass('x'));
-var_dump($rc->getParentClass('x', 123));
-
-?>
---EXPECTF--
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(1) "A"
-}
-bool(false)
-
-Test bad params:
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 2 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
index 68522e097a..d9a2ebcd71 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
@@ -13,12 +13,12 @@ $rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
var_dump($rc->getProperty());
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getProperty("a", "a"));
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -43,30 +43,22 @@ try {
}
try {
var_dump($rc->getProperty(array(1,2,3)));
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getProperty(new C));
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 0 given in %s on line 9
-NULL
-
-Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 2 given in %s on line 14
-NULL
+ReflectionClass::getProperty() expects exactly 1 parameter, 0 given
+ReflectionClass::getProperty() expects exactly 1 parameter, 2 given
Property does not exist
Property 1 does not exist
Property 1.5 does not exist
Property 1 does not exist
-
-Warning: ReflectionClass::getProperty() expects parameter 1 to be string, array given in %s on line 39
-NULL
-
-Warning: ReflectionClass::getProperty() expects parameter 1 to be string, object given in %s on line 44
-NULL
+ReflectionClass::getProperty() expects parameter 1 to be string, array given
+ReflectionClass::getProperty() expects parameter 1 to be string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
index 52fa378eb6..7c071e5ba0 100644
--- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
@@ -12,12 +12,12 @@ class C {
$rc = new ReflectionClass('C');
try {
var_dump($rc->getStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getStaticPropertyValue());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -32,20 +32,15 @@ try {
}
try {
var_dump($rc->getStaticPropertyValue(array(1,2,3)));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
-Warning: ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given in %s on line 13
-NULL
+--EXPECT--
+ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given
+ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given
Class C does not have a property named
string(3) "def"
-
-Warning: ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 28
-NULL
+ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given
diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
index 14c847401d..257d9aa9da 100644
--- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
@@ -11,30 +11,14 @@ class C {
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasConstant());
-var_dump($rc->hasConstant("myConst", "myConst"));
var_dump($rc->hasConstant(null));
var_dump($rc->hasConstant(1));
var_dump($rc->hasConstant(1.5));
var_dump($rc->hasConstant(true));
-var_dump($rc->hasConstant(array(1,2,3)));
-var_dump($rc->hasConstant(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
index 63fe8791fc..77f2865a31 100644
--- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
@@ -11,30 +11,14 @@ class C {
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasMethod());
-var_dump($rc->hasMethod("f", "f"));
var_dump($rc->hasMethod(null));
var_dump($rc->hasMethod(1));
var_dump($rc->hasMethod(1.5));
var_dump($rc->hasMethod(true));
-var_dump($rc->hasMethod(array(1,2,3)));
-var_dump($rc->hasMethod(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
index 753890394f..a1bbb9e73c 100644
--- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
@@ -11,30 +11,14 @@ class C {
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasProperty());
-var_dump($rc->hasProperty("a", "a"));
var_dump($rc->hasProperty(null));
var_dump($rc->hasProperty(1));
var_dump($rc->hasProperty(1.5));
var_dump($rc->hasProperty(true));
-var_dump($rc->hasProperty(array(1,2,3)));
-var_dump($rc->hasProperty(new C));
?>
--EXPECTF--
Check invalid params:
-
-Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
index d1cbc8ae47..5176dd75ad 100644
--- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
@@ -41,12 +41,12 @@ foreach ($rcs as $childName => $child) {
echo "\n\nTest bad arguments:\n";
try {
var_dump($rcs['A']->implementsInterface());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rcs['A']->implementsInterface('C', 'C'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -144,12 +144,8 @@ Does I2 implement I2?
Test bad arguments:
-
-Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given in %s on line 37
-NULL
-
-Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given in %s on line 42
-NULL
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Interface ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
index 1378edd3d2..e688b40f46 100644
--- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
@@ -17,39 +17,16 @@ class privateCtorNew {
private function __construct() {}
}
-class publicCtorOld {
- public function publicCtorOld() {}
-}
-
-class protectedCtorOld {
- protected function protectedCtorOld() {}
-}
-
-class privateCtorOld {
- private function privateCtorOld() {}
-}
-
-
-$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew",
- "publicCtorOld", "protectedCtorOld", "privateCtorOld");
-
-foreach($classes as $class ) {
+$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew");
+foreach ($classes as $class) {
$reflectionClass = new ReflectionClass($class);
echo "Is $class instantiable? ";
var_dump($reflectionClass->IsInstantiable());
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld 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; protectedCtorOld 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; privateCtorOld has a deprecated constructor in %s on line %d
+--EXPECT--
Is noCtor instantiable? bool(true)
Is publicCtorNew instantiable? bool(true)
Is protectedCtorNew instantiable? bool(false)
Is privateCtorNew instantiable? bool(false)
-Is publicCtorOld instantiable? bool(true)
-Is protectedCtorOld instantiable? bool(false)
-Is privateCtorOld instantiable? bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
index 10a86d9136..af4ce9d2f4 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
@@ -35,16 +35,6 @@ foreach($classes as $class) {
var_dump($rc->isIterateable());
}
-echo "\nTest invalid params:\n";
-$rc = new ReflectionClass('IteratorImpl');
-var_dump($rc->isIterateable(null));
-var_dump($rc->isIterateable(null, null));
-var_dump($rc->isIterateable(1));
-var_dump($rc->isIterateable(1.5));
-var_dump($rc->isIterateable(true));
-var_dump($rc->isIterateable('X'));
-var_dump($rc->isIterateable(null));
-
echo "\nTest static invocation:\n";
ReflectionClass::isIterateable();
@@ -61,32 +51,9 @@ Is ExtendsIteratorImpl iterable? bool(true)
Is ExtendsIteratorAggregateImpl iterable? bool(true)
Is A iterable? bool(false)
-Test invalid params:
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 34
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 2 given in %s on line 35
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 36
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 37
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 38
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 39
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 40
-NULL
-
Test static invocation:
-Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:43
+Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 43
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
index 368ea7d7ec..03d17e223e 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
@@ -11,12 +11,12 @@ $rc = new ReflectionClass('A');
echo "\n\nTest bad arguments:\n";
try {
var_dump($rc->isSubclassOf());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -35,14 +35,10 @@ try {
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Test bad arguments:
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12
-NULL
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Class ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
index 068710311d..11bd44077f 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
@@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
-class A {
- public function A() {
- echo "In constructor of class A\n";
- }
-}
class B {
public function __construct($a, $b) {
@@ -32,28 +27,17 @@ class E {
}
-$rcA = new ReflectionClass('A');
$rcB = new ReflectionClass('B');
$rcC = new ReflectionClass('C');
$rcD = new ReflectionClass('D');
$rcE = new ReflectionClass('E');
try {
- var_dump($rcA->newInstanceArgs());
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-try {
- var_dump($rcA->newInstanceArgs(array('x')));
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-
-try {
var_dump($rcB->newInstanceArgs());
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
+
try {
var_dump($rcB->newInstanceArgs(array('x', 123)));
} catch (Throwable $e) {
@@ -85,13 +69,6 @@ try {
}
?>
--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
-In constructor of class A
-object(A)#%d (0) {
-}
-In constructor of class A
-object(A)#%d (0) {
-}
Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected
In constructor of class B with args x, 123
object(B)#%d (0) {
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
index bd27dfc173..de4fe65ace 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
@@ -16,8 +16,8 @@ var_dump($a);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to ReflectionClass::newInstanceArgs() must be of the type array, string given in %s:8
+Fatal error: Uncaught TypeError: ReflectionClass::newInstanceArgs() expects parameter 1 to be array, string given in %s:%d
Stack trace:
#0 %s(%d): ReflectionClass->newInstanceArgs('x')
#1 {main}
- thrown in %s on line 8
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
index c91d2ee958..bf68098a7d 100644
--- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
@@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
-class A {
- public function A() {
- echo "In constructor of class A\n";
- }
-}
class B {
public function __construct($a, $b) {
@@ -28,20 +23,15 @@ class D {
echo "In constructor of class D\n";
}
}
+
class E {
}
-
-$rcA = new ReflectionClass('A');
$rcB = new ReflectionClass('B');
$rcC = new ReflectionClass('C');
$rcD = new ReflectionClass('D');
$rcE = new ReflectionClass('E');
-$a1 = $rcA->newInstance();
-$a2 = $rcA->newInstance('x');
-var_dump($a1, $a2);
-
try {
var_dump($rcB->newInstance());
} catch (Throwable $e) {
@@ -78,13 +68,6 @@ try {
}
?>
--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
-In constructor of class A
-In constructor of class A
-object(A)#%d (0) {
-}
-object(A)#%d (0) {
-}
Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected
In constructor of class B with args x, 123
object(B)#%d (0) {
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
index fb472681ca..6d3cf3a44f 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
@@ -12,17 +12,17 @@ class C {
$rc = new ReflectionClass('C');
try {
var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->setStaticPropertyValue());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->setStaticPropertyValue(null));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -37,23 +37,16 @@ try {
}
try {
var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given in %s on line 13
-NULL
-
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given in %s on line 18
-NULL
+--EXPECT--
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given
Class C does not have a property named
Class C does not have a property named 1.5
-
-Warning: ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 33
-NULL
+ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
index a83900a123..352a79ece8 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
@@ -31,7 +31,7 @@ var_dump(Test::$y);
?>
--EXPECT--
-Typed property Test::$y must be int, string used
+Cannot assign string to property Test::$y of type int
int(2)
int(21)
Cannot assign string to reference held by property Test::$y of type int
diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt
index 2cfd808cb8..9406c2e5d1 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -265,7 +265,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method newInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $args ]
+ Parameter #0 [ <optional> ...$args ]
}
}
diff --git a/ext/reflection/tests/ReflectionExtension_bug66218.phpt b/ext/reflection/tests/ReflectionExtension_bug66218.phpt
index 77f3d230b3..f42967c089 100644
--- a/ext/reflection/tests/ReflectionExtension_bug66218.phpt
+++ b/ext/reflection/tests/ReflectionExtension_bug66218.phpt
@@ -2,7 +2,6 @@
ReflectionExtension::getFunctions() ##6218 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/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt
index 627dc96f32..81f8116d77 100644
--- a/ext/reflection/tests/ReflectionMethod_006.phpt
+++ b/ext/reflection/tests/ReflectionMethod_006.phpt
@@ -17,79 +17,7 @@ try {
echo "Ok - ".$re->getMessage().PHP_EOL;
}
-class C {
- public function f() {}
-}
-
-$rm = new ReflectionMethod('C', 'f');
-
-var_dump($rm->isFinal(1));
-var_dump($rm->isAbstract(1));
-var_dump($rm->isPrivate(1));
-var_dump($rm->isProtected(1));
-var_dump($rm->isPublic(1));
-var_dump($rm->isStatic(1));
-var_dump($rm->isConstructor(1));
-var_dump($rm->isDestructor(1));
-var_dump($rm->getModifiers(1));
-var_dump($rm->isInternal(1));
-var_dump($rm->isUserDefined(1));
-var_dump($rm->getFileName(1));
-var_dump($rm->getStartLine(1));
-var_dump($rm->getEndLine(1));
-var_dump($rm->getStaticVariables(1));
-var_dump($rm->getName(1));
-
-
?>
---EXPECTF--
+--EXPECT--
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
-
-Warning: ReflectionMethod::isFinal() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isAbstract() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isConstructor() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isDestructor() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::isInternal() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::isUserDefined() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getFileName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getStartLine() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getEndLine() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getStaticVariables() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
index 243c59504b..da108d258d 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
@@ -19,21 +19,6 @@ echo "\nInherited new-style constructor\n";
$methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct");
var_dump($methodInfo->isConstructor());
-class OldCtor {
- function OldCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nOld-style constructor:\n";
-$methodInfo = new ReflectionMethod("OldCtor::OldCtor");
-var_dump($methodInfo->isConstructor());
-
-class ExtendsOldCtor extends OldCtor {
-}
-echo "\nInherited old-style constructor:\n";
-$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor");
-var_dump($methodInfo->isConstructor());
-
class X {
function Y() {
echo "In " . __METHOD__ . "\n";
@@ -49,69 +34,16 @@ echo "\nInherited method of the same name as the class:\n";
$methodInfo = new ReflectionMethod("Y::Y");
var_dump($methodInfo->isConstructor());
-class OldAndNewCtor {
- function OldAndNewCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-
- function __construct() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nOld-style constructor:\n";
-$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor");
-var_dump($methodInfo->isConstructor());
-
-echo "\nRedefined constructor:\n";
-$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct");
-var_dump($methodInfo->isConstructor());
-
-class NewAndOldCtor {
- function __construct() {
- echo "In " . __METHOD__ . "\n";
- }
-
- function NewAndOldCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nNew-style constructor:\n";
-$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct");
-var_dump($methodInfo->isConstructor());
-
-echo "\nRedefined old-style constructor:\n";
-$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor");
-var_dump($methodInfo->isConstructor());
-
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
+--EXPECT--
New-style constructor:
bool(true)
Inherited new-style constructor
bool(true)
-Old-style constructor:
-bool(true)
-
-Inherited old-style constructor:
-bool(true)
-
Not a constructor:
bool(false)
Inherited method of the same name as the class:
bool(false)
-
-Old-style constructor:
-bool(false)
-
-Redefined constructor:
-bool(true)
-
-New-style constructor:
-bool(true)
-
-Redefined old-style constructor:
-bool(false)
diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
index d3b9ca3c81..d1e7ee68fb 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
@@ -35,15 +35,7 @@ $staticmethod = $staticclass->getMethod( 'foo' );
$object = new Example();
$fakeobj = new StdClass();
-echo "\n-- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --\n";
-var_dump( $staticmethod->getClosure( 'foobar' ) );
-var_dump( $staticmethod->getClosure( 'foo', 'bar' ) );
-var_dump( $method->getClosure( $object, 'foobar' ) );
-
-echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n";
-$closure = $method->getClosure();
-
-echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n";
+echo "\n-- Testing ReflectionMethod::getClosure() function with invalid object --\n";
try {
var_dump( $method->getClosure( $fakeobj ) );
} catch( Exception $e ) {
@@ -55,19 +47,6 @@ try {
--EXPECTF--
*** Testing ReflectionMethod::getClosure() : error conditions ***
--- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --
-object(Closure)#%d (0) {
-}
-object(Closure)#%d (0) {
-}
-
-Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing ReflectionMethod::getClosure() function with Zero arguments --
-
-Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in %s on line %d
-
--- Testing ReflectionMethod::getClosure() function with Zero arguments --
+-- Testing ReflectionMethod::getClosure() function with invalid object --
string(72) "Given object is not an instance of the class this method was declared in"
===DONE===
diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
index d1a19c7116..d867993599 100644
--- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
@@ -75,13 +75,9 @@ reflectMethodModifiers("DerivedClass");
reflectMethodModifiers("TestInterface");
reflectMethodModifiers("AbstractClass");
-echo "Wrong number of params:\n";
-$a = new ReflectionMethod('TestClass::foo');
-$a->getModifiers(1);
-
$a = new ReflectionMethod('ReflectionMethod::getModifiers');
-echo "\nReflectionMethod::getModifiers() modifiers:\n";
+echo "ReflectionMethod::getModifiers() modifiers:\n";
printf("0x%08x\n", $a->getModifiers());
?>
@@ -234,9 +230,5 @@ Modifiers for method AbstractClass::foo():
0x00000041
-Wrong number of params:
-
-Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-
ReflectionMethod::getModifiers() modifiers:
0x00000001
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
index 6c81728f91..34e73c9a69 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
@@ -24,4 +24,4 @@ try {
?>
--EXPECT--
-string(89) "Argument 2 passed to ReflectionMethod::invokeArgs() must be of the type array, bool given"
+string(74) "ReflectionMethod::invokeArgs() expects parameter 2 to be array, bool given"
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
index 0c87a66153..156cc9db52 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
@@ -37,10 +37,6 @@ $foo = new ReflectionMethod($testClassInstance, 'foo');
$staticMethod = new ReflectionMethod('TestClass::staticMethod');
$privateMethod = new ReflectionMethod("TestClass::privateMethod");
-echo "Wrong number of parameters:\n";
-var_dump($foo->invokeArgs());
-var_dump($foo->invokeArgs(true));
-
echo "\nNon-instance:\n";
try {
var_dump($foo->invokeArgs(new stdClass(), array()));
@@ -48,14 +44,8 @@ try {
var_dump($e->getMessage());
}
-echo "\nNon-object:\n";
-var_dump($foo->invokeArgs(true, array()));
-
echo "\nStatic method:\n";
-var_dump($staticMethod->invokeArgs());
-var_dump($staticMethod->invokeArgs(true));
-var_dump($staticMethod->invokeArgs(true, array()));
var_dump($staticMethod->invokeArgs(null, array()));
echo "\nPrivate method:\n";
@@ -80,32 +70,10 @@ try {
?>
--EXPECTF--
-Wrong number of parameters:
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Non-instance:
string(72) "Given object is not an instance of the class this method was declared in"
-Non-object:
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
Static method:
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d
-NULL
Called staticMethod()
Exception: Using $this when not in object context
NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
index 0a2b15fb83..6711feb4ac 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
@@ -60,8 +60,16 @@ var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2", 3));
echo "\nStatic method:\n";
-var_dump($staticMethod->invoke());
-var_dump($staticMethod->invoke(true));
+try {
+ var_dump($staticMethod->invoke());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($staticMethod->invoke(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($staticMethod->invoke(new stdClass()));
echo "\nMethod that throws an exception:\n";
@@ -94,12 +102,8 @@ Called methodWithArgs(1, arg2)
NULL
Static method:
-
-Warning: ReflectionMethod::invoke() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s on line %d
-NULL
+ReflectionMethod::invoke() expects at least 1 parameter, 0 given
+ReflectionMethod::invoke() expects parameter 1 to be object, bool given
Called staticMethod()
Exception: Using $this when not in object context
NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
index 411299f0c7..4fa86eb363 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
@@ -30,7 +30,7 @@ $testClassInstance->prop = "Hello";
echo "invoke() on a non-object:\n";
try {
var_dump($foo->invoke(true));
-} catch (ReflectionException $e) {
+} catch (TypeError $e) {
var_dump($e->getMessage());
}
@@ -59,9 +59,7 @@ try {
?>
--EXPECTF--
invoke() on a non-object:
-
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s%eReflectionMethod_invoke_error1.php on line %d
-NULL
+string(71) "ReflectionMethod::invoke() expects parameter 1 to be object, bool given"
invoke() on a non-instance:
string(72) "Given object is not an instance of the class this method was declared in"
diff --git a/ext/reflection/tests/ReflectionNamedType.phpt b/ext/reflection/tests/ReflectionNamedType.phpt
index afb592127c..78fe1e8fd4 100644
--- a/ext/reflection/tests/ReflectionNamedType.phpt
+++ b/ext/reflection/tests/ReflectionNamedType.phpt
@@ -30,20 +30,12 @@ var_dump($return->getName());
var_dump((string) $return);
?>
---EXPECTF--
+--EXPECT--
string(11) "Traversable"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
-string(11) "Traversable"
-string(6) "string"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+string(12) "?Traversable"
string(6) "string"
+string(7) "?string"
string(4) "Test"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
-string(4) "Test"
-string(4) "Test"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+string(5) "?Test"
string(4) "Test"
+string(5) "?Test"
diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
index aecc9b97d2..fee873fe01 100644
--- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
@@ -9,14 +9,6 @@ class NewCtor {
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
class X {
function Y() {}
}
@@ -24,15 +16,6 @@ class X {
class Y extends X {
}
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
class B {
function B() {}
}
@@ -48,8 +31,8 @@ class D1 extends C {
class D2 extends C {
}
-$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
- 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
+$classes = array('NewCtor', 'ExtendsNewCtor',
+ 'B', 'C', 'D1', 'D2', 'X', 'Y');
foreach ($classes as $class) {
$rc = new ReflectionObject(new $class);
@@ -63,21 +46,12 @@ foreach ($classes as $class) {
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor 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; B 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
+--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
+No constructor for B
+No constructor for C
Constructor of D1: __construct
-Constructor of D2: C
+No constructor for D2
No constructor for X
No constructor for Y
diff --git a/ext/reflection/tests/ReflectionObject_getName_basic.phpt b/ext/reflection/tests/ReflectionObject_getName_basic.phpt
index 68cea6a1cd..1885695cb1 100644
--- a/ext/reflection/tests/ReflectionObject_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getName_basic.phpt
@@ -2,8 +2,6 @@
ReflectionObject::getName() - basic function test
--FILE--
<?php
-$r0 = new ReflectionObject();
-var_dump($r0->getName());
$r1 = new ReflectionObject(new stdClass);
var_dump($r1->getName());
@@ -18,8 +16,6 @@ var_dump($r3->getName());
?>
--EXPECTF--
-Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 2
-string(0) ""
string(8) "stdClass"
string(1) "C"
string(16) "ReflectionObject"
diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
index 675bbdde8d..3baa8a0950 100644
--- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
@@ -30,54 +30,21 @@ class privateCtorNew {
}
}
-class publicCtorOld {
- public function publicCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-class protectedCtorOld {
- protected function protectedCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-class privateCtorOld {
- private function privateCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-
$reflectionObjects = array(
noCtor::reflectionObjectFactory(),
publicCtorNew::reflectionObjectFactory(),
protectedCtorNew::reflectionObjectFactory(),
privateCtorNew::reflectionObjectFactory(),
- publicCtorOld::reflectionObjectFactory(),
- protectedCtorOld::reflectionObjectFactory(),
- privateCtorOld::reflectionObjectFactory()
);
-foreach($reflectionObjects as $reflectionObject ) {
+foreach ($reflectionObjects as $reflectionObject) {
$name = $reflectionObject->getName();
echo "Is $name instantiable? ";
var_dump($reflectionObject->IsInstantiable());
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld 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; protectedCtorOld 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; privateCtorOld has a deprecated constructor in %s on line %d
+--EXPECT--
Is noCtor instantiable? bool(true)
Is publicCtorNew instantiable? bool(true)
Is protectedCtorNew instantiable? bool(false)
Is privateCtorNew instantiable? bool(false)
-Is publicCtorOld instantiable? bool(true)
-Is protectedCtorOld instantiable? bool(false)
-Is privateCtorOld instantiable? bool(false)
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
index f05197ebaf..a2484f9dc2 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
@@ -11,12 +11,12 @@ $ro = new ReflectionObject(new C);
echo "\n\nTest bad arguments:\n";
try {
var_dump($ro->isSubclassOf());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($ro->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -35,14 +35,10 @@ try {
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Test bad arguments:
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12
-NULL
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Class ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
index 11994ed705..582bcffe65 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
@@ -5,20 +5,12 @@ ReflectionObject::isSubclassOf() - invalid params
class A {}
$ro = new ReflectionObject(new A);
-var_dump($ro->isSubclassOf());
-var_dump($ro->isSubclassOf('A',5));
var_dump($ro->isSubclassOf('X'));
?>
--EXPECTF--
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6
-NULL
-
-Fatal error: Uncaught ReflectionException: Class X does not exist in %s:7
+Fatal error: Uncaught ReflectionException: Class X does not exist in %s:%d
Stack trace:
-#0 %s(7): ReflectionClass->isSubclassOf('X')
+#0 %s(%d): ReflectionClass->isSubclassOf('X')
#1 {main}
- thrown in %s on line 7
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionParameter_003.phpt b/ext/reflection/tests/ReflectionParameter_003.phpt
index cc092bffcc..581c486f62 100644
--- a/ext/reflection/tests/ReflectionParameter_003.phpt
+++ b/ext/reflection/tests/ReflectionParameter_003.phpt
@@ -56,7 +56,7 @@ foreach($refParameters as $parameter) {
hello from test
third is jack
-Notice: Undefined variable: theIncrement in %s on line 8
+Warning: Undefined variable: theIncrement in %s on line %d
parameter names from staticMethod method:
object(ReflectionParameter)#%d (1) {
diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt
index c8a2f11ee1..a7fdff5000 100644
--- a/ext/reflection/tests/ReflectionProperty_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_error.phpt
@@ -24,39 +24,8 @@ try {
echo "Ok - ".$re->getMessage().PHP_EOL;
}
-
-$rp = new ReflectionProperty('C', 'p');
-var_dump($rp->getName(1));
-var_dump($rp->isPrivate(1));
-var_dump($rp->isProtected(1));
-var_dump($rp->isPublic(1));
-var_dump($rp->isStatic(1));
-var_dump($rp->getModifiers(1));
-var_dump($rp->isDefault(1));
-
?>
---EXPECTF--
+--EXPECT--
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 0 given
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 1 given
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 3 given
-
-Warning: ReflectionProperty::getName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionProperty_export_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt
index 114b4c0ac8..446fedf0a3 100644
--- a/ext/reflection/tests/ReflectionProperty_export_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_export_error.phpt
@@ -32,10 +32,6 @@ catch(Exception $e) {
echo $e->getMessage();
}
-echo "\n\nIncorrect number of args:\n";
-ReflectionProperty::export();
-ReflectionProperty::export('TestClass', "nonExistentProperty", true, false);
-
?>
--EXPECTF--
Non-existent class:
@@ -52,13 +48,3 @@ Non-existent property:
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property TestClass::$nonExistentProperty does not exist
-
-Incorrect number of args:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-
-Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-
-Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
index c7c9366471..7ee787a348 100644
--- a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
@@ -13,15 +13,9 @@ class B extends A {
$propInfo = new ReflectionProperty('B', 'prop');
var_dump($propInfo->getDeclaringClass());
-echo "Wrong number of params:\n";
-$propInfo->getDeclaringClass(1);
-
?>
--EXPECTF--
object(ReflectionClass)#%d (1) {
["name"]=>
string(1) "A"
}
-Wrong number of params:
-
-Warning: ReflectionProperty::getDeclaringClass() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
index 3bca85e4b6..52e9d1d2ef 100644
--- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
@@ -18,15 +18,6 @@ $instance = new TestClass();
$invalidInstance = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-echo "Too few args:\n";
-var_dump($propInfo->getValue());
-
-echo "\nToo many args:\n";
-var_dump($propInfo->getValue($instance, true));
-
-echo "\nWrong type of arg:\n";
-var_dump($propInfo->getValue(true));
-
echo "\nInstance without property:\n";
$propInfo = new ReflectionProperty('TestClass', 'stat');
@@ -51,21 +42,6 @@ var_dump($propInfo->getValue($invalidInstance));
?>
--EXPECTF--
-Too few args:
-
-Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Too many args:
-
-Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Wrong type of arg:
-
-Warning: ReflectionProperty::getValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
Instance without property:
Static property / too many args:
@@ -79,8 +55,8 @@ Cannot access non-public member TestClass::$prot
Invalid instance:
-Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:47
+Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:%d
Stack trace:
-#0 %s(47): ReflectionProperty->getValue(Object(AnotherClass))
+#0 %s(%d): ReflectionProperty->getValue(Object(AnotherClass))
#1 {main}
- thrown in %s on line 47
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
index 2aa630d9d0..1472615178 100644
--- a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
+++ b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
@@ -24,10 +24,6 @@ reflectProperty("TestClass", "stat");
reflectProperty("TestClass", "prot");
reflectProperty("TestClass", "priv");
-echo "Wrong number of params:\n";
-$propInfo = new ReflectionProperty('TestClass', 'pub');
-$propInfo->isDefault(1);
-
?>
--EXPECTF--
**********************************
@@ -58,6 +54,3 @@ isDefault():
bool(true)
**********************************
-Wrong number of params:
-
-Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
index 0bf223daa7..f58590b3ea 100644
--- a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
@@ -18,30 +18,6 @@ $instance = new TestClass();
$instanceWithNoProperties = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-echo "Too few args:\n";
-var_dump($propInfo->setValue());
-var_dump($propInfo->setValue($instance));
-
-echo "\nToo many args:\n";
-var_dump($propInfo->setValue($instance, "NewValue", true));
-
-echo "\nWrong type of arg:\n";
-var_dump($propInfo->setValue(true, "NewValue"));
-$propInfo = new ReflectionProperty('TestClass', 'stat');
-
-echo "\nStatic property / too many args:\n";
-var_dump($propInfo->setValue($instance, "NewValue", true));
-
-echo "\nStatic property / too few args:\n";
-var_dump($propInfo->setValue("A new value"));
-var_dump(TestClass::$stat);
-var_dump($propInfo->setValue());
-var_dump(TestClass::$stat);
-
-echo "\nStatic property / wrong type of arg:\n";
-var_dump($propInfo->setValue(true, "Another new value"));
-var_dump(TestClass::$stat);
-
echo "\nProtected property:\n";
try {
$propInfo = new ReflectionProperty('TestClass', 'prot');
@@ -57,41 +33,6 @@ var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue"));
var_dump($instanceWithNoProperties->pub2);
?>
--EXPECTF--
-Too few args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Too many args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Wrong type of arg:
-
-Warning: ReflectionProperty::setValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
-Static property / too many args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Static property / too few args:
-NULL
-string(11) "A new value"
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-string(11) "A new value"
-
-Static property / wrong type of arg:
-NULL
-string(17) "Another new value"
-
Protected property:
Cannot access non-public member TestClass::$prot
diff --git a/ext/reflection/tests/ReflectionProperty_typed_static.phpt b/ext/reflection/tests/ReflectionProperty_typed_static.phpt
index 77f95d77ef..eaf4209644 100644
--- a/ext/reflection/tests/ReflectionProperty_typed_static.phpt
+++ b/ext/reflection/tests/ReflectionProperty_typed_static.phpt
@@ -45,7 +45,7 @@ var_dump($rp->getValue());
int(42)
Typed static property Test::$y must not be accessed before initialization
int(24)
-Typed property Test::$y must be int, string used
+Cannot assign string to property Test::$y of type int
int(24)
Cannot assign string to reference held by property Test::$y of type int
int(24)
diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt
deleted file mode 100644
index 27c31ca6ae..0000000000
--- a/ext/reflection/tests/bug30148.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes)
---FILE--
-<?php
-
-class Root
-{
- function Root() {}
-}
-class Base extends Root
-{
- function __construct() {}
-}
-class Derived extends Base
-{
-}
-$a = new ReflectionMethod('Root','Root');
-$b = new ReflectionMethod('Base','Root');
-$c = new ReflectionMethod('Base','__construct');
-$d = new ReflectionMethod('Derived','Root');
-$e = new ReflectionMethod('Derived','__construct');
-var_dump($a->isConstructor());
-var_dump($b->isConstructor());
-var_dump($c->isConstructor());
-var_dump($d->isConstructor());
-var_dump($e->isConstructor());
-?>
-===DONE===
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Root has a deprecated constructor in %s on line %d
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-===DONE===
diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt
deleted file mode 100644
index 6dbe396ae6..0000000000
--- a/ext/reflection/tests/bug38942.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Bug #38942 (Double old-style-ctor inheritance)
---FILE--
-<?php
-class foo {
- public function foo() {}
-}
-
-class bar extends foo {
-}
-echo new ReflectionClass("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
-Class [ <user> class bar extends foo ] {
- @@ %sbug38942.php 6-7
-
- - Constants [0] {
- }
-
- - Static properties [0] {
- }
-
- - Static methods [0] {
- }
-
- - Properties [0] {
- }
-
- - Methods [1] {
- Method [ <user, inherits foo, ctor> public method foo ] {
- @@ %sbug38942.php 3 - 3
- }
- }
-}
diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt
index e3ce114c9c..b6f33fcfc6 100644
--- a/ext/reflection/tests/bug47254.phpt
+++ b/ext/reflection/tests/bug47254.phpt
@@ -23,10 +23,7 @@ $m = $R->getMethods();
print_r($m);
?>
---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
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
+--EXPECT--
Array
(
[0] => ReflectionMethod Object
diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt
index 46ba048078..b1cb764beb 100644
--- a/ext/reflection/tests/bug72661.phpt
+++ b/ext/reflection/tests/bug72661.phpt
@@ -6,6 +6,5 @@ function test(iterable $arg) { }
var_dump((string)(new ReflectionParameter("test", 0))->getType());
?>
---EXPECTF--
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+--EXPECT--
string(8) "iterable"
diff --git a/ext/reflection/tests/bug74673.phpt b/ext/reflection/tests/bug74673.phpt
index 47f7604e8b..42675f263e 100644
--- a/ext/reflection/tests/bug74673.phpt
+++ b/ext/reflection/tests/bug74673.phpt
@@ -3,10 +3,6 @@ Bug #74673 (Segfault when cast Reflection object to string with undefined consta
--FILE--
<?php
-set_error_handler(function() {
- throw new Exception();
-});
-
class A
{
public function method($test = PHP_SELF + 1)
@@ -19,9 +15,8 @@ $class = new ReflectionClass('A');
echo $class;
?>
--EXPECTF--
-Fatal error: Uncaught Exception in %s:%d
+Fatal error: Uncaught Error: Undefined constant 'PHP_SELF' in %s:%d
Stack trace:
-#0 [internal function]: {closure}(2, 'Use of undefine...', %s, %d, Array)
-#1 %s(%d): ReflectionClass->__toString()
-#2 {main}
+#0 %s(%d): ReflectionClass->__toString()
+#1 {main}
thrown in %s on line %d
diff --git a/ext/reflection/tests/bug76536.phpt b/ext/reflection/tests/bug76536.phpt
index 9f3b3fdb31..aa32781e16 100644
--- a/ext/reflection/tests/bug76536.phpt
+++ b/ext/reflection/tests/bug76536.phpt
@@ -2,7 +2,7 @@
Bug #76536 (PHP crashes with core dump when throwing exception in error handler)
--FILE--
<?php
-class SomeConstants {const SOME_CONSTANT = SOME_NONSENSE;}
+class SomeConstants {const SOME_CONSTANT = "foo" % 5; }
function handleError() {throw new ErrorException();}
diff --git a/ext/reflection/tests/request38992.phpt b/ext/reflection/tests/request38992.phpt
index 8c0052fd85..e6eab83415 100644
--- a/ext/reflection/tests/request38992.phpt
+++ b/ext/reflection/tests/request38992.phpt
@@ -11,12 +11,17 @@ class MyClass
}
$r = new ReflectionMethod('MyClass', 'doSomething');
-$r->invoke('WTF?');
-$r->invokeArgs('WTF?', array());
+try {
+ $r->invoke('WTF?');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $r->invokeArgs('WTF?', array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d
-===DONE===
+--EXPECT--
+ReflectionMethod::invoke() expects parameter 1 to be object, string given
+ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given
diff --git a/ext/session/config.m4 b/ext/session/config.m4
index 198c94c739..7abc8813b7 100644
--- a/ext/session/config.m4
+++ b/ext/session/config.m4
@@ -31,9 +31,9 @@ if test "$PHP_MM" != "no"; then
AC_MSG_ERROR(cannot find mm library)
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
dnl The mm library is not thread-safe, and mod_mm.c refuses to compile.
- AC_MSG_ERROR(--with-mm cannot be combined with --enable-maintainer-zts)
+ AC_MSG_ERROR(--with-mm cannot be combined with --enable-zts)
fi
PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/$PHP_LIBDIR, SESSION_SHARED_LIBADD)
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index cb8138e60a..d387a64091 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.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/ext/session/mod_files.h b/ext/session/mod_files.h
index fc12f6d96e..120a2e8a0a 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.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/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 93cfde7633..55ff0fb68a 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.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/ext/session/mod_mm.h b/ext/session/mod_mm.h
index b09b39f62b..125f32a4a6 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.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/ext/session/mod_user.c b/ext/session/mod_user.c
index b66ac26c81..c3e5c608aa 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.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/ext/session/mod_user.h b/ext/session/mod_user.h
index af002c01f9..897d825adc 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.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/ext/session/mod_user_class.c b/ext/session/mod_user_class.c
index 5452dd3c7b..8ee410e0e0 100644
--- a/ext/session/mod_user_class.c
+++ b/ext/session/mod_user_class.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/ext/session/php_session.h b/ext/session/php_session.h
index 4c795fdb68..34987992ea 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.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/ext/session/session.c b/ext/session/session.c
index 01c2d4b85a..a7b478f978 100644
--- a/ext/session/session.c
+++ b/ext/session/session.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, |
@@ -38,6 +36,7 @@
#include "rfc1867.h"
#include "php_variables.h"
#include "php_session.h"
+#include "session_arginfo.h"
#include "ext/standard/php_random.h"
#include "ext/standard/php_var.h"
#include "ext/date/php_date.h"
@@ -2360,33 +2359,31 @@ static PHP_FUNCTION(session_cache_limiter)
Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */
static PHP_FUNCTION(session_cache_expire)
{
- zval *expires = NULL;
- zend_string *ini_name;
+ zend_long expires;
+ zend_bool expires_is_null = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &expires) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &expires, &expires_is_null) == FAILURE) {
return;
}
- if (expires && PS(session_status) == php_session_active) {
+ if (!expires_is_null && PS(session_status) == php_session_active) {
php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active");
RETURN_LONG(PS(cache_expire));
}
- if (expires && SG(headers_sent)) {
+ if (!expires_is_null && SG(headers_sent)) {
php_error_docref(NULL, E_WARNING, "Cannot change cache expire when headers already sent");
RETURN_FALSE;
}
RETVAL_LONG(PS(cache_expire));
- if (expires) {
- if (!try_convert_to_string(expires)) {
- return;
- }
-
- ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ if (!expires_is_null) {
+ zend_string *ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
+ zend_string *ini_value = zend_long_to_str(expires);
+ zend_alter_ini_entry(ini_name, ini_value, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zend_string_release_ex(ini_name, 0);
+ zend_string_release_ex(ini_value, 0);
}
}
/* }}} */
@@ -2676,108 +2673,6 @@ static PHP_FUNCTION(session_register_shutdown)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_name, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_module_name, 0, 0, 0)
- ZEND_ARG_INFO(0, module)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_save_path, 0, 0, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_id, 0, 0, 0)
- ZEND_ARG_INFO(0, id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_create_id, 0, 0, 0)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_regenerate_id, 0, 0, 0)
- ZEND_ARG_INFO(0, delete_old_session)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_save_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, open)
- ZEND_ARG_INFO(0, close)
- ZEND_ARG_INFO(0, read)
- ZEND_ARG_INFO(0, write)
- ZEND_ARG_INFO(0, destroy)
- ZEND_ARG_INFO(0, gc)
- ZEND_ARG_INFO(0, create_sid)
- ZEND_ARG_INFO(0, validate_sid)
- ZEND_ARG_INFO(0, update_timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_limiter, 0, 0, 0)
- ZEND_ARG_INFO(0, cache_limiter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_expire, 0, 0, 0)
- ZEND_ARG_INFO(0, new_cache_expire)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_cookie_params, 0, 0, 1)
- ZEND_ARG_INFO(0, lifetime_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_open, 0)
- ZEND_ARG_INFO(0, save_path)
- ZEND_ARG_INFO(0, session_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_close, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_read, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_write, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_destroy, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_gc, 0)
- ZEND_ARG_INFO(0, maxlifetime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_create_sid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_validateId, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_updateTimestamp, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_start, 0, 0, 0)
- ZEND_ARG_INFO(0, options) /* array */
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ session_functions[]
*/
static const zend_function_entry session_functions[] = {
@@ -2788,22 +2683,22 @@ static const zend_function_entry session_functions[] = {
PHP_FE(session_create_id, arginfo_session_create_id)
PHP_FE(session_regenerate_id, arginfo_session_regenerate_id)
PHP_FE(session_decode, arginfo_session_decode)
- PHP_FE(session_encode, arginfo_session_void)
+ PHP_FE(session_encode, arginfo_session_encode)
PHP_FE(session_start, arginfo_session_start)
- PHP_FE(session_destroy, arginfo_session_void)
- PHP_FE(session_unset, arginfo_session_void)
- PHP_FE(session_gc, arginfo_session_void)
+ PHP_FE(session_destroy, arginfo_session_destroy)
+ PHP_FE(session_unset, arginfo_session_unset)
+ PHP_FE(session_gc, arginfo_session_gc)
PHP_FE(session_set_save_handler, arginfo_session_set_save_handler)
PHP_FE(session_cache_limiter, arginfo_session_cache_limiter)
PHP_FE(session_cache_expire, arginfo_session_cache_expire)
PHP_FE(session_set_cookie_params, arginfo_session_set_cookie_params)
- PHP_FE(session_get_cookie_params, arginfo_session_void)
- PHP_FE(session_write_close, arginfo_session_void)
- PHP_FE(session_abort, arginfo_session_void)
- PHP_FE(session_reset, arginfo_session_void)
- PHP_FE(session_status, arginfo_session_void)
- PHP_FE(session_register_shutdown, arginfo_session_void)
- PHP_FALIAS(session_commit, session_write_close, arginfo_session_void)
+ PHP_FE(session_get_cookie_params, arginfo_session_get_cookie_params)
+ PHP_FE(session_write_close, arginfo_session_write_close)
+ PHP_FE(session_abort, arginfo_session_abort)
+ PHP_FE(session_reset, arginfo_session_reset)
+ PHP_FE(session_status, arginfo_session_status)
+ PHP_FE(session_register_shutdown, arginfo_session_register_shutdown)
+ PHP_FALIAS(session_commit, session_write_close, arginfo_session_commit)
PHP_FE_END
};
/* }}} */
@@ -2811,12 +2706,12 @@ static const zend_function_entry session_functions[] = {
/* {{{ SessionHandlerInterface functions[]
*/
static const zend_function_entry php_session_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionHandlerInterface, open, arginfo_session_class_open)
- PHP_ABSTRACT_ME(SessionHandlerInterface, close, arginfo_session_class_close)
- PHP_ABSTRACT_ME(SessionHandlerInterface, read, arginfo_session_class_read)
- PHP_ABSTRACT_ME(SessionHandlerInterface, write, arginfo_session_class_write)
- PHP_ABSTRACT_ME(SessionHandlerInterface, destroy, arginfo_session_class_destroy)
- PHP_ABSTRACT_ME(SessionHandlerInterface, gc, arginfo_session_class_gc)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, open, arginfo_class_SessionHandlerInterface_open)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, close, arginfo_class_SessionHandlerInterface_close)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, read, arginfo_class_SessionHandlerInterface_read)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, write, arginfo_class_SessionHandlerInterface_write)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, destroy, arginfo_class_SessionHandlerInterface_destroy)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, gc, arginfo_class_SessionHandlerInterface_gc)
PHP_FE_END
};
/* }}} */
@@ -2824,7 +2719,7 @@ static const zend_function_entry php_session_iface_functions[] = {
/* {{{ SessionIdInterface functions[]
*/
static const zend_function_entry php_session_id_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionIdInterface, create_sid, arginfo_session_class_create_sid)
+ PHP_ABSTRACT_ME(SessionIdInterface, create_sid, arginfo_class_SessionIdInterface_create_sid)
PHP_FE_END
};
/* }}} */
@@ -2832,8 +2727,8 @@ static const zend_function_entry php_session_id_iface_functions[] = {
/* {{{ SessionUpdateTimestampHandler functions[]
*/
static const zend_function_entry php_session_update_timestamp_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_session_class_validateId)
- PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_session_class_updateTimestamp)
+ PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_class_SessionUpdateTimestampHandlerInterface_validateId)
+ PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_class_SessionUpdateTimestampHandlerInterface_updateTimestamp)
PHP_FE_END
};
/* }}} */
@@ -2841,13 +2736,13 @@ static const zend_function_entry php_session_update_timestamp_iface_functions[]
/* {{{ SessionHandler functions[]
*/
static const zend_function_entry php_session_class_functions[] = {
- PHP_ME(SessionHandler, open, arginfo_session_class_open, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, close, arginfo_session_class_close, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, read, arginfo_session_class_read, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, write, arginfo_session_class_write, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, destroy, arginfo_session_class_destroy, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, gc, arginfo_session_class_gc, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, create_sid, arginfo_session_class_create_sid, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, open, arginfo_class_SessionHandlerInterface_open, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, close, arginfo_class_SessionHandlerInterface_close, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, read, arginfo_class_SessionHandlerInterface_read, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, write, arginfo_class_SessionHandlerInterface_write, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, destroy, arginfo_class_SessionHandlerInterface_destroy, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, gc, arginfo_class_SessionHandlerInterface_gc, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, create_sid, arginfo_class_SessionIdInterface_create_sid, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/session/session.stub.php b/ext/session/session.stub.php
new file mode 100644
index 0000000000..51c5b47bdb
--- /dev/null
+++ b/ext/session/session.stub.php
@@ -0,0 +1,92 @@
+<?php
+
+/** @return string|false */
+function session_name(string $name = UNKNOWN) {}
+
+/** @return string|false */
+function session_module_name(string $module = UNKNOWN) {}
+
+/** @return string|false */
+function session_save_path(string $path = UNKNOWN) {}
+
+/** @return string|false */
+function session_id(string $id = UNKNOWN) {}
+
+/** @return string|false */
+function session_create_id(string $prefix = "") {}
+
+function session_regenerate_id(bool $delete_old_session = false): bool {}
+
+function session_decode(string $data): bool {}
+
+/** @return string|false */
+function session_encode() {}
+
+function session_destroy(): bool {}
+
+function session_unset(): bool {}
+
+/** @return int|false */
+function session_gc() {}
+
+function session_get_cookie_params(): array {}
+
+function session_write_close(): bool {}
+
+function session_abort(): bool {}
+
+function session_reset(): bool {}
+
+function session_status(): int {}
+
+function session_register_shutdown(): void {}
+
+function session_commit(): bool {}
+
+function session_set_save_handler($open, $close = null, $read = null, $write = null, $destroy = null, $gc = null, $create_sid = null, $validate_sid = null, $update_timestamp = null): bool {}
+
+/** @return string|false */
+function session_cache_limiter(string $cache_limiter = UNKNOWN) {}
+
+/** @return int|false */
+function session_cache_expire(?int $new_cache_expire = null) {}
+
+function session_set_cookie_params($lifetime_or_options, string $path = UNKNOWN, string $domain = "", ?bool $secure = null, ?bool $httponly = null): bool {}
+
+function session_start(array $options = []): bool {}
+
+interface SessionHandlerInterface
+{
+ /** @return bool */
+ function open(string $save_path, string $session_name);
+
+ /** @return bool */
+ function close();
+
+ /** @return string */
+ function read(string $key);
+
+ /** @return bool */
+ function write(string $key, string $val);
+
+ /** @return bool */
+ function destroy(string $key);
+
+ /** @return int|bool */
+ function gc(int $maxlifetime);
+}
+
+interface SessionIdInterface
+{
+ /** @return string */
+ function create_sid();
+}
+
+interface SessionUpdateTimestampHandlerInterface
+{
+ /** @return bool */
+ function validateId(string $key);
+
+ /** @return bool */
+ function updateTimestamp(string $key, string $val);
+}
diff --git a/ext/session/session_arginfo.h b/ext/session/session_arginfo.h
new file mode 100644
index 0000000000..f13a641edc
--- /dev/null
+++ b/ext/session/session_arginfo.h
@@ -0,0 +1,116 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_name, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_module_name, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, module, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_save_path, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_id, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_create_id, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_regenerate_id, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, delete_old_session, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_decode, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_encode, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_destroy, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_unset arginfo_session_destroy
+
+#define arginfo_session_gc arginfo_session_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_get_cookie_params, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_write_close arginfo_session_destroy
+
+#define arginfo_session_abort arginfo_session_destroy
+
+#define arginfo_session_reset arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_status, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_register_shutdown, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_commit arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_save_handler, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, open)
+ ZEND_ARG_INFO(0, close)
+ ZEND_ARG_INFO(0, read)
+ ZEND_ARG_INFO(0, write)
+ ZEND_ARG_INFO(0, destroy)
+ ZEND_ARG_INFO(0, gc)
+ ZEND_ARG_INFO(0, create_sid)
+ ZEND_ARG_INFO(0, validate_sid)
+ ZEND_ARG_INFO(0, update_timestamp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_limiter, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, cache_limiter, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_expire, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, new_cache_expire, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_cookie_params, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, lifetime_or_options)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, secure, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, httponly, _IS_BOOL, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_start, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_open, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, save_path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, session_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionHandlerInterface_close arginfo_session_encode
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_read, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_write, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionHandlerInterface_destroy arginfo_class_SessionHandlerInterface_read
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_gc, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionIdInterface_create_sid arginfo_session_encode
+
+#define arginfo_class_SessionUpdateTimestampHandlerInterface_validateId arginfo_class_SessionHandlerInterface_read
+
+#define arginfo_class_SessionUpdateTimestampHandlerInterface_updateTimestamp arginfo_class_SessionHandlerInterface_write
diff --git a/ext/session/tests/session_cache_expire_error.phpt b/ext/session/tests/session_cache_expire_error.phpt
deleted file mode 100644
index 5ae5d95637..0000000000
--- a/ext/session/tests/session_cache_expire_error.phpt
+++ /dev/null
@@ -1,169 +0,0 @@
---TEST--
-Test session_cache_expire() function : error functionality
---SKIPIF--
-<?php include('skipif.inc'); ?>
---FILE--
-<?php
-
-ob_start();
-
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
-echo "*** Testing session_cache_expire() : error functionality ***\n";
-
-// Get an unset variable
-$unset_var = 10;
-unset($unset_var);
-
-class classA
-{
- public function __toString() {
- return "Hello World!";
- }
-}
-
-$heredoc = <<<EOT
-Hello World!
-EOT;
-
-$fp = fopen(__FILE__, "r");
-
-// Unexpected values to be passed as arguments
-$inputs = array(
-
- // Integer data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // Float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // Null data
-/*10*/ NULL,
- null,
-
- // Boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // Empty strings
-/*16*/ "",
- '',
-
- // Invalid string data
-/*18*/ "Nothing",
- 'Nothing',
- $heredoc,
-
- // Object data
-/*21*/ new classA(),
-
- // Undefined data
-/*22*/ @$undefined_var,
-
- // Unset data
-/*23*/ @$unset_var,
-
- // Resource variable
-/*24*/ $fp
-);
-
-
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(session_cache_expire($input));
- $iterator++;
-};
-
-fclose($fp);
-echo "Done";
-ob_end_flush();
-?>
---EXPECTF--
-*** Testing session_cache_expire() : error functionality ***
-
--- Iteration 1 --
-int(180)
-
--- Iteration 2 --
-int(0)
-
--- Iteration 3 --
-int(1)
-
--- Iteration 4 --
-int(12345)
-
--- Iteration 5 --
-int(-2345)
-
--- Iteration 6 --
-int(10)
-
--- Iteration 7 --
-int(-10)
-
--- Iteration 8 --
-int(%s)
-
--- Iteration 9 --
-int(1)
-
--- Iteration 10 --
-int(0)
-
--- Iteration 11 --
-int(0)
-
--- Iteration 12 --
-int(0)
-
--- Iteration 13 --
-int(1)
-
--- Iteration 14 --
-int(0)
-
--- Iteration 15 --
-int(1)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(0)
-
--- Iteration 20 --
-int(0)
-
--- Iteration 21 --
-int(0)
-
--- Iteration 22 --
-int(0)
-
--- Iteration 23 --
-int(0)
-
--- Iteration 24 --
-int(0)
-Done
diff --git a/ext/session/tests/session_cache_limiter_error.phpt b/ext/session/tests/session_cache_limiter_error.phpt
index 42b2cb0694..284649e277 100644
--- a/ext/session/tests/session_cache_limiter_error.phpt
+++ b/ext/session/tests/session_cache_limiter_error.phpt
@@ -75,9 +75,6 @@ $inputs = array(
// Unset data
/*23*/ @$unset_var,
-
- // Resource variable
-/*24*/ $fp
);
@@ -163,9 +160,4 @@ string(12) "Hello World!"
-- Iteration 23 --
string(0) ""
-
--- Iteration 24 --
-
-Warning: session_cache_limiter() expects parameter 1 to be string, resource given in %s on line %d
-NULL
Done
diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt
index a50feb0cf0..b926de323e 100644
--- a/ext/session/tests/session_decode_variation3.phpt
+++ b/ext/session/tests/session_decode_variation3.phpt
@@ -37,7 +37,7 @@ ob_end_flush();
Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
bool(false)
-Notice: Undefined variable: _SESSION in %s on line %d
+Warning: Undefined variable: _SESSION in %s on line %d
NULL
array(3) {
["foo"]=>
diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt
index 1a87eb14a3..a947eab54e 100644
--- a/ext/session/tests/session_encode_error2.phpt
+++ b/ext/session/tests/session_encode_error2.phpt
@@ -84,7 +84,11 @@ $iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
var_dump(session_start());
- $_SESSION[$input] = "Hello World!";
+ try {
+ $_SESSION[$input] = "Hello World!";
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump(session_encode());
var_dump(session_destroy());
$iterator++;
@@ -225,8 +229,7 @@ bool(true)
-- Iteration 21 --
bool(true)
-
-Warning: Illegal offset type in %s on line 82
+Illegal offset type
bool(false)
bool(true)
@@ -243,7 +246,7 @@ bool(true)
-- Iteration 24 --
bool(true)
-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: session_encode(): Skipping numeric key %d in %s on line %d
bool(false)
diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt
index c3c5464860..79d99f3375 100644
--- a/ext/session/tests/session_regenerate_id_cookie.phpt
+++ b/ext/session/tests/session_regenerate_id_cookie.phpt
@@ -64,7 +64,7 @@ echo "Done";
?>
--EXPECTF--
*** Testing session_regenerate_id() : basic functionality for cookie ***
-string(%d) "X-Powered-By: PHP/7.%s
+string(%d) "X-Powered-By: PHP/%d.%d.%s
Expires: %s
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt
index b7bcc3fca6..bbf125bc9a 100644
--- a/ext/session/tests/session_set_save_handler_class_012.phpt
+++ b/ext/session/tests/session_set_save_handler_class_012.phpt
@@ -38,25 +38,23 @@ class MySession extends SessionHandler {
$oldHandler = ini_get('session.save_handler');
$handler = new MySession;
session_set_save_handler($handler);
-var_dump(session_start());
+try {
+ var_dump(session_start());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
Open
-Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on line %d
-Read %s
-
-Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d
+Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
+SessionHandler::open() expects exactly 2 parameters, 0 given
-Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d
-
-Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
-bool(false)
+Warning: Undefined variable: _SESSION in %s on line %d
string(0) ""
string(5) "files"
string(4) "user"
-int(2)
-array(0) {
-}
+int(1)
+NULL
diff --git a/ext/session/tests/session_set_save_handler_class_013.phpt b/ext/session/tests/session_set_save_handler_class_013.phpt
index 28e49c9f98..79c732f30c 100644
--- a/ext/session/tests/session_set_save_handler_class_013.phpt
+++ b/ext/session/tests/session_set_save_handler_class_013.phpt
@@ -41,6 +41,7 @@ session_set_save_handler($handler);
session_start();
var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
+?>
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***
Open
@@ -52,4 +53,10 @@ int(2)
array(0) {
}
-Warning: SessionHandler::close() expects exactly 0 parameters, 1 given in %s on line %d
+Fatal error: Uncaught ArgumentCountError: SessionHandler::close() expects exactly 0 parameters, 1 given in %s:%d
+Stack trace:
+#0 %s(%d): SessionHandler->close(false)
+#1 [internal function]: MySession->close()
+#2 [internal function]: session_write_close()
+#3 {main}
+ thrown in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_class_017.phpt b/ext/session/tests/session_set_save_handler_class_017.phpt
index 460552a620..456ea55dff 100644
--- a/ext/session/tests/session_set_save_handler_class_017.phpt
+++ b/ext/session/tests/session_set_save_handler_class_017.phpt
@@ -55,7 +55,7 @@ class MySession2 extends SessionHandler {
}
public function create_sid() {
- return 'my_sid';
+ return pathinfo(__FILE__)['filename'];
}
}
@@ -72,12 +72,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_class_017');
+--EXPECT--
*** Testing session_set_save_handler() function: class with create_sid ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_class_017"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_class_018.phpt b/ext/session/tests/session_set_save_handler_class_018.phpt
index c0b2eb61bf..7336b4ae88 100644
--- a/ext/session/tests/session_set_save_handler_class_018.phpt
+++ b/ext/session/tests/session_set_save_handler_class_018.phpt
@@ -34,7 +34,7 @@ class MySession2 extends SessionHandler {
}
public function read($id) {
- return @file_get_contents($this->path . $id);
+ return (string)@file_get_contents($this->path . $id);
}
public function write($id, $data) {
@@ -55,11 +55,11 @@ class MySession2 extends SessionHandler {
}
public function create_sid() {
- return 'my_sid';
+ return pathinfo(__FILE__)['filename'];
}
public function validate_sid($id) {
- return 'my_sid'===$id;
+ return pathinfo(__FILE__)['filename']===$id;
}
}
@@ -76,12 +76,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_class_018');
+--EXPECT--
*** Testing session_set_save_handler() function: class with validate_sid ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_class_018"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt
index bc9f801a5e..cf01d8badb 100644
--- a/ext/session/tests/session_set_save_handler_iface_002.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_002.phpt
@@ -76,14 +76,15 @@ $ret = session_set_save_handler(array($handler, 'open'), array($handler, 'close'
array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc'));
var_dump($ret);
-$ret = session_set_save_handler($handler);
-var_dump($ret);
+try {
+ $ret = session_set_save_handler($handler);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
session_start();
--EXPECTF--
*** Testing session_set_save_handler() function: interface wrong ***
bool(true)
-
-Warning: session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given in %s
-bool(false)
+session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given
good handler writing
diff --git a/ext/session/tests/session_set_save_handler_iface_003.phpt b/ext/session/tests/session_set_save_handler_iface_003.phpt
index 5a73d6d5f5..40474cb72e 100644
--- a/ext/session/tests/session_set_save_handler_iface_003.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_003.phpt
@@ -34,7 +34,7 @@ class MySession2 implements SessionHandlerInterface, SessionIdInterface {
}
public function read($id) {
- return @file_get_contents($this->path . $id);
+ return (string)@file_get_contents($this->path . $id);
}
public function write($id, $data) {
@@ -56,7 +56,7 @@ class MySession2 implements SessionHandlerInterface, SessionIdInterface {
}
public function create_sid() {
- return 'my_sid';
+ return pathinfo(__FILE__)['filename'];
}
}
@@ -73,12 +73,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_iface_003');
+--EXPECT--
*** Testing session_set_save_handler() function: id interface ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_iface_003"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_sid_001.phpt b/ext/session/tests/session_set_save_handler_sid_001.phpt
index 4d297d98f7..bd8c18424f 100644
--- a/ext/session/tests/session_set_save_handler_sid_001.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_001.phpt
@@ -28,7 +28,7 @@ class MySession2 {
}
public function read($id) {
- return @file_get_contents($this->path . $id);
+ return (string)@file_get_contents($this->path . $id);
}
public function write($id, $data) {
@@ -50,7 +50,7 @@ class MySession2 {
}
public function create_sid() {
- return 'my_sid';
+ return pathinfo(__FILE__)['filename'];
}
}
@@ -68,12 +68,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_sid_001');
+--EXPECT--
*** Testing session_set_save_handler() function: create_sid ***
-string(%d) "my_sid"
+string(32) "session_set_save_handler_sid_001"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index 1aafa6c6f4..2181e21893 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.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/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 8a4c0b8763..4f47372f31 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -24,6 +24,8 @@
#include "php.h"
#include "php_ini.h"
#include "php_shmop.h"
+#include "shmop_arginfo.h"
+
# ifndef PHP_WIN32
# include <sys/ipc.h>
# include <sys/shm.h>
@@ -44,39 +46,6 @@ php_shmop_globals shmop_globals;
int shm_type;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_open, 0, 0, 4)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_read, 0, 0, 3)
- ZEND_ARG_INFO(0, shmid)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_close, 0, 0, 1)
- ZEND_ARG_INFO(0, shmid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_size, 0, 0, 1)
- ZEND_ARG_INFO(0, shmid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_write, 0, 0, 3)
- ZEND_ARG_INFO(0, shmid)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_delete, 0, 0, 1)
- ZEND_ARG_INFO(0, shmid)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ shmop_functions[]
*/
static const zend_function_entry shmop_functions[] = {
@@ -238,7 +207,7 @@ PHP_FUNCTION(shmop_read)
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (start < 0 || start > shmop->size) {
@@ -273,7 +242,7 @@ PHP_FUNCTION(shmop_close)
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ return;
}
zend_list_close(Z_RES_P(shmid));
@@ -292,7 +261,7 @@ PHP_FUNCTION(shmop_size)
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(shmop->size);
@@ -314,7 +283,7 @@ PHP_FUNCTION(shmop_write)
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((shmop->shmatflg & SHM_RDONLY) == SHM_RDONLY) {
@@ -346,7 +315,7 @@ PHP_FUNCTION(shmop_delete)
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (shmctl(shmop->shmid, IPC_RMID, NULL)) {
diff --git a/ext/shmop/shmop.stub.php b/ext/shmop/shmop.stub.php
new file mode 100644
index 0000000000..11a65fc728
--- /dev/null
+++ b/ext/shmop/shmop.stub.php
@@ -0,0 +1,31 @@
+<?php
+
+/** @return resource|false */
+function shmop_open(int $key, string $flags, int $mode, int $size) {}
+
+/**
+ * @param resource $shmid
+ * @return string|false
+ */
+function shmop_read($shmid, int $start, int $count) {}
+
+/**
+ * @param resource $shmid
+ */
+function shmop_close($shmid): void {}
+
+/**
+ * @param resource $shmid
+ */
+function shmop_size($shmid): int {}
+
+/**
+ * @param resource $shmid
+ * @return int|false
+ */
+function shmop_write($shmid, string $data, int $offset) {}
+
+/**
+ * @param resource $shmid
+ */
+function shmop_delete($shmid): bool {}
diff --git a/ext/shmop/shmop_arginfo.h b/ext/shmop/shmop_arginfo.h
new file mode 100644
index 0000000000..c91b4ace12
--- /dev/null
+++ b/ext/shmop/shmop_arginfo.h
@@ -0,0 +1,32 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_open, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_read, 0, 0, 3)
+ ZEND_ARG_INFO(0, shmid)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shmop_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, shmid)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shmop_size, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, shmid)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_write, 0, 0, 3)
+ ZEND_ARG_INFO(0, shmid)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shmop_delete, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, shmid)
+ZEND_END_ARG_INFO()
diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt
index 3206f90776..a06f454445 100644
--- a/ext/shmop/tests/002.phpt
+++ b/ext/shmop/tests/002.phpt
@@ -18,9 +18,6 @@ edgarsandi - <edgar.r.sandi@gmail.com>
};
echo PHP_EOL, '## shmop_open function tests ##';
- // warning outputs: 4 parameters expected
- var_dump($shm_id = shmop_open());
-
// warning outputs: invalid flag when the flags length != 1
var_dump(shmop_open($hex_shm_id(), '', 0644, 1024));
@@ -34,9 +31,6 @@ echo PHP_EOL, '## shmop_open function tests ##';
var_dump(shmop_open($hex_shm_id(), "c", 0666, 0));
echo PHP_EOL, '## shmop_read function tests ##';
- // warning outputs: 3 parameters expected
- var_dump(shmop_read());
-
// warning outputs: start is out of range
$shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
var_dump(shmop_read($shm_id, -10, 0));
@@ -48,31 +42,13 @@ echo PHP_EOL, '## shmop_read function tests ##';
shmop_delete($shm_id);
echo PHP_EOL, '## shmop_write function tests ##';
- // warning outputs: 3 parameters expected
- var_dump(shmop_write());
-
// warning outputs: offset out of range
$shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
var_dump(shmop_write($shm_id, 'text to try write', -10));
shmop_delete($shm_id);
-
-echo PHP_EOL, '## shmop_size function tests ##';
- // warning outputs: 1 parameter expected
- var_dump(shmop_size());
-
-echo PHP_EOL, '## shmop_delete function tests ##';
- // warning outputs: 1 parameter expected
- var_dump(shmop_delete());
-
-echo PHP_EOL, '## shmop_close function tests ##';
- // warning outputs: 1 parameter expected
- var_dump(shmop_close());
?>
--EXPECTF--
## shmop_open function tests ##
-Warning: shmop_open() expects exactly 4 parameters, 0 given in %s on line %d
-NULL
-
Warning: shmop_open(): is not a valid flag in %s on line %d
bool(false)
@@ -86,9 +62,6 @@ Warning: shmop_open(): Shared memory segment size must be greater than zero in %
bool(false)
## shmop_read function tests ##
-Warning: shmop_read() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
Warning: shmop_read(): start is out of range in %s on line %d
bool(false)
@@ -96,20 +69,5 @@ Warning: shmop_read(): count is out of range in %s on line %d
bool(false)
## shmop_write function tests ##
-Warning: shmop_write() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
Warning: shmop_write(): offset out of range in %s on line %d
bool(false)
-
-## shmop_size function tests ##
-Warning: shmop_size() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-## shmop_delete function tests ##
-Warning: shmop_delete() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-## shmop_close function tests ##
-Warning: shmop_close() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
diff --git a/ext/simplexml/php_simplexml.h b/ext/simplexml/php_simplexml.h
index 09752229ac..164525d7b6 100644
--- a/ext/simplexml/php_simplexml.h
+++ b/ext/simplexml/php_simplexml.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/ext/simplexml/php_simplexml_exports.h b/ext/simplexml/php_simplexml_exports.h
index 20e9785162..748a59317d 100644
--- a/ext/simplexml/php_simplexml_exports.h
+++ b/ext/simplexml/php_simplexml_exports.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/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 2cdff0e648..563856393a 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.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, |
@@ -30,6 +28,7 @@
#include "ext/standard/php_string.h"
#include "php_simplexml.h"
#include "php_simplexml_exports.h"
+#include "simplexml_arginfo.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "sxe.h"
@@ -50,13 +49,13 @@ PHP_SXE_API zend_class_entry *sxe_get_element_class_entry() /* {{{ */
static php_sxe_object* php_sxe_object_new(zend_class_entry *ce, zend_function *fptr_count);
static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data);
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data);
-static zval *sxe_get_value(zval *z, zval *rv);
static void php_sxe_iterator_dtor(zend_object_iterator *iter);
static int php_sxe_iterator_valid(zend_object_iterator *iter);
static zval *php_sxe_iterator_current_data(zend_object_iterator *iter);
static void php_sxe_iterator_current_key(zend_object_iterator *iter, zval *key);
static void php_sxe_iterator_move_forward(zend_object_iterator *iter);
static void php_sxe_iterator_rewind(zend_object_iterator *iter);
+static int sxe_object_cast_ex(zend_object *readobj, zval *writeobj, int type);
/* {{{ _node_as_zval()
*/
@@ -228,7 +227,7 @@ next_iter:
/* {{{ sxe_prop_dim_read()
*/
-static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv)
+static zval *sxe_prop_dim_read(zend_object *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv)
{
php_sxe_object *sxe;
char *name;
@@ -238,7 +237,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
int nodendx = 0;
int test = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -369,15 +368,17 @@ long_dim:
/* {{{ sxe_property_read()
*/
-static zval *sxe_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *sxe_property_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- return sxe_prop_dim_read(object, member, 1, 0, type, rv);
+ zval member;
+ ZVAL_STR(&member, name);
+ return sxe_prop_dim_read(object, &member, 1, 0, type, rv);
}
/* }}} */
/* {{{ sxe_dimension_read()
*/
-static zval *sxe_dimension_read(zval *object, zval *offset, int type, zval *rv)
+static zval *sxe_dimension_read(zend_object *object, zval *offset, int type, zval *rv)
{
return sxe_prop_dim_read(object, offset, 0, 1, type, rv);
}
@@ -419,7 +420,7 @@ static void change_node_zval(xmlNodePtr node, zval *value)
/* {{{ sxe_property_write()
*/
-static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode)
+static zval *sxe_prop_dim_write(zend_object *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -436,7 +437,7 @@ static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bo
zval tmp_zv, zval_copy;
zend_string *trim_str;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -525,7 +526,12 @@ long_dim:
break;
case IS_OBJECT:
if (Z_OBJCE_P(value) == sxe_class_entry) {
- value = sxe_get_value(value, &zval_copy);
+ if (sxe_object_cast_ex(Z_OBJ_P(value), &zval_copy, IS_STRING) == FAILURE) {
+ zend_error(E_ERROR, "Unable to cast node to string");
+ /* FIXME: Should not be fatal */
+ }
+
+ value = &zval_copy;
new_value = 1;
break;
}
@@ -656,42 +662,41 @@ next_iter:
/* {{{ sxe_property_write()
*/
-static zval *sxe_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *sxe_property_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval *retval = sxe_prop_dim_write(object, member, value, 1, 0, NULL);
-
+ zval member;
+ ZVAL_STR(&member, name);
+ zval *retval = sxe_prop_dim_write(object, &member, value, 1, 0, NULL);
return retval == &EG(error_zval) ? &EG(uninitialized_zval) : retval;
}
/* }}} */
/* {{{ sxe_dimension_write()
*/
-static void sxe_dimension_write(zval *object, zval *offset, zval *value)
+static void sxe_dimension_write(zend_object *object, zval *offset, zval *value)
{
sxe_prop_dim_write(object, offset, value, 0, 1, NULL);
}
/* }}} */
-static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, void **cache_slot) /* {{{ */
+static zval *sxe_property_get_adr(zend_object *object, zend_string *zname, int fetch_type, void **cache_slot) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
zval ret;
char *name;
SXE_ITER type;
+ zval member;
- if (!try_convert_to_string(member)) {
- return NULL;
- }
-
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
- name = Z_STRVAL_P(member);
+ name = ZSTR_VAL(zname);
node = sxe_get_element_by_name(sxe, node, &name, &type);
if (node) {
return NULL;
}
- if (sxe_prop_dim_write(object, member, NULL, 1, 0, &node) == &EG(error_zval)) {
+ ZVAL_STR(&member, zname);
+ if (sxe_prop_dim_write(object, &member, NULL, 1, 0, &node) == &EG(error_zval)) {
return NULL;
}
type = SXE_ITER_NONE;
@@ -711,7 +716,7 @@ static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, vo
/* {{{ sxe_prop_dim_exists()
*/
-static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs)
+static int sxe_prop_dim_exists(zend_object *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -729,7 +734,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
member = &tmp_zv;
}
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
@@ -817,15 +822,17 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
/* {{{ sxe_property_exists()
*/
-static int sxe_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int sxe_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- return sxe_prop_dim_exists(object, member, check_empty, 1, 0);
+ zval member;
+ ZVAL_STR(&member, name);
+ return sxe_prop_dim_exists(object, &member, check_empty, 1, 0);
}
/* }}} */
/* {{{ sxe_dimension_exists()
*/
-static int sxe_dimension_exists(zval *object, zval *member, int check_empty)
+static int sxe_dimension_exists(zend_object *object, zval *member, int check_empty)
{
return sxe_prop_dim_exists(object, member, check_empty, 0, 1);
}
@@ -833,7 +840,7 @@ static int sxe_dimension_exists(zval *object, zval *member, int check_empty)
/* {{{ sxe_prop_dim_delete()
*/
-static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zend_bool attribs)
+static void sxe_prop_dim_delete(zend_object *object, zval *member, zend_bool elements, zend_bool attribs)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -852,7 +859,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
member = &tmp_zv;
}
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
@@ -944,15 +951,17 @@ next_iter:
/* {{{ sxe_property_delete()
*/
-static void sxe_property_delete(zval *object, zval *member, void **cache_slot)
+static void sxe_property_delete(zend_object *object, zend_string *name, void **cache_slot)
{
- sxe_prop_dim_delete(object, member, 1, 0);
+ zval member;
+ ZVAL_STR(&member, name);
+ sxe_prop_dim_delete(object, &member, 1, 0);
}
/* }}} */
/* {{{ sxe_dimension_unset()
*/
-static void sxe_dimension_delete(zval *object, zval *offset)
+static void sxe_dimension_delete(zend_object *object, zval *offset)
{
sxe_prop_dim_delete(object, offset, 0, 1);
}
@@ -1026,7 +1035,7 @@ static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *val
}
/* }}} */
-static int sxe_prop_is_empty(zval *object) /* {{{ */
+static int sxe_prop_is_empty(zend_object *object) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -1036,7 +1045,7 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */
int is_empty;
int use_iter = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
if (!node) {
@@ -1119,7 +1128,7 @@ next_iter:
}
/* }}} */
-static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
+static HashTable *sxe_get_prop_hash(zend_object *object, int is_debug) /* {{{ */
{
zval value;
zval zattr;
@@ -1135,7 +1144,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
use_iter = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (is_debug) {
rv = zend_new_array(0);
@@ -1249,9 +1258,9 @@ next_iter:
}
/* }}} */
-static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ {
+static HashTable *sxe_get_gc(zend_object *object, zval **table, int *n) /* {{{ */ {
php_sxe_object *sxe;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
*table = NULL;
*n = 0;
@@ -1259,13 +1268,13 @@ static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ {
}
/* }}} */
-static HashTable *sxe_get_properties(zval *object) /* {{{ */
+static HashTable *sxe_get_properties(zend_object *object) /* {{{ */
{
return sxe_get_prop_hash(object, 0);
}
/* }}} */
-static HashTable * sxe_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable * sxe_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
*is_temp = 1;
return sxe_get_prop_hash(object, 1);
@@ -1277,6 +1286,8 @@ static int sxe_objects_compare(zval *object1, zval *object2) /* {{{ */
php_sxe_object *sxe1;
php_sxe_object *sxe2;
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+
sxe1 = Z_SXEOBJ_P(object1);
sxe2 = Z_SXEOBJ_P(object2);
@@ -1403,7 +1414,7 @@ SXE_METHOD(registerXPathNamespace)
}
if (xmlXPathRegisterNs(sxe->xpath, (xmlChar *)prefix, (xmlChar *)ns_uri) != 0) {
- RETURN_FALSE
+ RETURN_FALSE;
}
RETURN_TRUE;
}
@@ -1419,88 +1430,76 @@ SXE_METHOD(asXML)
xmlOutputBufferPtr outbuf;
xmlChar *strval;
int strval_len;
- char *filename;
+ char *filename = NULL;
size_t filename_len;
- if (ZEND_NUM_ARGS() > 1) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- sxe = Z_SXEOBJ_P(ZEND_THIS);
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node);
-
- if (node) {
- if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
- int bytes;
- bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
- if (bytes == -1) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
- } else {
- outbuf = xmlOutputBufferCreateFilename(filename, NULL, 0);
-
- if (outbuf == NULL) {
- RETURN_FALSE;
- }
-
- xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
- xmlOutputBufferClose(outbuf);
- RETURN_TRUE;
- }
- } else {
- RETURN_FALSE;
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p", &filename, &filename_len) == FAILURE) {
+ return;
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
GET_NODE(sxe, node);
node = php_sxe_get_first_node(sxe, node);
- if (node) {
+ if (!node) {
+ RETURN_FALSE;
+ }
+
+ if (filename) {
if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
- xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
- if (!strval) {
- RETVAL_FALSE;
+ int bytes;
+ bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
+ if (bytes == -1) {
+ RETURN_FALSE;
} else {
- RETVAL_STRINGL((char *)strval, strval_len);
+ RETURN_TRUE;
}
- xmlFree(strval);
} else {
- char *return_content;
- size_t return_len;
- /* Should we be passing encoding information instead of NULL? */
- outbuf = xmlAllocOutputBuffer(NULL);
+ outbuf = xmlOutputBufferCreateFilename(filename, NULL, 0);
if (outbuf == NULL) {
RETURN_FALSE;
}
- xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
- xmlOutputBufferFlush(outbuf);
+ xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
+ xmlOutputBufferClose(outbuf);
+ RETURN_TRUE;
+ }
+ }
+
+ if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
+ xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
+ if (!strval) {
+ RETVAL_FALSE;
+ } else {
+ RETVAL_STRINGL((char *)strval, strval_len);
+ }
+ xmlFree(strval);
+ } else {
+ char *return_content;
+ size_t return_len;
+ /* Should we be passing encoding information instead of NULL? */
+ outbuf = xmlAllocOutputBuffer(NULL);
+
+ if (outbuf == NULL) {
+ RETURN_FALSE;
+ }
+
+ xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
+ xmlOutputBufferFlush(outbuf);
#ifdef LIBXML2_NEW_BUFFER
- return_content = (char *)xmlOutputBufferGetContent(outbuf);
- return_len = xmlOutputBufferGetSize(outbuf);
+ return_content = (char *)xmlOutputBufferGetContent(outbuf);
+ return_len = xmlOutputBufferGetSize(outbuf);
#else
- return_content = (char *)outbuf->buffer->content;
- return_len = outbuf->buffer->use;
+ return_content = (char *)outbuf->buffer->content;
+ return_len = outbuf->buffer->use;
#endif
- if (!return_content) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRINGL(return_content, return_len);
- }
- xmlOutputBufferClose(outbuf);
+ if (!return_content) {
+ RETVAL_FALSE;
+ } else {
+ RETVAL_STRINGL(return_content, return_len);
}
- } else {
- RETVAL_FALSE;
+ xmlOutputBufferClose(outbuf);
}
}
/* }}} */
@@ -1661,6 +1660,10 @@ SXE_METHOD(getName)
xmlNodePtr node;
int namelen;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
sxe = Z_SXEOBJ_P(ZEND_THIS);
GET_NODE(sxe, node);
@@ -1875,14 +1878,14 @@ static int cast_object(zval *object, int type, char *contents)
/* {{{ sxe_object_cast()
*/
-static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
+static int sxe_object_cast_ex(zend_object *readobj, zval *writeobj, int type)
{
php_sxe_object *sxe;
xmlChar *contents = NULL;
xmlNodePtr node;
int rv;
- sxe = Z_SXEOBJ_P(readobj);
+ sxe = php_sxe_fetch_object(readobj);
if (type == _IS_BOOL) {
node = php_sxe_get_first_node(sxe, NULL);
@@ -1924,7 +1927,7 @@ static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
/* }}} */
/* {{{ Variant of sxe_object_cast_ex that handles overwritten __toString() method */
-static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
+static int sxe_object_cast(zend_object *readobj, zval *writeobj, int type)
{
if (type == IS_STRING
&& zend_std_cast_object_tostring(readobj, writeobj, IS_STRING) == SUCCESS
@@ -1940,7 +1943,11 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
Returns the string content */
SXE_METHOD(__toString)
{
- if (sxe_object_cast_ex(ZEND_THIS, return_value, IS_STRING) != SUCCESS) {
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ if (sxe_object_cast_ex(Z_OBJ_P(ZEND_THIS), return_value, IS_STRING) != SUCCESS) {
zval_ptr_dtor(return_value);
RETURN_EMPTY_STRING();
}
@@ -1974,10 +1981,10 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count)
}
/* }}} */
-static int sxe_count_elements(zval *object, zend_long *count) /* {{{ */
+static int sxe_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
php_sxe_object *intern;
- intern = Z_SXEOBJ_P(object);
+ intern = php_sxe_fetch_object(object);
if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv);
@@ -2009,25 +2016,14 @@ SXE_METHOD(count)
}
/* }}} */
-static zval *sxe_get_value(zval *z, zval *rv) /* {{{ */
-{
- if (sxe_object_cast_ex(z, rv, IS_STRING) == FAILURE) {
- zend_error(E_ERROR, "Unable to cast node to string");
- /* FIXME: Should not be fatal */
- }
-
- return rv;
-}
-/* }}} */
-
static zend_object_handlers sxe_object_handlers;
/* {{{ sxe_object_clone()
*/
static zend_object *
-sxe_object_clone(zval *object)
+sxe_object_clone(zend_object *object)
{
- php_sxe_object *sxe = Z_SXEOBJ_P(object);
+ php_sxe_object *sxe = php_sxe_fetch_object(object);
php_sxe_object *clone;
xmlNodePtr nodep = NULL;
xmlDocPtr docp = NULL;
@@ -2572,73 +2568,6 @@ PHP_FUNCTION(simplexml_import_dom)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_string, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_import_dom, 0, 0, 1)
- ZEND_ARG_INFO(0, node)
- ZEND_ARG_INFO(0, class_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_xpath, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_registerxpathnamespace, 0, 0, 2)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, ns)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_asxml, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getnamespaces, 0, 0, 0)
- ZEND_ARG_INFO(0, recursve)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getdocnamespaces, 0, 0, 0)
- ZEND_ARG_INFO(0, recursve)
- ZEND_ARG_INFO(0, from_root)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_children, 0, 0, 0)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement__construct, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, data_is_url)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_simplexmlelement__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_addchild, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, ns)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry simplexml_functions[] = { /* {{{ */
PHP_FE(simplexml_load_file, arginfo_simplexml_load_file)
PHP_FE(simplexml_load_string, arginfo_simplexml_load_string)
@@ -2676,20 +2605,20 @@ ZEND_GET_MODULE(simplexml)
/* the method table */
/* each method can have its own parameters and visibility */
static const zend_function_entry sxe_functions[] = { /* {{{ */
- SXE_ME(__construct, arginfo_simplexmlelement__construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
- SXE_ME(asXML, arginfo_simplexmlelement_asxml, ZEND_ACC_PUBLIC)
- SXE_MALIAS(saveXML, asXML, arginfo_simplexmlelement_asxml, ZEND_ACC_PUBLIC)
- SXE_ME(xpath, arginfo_simplexmlelement_xpath, ZEND_ACC_PUBLIC)
- SXE_ME(registerXPathNamespace, arginfo_simplexmlelement_registerxpathnamespace, ZEND_ACC_PUBLIC)
- SXE_ME(attributes, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC)
- SXE_ME(children, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC)
- SXE_ME(getNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC)
- SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getdocnamespaces, ZEND_ACC_PUBLIC)
- SXE_ME(getName, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- SXE_ME(addChild, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
- SXE_ME(addAttribute, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
- SXE_ME(__toString, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- SXE_ME(count, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
+ SXE_ME(__construct, arginfo_class_SimpleXMLElement___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
+ SXE_ME(asXML, arginfo_class_SimpleXMLElement_asXML, ZEND_ACC_PUBLIC)
+ SXE_MALIAS(saveXML, asXML, arginfo_class_SimpleXMLElement_saveXML, ZEND_ACC_PUBLIC)
+ SXE_ME(xpath, arginfo_class_SimpleXMLElement_xpath, ZEND_ACC_PUBLIC)
+ SXE_ME(registerXPathNamespace, arginfo_class_SimpleXMLElement_registerXPathNamespace, ZEND_ACC_PUBLIC)
+ SXE_ME(attributes, arginfo_class_SimpleXMLElement_attributes, ZEND_ACC_PUBLIC)
+ SXE_ME(children, arginfo_class_SimpleXMLElement_children, ZEND_ACC_PUBLIC)
+ SXE_ME(getNamespaces, arginfo_class_SimpleXMLElement_getNamespaces, ZEND_ACC_PUBLIC)
+ SXE_ME(getDocNamespaces, arginfo_class_SimpleXMLElement_getDocNamespaces, ZEND_ACC_PUBLIC)
+ SXE_ME(getName, arginfo_class_SimpleXMLElement_getName, ZEND_ACC_PUBLIC)
+ SXE_ME(addChild, arginfo_class_SimpleXMLElement_addChild, ZEND_ACC_PUBLIC)
+ SXE_ME(addAttribute, arginfo_class_SimpleXMLElement_addAttribute, ZEND_ACC_PUBLIC)
+ SXE_ME(__toString, arginfo_class_SimpleXMLElement___toString, ZEND_ACC_PUBLIC)
+ SXE_ME(count, arginfo_class_SimpleXMLElement_count, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -2716,13 +2645,12 @@ PHP_MINIT_FUNCTION(simplexml)
sxe_object_handlers.read_dimension = sxe_dimension_read;
sxe_object_handlers.write_dimension = sxe_dimension_write;
sxe_object_handlers.get_property_ptr_ptr = sxe_property_get_adr;
- sxe_object_handlers.get = sxe_get_value;
sxe_object_handlers.has_property = sxe_property_exists;
sxe_object_handlers.unset_property = sxe_property_delete;
sxe_object_handlers.has_dimension = sxe_dimension_exists;
sxe_object_handlers.unset_dimension = sxe_dimension_delete;
sxe_object_handlers.get_properties = sxe_get_properties;
- sxe_object_handlers.compare_objects = sxe_objects_compare;
+ sxe_object_handlers.compare = sxe_objects_compare;
sxe_object_handlers.cast_object = sxe_object_cast;
sxe_object_handlers.count_elements = sxe_count_elements;
sxe_object_handlers.get_debug_info = sxe_get_debug_info;
diff --git a/ext/simplexml/simplexml.stub.php b/ext/simplexml/simplexml.stub.php
new file mode 100644
index 0000000000..dbbbfcba92
--- /dev/null
+++ b/ext/simplexml/simplexml.stub.php
@@ -0,0 +1,53 @@
+<?php
+
+/** @return SimpleXMLElement|false */
+function simplexml_load_file(string $filename, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false) {}
+
+/** @return SimpleXMLElement|false */
+function simplexml_load_string(string $data, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false) {}
+
+function simplexml_import_dom(DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {}
+
+class SimpleXMLElement
+{
+ /** @return array|false */
+ public function xpath(string $path) {}
+
+ /** @return bool */
+ public function registerXPathNamespace(string $prefix, string $ns) {}
+
+ /** @return string|bool */
+ public function asXML(string $filename = UNKNOWN) {}
+
+ /** @return string|bool */
+ public function saveXML(string $filename = UNKNOWN) {}
+
+ /** @return array */
+ public function getNamespaces(bool $recursive = false) {}
+
+ /** @return array|false */
+ public function getDocNamespaces(bool $recursive = false, bool $from_root = true) {}
+
+ /** @return SimpleXMLIterator */
+ public function children(?string $ns = null, bool $is_prefix = false) {}
+
+ /** @return SimpleXMLIterator */
+ public function attributes(?string $ns = null, bool $is_prefix = false) {}
+
+ public function __construct(string $data, int $options = 0, bool $data_is_url = false, string $ns = '', bool $is_prefix = false) {}
+
+ /** @return SimpleXMLElement */
+ public function addChild(string $name, ?string $value = null, ?string $ns = null) {}
+
+ /** @return SimpleXMLElement */
+ public function addAttribute(string $name, ?string $value = null, ?string $ns = null) {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return int */
+ public function count() {}
+}
diff --git a/ext/simplexml/simplexml_arginfo.h b/ext/simplexml/simplexml_arginfo.h
new file mode 100644
index 0000000000..ccbbb47d00
--- /dev/null
+++ b/ext/simplexml/simplexml_arginfo.h
@@ -0,0 +1,76 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_string, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_simplexml_import_dom, 0, 1, SimpleXMLElement, 1)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_xpath, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_registerXPathNamespace, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_asXML, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_saveXML arginfo_class_SimpleXMLElement_asXML
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getNamespaces, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getDocNamespaces, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, from_root, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_children, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_attributes arginfo_class_SimpleXMLElement_children
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data_is_url, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_addChild, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_addAttribute arginfo_class_SimpleXMLElement_addChild
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getName, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement___toString arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_count arginfo_class_SimpleXMLElement_getName
diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c
index c60e37e264..c8fce2ccde 100644
--- a/ext/simplexml/sxe.c
+++ b/ext/simplexml/sxe.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, |
@@ -29,6 +27,7 @@
#include "ext/spl/php_spl.h"
#include "ext/spl/spl_iterators.h"
#include "sxe.h"
+#include "sxe_arginfo.h"
PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator = NULL;
PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
@@ -166,19 +165,14 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren)
ZVAL_COPY_DEREF(return_value, data);
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_simplexmliterator__void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry funcs_SimpleXMLIterator[] = {
- PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, valid, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, current, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, key, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, next, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_class_SimpleXMLIterator_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, valid, arginfo_class_SimpleXMLIterator_valid, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, current, arginfo_class_SimpleXMLIterator_current, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, key, arginfo_class_SimpleXMLIterator_key, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, next, arginfo_class_SimpleXMLIterator_next, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_class_SimpleXMLIterator_hasChildren, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_class_SimpleXMLIterator_getChildren, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/simplexml/sxe.h b/ext/simplexml/sxe.h
index 6806553acc..771ddea4bb 100644
--- a/ext/simplexml/sxe.h
+++ b/ext/simplexml/sxe.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/ext/simplexml/sxe.stub.php b/ext/simplexml/sxe.stub.php
new file mode 100644
index 0000000000..98ea3327ba
--- /dev/null
+++ b/ext/simplexml/sxe.stub.php
@@ -0,0 +1,25 @@
+<?php
+
+class SimpleXMLIterator
+{
+ /** @return void */
+ public function rewind() {}
+
+ /** @return bool */
+ public function valid() {}
+
+ /** @return ?SimpleXMLElement */
+ public function current() {}
+
+ /** @return string|false */
+ public function key() {}
+
+ /** @return void */
+ public function next() {}
+
+ /** @return bool */
+ public function hasChildren() {}
+
+ /** @return ?SimpleXMLIterator */
+ public function getChildren() {}
+}
diff --git a/ext/simplexml/sxe_arginfo.h b/ext/simplexml/sxe_arginfo.h
new file mode 100644
index 0000000000..d3b0c6c479
--- /dev/null
+++ b/ext/simplexml/sxe_arginfo.h
@@ -0,0 +1,16 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLIterator_rewind, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLIterator_valid arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_current arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_key arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_next arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_hasChildren arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_getChildren arginfo_class_SimpleXMLIterator_rewind
diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt
deleted file mode 100644
index 8682cf818d..0000000000
--- a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing xpath() with invalid XML
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
-?>
---FILE--
-<?php
-$xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
-var_dump($xml->xpath("BBBB"));
-?>
---EXPECTF--
-Notice: Undefined variable: x in %s on line %d
-
-Warning: simplexml_load_string() expects parameter 3 to be int, float given in %s on line %d
-
-Fatal error: Uncaught Error: Call to a member function xpath() on null in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
index 28e0517651..c050ca2dd4 100644
--- a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
+++ b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
@@ -11,7 +11,7 @@ $xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
var_dump($xml);
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
Warning: simplexml_load_string(): Invalid options in %s on line %d
bool(false)
diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt
index 41e42cb907..d20fbd5aca 100644
--- a/ext/simplexml/tests/bug37565.phpt
+++ b/ext/simplexml/tests/bug37565.phpt
@@ -31,9 +31,5 @@ try {
===DONE===
--EXPECT--
Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: Function Reflection::export() is deprecated
-Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: Function Reflection::export() is deprecated
-Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
===DONE===
diff --git a/ext/simplexml/tests/bug38406.phpt b/ext/simplexml/tests/bug38406.phpt
index ea92229496..51a716cbd3 100644
--- a/ext/simplexml/tests/bug38406.phpt
+++ b/ext/simplexml/tests/bug38406.phpt
@@ -27,7 +27,7 @@ object(SimpleXMLElement)#%d (1) {
string(9) "something"
}
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: It is not yet possible to assign complex types to properties in %s on line %d
Done
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
index d65757258a..45c8ae3d0f 100644
--- a/ext/snmp/php_snmp.h
+++ b/ext/snmp/php_snmp.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/ext/snmp/snmp.c b/ext/snmp/snmp.c
index f2f55d19b5..95c6e210c7 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.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, |
@@ -32,6 +30,7 @@
#include "zend_exceptions.h"
#include "ext/spl/spl_exceptions.h"
+#include "snmp_arginfo.h"
#if HAVE_SNMP
@@ -125,229 +124,6 @@ zend_class_entry *php_snmp_exception_ce;
/* Class object properties */
static HashTable php_snmp_properties;
-/* {{{ arginfo */
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpget, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpgetnext, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpwalk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmprealwalk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpset, 0, 0, 5)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_get_quick_print, 0, 0, 1)
- ZEND_ARG_INFO(0, d)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_quick_print, 0, 0, 1)
- ZEND_ARG_INFO(0, quick_print)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_enum_print, 0, 0, 1)
- ZEND_ARG_INFO(0, enum_print)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_oid_output_format, 0, 0, 1)
- ZEND_ARG_INFO(0, oid_format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_get, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_getnext, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_walk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_real_walk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_set, 0, 0, 5)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_get, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_getnext, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_walk, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_real_walk, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_set, 0, 0, 10)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_valueretrieval, 0, 0, 1)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_snmp_get_valueretrieval, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_read_mib, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-/* OO arginfo */
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_create, 0, 0, 3)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_snmp_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_setSecurity, 0, 0, 8)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, contextName)
- ZEND_ARG_INFO(0, contextEngineID)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, use_orignames)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_walk, 0, 0, 4)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, suffix_keys)
- ZEND_ARG_INFO(0, max_repetitions)
- ZEND_ARG_INFO(0, non_repeaters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set, 0, 0, 3)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-/* }}} */
-
struct objid_query {
int count;
int offset;
@@ -367,13 +143,13 @@ static const zend_function_entry snmp_functions[] = {
PHP_FE(snmpgetnext, arginfo_snmpgetnext)
PHP_FE(snmpwalk, arginfo_snmpwalk)
PHP_FE(snmprealwalk, arginfo_snmprealwalk)
- PHP_FALIAS(snmpwalkoid, snmprealwalk, arginfo_snmprealwalk)
+ PHP_FALIAS(snmpwalkoid, snmprealwalk, arginfo_snmpwalkoid)
PHP_FE(snmpset, arginfo_snmpset)
PHP_FE(snmp_get_quick_print, arginfo_snmp_get_quick_print)
PHP_FE(snmp_set_quick_print, arginfo_snmp_set_quick_print)
PHP_FE(snmp_set_enum_print, arginfo_snmp_set_enum_print)
PHP_FE(snmp_set_oid_output_format, arginfo_snmp_set_oid_output_format)
- PHP_FALIAS(snmp_set_oid_numeric_print, snmp_set_oid_output_format, arginfo_snmp_set_oid_output_format)
+ PHP_FALIAS(snmp_set_oid_numeric_print, snmp_set_oid_output_format, arginfo_snmp_set_oid_numeric_print)
PHP_FE(snmp2_get, arginfo_snmp2_get)
PHP_FE(snmp2_getnext, arginfo_snmp2_getnext)
@@ -1359,7 +1135,7 @@ static int netsnmp_session_set_security(struct snmp_session *session, char *sec_
*/
static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
{
- zval *oid, *value, *type;
+ zval *oid, *value = NULL, *type = NULL;
char *a1, *a2, *a3, *a4, *a5, *a6, *a7;
size_t a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len;
zend_bool use_orignames = 0, suffix_keys = 0;
@@ -1382,7 +1158,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
if (st & SNMP_CMD_SET) {
if (zend_parse_parameters(argc, "ssssssszzz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ return;
}
} else {
/* SNMP_CMD_GET
@@ -1391,13 +1167,13 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
*/
if (zend_parse_parameters(argc, "sssssssz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ return;
}
}
} else {
if (st & SNMP_CMD_SET) {
if (zend_parse_parameters(argc, "sszzz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ return;
}
} else {
/* SNMP_CMD_GET
@@ -1405,25 +1181,25 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
* SNMP_CMD_WALK
*/
if (zend_parse_parameters(argc, "ssz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ return;
}
}
}
} else {
if (st & SNMP_CMD_SET) {
if (zend_parse_parameters(argc, "zzz", &oid, &type, &value) == FAILURE) {
- RETURN_FALSE;
+ return;
}
} else if (st & SNMP_CMD_WALK) {
if (zend_parse_parameters(argc, "z|bll", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (suffix_keys) {
st |= SNMP_USE_SUFFIX_AS_KEYS;
}
} else if (st & SNMP_CMD_GET) {
if (zend_parse_parameters(argc, "z|b", &oid, &use_orignames) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (use_orignames) {
st |= SNMP_ORIGINAL_NAMES_AS_KEYS;
@@ -1432,7 +1208,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
/* SNMP_CMD_GETNEXT
*/
if (zend_parse_parameters(argc, "z", &oid) == FAILURE) {
- RETURN_FALSE;
+ return;
}
}
}
@@ -1556,7 +1332,7 @@ PHP_FUNCTION(snmp_set_quick_print)
zend_long a1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) {
- RETURN_FALSE;
+ return;
}
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, (int)a1);
@@ -1571,7 +1347,7 @@ PHP_FUNCTION(snmp_set_enum_print)
zend_long a1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) {
- RETURN_FALSE;
+ return;
}
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM, (int) a1);
@@ -1586,7 +1362,7 @@ PHP_FUNCTION(snmp_set_oid_output_format)
zend_long a1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) {
- RETURN_FALSE;
+ return;
}
switch((int) a1) {
@@ -1694,7 +1470,7 @@ PHP_FUNCTION(snmp_set_valueretrieval)
zend_long method;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (method >= 0 && method <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
@@ -1712,7 +1488,7 @@ PHP_FUNCTION(snmp_set_valueretrieval)
PHP_FUNCTION(snmp_get_valueretrieval)
{
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ return;
}
RETURN_LONG(SNMP_G(valueretrieval));
@@ -1727,7 +1503,7 @@ PHP_FUNCTION(snmp_read_mib)
size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (!read_mib(filename)) {
@@ -1796,7 +1572,7 @@ PHP_METHOD(snmp, close)
snmp_object = Z_SNMP_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ return;
}
netsnmp_session_free(&(snmp_object->session));
@@ -1851,7 +1627,7 @@ PHP_METHOD(snmp, setSecurity)
if (zend_parse_parameters(argc, "s|ssssss", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (netsnmp_session_set_security(snmp_object->session, a1, a2, a3, a4, a5, a6, a7)) {
@@ -1871,6 +1647,10 @@ PHP_METHOD(snmp, getErrno)
snmp_object = Z_SNMP_P(object);
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETVAL_LONG(snmp_object->snmp_errno);
return;
}
@@ -1885,6 +1665,10 @@ PHP_METHOD(snmp, getError)
snmp_object = Z_SNMP_P(object);
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETURN_STRING(snmp_object->snmp_errstr);
}
/* }}} */
@@ -1907,26 +1691,15 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p
/* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const zend_literal *key])
Generic object property reader */
-zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *php_snmp_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- zval tmp_member;
zval *retval;
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
int ret;
- obj = Z_SNMP_P(object);
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member));
+ obj = php_snmp_fetch_object(object);
+ hnd = zend_hash_find_ptr(&php_snmp_properties, name);
if (hnd && hnd->read_func) {
ret = hnd->read_func(obj, rv);
@@ -1936,11 +1709,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor(member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
@@ -1949,24 +1718,13 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
/* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const zend_literal *key])
Generic object property writer */
-zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *php_snmp_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval tmp_member;
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_SNMP_P(object);
-
- hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member));
+ obj = php_snmp_fetch_object(object);
+ hnd = zend_hash_find_ptr(&php_snmp_properties, name);
if (hnd && hnd->write_func) {
hnd->write_func(obj, value);
@@ -1977,11 +1735,7 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca
}
*/
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor(member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -1990,19 +1744,19 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca
/* {{{ php_snmp_has_property(zval *object, zval *member, int has_set_exists[, const zend_literal *key])
Generic object property checker */
-static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot)
+static int php_snmp_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot)
{
zval rv;
php_snmp_prop_handler *hnd;
int ret = 0;
- if ((hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member))) != NULL) {
+ if ((hnd = zend_hash_find_ptr(&php_snmp_properties, name)) != NULL) {
switch (has_set_exists) {
case ZEND_PROPERTY_EXISTS:
ret = 1;
break;
case ZEND_PROPERTY_ISSET: {
- zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
ret = Z_TYPE_P(value) != IS_NULL? 1 : 0;
zval_ptr_dtor(value);
@@ -2010,7 +1764,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
break;
}
default: {
- zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
convert_to_boolean(value);
ret = Z_TYPE_P(value) == IS_TRUE? 1:0;
@@ -2019,13 +1773,13 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
}
}
} else {
- ret = zend_std_has_property(object, member, has_set_exists, cache_slot);
+ ret = zend_std_has_property(object, name, has_set_exists, cache_slot);
}
return ret;
}
/* }}} */
-static HashTable *php_snmp_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *php_snmp_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */
{
*gc_data = NULL;
*gc_data_count = 0;
@@ -2035,7 +1789,7 @@ static HashTable *php_snmp_get_gc(zval *object, zval **gc_data, int *gc_data_cou
/* {{{ php_snmp_get_properties(zval *object)
Returns all object properties. Injects SNMP properties into object on first call */
-static HashTable *php_snmp_get_properties(zval *object)
+static HashTable *php_snmp_get_properties(zend_object *object)
{
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
@@ -2043,7 +1797,7 @@ static HashTable *php_snmp_get_properties(zval *object)
zval rv;
zend_string *key;
- obj = Z_SNMP_P(object);
+ obj = php_snmp_fetch_object(object);
props = zend_std_get_properties(object);
ZEND_HASH_FOREACH_STR_KEY_PTR(&php_snmp_properties, key, hnd) {
@@ -2227,16 +1981,16 @@ static void free_php_snmp_properties(zval *el) /* {{{ */
/* {{{ php_snmp_class_methods[] */
static const zend_function_entry php_snmp_class_methods[] = {
- PHP_ME(snmp, __construct, arginfo_snmp_create, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, close, arginfo_snmp_void, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, setSecurity, arginfo_snmp_setSecurity, ZEND_ACC_PUBLIC)
-
- PHP_ME(snmp, get, arginfo_snmp_get, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, getnext, arginfo_snmp_get, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, walk, arginfo_snmp_walk, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, set, arginfo_snmp_set, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, getErrno, arginfo_snmp_void, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, getError, arginfo_snmp_void, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, __construct, arginfo_class_SNMP___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, close, arginfo_class_SNMP_close, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, setSecurity, arginfo_class_SNMP_setSecurity, ZEND_ACC_PUBLIC)
+
+ PHP_ME(snmp, get, arginfo_class_SNMP_get, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, getnext, arginfo_class_SNMP_getnext, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, walk, arginfo_class_SNMP_walk, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, set, arginfo_class_SNMP_set, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, getErrno, arginfo_class_SNMP_getErrno, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, getError, arginfo_class_SNMP_getError, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/snmp/snmp.stub.php b/ext/snmp/snmp.stub.php
new file mode 100644
index 0000000000..903ec81570
--- /dev/null
+++ b/ext/snmp/snmp.stub.php
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmpget(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmpgetnext(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmpwalk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmprealwalk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmpwalkoid(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ * @return array|bool
+ */
+function snmpset(string $host, string $community, $object_id, $type, $value, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+function snmp_get_quick_print(): bool {}
+
+function snmp_set_quick_print(int $quick_print): bool {}
+
+function snmp_set_enum_print(int $enum_print): bool {}
+
+function snmp_set_oid_output_format(int $oid_format): bool {}
+
+function snmp_set_oid_numeric_print(int $oid_format): bool {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp2_get(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp2_getnext(string $host, string $community, $object_id, int $timeout = UNKOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp2_walk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp2_real_walk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ * @return array|bool
+ */
+function snmp2_set(string $host, string $community, $object_id, $type, $value, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp3_get(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp3_getnext(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp3_walk(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+function snmp3_real_walk(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+/**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ * @return array|bool
+ */
+function snmp3_set(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, $type, $value, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+function snmp_set_valueretrieval(int $method): bool {}
+
+function snmp_get_valueretrieval(): int {}
+
+function snmp_read_mib(string $filename): bool {}
+
+class SNMP
+{
+ function __construct(int $version, string $host, string $community, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+ /** @return bool */
+ function close() {}
+
+ /** @return bool */
+ function setSecurity(string $sec_level, string $auth_protocol = '', string $auth_passphrase = '', string $priv_protocol = '', string $priv_passphrase = '', string $contextName = '', string $contextEngineID = '') {}
+
+ /**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+ function get($object_id, bool $use_orignames = false) {}
+
+ /**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+ function getnext($object_id) {}
+
+ /**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+ function walk($object_id, bool $suffix_keys = false, int $max_repetitions = UNKNOWN, int $non_repeaters = UNKNOWN) {}
+
+ /**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ * @return array|bool
+ */
+ function set($object_id, $type, $value) {}
+
+ /** @return int */
+ function getErrno() {}
+
+ /** @return string */
+ function getError() {}
+}
diff --git a/ext/snmp/snmp_arginfo.h b/ext/snmp/snmp_arginfo.h
new file mode 100644
index 0000000000..f4cbdbc182
--- /dev/null
+++ b/ext/snmp/snmp_arginfo.h
@@ -0,0 +1,146 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpget, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_snmpgetnext arginfo_snmpget
+
+#define arginfo_snmpwalk arginfo_snmpget
+
+#define arginfo_snmprealwalk arginfo_snmpget
+
+#define arginfo_snmpwalkoid arginfo_snmpget
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpset, 0, 0, 5)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_get_quick_print, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_quick_print, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, quick_print, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_enum_print, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, enum_print, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_oid_output_format, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, oid_format, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_snmp_set_oid_numeric_print arginfo_snmp_set_oid_output_format
+
+#define arginfo_snmp2_get arginfo_snmpget
+
+#define arginfo_snmp2_getnext arginfo_snmpget
+
+#define arginfo_snmp2_walk arginfo_snmpget
+
+#define arginfo_snmp2_real_walk arginfo_snmpget
+
+#define arginfo_snmp2_set arginfo_snmpset
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_get, 0, 0, 8)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_snmp3_getnext arginfo_snmp3_get
+
+#define arginfo_snmp3_walk arginfo_snmp3_get
+
+#define arginfo_snmp3_real_walk arginfo_snmp3_get
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_set, 0, 0, 10)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_valueretrieval, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_get_valueretrieval, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_read_mib, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP___construct, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, version, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_setSecurity, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contextName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contextEngineID, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_get, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, use_orignames, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_getnext, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_walk, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, suffix_keys, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, max_repetitions, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, non_repeaters, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_set, 0, 0, 3)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SNMP_getErrno arginfo_class_SNMP_close
+
+#define arginfo_class_SNMP_getError arginfo_class_SNMP_close
diff --git a/ext/snmp/tests/reflection.phpt b/ext/snmp/tests/reflection.phpt
index 7943dcf5be..d2823d8377 100644
--- a/ext/snmp/tests/reflection.phpt
+++ b/ext/snmp/tests/reflection.phpt
@@ -25,11 +25,11 @@ echo new reflectionmethod('snmp', 'getError');
Method [ <internal:snmp, ctor> public method __construct ] {
- Parameters [5] {
- Parameter #0 [ <required> $version ]
- Parameter #1 [ <required> $host ]
- Parameter #2 [ <required> $community ]
- Parameter #3 [ <optional> $timeout ]
- Parameter #4 [ <optional> $retries ]
+ Parameter #0 [ <required> int $version ]
+ Parameter #1 [ <required> string $host ]
+ Parameter #2 [ <required> string $community ]
+ Parameter #3 [ <optional> int $timeout ]
+ Parameter #4 [ <optional> int $retries ]
}
}
Method [ <internal:snmp> public method close ] {
@@ -40,36 +40,35 @@ Method [ <internal:snmp> public method close ] {
Method [ <internal:snmp> public method setSecurity ] {
- Parameters [7] {
- Parameter #0 [ <required> $sec_level ]
- Parameter #1 [ <required> $auth_protocol ]
- Parameter #2 [ <required> $auth_passphrase ]
- Parameter #3 [ <required> $priv_protocol ]
- Parameter #4 [ <required> $priv_passphrase ]
- Parameter #5 [ <required> $contextName ]
- Parameter #6 [ <required> $contextEngineID ]
+ Parameter #0 [ <required> string $sec_level ]
+ Parameter #1 [ <optional> string $auth_protocol ]
+ Parameter #2 [ <optional> string $auth_passphrase ]
+ Parameter #3 [ <optional> string $priv_protocol ]
+ Parameter #4 [ <optional> string $priv_passphrase ]
+ Parameter #5 [ <optional> string $contextName ]
+ Parameter #6 [ <optional> string $contextEngineID ]
}
}
Method [ <internal:snmp> public method get ] {
- Parameters [2] {
Parameter #0 [ <required> $object_id ]
- Parameter #1 [ <optional> $use_orignames ]
+ Parameter #1 [ <optional> bool $use_orignames ]
}
}
Method [ <internal:snmp> public method getnext ] {
- - Parameters [2] {
+ - Parameters [1] {
Parameter #0 [ <required> $object_id ]
- Parameter #1 [ <optional> $use_orignames ]
}
}
Method [ <internal:snmp> public method walk ] {
- Parameters [4] {
Parameter #0 [ <required> $object_id ]
- Parameter #1 [ <required> $suffix_keys ]
- Parameter #2 [ <required> $max_repetitions ]
- Parameter #3 [ <required> $non_repeaters ]
+ Parameter #1 [ <optional> bool $suffix_keys ]
+ Parameter #2 [ <optional> int $max_repetitions ]
+ Parameter #3 [ <optional> int $non_repeaters ]
}
}
Method [ <internal:snmp> public method set ] {
diff --git a/ext/snmp/tests/skipif.inc b/ext/snmp/tests/skipif.inc
index 41ac99ffe4..ac623c350d 100644
--- a/ext/snmp/tests/skipif.inc
+++ b/ext/snmp/tests/skipif.inc
@@ -8,5 +8,5 @@ require_once (dirname(__FILE__).'/snmp_include.inc');
//snmpget ( string $hostname , string $community ,
//string $object_id [, int $timeout [, int $retries ]] )
-if (snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false)
+if (@snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false)
die('skip NO SNMPD on this host or community invalid');
diff --git a/ext/snmp/tests/snmp-object-error.phpt b/ext/snmp/tests/snmp-object-error.phpt
index 4e6bd04ea6..299a76350d 100644
--- a/ext/snmp/tests/snmp-object-error.phpt
+++ b/ext/snmp/tests/snmp-object-error.phpt
@@ -57,17 +57,11 @@ $session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries
$session->valueretrieval = 67;
var_dump($session->valueretrieval);
echo "Closing session\n";
-var_dump($session->close(''));
var_dump($session->close());
var_dump($session->get('.1.3.6.1.2.1.1.1.0'));
var_dump($session->close());
$session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries);
-var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, ''));
-var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, 30, ''));
-var_dump($session->get());
-var_dump($session->getnext());
-var_dump($session->set());
var_dump($session->max_oids);
$session->max_oids = "ttt";
@@ -91,29 +85,11 @@ Open normal session
Warning: main(): Unknown SNMP value retrieval method '67' in %s on line %d
int(%d)
Closing session
-
-Warning: SNMP::close() expects exactly 0 parameters, 1 given in %s on line %d
-bool(false)
bool(true)
Warning: SNMP::get(): Invalid or uninitialized SNMP object in %s on line %d
bool(false)
bool(true)
-
-Warning: SNMP::walk() expects parameter 3 to be int, string given in %s on line %d
-bool(false)
-
-Warning: SNMP::walk() expects parameter 4 to be int, string given in %s on line %d
-bool(false)
-
-Warning: SNMP::get() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: SNMP::getnext() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: SNMP::set() expects exactly 3 parameters, 0 given in %s on line %d
-bool(false)
NULL
Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d
diff --git a/ext/snmp/tests/snmp-object-setSecurity_error.phpt b/ext/snmp/tests/snmp-object-setSecurity_error.phpt
index f43e699a31..819642d957 100644
--- a/ext/snmp/tests/snmp-object-setSecurity_error.phpt
+++ b/ext/snmp/tests/snmp-object-setSecurity_error.phpt
@@ -18,7 +18,6 @@ $session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries
$session->setSecurity('noAuthNoPriv');
#echo "Checking error handling\n";
-var_dump($session->setSecurity());
var_dump($session->setSecurity(''));
var_dump($session->setSecurity('bugusPriv'));
var_dump($session->setSecurity('authNoPriv', 'TTT'));
@@ -33,9 +32,6 @@ var_dump($session->close());
?>
--EXPECTF--
-Warning: SNMP::setSecurity() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: SNMP::setSecurity(): Invalid security level '' in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/snmp2_get.phpt b/ext/snmp/tests/snmp2_get.phpt
index 12276f9952..04a8fc0347 100644
--- a/ext/snmp/tests/snmp2_get.phpt
+++ b/ext/snmp/tests/snmp2_get.phpt
@@ -15,8 +15,6 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Checking error handling\n";
-var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', ''));
-var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, ''));
echo "Empty OID array\n";
var_dump(snmp2_get($hostname, $community, array(), $timeout, $retries));
@@ -48,12 +46,6 @@ var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.
?>
--EXPECTF--
Checking error handling
-
-Warning: snmp2_get() expects parameter 4 to be int,%s given in %s on line %d
-bool(false)
-
-Warning: snmp2_get() expects parameter 5 to be int,%s given in %s on line %d
-bool(false)
Empty OID array
Warning: snmp2_get(): Got empty OID array in %s on line %d
diff --git a/ext/snmp/tests/snmp2_real_walk.phpt b/ext/snmp/tests/snmp2_real_walk.phpt
index 5a66312ebd..d98c2c4c04 100644
--- a/ext/snmp/tests/snmp2_real_walk.phpt
+++ b/ext/snmp/tests/snmp2_real_walk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -50,13 +46,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp2_real_walk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmp2_real_walk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/snmp/tests/snmp2_set.phpt b/ext/snmp/tests/snmp2_set.phpt
index 4f4d5d7a51..78b3675bb4 100644
--- a/ext/snmp/tests/snmp2_set.phpt
+++ b/ext/snmp/tests/snmp2_set.phpt
@@ -15,10 +15,6 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Check error handing\n";
-echo "4args (5 needed)\n";
-$z = snmp2_set($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0');
-var_dump($z);
-
echo "No type & no value (timeout & retries instead)\n";
$z = snmp2_set($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0', $timeout, $retries);
var_dump($z);
@@ -142,10 +138,6 @@ var_dump((snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $ol
?>
--EXPECTF--
Check error handing
-4args (5 needed)
-
-Warning: snmp2_set() expects at least 5 parameters, 3 given in %s on line %d
-bool(false)
No type & no value (timeout & retries instead)
Warning: snmp2_set(): Bogus type '-1', should be single char, got 2 in %s on line %d
diff --git a/ext/snmp/tests/snmp2_walk.phpt b/ext/snmp/tests/snmp2_walk.phpt
index ccccf76dc8..326e0a71cd 100644
--- a/ext/snmp/tests/snmp2_walk.phpt
+++ b/ext/snmp/tests/snmp2_walk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -58,13 +54,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp2_walk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmp2_walk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/snmp/tests/snmp3-error.phpt b/ext/snmp/tests/snmp3-error.phpt
index 58e02dc7c5..cbebf69f62 100644
--- a/ext/snmp/tests/snmp3-error.phpt
+++ b/ext/snmp/tests/snmp3-error.phpt
@@ -16,7 +16,6 @@ echo "Checking error handling\n";
// string auth_passphrase, string priv_protocol, string priv_passphrase,
// string object_id [, int timeout [, int retries]]);
-var_dump(snmp3_get($hostname, $community, '', '', '', '', ''));
var_dump(snmp3_get($hostname, $community, '', '', '', '', '', '.1.3.6.1.2.1.1.1.0'));
var_dump(snmp3_get($hostname, $community, 'bugusPriv', '', '', '', '', '.1.3.6.1.2.1.1.1.0'));
var_dump(snmp3_get($hostname, $community, 'authNoPriv', 'TTT', '', '', '', '.1.3.6.1.2.1.1.1.0'));
@@ -27,8 +26,6 @@ var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES',
var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', 'ty', '.1.3.6.1.2.1.1.1.0'));
var_dump(snmp3_get($hostname, 'somebogususer', 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
-var_dump(snmp3_set($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 's'));
-
var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.777...7.5.3', 's', 'ttt', $timeout, $retries));
var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.777.7.5.3', array('s'), 'yyy', $timeout, $retries));
@@ -36,9 +33,6 @@ var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $pr
--EXPECTF--
Checking error handling
-Warning: snmp3_get() expects at least 8 parameters, 7 given in %s on line %d
-bool(false)
-
Warning: snmp3_get(): Invalid security level '' in %s on line %d
bool(false)
@@ -66,9 +60,6 @@ bool(false)
Warning: snmp3_get(): Fatal error: Unknown user name in %s on line %d
bool(false)
-Warning: snmp3_set() expects at least 10 parameters, 9 given in %s on line %d
-bool(false)
-
Warning: snmp3_set(): Invalid object identifier: .1.3.6.777...7.5.3 in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/snmp_get_quick_print.phpt b/ext/snmp/tests/snmp_get_quick_print.phpt
index 630f7b544a..bce2aca461 100644
--- a/ext/snmp/tests/snmp_get_quick_print.phpt
+++ b/ext/snmp/tests/snmp_get_quick_print.phpt
@@ -10,11 +10,6 @@ require_once(__DIR__.'/skipif.inc');
<?php
require_once(__DIR__.'/snmp_include.inc');
-echo "Checking error handling\n";
-var_dump(snmp_get_quick_print('noarg'));
-var_dump(snmp_set_quick_print('noarg'));
-var_dump(snmp_set_quick_print());
-
echo "Checking working\n";
var_dump(snmp_get_quick_print());
snmp_set_quick_print(false);
@@ -24,16 +19,6 @@ var_dump(snmp_get_quick_print());
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp_get_quick_print() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: snmp_set_quick_print() expects parameter 1 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmp_set_quick_print() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
Checking working
bool(%s)
bool(false)
diff --git a/ext/snmp/tests/snmp_get_valueretrieval.phpt b/ext/snmp/tests/snmp_get_valueretrieval.phpt
index ca07ecaa55..5d2242c1cd 100644
--- a/ext/snmp/tests/snmp_get_valueretrieval.phpt
+++ b/ext/snmp/tests/snmp_get_valueretrieval.phpt
@@ -11,9 +11,6 @@ require_once(__DIR__.'/skipif.inc');
require_once(__DIR__.'/snmp_include.inc');
echo "Checking error handling\n";
-var_dump(snmp_get_valueretrieval('noarg'));
-var_dump(snmp_set_valueretrieval());
-var_dump(snmp_set_valueretrieval('noarg'));
var_dump(snmp_set_valueretrieval(67));
echo "Checking working\n";
@@ -33,15 +30,6 @@ var_dump(snmp_get_valueretrieval() === (SNMP_VALUE_LIBRARY|SNMP_VALUE_OBJECT));
--EXPECTF--
Checking error handling
-Warning: snmp_get_valueretrieval() expects exactly 0 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: snmp_set_valueretrieval() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: snmp_set_valueretrieval() expects parameter 1 to be int, %s given in %s on line %d
-bool(false)
-
Warning: snmp_set_valueretrieval(): Unknown SNMP value retrieval method '67' in %s on line %d
bool(false)
Checking working
diff --git a/ext/snmp/tests/snmp_read_mib.phpt b/ext/snmp/tests/snmp_read_mib.phpt
index 00203bb4e5..65ce16d209 100644
--- a/ext/snmp/tests/snmp_read_mib.phpt
+++ b/ext/snmp/tests/snmp_read_mib.phpt
@@ -15,7 +15,6 @@ if (!file_exists($mibdir . '/SNMPv2-MIB.txt')) die('skip MIB file not in the sys
require_once(__DIR__.'/snmp_include.inc');
echo "Checking error handling\n";
-var_dump(snmp_read_mib());
var_dump(snmp_read_mib(__DIR__.'/cannotfindthisfile'));
echo "Checking working\n";
@@ -25,9 +24,6 @@ var_dump(snmp_read_mib($mibdir . '/SNMPv2-MIB.txt'));
--EXPECTF--
Checking error handling
-Warning: snmp_read_mib() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: snmp_read_mib(): Error while reading MIB file '%s': No such file or directory in %s on line %d
bool(false)
Checking working
diff --git a/ext/snmp/tests/snmp_set_enum_print.phpt b/ext/snmp/tests/snmp_set_enum_print.phpt
index d67f19aee3..ed92119080 100644
--- a/ext/snmp/tests/snmp_set_enum_print.phpt
+++ b/ext/snmp/tests/snmp_set_enum_print.phpt
@@ -11,18 +11,11 @@ if (!function_exists('snmp_set_enum_print')) die('skip This function is only ava
<?php
require_once(__DIR__.'/snmp_include.inc');
-echo "Checking error handling\n";
-var_dump(snmp_set_enum_print());
-
echo "Checking working\n";
var_dump(snmp_set_enum_print(0));
var_dump(snmp_set_enum_print(1));
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp_set_enum_print() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
Checking working
bool(true)
bool(true)
diff --git a/ext/snmp/tests/snmp_set_oid_output_format.phpt b/ext/snmp/tests/snmp_set_oid_output_format.phpt
index 3d74fc40b9..3ad5f16458 100644
--- a/ext/snmp/tests/snmp_set_oid_output_format.phpt
+++ b/ext/snmp/tests/snmp_set_oid_output_format.phpt
@@ -12,7 +12,6 @@ if (!function_exists('snmp_set_oid_output_format')) die('skip This function is o
require_once(__DIR__.'/snmp_include.inc');
echo "Checking error handling\n";
-var_dump(snmp_set_oid_output_format());
var_dump(snmp_set_oid_output_format(123));
echo "Checking working\n";
@@ -22,9 +21,6 @@ var_dump(snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC));
--EXPECTF--
Checking error handling
-Warning: snmp_set_oid_output_format() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: snmp_set_oid_output_format(): Unknown SNMP output print format '123' in %s on line %d
bool(false)
Checking working
diff --git a/ext/snmp/tests/snmpget.phpt b/ext/snmp/tests/snmpget.phpt
index c710420965..9875f31f65 100644
--- a/ext/snmp/tests/snmpget.phpt
+++ b/ext/snmp/tests/snmpget.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', ''));
-var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID, default timeout and retries\n";
var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0'));
@@ -49,13 +45,6 @@ var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmpget() expects parameter 4 to be int,%s given in %s on line %d
-bool(false)
-
-Warning: snmpget() expects parameter 5 to be int,%s given in %s on line %d
-bool(false)
Checking working
Single OID, default timeout and retries
string(%d) "%s"
diff --git a/ext/snmp/tests/snmprealwalk.phpt b/ext/snmp/tests/snmprealwalk.phpt
index ba5a304240..b3e7576466 100644
--- a/ext/snmp/tests/snmprealwalk.phpt
+++ b/ext/snmp/tests/snmprealwalk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -50,13 +46,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmprealwalk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmprealwalk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/snmp/tests/snmpset.phpt b/ext/snmp/tests/snmpset.phpt
index 809016444d..b1bb26c15a 100644
--- a/ext/snmp/tests/snmpset.phpt
+++ b/ext/snmp/tests/snmpset.phpt
@@ -15,10 +15,6 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Check error handing\n";
-echo "4args (5 needed)\n";
-$z = snmpset($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0');
-var_dump($z);
-
echo "No type & no value (timeout & retries instead)\n";
$z = snmpset($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0', $timeout, $retries);
var_dump($z);
@@ -142,10 +138,6 @@ var_dump((snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $ol
?>
--EXPECTF--
Check error handing
-4args (5 needed)
-
-Warning: snmpset() expects at least 5 parameters, 3 given in %s on line %d
-bool(false)
No type & no value (timeout & retries instead)
Warning: snmpset(): Bogus type '-1', should be single char, got 2 in %s on line %d
diff --git a/ext/snmp/tests/snmpwalk.phpt b/ext/snmp/tests/snmpwalk.phpt
index 1cdfc6d1e5..b7ed803fd3 100644
--- a/ext/snmp/tests/snmpwalk.phpt
+++ b/ext/snmp/tests/snmpwalk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmpwalk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmpwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmpwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -58,13 +54,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmpwalk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmpwalk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index c44fec3ab0..0faa6e9d57 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.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/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
index cab46ddf29..978012f668 100644
--- a/ext/soap/php_encoding.h
+++ b/ext/soap/php_encoding.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/ext/soap/php_http.c b/ext/soap/php_http.c
index 299fe23a82..8b251155fd 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.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/ext/soap/php_http.h b/ext/soap/php_http.h
index 887e28fe69..8065fef7c9 100644
--- a/ext/soap/php_http.h
+++ b/ext/soap/php_http.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/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index 685a474e82..0e3a519737 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.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/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
index 4d47071634..7a2a842537 100644
--- a/ext/soap/php_packet_soap.h
+++ b/ext/soap/php_packet_soap.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/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 33793704ad..fc80b4a79c 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.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/ext/soap/php_schema.h b/ext/soap/php_schema.h
index d7b51aa4b7..9e597700ee 100644
--- a/ext/soap/php_schema.h
+++ b/ext/soap/php_schema.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/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 82fbd3bb20..a331e7be01 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.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/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index f57b079f86..bd55a9618c 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.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/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 8e8adb87d2..ffc352a8f2 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.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/ext/soap/php_xml.c b/ext/soap/php_xml.c
index b606030179..df55678159 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.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/ext/soap/php_xml.h b/ext/soap/php_xml.h
index ac92aa9755..436b1ad28b 100644
--- a/ext/soap/php_xml.h
+++ b/ext/soap/php_xml.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/ext/soap/soap.c b/ext/soap/soap.c
index ce776efb3f..d1b3b4eb9e 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.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, |
@@ -25,6 +23,7 @@
#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
#include "ext/session/php_session.h"
#endif
+#include "soap_arginfo.h"
#include "zend_exceptions.h"
@@ -197,7 +196,7 @@ PHP_FUNCTION(is_soap_fault);
/* Server Functions */
-PHP_METHOD(SoapServer, SoapServer);
+PHP_METHOD(SoapServer, __construct);
PHP_METHOD(SoapServer, setClass);
PHP_METHOD(SoapServer, setObject);
PHP_METHOD(SoapServer, addFunction);
@@ -208,7 +207,7 @@ PHP_METHOD(SoapServer, fault);
PHP_METHOD(SoapServer, addSoapHeader);
/* Client Functions */
-PHP_METHOD(SoapClient, SoapClient);
+PHP_METHOD(SoapClient, __construct);
PHP_METHOD(SoapClient, __call);
PHP_METHOD(SoapClient, __getLastRequest);
PHP_METHOD(SoapClient, __getLastResponse);
@@ -223,220 +222,73 @@ PHP_METHOD(SoapClient, __setLocation);
PHP_METHOD(SoapClient, __setSoapHeaders);
/* SoapVar Functions */
-PHP_METHOD(SoapVar, SoapVar);
+PHP_METHOD(SoapVar, __construct);
/* SoapFault Functions */
-PHP_METHOD(SoapFault, SoapFault);
+PHP_METHOD(SoapFault, __construct);
PHP_METHOD(SoapFault, __toString);
/* SoapParam Functions */
-PHP_METHOD(SoapParam, SoapParam);
+PHP_METHOD(SoapParam, __construct);
/* SoapHeader Functions */
-PHP_METHOD(SoapHeader, SoapHeader);
-
-#define SOAP_CTOR(class_name, func_name, arginfo, flags) PHP_ME(class_name, func_name, arginfo, flags)
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_soap__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam_soapparam, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2)
- ZEND_ARG_INFO(0, namespace)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, mustunderstand)
- ZEND_ARG_INFO(0, actor)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2)
- ZEND_ARG_INFO(0, faultcode)
- ZEND_ARG_INFO(0, faultstring)
- ZEND_ARG_INFO(0, faultactor)
- ZEND_ARG_INFO(0, detail)
- ZEND_ARG_INFO(0, faultname)
- ZEND_ARG_INFO(0, headerfault)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, type_name)
- ZEND_ARG_INFO(0, type_namespace)
- ZEND_ARG_INFO(0, node_name)
- ZEND_ARG_INFO(0, node_namespace)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_fault, 0, 0, 2)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, actor)
- ZEND_ARG_INFO(0, details)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addsoapheader, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_soapserver, 0, 0, 1)
- ZEND_ARG_INFO(0, wsdl)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setpersistence, 0, 0, 1)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setclass, 0, 0, 1)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setobject, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapserver_getfunctions, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addfunction, 0, 0, 1)
- ZEND_ARG_INFO(0, functions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_handle, 0, 0, 0)
- ZEND_ARG_INFO(0, soap_request)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient_soapclient, 0, 0, 1)
- ZEND_ARG_INFO(0, wsdl)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___call, 0, 0, 2)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_INFO(0, arguments)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___soapcall, 0, 0, 2)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_INFO(0, arguments)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, input_headers)
- ZEND_ARG_INFO(1, output_headers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getfunctions, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___gettypes, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastrequest, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastresponse, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastrequestheaders, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastresponseheaders, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___dorequest, 0, 0, 4)
- ZEND_ARG_INFO(0, request)
- ZEND_ARG_INFO(0, location)
- ZEND_ARG_INFO(0, action)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, one_way)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setcookie, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getcookies, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setsoapheaders, 0, 0, 0)
- ZEND_ARG_INFO(0, soapheaders)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setlocation, 0, 0, 0)
- ZEND_ARG_INFO(0, new_location)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soap_use_soap_error_handler, 0, 0, 0)
- ZEND_ARG_INFO(0, handler)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soap_is_soap_fault, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-/* }}} */
+PHP_METHOD(SoapHeader, __construct);
static const zend_function_entry soap_functions[] = {
- PHP_FE(use_soap_error_handler, arginfo_soap_use_soap_error_handler)
- PHP_FE(is_soap_fault, arginfo_soap_is_soap_fault)
+ PHP_FE(use_soap_error_handler, arginfo_use_soap_error_handler)
+ PHP_FE(is_soap_fault, arginfo_is_soap_fault)
PHP_FE_END
};
static const zend_function_entry soap_fault_functions[] = {
- SOAP_CTOR(SoapFault, SoapFault, arginfo_soapfault_soapfault, 0)
- PHP_ME(SoapFault, __toString, arginfo_soap__void, 0)
+ PHP_ME(SoapFault, __construct, arginfo_class_SoapFault___construct, 0)
+ PHP_ME(SoapFault, __toString, arginfo_class_SoapFault___toString, 0)
PHP_FE_END
};
static const zend_function_entry soap_server_functions[] = {
- SOAP_CTOR(SoapServer, SoapServer, arginfo_soapserver_soapserver, 0)
- PHP_ME(SoapServer, setPersistence, arginfo_soapserver_setpersistence, 0)
- PHP_ME(SoapServer, setClass, arginfo_soapserver_setclass, 0)
- PHP_ME(SoapServer, setObject, arginfo_soapserver_setobject, 0)
- PHP_ME(SoapServer, addFunction, arginfo_soapserver_addfunction, 0)
- PHP_ME(SoapServer, getFunctions, arginfo_soapserver_getfunctions, 0)
- PHP_ME(SoapServer, handle, arginfo_soapserver_handle, 0)
- PHP_ME(SoapServer, fault, arginfo_soapserver_fault, 0)
- PHP_ME(SoapServer, addSoapHeader, arginfo_soapserver_addsoapheader, 0)
+ PHP_ME(SoapServer, __construct, arginfo_class_SoapServer___construct, 0)
+ PHP_ME(SoapServer, setPersistence, arginfo_class_SoapServer_setPersistence, 0)
+ PHP_ME(SoapServer, setClass, arginfo_class_SoapServer_setClass, 0)
+ PHP_ME(SoapServer, setObject, arginfo_class_SoapServer_setObject, 0)
+ PHP_ME(SoapServer, addFunction, arginfo_class_SoapServer_addFunction, 0)
+ PHP_ME(SoapServer, getFunctions, arginfo_class_SoapServer_getFunctions, 0)
+ PHP_ME(SoapServer, handle, arginfo_class_SoapServer_handle, 0)
+ PHP_ME(SoapServer, fault, arginfo_class_SoapServer_fault, 0)
+ PHP_ME(SoapServer, addSoapHeader, arginfo_class_SoapServer_addSoapHeader, 0)
PHP_FE_END
};
static const zend_function_entry soap_client_functions[] = {
- SOAP_CTOR(SoapClient, SoapClient, arginfo_soapclient_soapclient, 0)
- PHP_ME(SoapClient, __call, arginfo_soapclient___call, 0)
- ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_soapclient___soapcall, 0)
- PHP_ME(SoapClient, __getLastRequest, arginfo_soapclient___getlastrequest, 0)
- PHP_ME(SoapClient, __getLastResponse, arginfo_soapclient___getlastresponse, 0)
- PHP_ME(SoapClient, __getLastRequestHeaders, arginfo_soapclient___getlastrequestheaders, 0)
- PHP_ME(SoapClient, __getLastResponseHeaders, arginfo_soapclient___getlastresponseheaders, 0)
- PHP_ME(SoapClient, __getFunctions, arginfo_soapclient___getfunctions, 0)
- PHP_ME(SoapClient, __getTypes, arginfo_soapclient___gettypes, 0)
- PHP_ME(SoapClient, __doRequest, arginfo_soapclient___dorequest, 0)
- PHP_ME(SoapClient, __setCookie, arginfo_soapclient___setcookie, 0)
- PHP_ME(SoapClient, __getCookies, arginfo_soapclient___getcookies, 0)
- PHP_ME(SoapClient, __setLocation, arginfo_soapclient___setlocation, 0)
- PHP_ME(SoapClient, __setSoapHeaders, arginfo_soapclient___setsoapheaders, 0)
+ PHP_ME(SoapClient, __construct, arginfo_class_SoapClient___construct, 0)
+ PHP_ME(SoapClient, __call, arginfo_class_SoapClient___call, 0)
+ ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_class_SoapClient___soapCall, 0)
+ PHP_ME(SoapClient, __getLastRequest, arginfo_class_SoapClient___getLastRequest, 0)
+ PHP_ME(SoapClient, __getLastResponse, arginfo_class_SoapClient___getLastResponse, 0)
+ PHP_ME(SoapClient, __getLastRequestHeaders, arginfo_class_SoapClient___getLastRequestHeaders, 0)
+ PHP_ME(SoapClient, __getLastResponseHeaders, arginfo_class_SoapClient___getLastResponseHeaders, 0)
+ PHP_ME(SoapClient, __getFunctions, arginfo_class_SoapClient___getFunctions, 0)
+ PHP_ME(SoapClient, __getTypes, arginfo_class_SoapClient___getTypes, 0)
+ PHP_ME(SoapClient, __doRequest, arginfo_class_SoapClient___doRequest, 0)
+ PHP_ME(SoapClient, __setCookie, arginfo_class_SoapClient___setCookie, 0)
+ PHP_ME(SoapClient, __getCookies, arginfo_class_SoapClient___getCookies, 0)
+ PHP_ME(SoapClient, __setLocation, arginfo_class_SoapClient___setLocation, 0)
+ PHP_ME(SoapClient, __setSoapHeaders, arginfo_class_SoapClient___setSoapHeaders, 0)
PHP_FE_END
};
static const zend_function_entry soap_var_functions[] = {
- SOAP_CTOR(SoapVar, SoapVar, arginfo_soapvar_soapvar, 0)
+ PHP_ME(SoapVar, __construct, arginfo_class_SoapVar___construct, 0)
PHP_FE_END
};
static const zend_function_entry soap_param_functions[] = {
- SOAP_CTOR(SoapParam, SoapParam, arginfo_soapparam_soapparam, 0)
+ PHP_ME(SoapParam, __construct, arginfo_class_SoapParam___construct, 0)
PHP_FE_END
};
static const zend_function_entry soap_header_functions[] = {
- SOAP_CTOR(SoapHeader, SoapHeader, arginfo_soapheader_soapheader, 0)
+ PHP_ME(SoapHeader, __construct, arginfo_class_SoapHeader___construct, 0)
PHP_FE_END
};
@@ -785,9 +637,9 @@ PHP_MINFO_FUNCTION(soap)
}
-/* {{{ proto object SoapParam::SoapParam(mixed data, string name)
+/* {{{ proto object SoapParam::__construct(mixed data, string name)
SoapParam constructor */
-PHP_METHOD(SoapParam, SoapParam)
+PHP_METHOD(SoapParam, __construct)
{
zval *data;
char *name;
@@ -809,9 +661,9 @@ PHP_METHOD(SoapParam, SoapParam)
/* }}} */
-/* {{{ proto object SoapHeader::SoapHeader(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]])
+/* {{{ proto object SoapHeader::__construct(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]])
SoapHeader constructor */
-PHP_METHOD(SoapHeader, SoapHeader)
+PHP_METHOD(SoapHeader, __construct)
{
zval *data = NULL, *actor = NULL;
char *name, *ns;
@@ -852,15 +704,15 @@ PHP_METHOD(SoapHeader, SoapHeader)
}
/* }}} */
-/* {{{ proto object SoapFault::SoapFault(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])
+/* {{{ proto object SoapFault::__construct(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])
SoapFault constructor */
-PHP_METHOD(SoapFault, SoapFault)
+PHP_METHOD(SoapFault, __construct)
{
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL;
size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0;
zval *code = NULL, *details = NULL, *headerfault = NULL, *this_ptr;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs|s!z!s!z",
+ if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs|s!z!s!z!",
&code,
&fault_string, &fault_string_len,
&fault_actor, &fault_actor_len,
@@ -955,9 +807,9 @@ PHP_METHOD(SoapFault, __toString)
}
/* }}} */
-/* {{{ proto object SoapVar::SoapVar(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
+/* {{{ proto object SoapVar::__construct(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
SoapVar constructor */
-PHP_METHOD(SoapVar, SoapVar)
+PHP_METHOD(SoapVar, __construct)
{
zval *data, *type, *this_ptr;
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
@@ -1102,9 +954,9 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */
}
/* }}} */
-/* {{{ proto object SoapServer::SoapServer(mixed wsdl [, array options])
+/* {{{ proto object SoapServer::__construct(mixed wsdl [, array options])
SoapServer constructor */
-PHP_METHOD(SoapServer, SoapServer)
+PHP_METHOD(SoapServer, __construct)
{
soapServicePtr service;
zval *wsdl = NULL, *options = NULL;
@@ -1113,12 +965,12 @@ PHP_METHOD(SoapServer, SoapServer)
zend_long cache_wsdl;
HashTable *typemap_ht = NULL;
- SOAP_SERVER_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Invalid parameters");
+ return;
}
+ SOAP_SERVER_BEGIN_CODE();
+
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "Invalid parameters");
}
@@ -2014,6 +1866,10 @@ PHP_METHOD(SoapServer, addSoapHeader)
SOAP_SERVER_BEGIN_CODE();
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) == FAILURE) {
+ return;
+ }
+
FETCH_THIS_SERVICE(service);
if (!service || !service->soap_headers_ptr) {
@@ -2021,10 +1877,6 @@ PHP_METHOD(SoapServer, addSoapHeader)
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) == FAILURE) {
- return;
- }
-
p = service->soap_headers_ptr;
while (*p != NULL) {
p = &(*p)->next;
@@ -2265,15 +2117,15 @@ PHP_FUNCTION(is_soap_fault)
instanceof_function(Z_OBJCE_P(fault), soap_fault_class_entry)) {
RETURN_TRUE;
}
- RETURN_FALSE
+ RETURN_FALSE;
}
/* }}} */
/* SoapClient functions */
-/* {{{ proto object SoapClient::SoapClient(mixed wsdl [, array options])
+/* {{{ proto object SoapClient::__construct(mixed wsdl [, array options])
SoapClient constructor */
-PHP_METHOD(SoapClient, SoapClient)
+PHP_METHOD(SoapClient, __construct)
{
zval *wsdl, *options = NULL;
@@ -2284,12 +2136,12 @@ PHP_METHOD(SoapClient, SoapClient)
HashTable *typemap_ht = NULL;
zval *this_ptr = ZEND_THIS;
- SOAP_CLIENT_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Invalid parameters");
+ return;
}
+ SOAP_CLIENT_BEGIN_CODE();
+
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "$wsdl must be string or null");
}
@@ -3103,7 +2955,7 @@ PHP_METHOD(SoapClient, __setCookie)
zval *cookies;
zval *this_ptr = ZEND_THIS;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &val, &val_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name, &name_len, &val, &val_len) == FAILURE) {
return;
}
diff --git a/ext/soap/soap.stub.php b/ext/soap/soap.stub.php
new file mode 100644
index 0000000000..15ea54f660
--- /dev/null
+++ b/ext/soap/soap.stub.php
@@ -0,0 +1,101 @@
+<?php
+
+function use_soap_error_handler(bool $handler = true): bool {}
+
+function is_soap_fault($object): bool {}
+
+class SoapParam
+{
+ function __construct($data, string $name);
+}
+
+class SoapHeader
+{
+ function __construct(string $namespace, string $name, $data = UNKNOWN, bool $mustunderstand = false, $actor = UNKNOWN);
+}
+
+class SoapFault extends Exception
+{
+ function __construct($faultcode, string $faultstring, ?string $faultactor = null, $detail = null, ?string $faultname = null, $headerfault = null);
+
+ /** @return string */
+ function __toString();
+}
+
+class SoapVar
+{
+ function __construct($data, $encoding, string $type_name = "", string $type_namespace = "", string $node_name = "", string $node_namespace = "");
+}
+
+class SoapServer
+{
+ function __construct($wsdl, array $options = []);
+
+ /** @return void */
+ function fault(string $code, string $string, string $actor = "", $details = null, string $name = "");
+
+ /** @return void */
+ function addSoapHeader(SoapHeader $object);
+
+ /** @return void */
+ function setPersistence(int $mode);
+
+ /** @return void */
+ function setClass(string $class_name, ...$argv);
+
+ /** @return void */
+ function setObject(object $object);
+
+ /** @return array */
+ function getFunctions();
+
+ /** @return void */
+ function addFunction($functions);
+
+ /** @return void */
+ function handle(string $soap_request = UNKNOWN);
+}
+
+class SoapClient
+{
+ function __construct($wsdl, array $options = []);
+
+ /** @return mixed */
+ function __call(string $function_name, array $arguments);
+
+ /** @return mixed */
+ function __soapCall(string $function_name, array $arguments, ?array $options = null, $input_headers = null, $output_headers = null);
+
+ /** @return array|null */
+ function __getFunctions();
+
+ /** @return array|null */
+ function __getTypes();
+
+ /** @return ?string */
+ function __getLastRequest();
+
+ /** @return ?string */
+ function __getLastResponse();
+
+ /** @return ?string */
+ function __getLastRequestHeaders();
+
+ /** @return ?string */
+ function __getLastResponseHeaders();
+
+ /** @return ?string */
+ function __doRequest(string $request, string $location, string $action, int $version, int $one_way = 0);
+
+ /** @return void */
+ function __setCookie(string $name, ?string $value = null);
+
+ /** @return array */
+ function __getCookies();
+
+ /** @return bool */
+ function __setSoapHeaders($soapheaders = null);
+
+ /** @return ?string */
+ function __setLocation(string $new_location = "");
+}
diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h
new file mode 100644
index 0000000000..69079b82eb
--- /dev/null
+++ b/ext/soap/soap_arginfo.h
@@ -0,0 +1,133 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, handler, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_soap_fault, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapParam___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapHeader___construct, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_TYPE_INFO(0, mustunderstand, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, actor)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapFault___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, faultcode)
+ ZEND_ARG_TYPE_INFO(0, faultstring, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, faultactor, IS_STRING, 1)
+ ZEND_ARG_INFO(0, detail)
+ ZEND_ARG_TYPE_INFO(0, faultname, IS_STRING, 1)
+ ZEND_ARG_INFO(0, headerfault)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapFault___toString, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapVar___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_INFO(0, encoding)
+ ZEND_ARG_TYPE_INFO(0, type_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, type_namespace, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, node_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, node_namespace, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, wsdl)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_fault, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, actor, IS_STRING, 0)
+ ZEND_ARG_INFO(0, details)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_addSoapHeader, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, SoapHeader, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setPersistence, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setClass, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(0, argv)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setObject, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapServer_getFunctions arginfo_class_SoapFault___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_addFunction, 0, 0, 1)
+ ZEND_ARG_INFO(0, functions)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_handle, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, soap_request, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapClient___construct arginfo_class_SoapServer___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___call, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, arguments, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___soapCall, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, arguments, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 1)
+ ZEND_ARG_INFO(0, input_headers)
+ ZEND_ARG_INFO(0, output_headers)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapClient___getFunctions arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getTypes arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastRequest arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastResponse arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastRequestHeaders arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastResponseHeaders arginfo_class_SoapFault___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___doRequest, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, request, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, location, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, action, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, one_way, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___setCookie, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapClient___getCookies arginfo_class_SoapFault___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___setSoapHeaders, 0, 0, 0)
+ ZEND_ARG_INFO(0, soapheaders)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___setLocation, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, new_location, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/soap/tests/bug77088.phpt b/ext/soap/tests/bug77088.phpt
index 0c1a604f2e..e6f5e7582e 100644
--- a/ext/soap/tests/bug77088.phpt
+++ b/ext/soap/tests/bug77088.phpt
@@ -12,18 +12,17 @@ try
$options = NULL;
$sClient = new SoapClient("test.wsdl", $options);
}
-catch(SoapFault $e)
+catch(TypeError $e)
{
var_dump($e);
}
?>
--EXPECTF--
-Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d
-object(SoapFault)#%d (%d) {
+object(TypeError)#%d (%d) {
["message":protected]=>
- string(44) "SoapClient::SoapClient(): Invalid parameters"
- ["string":"Exception":private]=>
+ string(%d) "SoapClient::__construct() expects parameter 2 to be array, null given"
+ ["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
@@ -31,7 +30,7 @@ object(SoapFault)#%d (%d) {
string(%d) "%sbug77088.php"
["line":protected]=>
int(6)
- ["trace":"Exception":private]=>
+ ["trace":"Error":private]=>
array(1) {
[0]=>
array(6) {
@@ -40,7 +39,7 @@ object(SoapFault)#%d (%d) {
["line"]=>
int(6)
["function"]=>
- string(10) "SoapClient"
+ string(11) "__construct"
["class"]=>
string(10) "SoapClient"
["type"]=>
@@ -54,12 +53,6 @@ object(SoapFault)#%d (%d) {
}
}
}
- ["previous":"Exception":private]=>
+ ["previous":"Error":private]=>
NULL
- ["faultstring"]=>
- string(44) "SoapClient::SoapClient(): Invalid parameters"
- ["faultcode"]=>
- string(6) "Client"
- ["faultcodens"]=>
- string(41) "http://schemas.xmlsoap.org/soap/envelope/"
}
diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt
index 4889b10d8e..152781a4ec 100644
--- a/ext/soap/tests/bugs/bug31422.phpt
+++ b/ext/soap/tests/bugs/bug31422.phpt
@@ -39,7 +39,6 @@ $server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECTF--
-PHP Warning: fopen() expects at least 2 parameters, 0 given in %sbug31422.php on line %d
-PHP Fatal error: Hello in %sbug31422.php on line %d
<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Hello</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>fopen() expects at least 2 parameters, 0 given</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
+ok
diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt
index 1d65b3a42b..600fd43058 100644
--- a/ext/soap/tests/bugs/bug31755.phpt
+++ b/ext/soap/tests/bugs/bug31755.phpt
@@ -14,6 +14,6 @@ $response= $client->__call('function', array(), null, $header);
print $client->__getLastRequest();
?>
--EXPECTF--
-Warning: SoapHeader::SoapHeader(): Invalid namespace in %s on line %d
+Warning: SoapHeader::__construct(): Invalid namespace in %s on line %d
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="myNS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns1:function/></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt
index 98d2d269ea..2ee8bf58ee 100644
--- a/ext/soap/tests/fault_warning.phpt
+++ b/ext/soap/tests/fault_warning.phpt
@@ -16,13 +16,13 @@ $fault = new SoapFault(["more-ns", "Sender"], "message"); // two given
echo get_class($fault);
?>
--EXPECTF--
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
SoapFault
SoapFault
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
SoapFault
diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c
index c6aa9f0c78..4ed32d2518 100644
--- a/ext/sockets/multicast.c
+++ b/ext/sockets/multicast.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/ext/sockets/multicast.h b/ext/sockets/multicast.h
index 256af0c66c..98a19ba54c 100644
--- a/ext/sockets/multicast.h
+++ b/ext/sockets/multicast.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/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index c1aba9dc98..7f67040ce3 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.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/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c
index 86556a308f..6ceb4035b8 100644
--- a/ext/sockets/sendrecvmsg.c
+++ b/ext/sockets/sendrecvmsg.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, |
@@ -183,7 +181,7 @@ PHP_FUNCTION(socket_sendmsg)
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(zsocket),
php_sockets_le_socket_name, php_sockets_le_socket())) == NULL) {
- RETURN_FALSE;
+ return;
}
msghdr = from_zval_run_conversions(zmsg, php_sock, from_zval_write_msghdr_send,
@@ -228,7 +226,7 @@ PHP_FUNCTION(socket_recvmsg)
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(zsocket),
php_sockets_le_socket_name, php_sockets_le_socket())) == NULL) {
- RETURN_FALSE;
+ return;
}
msghdr = from_zval_run_conversions(zmsg, php_sock, from_zval_write_msghdr_recv,
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index dd0023f46c..575c213181 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.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, |
@@ -65,6 +63,7 @@
#include "sockaddr_conv.h"
#include "multicast.h"
#include "sendrecvmsg.h"
+#include "sockets_arginfo.h"
ZEND_DECLARE_MODULE_GLOBALS(sockets)
@@ -99,215 +98,6 @@ static int le_socket;
static int le_addrinfo;
#define le_addrinfo_name php_sockets_le_addrinfo_name
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_select, 0, 0, 4)
- ZEND_ARG_INFO(1, read_fds)
- ZEND_ARG_INFO(1, write_fds)
- ZEND_ARG_INFO(1, except_fds)
- ZEND_ARG_INFO(0, tv_sec)
- ZEND_ARG_INFO(0, tv_usec)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_listen, 0, 0, 1)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, backlog)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_accept, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_set_nonblock, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_set_block, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_listen, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, backlog)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_close, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_write, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, buf)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_read, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_getsockname, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, addr)
- ZEND_ARG_INFO(1, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_getpeername, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, addr)
- ZEND_ARG_INFO(1, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create, 0, 0, 3)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_connect, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, addr)
- ZEND_ARG_INFO(0, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_strerror, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_bind, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, addr)
- ZEND_ARG_INFO(0, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recv, 0, 0, 4)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_send, 0, 0, 4)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recvfrom, 0, 0, 5)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(1, name)
- ZEND_ARG_INFO(1, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_sendto, 0, 0, 5)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, addr)
- ZEND_ARG_INFO(0, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_get_option, 0, 0, 3)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, optname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_set_option, 0, 0, 4)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, optname)
- ZEND_ARG_INFO(0, optval)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SOCKETPAIR
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_pair, 0, 0, 4)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, protocol)
- ZEND_ARG_INFO(1, fd)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_SHUTDOWN
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_shutdown, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, how)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_last_error, 0, 0, 0)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_clear_error, 0, 0, 0)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_import_stream, 0, 0, 1)
- ZEND_ARG_INFO(0, stream)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_export_stream, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_sendmsg, 0, 0, 3)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, msghdr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recvmsg, 0, 0, 3)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, msghdr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_cmsg_space, 0, 0, 2)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_lookup, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, service)
- ZEND_ARG_INFO(0, hints)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_connect, 0, 0, 1)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_bind, 0, 0, 1)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_explain, 0, 0, 1)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_WIN32
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_export, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, target_pid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_import, 0, 0, 1)
- ZEND_ARG_INFO(0, info_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_release, 0, 0, 1)
- ZEND_ARG_INFO(0, info_id)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
static PHP_GINIT_FUNCTION(sockets);
static PHP_GSHUTDOWN_FUNCTION(sockets);
static PHP_MINIT_FUNCTION(sockets);
@@ -850,8 +640,6 @@ static PHP_MINIT_FUNCTION(sockets)
#if HAVE_AI_IDN
REGISTER_LONG_CONSTANT("AI_IDN", AI_IDN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AI_CANONIDN", AI_CANONIDN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AI_IDN_ALLOW_UNASSIGNED", AI_IDN_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AI_IDN_USE_STD3_ASCII_RULES", AI_IDN_USE_STD3_ASCII_RULES, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef AI_NUMERICSERV
REGISTER_LONG_CONSTANT("AI_NUMERICSERV", AI_NUMERICSERV, CONST_CS | CONST_PERSISTENT);
@@ -906,7 +694,7 @@ static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, PHP_SOCKET *m
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(sock_array), element) {
ZVAL_DEREF(element);
php_sock = (php_socket*) zend_fetch_resource_ex(element, le_socket_name, le_socket);
- if (!php_sock) continue; /* If element is not a resource, skip it */
+ if (!php_sock) return -1; /* If element is not a resource, bail out */
PHP_SAFE_FD_SET(php_sock->bsd_socket, fds);
if (php_sock->bsd_socket > *max_fd) {
@@ -935,7 +723,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds) /* {{{ */
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(sock_array), num_key, key, element) {
ZVAL_DEREF(element);
php_sock = (php_socket*) zend_fetch_resource_ex(element, le_socket_name, le_socket);
- if (!php_sock) continue; /* If element is not a resource, skip it */
+ ZEND_ASSERT(php_sock); /* element is supposed to be resource */
if (PHP_SAFE_FD_ISSET(php_sock->bsd_socket, fds)) {
/* Add fd to new array */
@@ -964,15 +752,16 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds) /* {{{ */
Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */
PHP_FUNCTION(socket_select)
{
- zval *r_array, *w_array, *e_array, *sec;
+ zval *r_array, *w_array, *e_array;
struct timeval tv;
struct timeval *tv_p = NULL;
fd_set rfds, wfds, efds;
PHP_SOCKET max_fd = 0;
int retval, sets = 0;
- zend_long usec = 0;
+ zend_long sec, usec = 0;
+ zend_bool sec_is_null = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!a!a!l!|l", &r_array, &w_array, &e_array, &sec, &sec_is_null, &usec) == FAILURE) {
return;
}
@@ -980,9 +769,24 @@ PHP_FUNCTION(socket_select)
FD_ZERO(&wfds);
FD_ZERO(&efds);
- if (r_array != NULL) sets += php_sock_array_to_fd_set(r_array, &rfds, &max_fd);
- if (w_array != NULL) sets += php_sock_array_to_fd_set(w_array, &wfds, &max_fd);
- if (e_array != NULL) sets += php_sock_array_to_fd_set(e_array, &efds, &max_fd);
+ if (r_array != NULL) {
+ sets += retval = php_sock_array_to_fd_set(r_array, &rfds, &max_fd);
+ if (retval == -1) {
+ return;
+ }
+ }
+ if (w_array != NULL) {
+ sets += retval = php_sock_array_to_fd_set(w_array, &wfds, &max_fd);
+ if (retval == -1) {
+ return;
+ }
+ }
+ if (e_array != NULL) {
+ sets += retval = php_sock_array_to_fd_set(e_array, &efds, &max_fd);
+ if (retval == -1) {
+ return;
+ }
+ }
if (!sets) {
php_error_docref(NULL, E_WARNING, "no resource arrays were passed to select");
@@ -992,15 +796,13 @@ PHP_FUNCTION(socket_select)
PHP_SAFE_MAX_FD(max_fd, 0); /* someone needs to make this look more like stream_socket_select */
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
- if (sec != NULL) {
- zend_long s = zval_get_long(sec);
-
+ if (!sec_is_null) {
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
- tv.tv_sec = s + (usec / 1000000);
+ tv.tv_sec = sec + (usec / 1000000);
tv.tv_usec = usec % 1000000;
} else {
- tv.tv_sec = s;
+ tv.tv_sec = sec;
tv.tv_usec = usec;
}
@@ -1059,7 +861,7 @@ PHP_FUNCTION(socket_accept)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!php_accept_connect(php_sock, &new_sock, (struct sockaddr*)&sa, &php_sa_len)) {
@@ -1082,7 +884,7 @@ PHP_FUNCTION(socket_set_nonblock)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!Z_ISUNDEF(php_sock->zstream)) {
@@ -1120,7 +922,7 @@ PHP_FUNCTION(socket_set_block)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* if socket was created from a stream, give the stream a chance to take
@@ -1161,7 +963,7 @@ PHP_FUNCTION(socket_listen)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (listen(php_sock->bsd_socket, backlog) != 0) {
@@ -1184,7 +986,7 @@ PHP_FUNCTION(socket_close)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (!Z_ISUNDEF(php_sock->zstream)) {
@@ -1223,7 +1025,7 @@ PHP_FUNCTION(socket_write)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (ZEND_NUM_ARGS() < 3) {
@@ -1267,7 +1069,7 @@ PHP_FUNCTION(socket_read)
tmpbuf = zend_string_alloc(length, 0);
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (type == PHP_NORMAL_READ) {
@@ -1327,7 +1129,7 @@ PHP_FUNCTION(socket_getsockname)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
sa = (struct sockaddr *) &sa_storage;
@@ -1401,7 +1203,7 @@ PHP_FUNCTION(socket_getpeername)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
sa = (struct sockaddr *) &sa_storage;
@@ -1516,7 +1318,7 @@ PHP_FUNCTION(socket_connect)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch(php_sock->type) {
@@ -1622,7 +1424,7 @@ PHP_FUNCTION(socket_bind)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch(php_sock->type) {
@@ -1704,7 +1506,7 @@ PHP_FUNCTION(socket_recv)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(php_sock_res), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* overflow check */
@@ -1752,7 +1554,7 @@ PHP_FUNCTION(socket_send)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
retval = send(php_sock->bsd_socket, buf, (buf_len < (size_t)len ? buf_len : (size_t)len), flags);
@@ -1789,7 +1591,7 @@ PHP_FUNCTION(socket_recvfrom)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* overflow check */
@@ -1910,7 +1712,7 @@ PHP_FUNCTION(socket_sendto)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
switch (php_sock->type) {
@@ -1988,7 +1790,7 @@ PHP_FUNCTION(socket_get_option)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (level == IPPROTO_IP) {
@@ -2103,7 +1905,7 @@ PHP_FUNCTION(socket_set_option)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
set_errno(0);
@@ -2303,7 +2105,7 @@ PHP_FUNCTION(socket_shutdown)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (shutdown(php_sock->bsd_socket, how_shutdown) != 0) {
@@ -2329,7 +2131,7 @@ PHP_FUNCTION(socket_last_error)
if (arg1) {
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
RETVAL_LONG(php_sock->error);
} else {
@@ -2351,7 +2153,7 @@ PHP_FUNCTION(socket_clear_error)
if (arg1) {
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_sock->error = 0;
} else {
@@ -2470,7 +2272,7 @@ PHP_FUNCTION(socket_export_stream)
return;
}
if ((socket = (php_socket *) zend_fetch_resource(Z_RES_P(zsocket), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
/* Either we already exported a stream or the socket came from an import,
@@ -2573,14 +2375,7 @@ PHP_FUNCTION(socket_addrinfo_lookup)
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(zhints), key, hint) {
if (key) {
if (zend_string_equals_literal(key, "ai_flags")) {
- zend_long flags = zval_get_long(hint);
-#if HAVE_AI_IDN
- if (flags & (AI_IDN_ALLOW_UNASSIGNED | AI_IDN_USE_STD3_ASCII_RULES)) {
- php_error_docref(NULL, E_DEPRECATED,
- "AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES are deprecated");
- }
-#endif
- hints.ai_flags = flags;
+ hints.ai_flags = zval_get_long(hint);
} else if (zend_string_equals_literal(key, "ai_socktype")) {
hints.ai_socktype = zval_get_long(hint);
} else if (zend_string_equals_literal(key, "ai_protocol")) {
@@ -2634,7 +2429,7 @@ PHP_FUNCTION(socket_addrinfo_bind)
}
if ((ai = (struct addrinfo *) zend_fetch_resource(Z_RES_P(arg1), le_addrinfo_name, le_addrinfo)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_sock = php_create_socket();
@@ -2700,7 +2495,7 @@ PHP_FUNCTION(socket_addrinfo_connect)
}
if ((ai = (struct addrinfo *) zend_fetch_resource(Z_RES_P(arg1), le_addrinfo_name, le_addrinfo)) == NULL) {
- RETURN_FALSE;
+ return;
}
php_sock = php_create_socket();
@@ -2764,7 +2559,7 @@ PHP_FUNCTION(socket_addrinfo_explain)
}
if ((ai = (struct addrinfo *) zend_fetch_resource(Z_RES_P(arg1), le_addrinfo_name, le_addrinfo)) == NULL) {
- RETURN_FALSE;
+ return;
}
array_init(return_value);
@@ -2824,7 +2619,7 @@ PHP_FUNCTION(socket_wsaprotocol_info_export)
return;
}
if ((socket = (php_socket *) zend_fetch_resource(Z_RES_P(zsocket), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (SOCKET_ERROR == WSADuplicateSocket(socket->bsd_socket, (DWORD)target_pid, &wi)) {
diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php
new file mode 100644
index 0000000000..42abd805b6
--- /dev/null
+++ b/ext/sockets/sockets.stub.php
@@ -0,0 +1,173 @@
+<?php
+
+/** @return int|false */
+function socket_select(?array &$read_fds, ?array &$write_fds, ?array &$except_fds, ?int $tv_sec, int $tv_usec = 0) {}
+
+/** @return resource|false */
+function socket_create_listen(int $port, int $backlog = 128) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return resource|false
+ */
+function socket_accept($socket) {}
+
+/** @param resource $socket */
+function socket_set_nonblock($socket): bool {}
+
+/** @param resource $socket */
+function socket_set_block($socket): bool {}
+
+/** @param resource $socket */
+function socket_listen($socket, int $backlog = 0): bool {}
+
+/** @param resource $socket */
+function socket_close($socket): void {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_write($socket, string $buf, int $length = 0) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return string|false
+ */
+function socket_read($socket, int $length, int $type = PHP_BINARY_READ) {}
+
+/** @param resource $socket */
+function socket_getsockname($socket, &$addr, &$port = UNKNOWN): bool {}
+
+/** @param resource $socket */
+function socket_getpeername($socket, &$addr, &$port = UNKNOWN): bool {}
+
+/** @return resource|false */
+function socket_create(int $domain, int $type, int $protocol) {}
+
+/** @param resource $socket */
+function socket_connect($socket, string $addr, int $port = 0): bool {}
+
+function socket_strerror(int $errno): string {}
+
+/** @param resource $socket */
+function socket_bind($socket, string $addr, int $port = 0): bool {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_recv($socket, &$buf, int $len, int $flags) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_send($socket, string $buf, int $len, int $flags) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_recvfrom($socket, &$buf, int $len, int $flags, &$name, &$port = UNKNOWN) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_sendto($socket, string $buf, int $len, int $flags, string $addr, int $port = 0) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return array|int|false
+ */
+function socket_get_option($socket, int $level, int $optname) {}
+
+/** @param resource $socket */
+function socket_set_option($socket, int $level, int $optname, $optval): bool {}
+
+#ifdef HAVE_SOCKETPAIR
+/** @return bool|null */
+function socket_create_pair(int $domain, int $type, int $protocol, &$fd) {}
+#endif
+
+#ifdef HAVE_SHUTDOWN
+/** @param resource $socket */
+function socket_shutdown($socket, int $how = 2): bool {}
+#endif
+
+/** @param resource $socket */
+function socket_last_error($socket = UNKNOWN): int {}
+
+/** @param resource $socket */
+function socket_clear_error($socket = UNKNOWN): void {}
+
+/**
+ * @param resource $stream
+ *
+ * @return resource|false
+ */
+function socket_import_stream($stream) {}
+
+/** @param resource $socket */
+function socket_export_stream($socket) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_sendmsg($socket, array $msghdr, int $flags = 0) {}
+
+/**
+ * @param resource $socket
+ *
+ * @return int|false
+ */
+function socket_recvmsg($socket, array &$msghdr, int $flags = 0) {}
+
+function socket_cmsg_space(int $level, int $type, int $n = 0): ?int {}
+
+/** @return array|false */
+function socket_addrinfo_lookup(string $host, string $service = UNKNOWN, array $hints = UNKNOWN) {}
+
+/**
+ * @param resource $addr
+ *
+ * @return resource|false
+ */
+function socket_addrinfo_connect($addr) {}
+
+/**
+ * @param resource $addr
+ *
+ * @return resource|false
+ */
+function socket_addrinfo_bind($addr) {}
+
+/** @param resource $addr */
+function socket_addrinfo_explain($addr): array {}
+
+#ifdef PHP_WIN32
+/**
+ * @param resource $socket
+ *
+ * @return string|false
+ */
+function socket_wsaprotocol_info_export($socket, int $target_pid) {}
+
+/**
+ * @return resource|false
+ */
+function socket_wsaprotocol_info_import(string $info_id) {}
+
+function socket_wsaprotocol_info_release(string $info_id): bool {}
+#endif
diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h
new file mode 100644
index 0000000000..df833f33af
--- /dev/null
+++ b/ext/sockets/sockets_arginfo.h
@@ -0,0 +1,199 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_select, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(1, read_fds, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(1, write_fds, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(1, except_fds, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, tv_sec, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, tv_usec, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_listen, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, backlog, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_accept, 0, 0, 1)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_set_nonblock, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_set_block arginfo_socket_set_nonblock
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_listen, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, backlog, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_write, 0, 0, 2)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_read, 0, 0, 2)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_getsockname, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_INFO(1, addr)
+ ZEND_ARG_INFO(1, port)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_getpeername arginfo_socket_getsockname
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_connect, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_strerror, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_bind arginfo_socket_connect
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recv, 0, 0, 4)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_INFO(1, buf)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_send, 0, 0, 4)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recvfrom, 0, 0, 5)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_INFO(1, buf)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(1, name)
+ ZEND_ARG_INFO(1, port)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_sendto, 0, 0, 5)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_get_option, 0, 0, 3)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_set_option, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_LONG, 0)
+ ZEND_ARG_INFO(0, optval)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SOCKETPAIR)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_pair, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0)
+ ZEND_ARG_INFO(1, fd)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SHUTDOWN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_shutdown, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_last_error, 0, 0, IS_LONG, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_clear_error, 0, 0, IS_VOID, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_import_stream, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_export_stream arginfo_socket_accept
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_sendmsg, 0, 0, 2)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, msghdr, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recvmsg, 0, 0, 2)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(1, msghdr, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_cmsg_space, 0, 2, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, n, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_lookup, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, service, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, hints, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_connect, 0, 0, 1)
+ ZEND_ARG_INFO(0, addr)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_addrinfo_bind arginfo_socket_addrinfo_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_addrinfo_explain, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, addr)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_export, 0, 0, 2)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, target_pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_import, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, info_id, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_wsaprotocol_info_release, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, info_id, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/sockets/tests/ai_idn_deprecation.phpt b/ext/sockets/tests/ai_idn_deprecation.phpt
deleted file mode 100644
index 02a6965d26..0000000000
--- a/ext/sockets/tests/ai_idn_deprecation.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES are deprecated
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) die('skip The sockets extension is not loaded');
-if (!defined('AI_IDN_ALLOW_UNASSIGNED')) die('skip AI_IDN_ALLOW_UNASSIGNED not defined');
-?>
---FILE--
-<?php
-$addrinfo = socket_addrinfo_lookup('127.0.0.1', 2000, array(
- 'ai_family' => AF_INET,
- 'ai_socktype' => SOCK_DGRAM,
- 'ai_flags' => AI_IDN_ALLOW_UNASSIGNED,
-));
-var_dump(socket_addrinfo_connect($addrinfo[0]));
-echo "Done";
---EXPECTF--
-Deprecated: socket_addrinfo_lookup(): AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES are deprecated in %s on line %d
-resource(%d) of type (Socket)
-Done
diff --git a/ext/sockets/tests/mcast_ipv4_recv.phpt b/ext/sockets/tests/mcast_ipv4_recv.phpt
index f56b21a2fa..aef566e915 100644
--- a/ext/sockets/tests/mcast_ipv4_recv.phpt
+++ b/ext/sockets/tests/mcast_ipv4_recv.phpt
@@ -8,7 +8,7 @@ if (!extension_loaded('sockets')) {
if (getenv('SKIP_ONLINE_TESTS')) die('skip online test');
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$br = socket_bind($s, '0.0.0.0', 3000);
-$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
+$so = @socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
"group" => '224.0.0.23',
"interface" => 'lo',
));
diff --git a/ext/sockets/tests/socket_connect_params.phpt b/ext/sockets/tests/socket_connect_params.phpt
index 94c38de1cb..f1fdf55a81 100644
--- a/ext/sockets/tests/socket_connect_params.phpt
+++ b/ext/sockets/tests/socket_connect_params.phpt
@@ -14,8 +14,11 @@ fa@php.net
$rand = rand(1,999);
$s_c = socket_create_listen(31330+$rand);
// wrong parameter count
- $s_w = socket_connect();
- $s_w = socket_connect($s_c);
+ try {
+ $s_w = socket_connect($s_c);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$s_w = socket_connect($s_c, '0.0.0.0');
$s_w = socket_connect($s_c, '0.0.0.0', 31330+$rand);
@@ -23,9 +26,7 @@ fa@php.net
?>
--EXPECTF--
-Warning: socket_connect() expects at least 2 parameters, 0 given in %s on line %d
-
-Warning: socket_connect() expects at least 2 parameters, 1 given in %s on line %d
+socket_connect() expects at least 2 parameters, 1 given
Warning: socket_connect(): Socket of type AF_INET requires 3 arguments in %s on line %d
diff --git a/ext/sockets/tests/socket_create_listen_used.phpt b/ext/sockets/tests/socket_create_listen_used.phpt
index b41e2caefc..2dfec4fbf7 100644
--- a/ext/sockets/tests/socket_create_listen_used.phpt
+++ b/ext/sockets/tests/socket_create_listen_used.phpt
@@ -18,7 +18,6 @@ fa@php.net
// default invocation
$s_c_l2 = socket_create_listen(31330+$rand);
var_dump($s_c_l2);
- socket_close($s_c_l2);
socket_close($s_c_l);
?>
--EXPECTF--
@@ -26,5 +25,3 @@ resource(%i) of type (Socket)
Warning: socket_create_listen(): unable to bind to given address [%i]: %a in %s on line %d
bool(false)
-
-Warning: socket_close() expects parameter 1 to be resource, bool given in %s on line %d
diff --git a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt
index 554819ac99..5cf054458a 100644
--- a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt
+++ b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt
@@ -10,10 +10,6 @@ if (!extension_loaded('sockets')) {
}
--FILE--
<?php
-var_dump(socket_create_pair(AF_INET, null, null));
-
-$domain = 'unknown';
-var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets));
var_dump(socket_create_pair(AF_INET, null, null, $sockets));
@@ -21,11 +17,6 @@ var_dump(socket_create_pair(31337, null, null, $sockets));
var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
--EXPECTF--
-Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d
-NULL
-
-Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d
-NULL
bool(true)
Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
diff --git a/ext/sockets/tests/socket_create_pair-wrongparams.phpt b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
index 856d2cdc52..41154620ad 100644
--- a/ext/sockets/tests/socket_create_pair-wrongparams.phpt
+++ b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
@@ -10,23 +10,15 @@ if (!extension_loaded('sockets')) {
}
--FILE--
<?php
-var_dump(socket_create_pair(AF_INET, null, null));
-
-$domain = 'unknown';
-var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets));
var_dump(socket_create_pair(AF_INET, null, null, $sockets));
var_dump(socket_create_pair(31337, null, null, $sockets));
var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
---EXPECTF--
-Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d
-NULL
-
-Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d
-NULL
+?>
+--EXPECTF--
Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported in %s on line %d
bool(false)
diff --git a/ext/sockets/tests/socket_export_stream-2.phpt b/ext/sockets/tests/socket_export_stream-2.phpt
index d3db5e36c8..e95945038a 100644
--- a/ext/sockets/tests/socket_export_stream-2.phpt
+++ b/ext/sockets/tests/socket_export_stream-2.phpt
@@ -8,39 +8,31 @@ if (!extension_loaded('sockets')) {
--FILE--
<?php
-var_dump(socket_export_stream());
-var_dump(socket_export_stream(1, 2));
-var_dump(socket_export_stream(1));
-var_dump(socket_export_stream(new stdclass));
-var_dump(socket_export_stream(fopen(__FILE__, "rb")));
-var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND)));
+try {
+ var_dump(socket_export_stream(fopen(__FILE__, "rb")));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND)));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
var_dump($s);
socket_close($s);
-var_dump(socket_export_stream($s));
+try {
+ var_dump(socket_export_stream($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done.";
+?>
--EXPECTF--
-Warning: socket_export_stream() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: socket_export_stream() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: socket_export_stream() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
-Warning: socket_export_stream() expects parameter 1 to be resource, object given in %s on line %d
-NULL
-
-Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
-
-Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_export_stream(): supplied resource is not a valid Socket resource
+socket_export_stream(): supplied resource is not a valid Socket resource
resource(%d) of type (Socket)
-
-Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_export_stream(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_export_stream-4-win.phpt b/ext/sockets/tests/socket_export_stream-4-win.phpt
index 3b80092c18..1d53fef361 100644
--- a/ext/sockets/tests/socket_export_stream-4-win.phpt
+++ b/ext/sockets/tests/socket_export_stream-4-win.phpt
@@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
function test($stream, $sock) {
if ($stream !== null) {
echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
if ($sock !== null) {
echo "socket_set_block ";
- print_r(socket_set_block($sock));
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
echo "\n";
@@ -80,8 +92,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: An operation was attempted on something that is not a socket.
@@ -94,14 +105,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: An operatio
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_export_stream-4.phpt b/ext/sockets/tests/socket_export_stream-4.phpt
index ff329ec795..668ac648d3 100644
--- a/ext/sockets/tests/socket_export_stream-4.phpt
+++ b/ext/sockets/tests/socket_export_stream-4.phpt
@@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
function test($stream, $sock) {
if ($stream !== null) {
echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
if ($sock !== null) {
echo "socket_set_block ";
- print_r(socket_set_block($sock));
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
echo "\n";
@@ -80,8 +92,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d
@@ -92,14 +103,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_import_stream-2.phpt b/ext/sockets/tests/socket_import_stream-2.phpt
index c9eb583a3d..dfa291c283 100644
--- a/ext/sockets/tests/socket_import_stream-2.phpt
+++ b/ext/sockets/tests/socket_import_stream-2.phpt
@@ -8,40 +8,28 @@ if (!extension_loaded('sockets')) {
--FILE--
<?php
-var_dump(socket_import_stream());
-var_dump(socket_import_stream(1, 2));
-var_dump(socket_import_stream(1));
-var_dump(socket_import_stream(new stdclass));
var_dump(socket_import_stream(fopen(__FILE__, "rb")));
-var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)));
+try {
+ var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$s = stream_socket_server("udp://127.0.0.1:58394", $errno, $errstr, STREAM_SERVER_BIND);
var_dump($s);
var_dump(fclose($s));
-var_dump(socket_import_stream($s));
-
+try {
+ var_dump(socket_import_stream($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done.";
+?>
--EXPECTF--
-Warning: socket_import_stream() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: socket_import_stream() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: socket_import_stream() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
-Warning: socket_import_stream() expects parameter 1 to be resource, object given in %s on line %d
-NULL
-
Warning: socket_import_stream(): cannot represent a stream of type STDIO as a Socket Descriptor in %s on line %d
bool(false)
-
-Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+socket_import_stream(): supplied resource is not a valid stream resource
resource(%d) of type (stream)
bool(true)
-
-Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+socket_import_stream(): supplied resource is not a valid stream resource
Done.
diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt
index e14e94c122..9161db2cf1 100644
--- a/ext/sockets/tests/socket_import_stream-4-win.phpt
+++ b/ext/sockets/tests/socket_import_stream-4-win.phpt
@@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
function test($stream, $sock) {
if ($stream !== null) {
echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
if ($sock !== null) {
echo "socket_set_block ";
- print_r(socket_set_block($sock));
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
echo "\n";
@@ -75,8 +87,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [10038]: %s
@@ -89,14 +100,11 @@ Warning: socket_get_option(): unable to retrieve socket option [10038]: %s
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt
index f124161e10..5a528c6e33 100644
--- a/ext/sockets/tests/socket_import_stream-4.phpt
+++ b/ext/sockets/tests/socket_import_stream-4.phpt
@@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
function test($stream, $sock) {
if ($stream !== null) {
echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
if ($sock !== null) {
echo "socket_set_block ";
- print_r(socket_set_block($sock));
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
echo "\n";
}
echo "\n";
@@ -75,8 +87,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d
@@ -87,14 +98,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_listen-wrongparams.phpt b/ext/sockets/tests/socket_listen-wrongparams.phpt
index 41d7ac1f10..b5715a5ff5 100644
--- a/ext/sockets/tests/socket_listen-wrongparams.phpt
+++ b/ext/sockets/tests/socket_listen-wrongparams.phpt
@@ -10,13 +10,9 @@ if (!extension_loaded('sockets')) {
}
--FILE--
<?php
-var_dump(socket_listen(null));
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
var_dump(socket_listen($socket));
--EXPECTF--
-Warning: socket_listen() expects parameter 1 to be resource, null given in %s on line %d
-NULL
-
Warning: socket_listen(): unable to listen on socket [%d]: Invalid argument in %s on line %d
bool(false)
--CREDITS--
diff --git a/ext/sockets/tests/socket_select-wrongparams-2.phpt b/ext/sockets/tests/socket_select-wrongparams-2.phpt
index c149973e70..a7c423df1b 100644
--- a/ext/sockets/tests/socket_select-wrongparams-2.phpt
+++ b/ext/sockets/tests/socket_select-wrongparams-2.phpt
@@ -12,12 +12,9 @@ $write = null;
$except = null;
$time = 0;
var_dump(socket_select($sockets, $write, $except, $time));
-socket_select($sockets, $write, $except);
--EXPECTF--
Warning: socket_select(): no resource arrays were passed to select in %s on line %d
bool(false)
-
-Warning: socket_select() expects at least 4 parameters, 3 given in %s on line %d
--CREDITS--
Till Klampaeckel, till@php.net
Berlin TestFest 2009
diff --git a/ext/sockets/tests/socket_select-wrongparams-3.phpt b/ext/sockets/tests/socket_select-wrongparams-3.phpt
deleted file mode 100644
index 51686f9ccc..0000000000
--- a/ext/sockets/tests/socket_select-wrongparams-3.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Test parameter handling in socket_select().
---DESCRIPTION--
-Time must be long, otherwise it's casted.
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('SKIP The sockets extension is not loaded.');
-}
---FILE--
-<?php
-$sockets = array();
-if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
- $domain = AF_INET;
-} else {
- $domain = AF_UNIX;
-}
-socket_create_pair($domain, SOCK_STREAM, 0, $sockets);
-
-$write = null;
-$except = null;
-$time = array();
-var_dump(socket_select($sockets, $write, $except, $time));
---EXPECT--
-int(0)
---CREDITS--
-Till Klampaeckel, till@php.net
-Berlin TestFest 2009
diff --git a/ext/sockets/tests/socket_select_error.phpt b/ext/sockets/tests/socket_select_error.phpt
new file mode 100644
index 0000000000..48acb33020
--- /dev/null
+++ b/ext/sockets/tests/socket_select_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+socket_select() error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) die('skip socket extension not available');
+?>
+--FILE--
+<?php
+$r = $w = $e = ['no resource'];
+try {
+ socket_select($r, $w, $e, 1);
+} catch (TypeError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+?>
+--EXPECT--
+socket_select(): supplied argument is not a valid Socket resource
diff --git a/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt b/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt
index 88654e1973..f06e0a4789 100644
--- a/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt
+++ b/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt
@@ -8,8 +8,8 @@ if (!defined('IPPROTO_IPV6'))
die('skip IPv6 not available.');
/* Windows supports IPV6_RECVTCLASS and is able to receive the tclass via
* WSARecvMsg (though only the top 6 bits seem to reported), but WSASendMsg
- * does not accept IPV6_TCLASS messages. We still test that sendmsg() works
- * corectly by sending an IPV6_PKTINFO message that will have no effect */
+ * does not accept IPV6_TCLASS messages. We still test that sendmsg() works
+ * correctly by sending an IPV6_PKTINFO message that will have no effect */
--FILE--
<?php
include __DIR__."/mcast_helpers.php.inc";
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt
index 8754028f84..fbc4da3861 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt
@@ -20,7 +20,6 @@ require 'ipv6_skipif.inc';
}
socket_recvfrom($socket, $buf, 12, 0, $from, $port); // cause warning
$address = '::1';
- socket_sendto($socket, '', 1, 0, $address); // cause warning
if (!socket_bind($socket, $address, 1223)) {
die("Unable to bind to $address:1223");
}
@@ -36,8 +35,6 @@ require 'ipv6_skipif.inc';
$from = "";
$port = 0;
- socket_recvfrom($socket, $buf, 12, 0); // cause warning
- socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning
$bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port);
if ($bytes_received == -1) {
die('An error occurred while receiving from the socket');
@@ -50,12 +47,6 @@ require 'ipv6_skipif.inc';
--EXPECTF--
Warning: socket_recvfrom(): unable to recvfrom [10022]: %s
in %s on line %d
-
-Warning: Wrong parameter count for socket_sendto() in %s on line %d
-
-Warning: socket_recvfrom() expects at least 5 parameters, 4 given in %s on line %d
-
-Warning: Wrong parameter count for socket_recvfrom() in %s on line %d
Received Ping! from remote address ::1 and remote port 1223
--CREDITS--
Falko Menge <mail at falko-menge dot de>
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
index e25bf4df1a..600cbea595 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
@@ -26,7 +26,6 @@ if (!extension_loaded('sockets')) {
$msg = "Ping!";
$len = strlen($msg);
- $bytes_sent = socket_sendto($socket, $msg, $len, 0); // cause warning
$bytes_sent = socket_sendto($socket, $msg, $len, 0, $address);
if ($bytes_sent == -1) {
@unlink($address);
@@ -54,8 +53,6 @@ if (!extension_loaded('sockets')) {
--EXPECTF--
Warning: socket_create(): Unable to create socket [%d]: Protocol not supported in %s on line %d
bool(false)
-
-Warning: socket_sendto() expects at least 5 parameters, 4 given in %s on line %d
bool(false)
Received Ping!
--CREDITS--
diff --git a/ext/sockets/tests/socket_set_block-retval.phpt b/ext/sockets/tests/socket_set_block-retval.phpt
index 88e0029989..89dcc7ab4f 100644
--- a/ext/sockets/tests/socket_set_block-retval.phpt
+++ b/ext/sockets/tests/socket_set_block-retval.phpt
@@ -15,14 +15,16 @@ socket_close($socket);
$socket2 = socket_create_listen(31340);
socket_close($socket2);
-var_dump(socket_set_block($socket2));
+try {
+ var_dump(socket_set_block($socket2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_set_block(): supplied resource is not a valid Socket resource
--CREDITS--
Robin Mehner, robin@coding-robin.de
PHP Testfest Berlin 2009-05-09
diff --git a/ext/sockets/tests/socket_set_nonblock-retval.phpt b/ext/sockets/tests/socket_set_nonblock-retval.phpt
index c9bb1150ab..fb0e593810 100644
--- a/ext/sockets/tests/socket_set_nonblock-retval.phpt
+++ b/ext/sockets/tests/socket_set_nonblock-retval.phpt
@@ -15,14 +15,16 @@ socket_close($socket);
$socket2 = socket_create_listen(31340);
socket_close($socket2);
-var_dump(socket_set_nonblock($socket2));
+try {
+ var_dump(socket_set_nonblock($socket2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: socket_set_nonblock(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_set_nonblock(): supplied resource is not a valid Socket resource
--CREDITS--
Robin Mehner, robin@coding-robin.de
PHP Testfest Berlin 2009-05-09
diff --git a/ext/sockets/tests/socket_strerror.phpt b/ext/sockets/tests/socket_strerror.phpt
index aef56e5a84..4f1237e890 100644
--- a/ext/sockets/tests/socket_strerror.phpt
+++ b/ext/sockets/tests/socket_strerror.phpt
@@ -14,13 +14,11 @@ fa@php.net
?>
--FILE--
<?php
- $s_s = socket_strerror();
for ($i=0;$i<=132;$i++) {
var_dump(socket_strerror($i));
}
?>
--EXPECTF--
-Warning: socket_strerror() expects exactly 1 parameter, 0 given in %s on line %d
string(7) "Success"
string(23) "Operation not permitted"
string(25) "No such file or directory"
diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h
index a8a276ccbf..53763b6aa1 100644
--- a/ext/sockets/unix_socket_constants.h
+++ b/ext/sockets/unix_socket_constants.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/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h
index e2adf8cacf..656b530a29 100644
--- a/ext/sockets/win32_socket_constants.h
+++ b/ext/sockets/win32_socket_constants.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/ext/sockets/windows_common.h b/ext/sockets/windows_common.h
index 771d07d752..2923503556 100644
--- a/ext/sockets/windows_common.h
+++ b/ext/sockets/windows_common.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/ext/sodium/libsodium.c b/ext/sodium/libsodium.c
index 60bdd29aca..43629e0592 100644
--- a/ext/sodium/libsodium.c
+++ b/ext/sodium/libsodium.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, |
@@ -34,190 +32,13 @@
static zend_class_entry *sodium_exception_ce;
-ZEND_BEGIN_ARG_INFO_EX(AI_None, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_FirstArgByReference, 0, 0, 1)
- ZEND_ARG_INFO(1, reference)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_String, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringRef, 0, 0, 1)
- ZEND_ARG_INFO(1, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_TwoStrings, 0, 0, 2)
- ZEND_ARG_INFO(0, string_1)
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndMaybeString, 0, 0, 1)
- ZEND_ARG_INFO(0, string_1)
- /* optional */
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndIdAndMaybeString, 0, 0, 2)
- ZEND_ARG_INFO(0, string_1)
- ZEND_ARG_INFO(0, id)
- /* optional */
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringRefAndString, 0, 0, 2)
- ZEND_ARG_INFO(1, string_1)
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndKey, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndLength, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndId, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndKeyPair, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, keypair)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_SignatureAndStringAndKey, 0, 0, 3)
- ZEND_ARG_INFO(0, signature)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_Key, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_SecretKeyAndPublicKey, 0, 0, 2)
- ZEND_ARG_INFO(0, secret_key)
- ZEND_ARG_INFO(0, public_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_LengthAndNonceAndKey, 0, 0, 3)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndNonceAndKey, 0, 0, 3)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndNonceAndKeyPair, 0, 0, 3)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndMaybeKeyAndLength, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- /* optional */
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_LengthAndPasswordAndSaltAndOpsLimitAndMemLimit, 0, 0, 5)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, opslimit)
- ZEND_ARG_INFO(0, memlimit)
- /* optional */
- ZEND_ARG_INFO(0, alg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_PasswordAndOpsLimitAndMemLimit, 0, 0, 3)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, opslimit)
- ZEND_ARG_INFO(0, memlimit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_HashAndPassword, 0, 0, 2)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndADAndNonceAndKey, 0, 0, 4)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, ad)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReference, 0, 0, 1)
- ZEND_ARG_INFO(1, state)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndStringAndMaybeStringAndLong, 0, 0, 2)
- ZEND_ARG_INFO(1, state)
- ZEND_ARG_INFO(0, string)
- /* optional */
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, long)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndStringAndMaybeString, 0, 0, 2)
- ZEND_ARG_INFO(1, state)
- ZEND_ARG_INFO(0, string)
- /* optional */
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndMaybeLength, 0, 0, 1)
- ZEND_ARG_INFO(1, state)
- /* optional */
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndString, 0, 0, 2)
- ZEND_ARG_INFO(1, state)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_MaybeKeyAndLength, 0, 0, 0)
- /* optional */
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_KXClientSession, 0, 0, 2)
- ZEND_ARG_INFO(0, client_keypair)
- ZEND_ARG_INFO(0, server_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_KXServerSession, 0, 0, 2)
- ZEND_ARG_INFO(0, server_keypair)
- ZEND_ARG_INFO(0, client_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_KDF, 0, 0, 4)
- ZEND_ARG_INFO(0, subkey_len)
- ZEND_ARG_INFO(0, subkey_id)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || defined(__i386__) || \
defined(_M_AMD64) || defined(_M_IX86))
# define HAVE_AESGCM 1
#endif
+#include "libsodium_arginfo.h"
+
#ifndef crypto_aead_chacha20poly1305_IETF_KEYBYTES
# define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_KEYBYTES
#endif
@@ -246,114 +67,114 @@ ZEND_END_ARG_INFO()
#endif
static const zend_function_entry sodium_functions[] = {
- PHP_FE(sodium_crypto_aead_aes256gcm_is_available, AI_None)
+ PHP_FE(sodium_crypto_aead_aes256gcm_is_available, arginfo_sodium_crypto_aead_aes256gcm_is_available)
#ifdef HAVE_AESGCM
- PHP_FE(sodium_crypto_aead_aes256gcm_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_aes256gcm_encrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_aes256gcm_keygen, AI_None)
+ PHP_FE(sodium_crypto_aead_aes256gcm_decrypt, arginfo_sodium_crypto_aead_aes256gcm_decrypt)
+ PHP_FE(sodium_crypto_aead_aes256gcm_encrypt, arginfo_sodium_crypto_aead_aes256gcm_encrypt)
+ PHP_FE(sodium_crypto_aead_aes256gcm_keygen, arginfo_sodium_crypto_aead_aes256gcm_keygen)
#endif
- PHP_FE(sodium_crypto_aead_chacha20poly1305_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_encrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_keygen, AI_None)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_encrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_keygen, AI_None)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_decrypt, arginfo_sodium_crypto_aead_chacha20poly1305_decrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_encrypt, arginfo_sodium_crypto_aead_chacha20poly1305_encrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_keygen, arginfo_sodium_crypto_aead_chacha20poly1305_keygen)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_decrypt, arginfo_sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_encrypt, arginfo_sodium_crypto_aead_chacha20poly1305_ietf_encrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_keygen, arginfo_sodium_crypto_aead_chacha20poly1305_ietf_keygen)
#ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES
- PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_keygen, AI_None)
- PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, AI_StringAndADAndNonceAndKey)
+ PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_decrypt)
+ PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_keygen, arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_keygen)
+ PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_encrypt)
#endif
- PHP_FE(sodium_crypto_auth, AI_StringAndKey)
- PHP_FE(sodium_crypto_auth_keygen, AI_None)
- PHP_FE(sodium_crypto_auth_verify, AI_SignatureAndStringAndKey)
- PHP_FE(sodium_crypto_box, AI_StringAndNonceAndKeyPair)
- PHP_FE(sodium_crypto_box_keypair, AI_None)
- PHP_FE(sodium_crypto_box_seed_keypair, AI_Key)
- PHP_FE(sodium_crypto_box_keypair_from_secretkey_and_publickey, AI_SecretKeyAndPublicKey)
- PHP_FE(sodium_crypto_box_open, AI_StringAndNonceAndKey)
- PHP_FE(sodium_crypto_box_publickey, AI_Key)
- PHP_FE(sodium_crypto_box_publickey_from_secretkey, AI_Key)
- PHP_FE(sodium_crypto_box_seal, AI_StringAndKey)
- PHP_FE(sodium_crypto_box_seal_open, AI_StringAndKey)
- PHP_FE(sodium_crypto_box_secretkey, AI_Key)
- PHP_FE(sodium_crypto_kx_keypair, AI_None)
- PHP_FE(sodium_crypto_kx_publickey, AI_Key)
- PHP_FE(sodium_crypto_kx_secretkey, AI_Key)
- PHP_FE(sodium_crypto_kx_seed_keypair, AI_String)
- PHP_FE(sodium_crypto_kx_client_session_keys, AI_KXClientSession)
- PHP_FE(sodium_crypto_kx_server_session_keys, AI_KXServerSession)
- PHP_FE(sodium_crypto_generichash, AI_StringAndMaybeKeyAndLength)
- PHP_FE(sodium_crypto_generichash_keygen, AI_None)
- PHP_FE(sodium_crypto_generichash_init, AI_MaybeKeyAndLength)
- PHP_FE(sodium_crypto_generichash_update, AI_StateByReferenceAndString)
- PHP_FE(sodium_crypto_generichash_final, AI_StateByReferenceAndMaybeLength)
- PHP_FE(sodium_crypto_kdf_derive_from_key, AI_KDF)
- PHP_FE(sodium_crypto_kdf_keygen, AI_None)
+ PHP_FE(sodium_crypto_auth, arginfo_sodium_crypto_auth)
+ PHP_FE(sodium_crypto_auth_keygen, arginfo_sodium_crypto_auth_keygen)
+ PHP_FE(sodium_crypto_auth_verify, arginfo_sodium_crypto_auth_verify)
+ PHP_FE(sodium_crypto_box, arginfo_sodium_crypto_box)
+ PHP_FE(sodium_crypto_box_keypair, arginfo_sodium_crypto_box_keypair)
+ PHP_FE(sodium_crypto_box_seed_keypair, arginfo_sodium_crypto_box_seed_keypair)
+ PHP_FE(sodium_crypto_box_keypair_from_secretkey_and_publickey, arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey)
+ PHP_FE(sodium_crypto_box_open, arginfo_sodium_crypto_box_open)
+ PHP_FE(sodium_crypto_box_publickey, arginfo_sodium_crypto_box_publickey)
+ PHP_FE(sodium_crypto_box_publickey_from_secretkey, arginfo_sodium_crypto_box_publickey_from_secretkey)
+ PHP_FE(sodium_crypto_box_seal, arginfo_sodium_crypto_box_seal)
+ PHP_FE(sodium_crypto_box_seal_open, arginfo_sodium_crypto_box_seal_open)
+ PHP_FE(sodium_crypto_box_secretkey, arginfo_sodium_crypto_box_secretkey)
+ PHP_FE(sodium_crypto_kx_keypair, arginfo_sodium_crypto_kx_keypair)
+ PHP_FE(sodium_crypto_kx_publickey, arginfo_sodium_crypto_kx_publickey)
+ PHP_FE(sodium_crypto_kx_secretkey, arginfo_sodium_crypto_kx_secretkey)
+ PHP_FE(sodium_crypto_kx_seed_keypair, arginfo_sodium_crypto_kx_seed_keypair)
+ PHP_FE(sodium_crypto_kx_client_session_keys, arginfo_sodium_crypto_kx_client_session_keys)
+ PHP_FE(sodium_crypto_kx_server_session_keys, arginfo_sodium_crypto_kx_server_session_keys)
+ PHP_FE(sodium_crypto_generichash, arginfo_sodium_crypto_generichash)
+ PHP_FE(sodium_crypto_generichash_keygen, arginfo_sodium_crypto_generichash_keygen)
+ PHP_FE(sodium_crypto_generichash_init, arginfo_sodium_crypto_generichash_init)
+ PHP_FE(sodium_crypto_generichash_update, arginfo_sodium_crypto_generichash_update)
+ PHP_FE(sodium_crypto_generichash_final, arginfo_sodium_crypto_generichash_final)
+ PHP_FE(sodium_crypto_kdf_derive_from_key, arginfo_sodium_crypto_kdf_derive_from_key)
+ PHP_FE(sodium_crypto_kdf_keygen, arginfo_sodium_crypto_kdf_keygen)
#ifdef crypto_pwhash_SALTBYTES
- PHP_FE(sodium_crypto_pwhash, AI_LengthAndPasswordAndSaltAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_str, AI_PasswordAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_str_verify, AI_HashAndPassword)
+ PHP_FE(sodium_crypto_pwhash, arginfo_sodium_crypto_pwhash)
+ PHP_FE(sodium_crypto_pwhash_str, arginfo_sodium_crypto_pwhash_str)
+ PHP_FE(sodium_crypto_pwhash_str_verify, arginfo_sodium_crypto_pwhash_str_verify)
#endif
#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
- PHP_FE(sodium_crypto_pwhash_str_needs_rehash, AI_PasswordAndOpsLimitAndMemLimit)
+ PHP_FE(sodium_crypto_pwhash_str_needs_rehash, arginfo_sodium_crypto_pwhash_str_needs_rehash)
#endif
#ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
- PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256, AI_LengthAndPasswordAndSaltAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str, AI_PasswordAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str_verify, AI_HashAndPassword)
+ PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256, arginfo_sodium_crypto_pwhash_scryptsalsa208sha256)
+ PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str, arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str)
+ PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str_verify, arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str_verify)
#endif
- PHP_FE(sodium_crypto_scalarmult, AI_TwoStrings)
- PHP_FE(sodium_crypto_secretbox, AI_StringAndNonceAndKey)
- PHP_FE(sodium_crypto_secretbox_keygen, AI_None)
- PHP_FE(sodium_crypto_secretbox_open, AI_StringAndNonceAndKey)
+ PHP_FE(sodium_crypto_scalarmult, arginfo_sodium_crypto_scalarmult)
+ PHP_FE(sodium_crypto_secretbox, arginfo_sodium_crypto_secretbox)
+ PHP_FE(sodium_crypto_secretbox_keygen, arginfo_sodium_crypto_secretbox_keygen)
+ PHP_FE(sodium_crypto_secretbox_open, arginfo_sodium_crypto_secretbox_open)
#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_keygen, AI_None)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_push, AI_Key)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_push, AI_StateByReferenceAndStringAndMaybeStringAndLong)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_pull, AI_StringAndKey)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_pull, AI_StateByReferenceAndStringAndMaybeString)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_rekey, AI_StateByReference)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_keygen, arginfo_sodium_crypto_secretstream_xchacha20poly1305_keygen)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_push, arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_push)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_push, arginfo_sodium_crypto_secretstream_xchacha20poly1305_push)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_pull, arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_pull)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_pull, arginfo_sodium_crypto_secretstream_xchacha20poly1305_pull)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_rekey, arginfo_sodium_crypto_secretstream_xchacha20poly1305_rekey)
#endif
- PHP_FE(sodium_crypto_shorthash, AI_StringAndKey)
- PHP_FE(sodium_crypto_shorthash_keygen, AI_None)
- PHP_FE(sodium_crypto_sign, AI_StringAndKeyPair)
- PHP_FE(sodium_crypto_sign_detached, AI_StringAndKeyPair)
- PHP_FE(sodium_crypto_sign_ed25519_pk_to_curve25519, AI_Key)
- PHP_FE(sodium_crypto_sign_ed25519_sk_to_curve25519, AI_Key)
- PHP_FE(sodium_crypto_sign_keypair, AI_None)
- PHP_FE(sodium_crypto_sign_keypair_from_secretkey_and_publickey, AI_SecretKeyAndPublicKey)
- PHP_FE(sodium_crypto_sign_open, AI_StringAndKeyPair)
- PHP_FE(sodium_crypto_sign_publickey, AI_Key)
- PHP_FE(sodium_crypto_sign_secretkey, AI_Key)
- PHP_FE(sodium_crypto_sign_publickey_from_secretkey, AI_Key)
- PHP_FE(sodium_crypto_sign_seed_keypair, AI_Key)
- PHP_FE(sodium_crypto_sign_verify_detached, AI_SignatureAndStringAndKey)
- PHP_FE(sodium_crypto_stream, AI_LengthAndNonceAndKey)
- PHP_FE(sodium_crypto_stream_keygen, AI_None)
- PHP_FE(sodium_crypto_stream_xor, AI_StringAndNonceAndKey)
+ PHP_FE(sodium_crypto_shorthash, arginfo_sodium_crypto_shorthash)
+ PHP_FE(sodium_crypto_shorthash_keygen, arginfo_sodium_crypto_shorthash_keygen)
+ PHP_FE(sodium_crypto_sign, arginfo_sodium_crypto_sign)
+ PHP_FE(sodium_crypto_sign_detached, arginfo_sodium_crypto_sign_detached)
+ PHP_FE(sodium_crypto_sign_ed25519_pk_to_curve25519, arginfo_sodium_crypto_sign_ed25519_pk_to_curve25519)
+ PHP_FE(sodium_crypto_sign_ed25519_sk_to_curve25519, arginfo_sodium_crypto_sign_ed25519_sk_to_curve25519)
+ PHP_FE(sodium_crypto_sign_keypair, arginfo_sodium_crypto_sign_keypair)
+ PHP_FE(sodium_crypto_sign_keypair_from_secretkey_and_publickey, arginfo_sodium_crypto_sign_keypair_from_secretkey_and_publickey)
+ PHP_FE(sodium_crypto_sign_open, arginfo_sodium_crypto_sign_open)
+ PHP_FE(sodium_crypto_sign_publickey, arginfo_sodium_crypto_sign_publickey)
+ PHP_FE(sodium_crypto_sign_secretkey, arginfo_sodium_crypto_sign_secretkey)
+ PHP_FE(sodium_crypto_sign_publickey_from_secretkey, arginfo_sodium_crypto_sign_publickey_from_secretkey)
+ PHP_FE(sodium_crypto_sign_seed_keypair, arginfo_sodium_crypto_sign_seed_keypair)
+ PHP_FE(sodium_crypto_sign_verify_detached, arginfo_sodium_crypto_sign_verify_detached)
+ PHP_FE(sodium_crypto_stream, arginfo_sodium_crypto_stream)
+ PHP_FE(sodium_crypto_stream_keygen, arginfo_sodium_crypto_stream_keygen)
+ PHP_FE(sodium_crypto_stream_xor, arginfo_sodium_crypto_stream_xor)
/* helpers */
- PHP_FE(sodium_add, AI_StringRefAndString)
- PHP_FE(sodium_compare, AI_TwoStrings)
- PHP_FE(sodium_increment, AI_StringRef)
- PHP_FE(sodium_memcmp, AI_TwoStrings)
- PHP_FE(sodium_memzero, AI_FirstArgByReference)
- PHP_FE(sodium_pad, AI_StringAndLength)
- PHP_FE(sodium_unpad, AI_StringAndLength)
+ PHP_FE(sodium_add, arginfo_sodium_add)
+ PHP_FE(sodium_compare, arginfo_sodium_compare)
+ PHP_FE(sodium_increment, arginfo_sodium_increment)
+ PHP_FE(sodium_memcmp, arginfo_sodium_memcmp)
+ PHP_FE(sodium_memzero, arginfo_sodium_memzero)
+ PHP_FE(sodium_pad, arginfo_sodium_pad)
+ PHP_FE(sodium_unpad, arginfo_sodium_unpad)
/* codecs */
- PHP_FE(sodium_bin2hex, AI_String)
- PHP_FE(sodium_hex2bin, AI_StringAndMaybeString)
+ PHP_FE(sodium_bin2hex, arginfo_sodium_bin2hex)
+ PHP_FE(sodium_hex2bin, arginfo_sodium_hex2bin)
#ifdef sodium_base64_VARIANT_ORIGINAL
- PHP_FE(sodium_bin2base64, AI_StringAndId)
- PHP_FE(sodium_base642bin, AI_StringAndIdAndMaybeString)
+ PHP_FE(sodium_bin2base64, arginfo_sodium_bin2base64)
+ PHP_FE(sodium_base642bin, arginfo_sodium_base642bin)
#endif
/* aliases */
- PHP_FALIAS(sodium_crypto_scalarmult_base, sodium_crypto_box_publickey_from_secretkey, AI_TwoStrings)
+ PHP_FALIAS(sodium_crypto_scalarmult_base, sodium_crypto_box_publickey_from_secretkey, arginfo_sodium_crypto_scalarmult_base)
PHP_FE_END
};
diff --git a/ext/sodium/libsodium.stub.php b/ext/sodium/libsodium.stub.php
new file mode 100644
index 0000000000..23d75ba920
--- /dev/null
+++ b/ext/sodium/libsodium.stub.php
@@ -0,0 +1,194 @@
+<?php
+
+function sodium_crypto_aead_aes256gcm_is_available(): bool {}
+
+#ifdef HAVE_AESGCM
+/** @return string|false */
+function sodium_crypto_aead_aes256gcm_decrypt(string $string, string $ad, string $nonce, string $key) {}
+
+function sodium_crypto_aead_aes256gcm_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+
+function sodium_crypto_aead_aes256gcm_keygen(): string {}
+#endif
+
+/** @return string|false */
+function sodium_crypto_aead_chacha20poly1305_decrypt(string $string, string $ad, string $nonce, string $key) {}
+
+function sodium_crypto_aead_chacha20poly1305_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+
+function sodium_crypto_aead_chacha20poly1305_keygen(): string {}
+
+/** @return string|false */
+function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $string, string $ad, string $nonce, string $key) {}
+
+function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+
+function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {}
+
+#ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES
+/** @return string|false */
+function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $string, string $ad, string $nonce, string $key) {}
+
+function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {}
+
+function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+#endif
+
+function sodium_crypto_auth(string $string, string $key): string {}
+
+function sodium_crypto_auth_keygen(): string {}
+
+function sodium_crypto_auth_verify(string $signature, string $string, string $key): bool {}
+
+function sodium_crypto_box(string $string, string $nonce, string $key): string {}
+
+function sodium_crypto_box_keypair(): string {}
+
+function sodium_crypto_box_seed_keypair(string $key): string {}
+
+function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
+
+/** @return string|false */
+function sodium_crypto_box_open(string $string, string $nonce, string $key) {}
+
+function sodium_crypto_box_publickey(string $key): string {}
+
+function sodium_crypto_box_publickey_from_secretkey(string $key): string {}
+
+function sodium_crypto_box_seal(string $string, string $key): string {}
+
+/** @return string|false */
+function sodium_crypto_box_seal_open(string $string, string $key) {}
+
+function sodium_crypto_box_secretkey(string $key): string {}
+
+function sodium_crypto_kx_keypair(): string {}
+
+function sodium_crypto_kx_publickey(string $key): string {}
+
+function sodium_crypto_kx_secretkey(string $key): string {}
+
+function sodium_crypto_kx_seed_keypair(string $string): string {}
+
+function sodium_crypto_kx_client_session_keys(string $client_keypair, string $server_key): array {}
+
+function sodium_crypto_kx_server_session_keys(string $server_keypair, string $client_key): array {}
+
+function sodium_crypto_generichash(string $string, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
+
+function sodium_crypto_generichash_keygen(): string {}
+
+function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
+
+function sodium_crypto_generichash_update(string &$state, string $string): bool {}
+
+function sodium_crypto_generichash_final(string &$state, $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
+
+function sodium_crypto_kdf_derive_from_key(int $subkey_len, int $subkey_id, string $context, string $key): string {}
+
+function sodium_crypto_kdf_keygen(): string {}
+
+#ifdef crypto_pwhash_SALTBYTES
+function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $alg = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {}
+
+function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {}
+
+function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {}
+#endif
+
+#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
+function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool {}
+#endif
+
+#ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {}
+
+function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {}
+
+function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {}
+#endif
+
+function sodium_crypto_scalarmult(string $string_1, string $string_2): string {}
+
+function sodium_crypto_secretbox(string $string, string $nonce, string $key): string {}
+
+function sodium_crypto_secretbox_keygen(): string {}
+
+/** @return string|false */
+function sodium_crypto_secretbox_open(string $string, string $nonce, string $key) {}
+
+#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
+function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $msg, string $ad = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $string, string $key): string {}
+
+/** @return array|false */
+function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $c, string $ad = "") {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {}
+#endif
+
+function sodium_crypto_shorthash(string $string, string $key): string {}
+
+function sodium_crypto_shorthash_keygen(): string {}
+
+function sodium_crypto_sign(string $string, string $keypair): string {}
+
+function sodium_crypto_sign_detached(string $string, string $keypair): string {}
+
+function sodium_crypto_sign_ed25519_pk_to_curve25519(string $key): string {}
+
+function sodium_crypto_sign_ed25519_sk_to_curve25519(string $key): string {}
+
+function sodium_crypto_sign_keypair(): string {}
+
+function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
+
+/** @return string|false */
+function sodium_crypto_sign_open(string $string, string $keypair) {}
+
+function sodium_crypto_sign_publickey(string $key): string {}
+
+function sodium_crypto_sign_secretkey(string $key): string {}
+
+function sodium_crypto_sign_publickey_from_secretkey(string $key): string {}
+
+function sodium_crypto_sign_seed_keypair(string $key): string {}
+
+function sodium_crypto_sign_verify_detached(string $signature, string $string, string $key): bool {}
+
+function sodium_crypto_stream(int $length, string $nonce, string $key): string {}
+
+function sodium_crypto_stream_keygen(): string {}
+
+function sodium_crypto_stream_xor(string $string, string $nonce, string $key): string {}
+
+function sodium_add(string &$string_1, string $string_2): void {}
+
+function sodium_compare(string $string_1, string $string_2): int {}
+
+function sodium_increment(string &$string): void {}
+
+function sodium_memcmp(string $string_1, string $string_2): int {}
+
+function sodium_memzero(string &$reference): void {}
+
+function sodium_pad(string $string, int $length): string {}
+
+function sodium_unpad(string $string, int $length): string {}
+
+function sodium_bin2hex(string $string): string {}
+
+function sodium_hex2bin(string $string, $ignore = ""): string {}
+
+#ifdef sodium_base64_VARIANT_ORIGINAL
+function sodium_bin2base64(string $string, int $id): string {}
+
+function sodium_base642bin(string $string, int $id, string $ignore = ""): string {}
+#endif
+
+function sodium_crypto_scalarmult_base(string $key): string {}
diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h
new file mode 100644
index 0000000000..d7c17eee23
--- /dev/null
+++ b/ext/sodium/libsodium_arginfo.h
@@ -0,0 +1,380 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_AESGCM)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_decrypt, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_AESGCM)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_encrypt, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_AESGCM)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_aead_chacha20poly1305_decrypt, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_chacha20poly1305_encrypt, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_chacha20poly1305_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_aead_chacha20poly1305_ietf_decrypt arginfo_sodium_crypto_aead_chacha20poly1305_decrypt
+
+#define arginfo_sodium_crypto_aead_chacha20poly1305_ietf_encrypt arginfo_sodium_crypto_aead_chacha20poly1305_encrypt
+
+#define arginfo_sodium_crypto_aead_chacha20poly1305_ietf_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_auth, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_auth_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_auth_verify, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, signature, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_box_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_seed_keypair, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, secret_key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, public_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_box_open, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_box_publickey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_box_publickey_from_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_box_seal arginfo_sodium_crypto_auth
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_box_seal_open, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_box_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_kx_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_kx_publickey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_kx_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_seed_keypair, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_client_session_keys, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, client_keypair, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_server_session_keys, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, server_keypair, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, client_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_generichash_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_init, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_update, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_final, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_INFO(0, length)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kdf_derive_from_key, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subkey_len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, subkey_id, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_kdf_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#if defined(crypto_pwhash_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash, 0, 5, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alg, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_str, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_str_verify, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_str_needs_rehash, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_scryptsalsa208sha256, 0, 5, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str_verify, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_scalarmult, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_secretbox arginfo_sodium_crypto_box
+
+#define arginfo_sodium_crypto_secretbox_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_secretbox_open arginfo_sodium_crypto_box_open
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_push, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_push, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msg, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_pull, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_pull, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, c, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_rekey, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_sodium_crypto_shorthash arginfo_sodium_crypto_auth
+
+#define arginfo_sodium_crypto_shorthash_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_sign, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, keypair, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_sign_detached arginfo_sodium_crypto_sign
+
+#define arginfo_sodium_crypto_sign_ed25519_pk_to_curve25519 arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_ed25519_sk_to_curve25519 arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_sign_keypair_from_secretkey_and_publickey arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sodium_crypto_sign_open, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, keypair, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_sign_publickey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_publickey_from_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_seed_keypair arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_verify_detached arginfo_sodium_crypto_auth_verify
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_stream, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_stream_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_stream_xor arginfo_sodium_crypto_box
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_add, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, string_1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_compare, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, string_1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_increment, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_memcmp arginfo_sodium_compare
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_memzero, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, reference, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_pad, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_unpad arginfo_sodium_pad
+
+#define arginfo_sodium_bin2hex arginfo_sodium_crypto_kx_seed_keypair
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_hex2bin, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_INFO(0, ignore)
+ZEND_END_ARG_INFO()
+
+#if defined(sodium_base64_VARIANT_ORIGINAL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_bin2base64, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(sodium_base64_VARIANT_ORIGINAL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_base642bin, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ignore, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_sodium_crypto_scalarmult_base arginfo_sodium_crypto_box_seed_keypair
diff --git a/ext/sodium/php_libsodium.h b/ext/sodium/php_libsodium.h
index f0ec64ca77..1a8d3ef907 100644
--- a/ext/sodium/php_libsodium.h
+++ b/ext/sodium/php_libsodium.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/ext/sodium/sodium_pwhash.c b/ext/sodium/sodium_pwhash.c
index 2b284c7116..3ff304c452 100644
--- a/ext/sodium/sodium_pwhash.c
+++ b/ext/sodium/sodium_pwhash.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/ext/spl/php_spl.c b/ext/spl/php_spl.c
index b147a96128..f3bf3969ee 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.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, |
@@ -306,7 +304,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
} /* }}} */
/* {{{ proto void spl_autoload(string class_name [, string file_extensions])
- Default implementation for __autoload() */
+ Default autoloader implementation */
PHP_FUNCTION(spl_autoload)
{
int pos_len, pos1_len;
@@ -498,7 +496,7 @@ PHP_FUNCTION(spl_autoload_call)
} while (0)
/* {{{ proto bool spl_autoload_register([mixed autoload_function [, bool throw [, bool prepend]]])
- Register given function as __autoload() implementation */
+ Register given function as autoloader */
PHP_FUNCTION(spl_autoload_register)
{
zend_string *func_name;
@@ -517,7 +515,7 @@ PHP_FUNCTION(spl_autoload_register)
}
if (ZEND_NUM_ARGS()) {
- if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &func_name, &fcc, &error)) {
+ if (!zend_is_callable_ex(zcallable, NULL, 0, &func_name, &fcc, &error)) {
alfi.ce = fcc.calling_scope;
alfi.func_ptr = fcc.function_handler;
obj_ptr = fcc.object;
@@ -672,7 +670,7 @@ skip:
} /* }}} */
/* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
- Unregister given function as __autoload() implementation */
+ Unregister given function as autoloader */
PHP_FUNCTION(spl_autoload_unregister)
{
zend_string *func_name = NULL;
@@ -756,7 +754,7 @@ PHP_FUNCTION(spl_autoload_unregister)
} /* }}} */
/* {{{ proto false|array spl_autoload_functions()
- Return all registered __autoload() functionns */
+ Return all registered autoloader functions */
PHP_FUNCTION(spl_autoload_functions)
{
zend_function *fptr;
@@ -767,14 +765,6 @@ PHP_FUNCTION(spl_autoload_functions)
}
if (!EG(autoload_func)) {
- if ((fptr = zend_hash_find_ptr(EG(function_table), ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)))) {
- zval tmp;
-
- array_init(return_value);
- ZVAL_STR_COPY(&tmp, ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
- zend_hash_next_index_insert_new(Z_ARR_P(return_value), &tmp);
- return;
- }
RETURN_FALSE;
}
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index 69ff65f72c..61fc80ac1d 100644
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.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/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 90861b49c6..b9c58caea0 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.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, |
@@ -165,7 +163,7 @@ static void spl_array_object_free_storage(zend_object *object)
zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
/* {{{ spl_array_object_new_ex */
-static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig)
+static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig)
{
spl_array_object *intern;
zend_class_entry *parent = class_type;
@@ -179,7 +177,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
intern->ar_flags = 0;
intern->ce_get_iterator = spl_ce_ArrayIterator;
if (orig) {
- spl_array_object *other = Z_SPLARRAY_P(orig);
+ spl_array_object *other = spl_array_from_obj(orig);
intern->ar_flags &= ~ SPL_ARRAY_CLONE_MASK;
intern->ar_flags |= (other->ar_flags & SPL_ARRAY_CLONE_MASK);
@@ -187,16 +185,18 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
if (clone_orig) {
if (other->ar_flags & SPL_ARRAY_IS_SELF) {
ZVAL_UNDEF(&intern->array);
- } else if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) {
+ } else if (orig->handlers == &spl_handler_ArrayObject) {
ZVAL_ARR(&intern->array,
zend_array_dup(spl_array_get_hash_table(other)));
} else {
- ZEND_ASSERT(Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator);
- ZVAL_COPY(&intern->array, orig);
+ ZEND_ASSERT(orig->handlers == &spl_handler_ArrayIterator);
+ GC_ADDREF(orig);
+ ZVAL_OBJ(&intern->array, orig);
intern->ar_flags |= SPL_ARRAY_USE_OTHER;
}
} else {
- ZVAL_COPY(&intern->array, orig);
+ GC_ADDREF(orig);
+ ZVAL_OBJ(&intern->array, orig);
intern->ar_flags |= SPL_ARRAY_USE_OTHER;
}
} else {
@@ -273,13 +273,11 @@ static zend_object *spl_array_object_new(zend_class_entry *class_type)
/* }}} */
/* {{{ spl_array_object_clone */
-static zend_object *spl_array_object_clone(zval *zobject)
+static zend_object *spl_array_object_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
- old_object = Z_OBJ_P(zobject);
- new_object = spl_array_object_new_ex(old_object->ce, zobject, 1);
+ new_object = spl_array_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -393,11 +391,11 @@ num_index:
}
} /* }}} */
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty);
+static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty);
-static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zval *ret;
if (check_inherited &&
@@ -416,7 +414,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", rv, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset);
zval_ptr_dtor(offset);
if (!Z_ISUNDEF_P(rv)) {
@@ -442,14 +440,14 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
return ret;
} /* }}} */
-static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_array_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
return spl_array_read_dimension_ex(1, object, offset, type, rv);
} /* }}} */
-static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_array_write_dimension_ex(int check_inherited, zend_object *object, zval *offset, zval *value) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zend_long index;
HashTable *ht;
@@ -462,7 +460,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_2_params(object, Z_OBJCE_P(object), &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
+ zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
zval_ptr_dtor(offset);
return;
}
@@ -517,20 +515,20 @@ num_index:
}
} /* }}} */
-static void spl_array_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_array_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
spl_array_write_dimension_ex(1, object, offset, value);
} /* }}} */
-static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset) /* {{{ */
+static void spl_array_unset_dimension_ex(int check_inherited, zend_object *object, zval *offset) /* {{{ */
{
zend_long index;
HashTable *ht;
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if (check_inherited && intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_del, "offsetUnset", NULL, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset);
zval_ptr_dtor(offset);
return;
}
@@ -602,20 +600,20 @@ num_index:
}
} /* }}} */
-static void spl_array_unset_dimension(zval *object, zval *offset) /* {{{ */
+static void spl_array_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
spl_array_unset_dimension_ex(1, object, offset);
} /* }}} */
-static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_array_has_dimension_ex(int check_inherited, zend_object *object, zval *offset, int check_empty) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zend_long index;
zval rv, *value = NULL, *tmp;
if (check_inherited && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset);
zval_ptr_dtor(offset);
if (zend_is_true(&rv)) {
@@ -693,7 +691,7 @@ num_index:
}
} /* }}} */
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
return spl_array_has_dimension_ex(1, object, offset, check_empty);
} /* }}} */
@@ -707,7 +705,7 @@ SPL_METHOD(Array, offsetExists)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
return;
}
- RETURN_BOOL(spl_array_has_dimension_ex(0, ZEND_THIS, index, 2));
+ RETURN_BOOL(spl_array_has_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, 2));
} /* }}} */
/* {{{ proto mixed ArrayObject::offsetGet(mixed $index)
@@ -719,7 +717,7 @@ SPL_METHOD(Array, offsetGet)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
return;
}
- value = spl_array_read_dimension_ex(0, ZEND_THIS, index, BP_VAR_R, return_value);
+ value = spl_array_read_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, BP_VAR_R, return_value);
if (value != return_value) {
ZVAL_COPY_DEREF(return_value, value);
}
@@ -734,7 +732,7 @@ SPL_METHOD(Array, offsetSet)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &index, &value) == FAILURE) {
return;
}
- spl_array_write_dimension_ex(0, ZEND_THIS, index, value);
+ spl_array_write_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, value);
} /* }}} */
void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
@@ -746,7 +744,7 @@ void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
return;
}
- spl_array_write_dimension(object, NULL, append_value);
+ spl_array_write_dimension(Z_OBJ_P(object), NULL, append_value);
} /* }}} */
/* {{{ proto void ArrayObject::append(mixed $newval)
@@ -771,7 +769,7 @@ SPL_METHOD(Array, offsetUnset)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
return;
}
- spl_array_unset_dimension_ex(0, ZEND_THIS, index);
+ spl_array_unset_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index);
} /* }}} */
/* {{{ proto array ArrayObject::getArrayCopy()
@@ -785,9 +783,9 @@ SPL_METHOD(Array, getArrayCopy)
RETURN_ARR(zend_array_dup(spl_array_get_hash_table(intern)));
} /* }}} */
-static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *spl_array_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
HashTable *ht;
zend_bool dup;
@@ -822,12 +820,12 @@ static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose p
return ht;
} /* }}} */
-static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_array_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
zval *storage;
zend_string *zname;
zend_class_entry *base;
- spl_array_object *intern = Z_SPLARRAY_P(obj);
+ spl_array_object *intern = spl_array_from_obj(obj);
if (!intern->std.properties) {
rebuild_object_properties(&intern->std);
@@ -846,7 +844,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
storage = &intern->array;
Z_TRY_ADDREF_P(storage);
- base = Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator
+ base = obj->handlers == &spl_handler_ArrayIterator
? spl_ce_ArrayIterator : spl_ce_ArrayObject;
zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1);
zend_symtable_update(debug_info, zname, storage);
@@ -857,75 +855,85 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
-static HashTable *spl_array_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_array_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(obj);
+ spl_array_object *intern = spl_array_from_obj(obj);
*gc_data = &intern->array;
*gc_data_count = 1;
return zend_std_get_properties(obj);
}
/* }}} */
-static zval *spl_array_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *spl_array_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- return spl_array_read_dimension(object, member, type, rv);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ return spl_array_read_dimension(object, &member, type, rv);
}
- return zend_std_read_property(object, member, type, cache_slot, rv);
+ return zend_std_read_property(object, name, type, cache_slot, rv);
} /* }}} */
-static zval *spl_array_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *spl_array_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- spl_array_write_dimension(object, member, value);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ spl_array_write_dimension(object, &member, value);
return value;
}
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
} /* }}} */
-static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *spl_array_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
/* If object has offsetGet() overridden, then fallback to read_property,
* which will call offsetGet(). */
+ zval member;
if (intern->fptr_offset_get) {
return NULL;
}
- return spl_array_get_dimension_ptr(1, intern, member, type);
+ ZVAL_STR(&member, name);
+ return spl_array_get_dimension_ptr(1, intern, &member, type);
}
- return zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
} /* }}} */
-static int spl_array_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static int spl_array_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- return spl_array_has_dimension(object, member, has_set_exists);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ return spl_array_has_dimension(object, &member, has_set_exists);
}
- return zend_std_has_property(object, member, has_set_exists, cache_slot);
+ return zend_std_has_property(object, name, has_set_exists, cache_slot);
} /* }}} */
-static void spl_array_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static void spl_array_unset_property(zend_object *object, zend_string *name, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- spl_array_unset_dimension(object, member);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ spl_array_unset_dimension(object, &member);
return;
}
- zend_std_unset_property(object, member, cache_slot);
+ zend_std_unset_property(object, name, cache_slot);
} /* }}} */
static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */
@@ -936,6 +944,8 @@ static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */
*intern2;
int result = 0;
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
intern1 = Z_SPLARRAY_P(o1);
intern2 = Z_SPLARRAY_P(o2);
ht1 = spl_array_get_hash_table(intern1);
@@ -1323,7 +1333,7 @@ SPL_METHOD(Array, getIterator)
return;
}
- ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, object, 0));
+ ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, Z_OBJ_P(object), 0));
}
/* }}} */
@@ -1392,9 +1402,9 @@ static zend_long spl_array_object_count_elements_helper(spl_array_object *intern
}
} /* }}} */
-int spl_array_object_count_elements(zval *object, zend_long *count) /* {{{ */
+int spl_array_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -1839,7 +1849,7 @@ SPL_METHOD(Array, __serialize)
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
/* members */
- ZVAL_ARR(&tmp, zend_std_get_properties(ZEND_THIS));
+ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std));
Z_TRY_ADDREF(tmp);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
}
@@ -2031,7 +2041,7 @@ PHP_MINIT_FUNCTION(spl_array)
spl_handler_ArrayObject.has_property = spl_array_has_property;
spl_handler_ArrayObject.unset_property = spl_array_unset_property;
- spl_handler_ArrayObject.compare_objects = spl_array_compare_objects;
+ spl_handler_ArrayObject.compare = spl_array_compare_objects;
spl_handler_ArrayObject.dtor_obj = zend_objects_destroy_object;
spl_handler_ArrayObject.free_obj = spl_array_object_free_storage;
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
index ed5dec3e62..c98a6d02b6 100644
--- a/ext/spl/spl_array.h
+++ b/ext/spl/spl_array.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/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 691ae9b8d0..2d71171859 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.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, |
@@ -345,15 +343,13 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
Open the directory
Clone other members (properties)
*/
-static zend_object *spl_filesystem_object_clone(zval *zobject)
+static zend_object *spl_filesystem_object_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
spl_filesystem_object *intern;
spl_filesystem_object *source;
int index, skip_dots;
- old_object = Z_OBJ_P(zobject);
source = spl_filesystem_from_obj(old_object);
new_object = spl_filesystem_object_new_ex(old_object->ce);
intern = spl_filesystem_from_obj(new_object);
@@ -464,7 +460,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STRINGL(&arg1, file_path, file_path_len);
- zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
} else {
spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy);
@@ -509,7 +505,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
spl_filesystem_object_get_file_name(source);
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len);
- zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
} else {
intern->file_name = estrndup(source->file_name, source->file_name_len);
@@ -534,7 +530,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
if (ce->constructor->common.scope != spl_ce_SplFileObject) {
ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len);
ZVAL_STRINGL(&arg2, "r", 1);
- zend_call_method_with_2_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1, &arg2);
+ zend_call_method_with_2_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1, &arg2);
zval_ptr_dtor(&arg1);
zval_ptr_dtor(&arg2);
} else {
@@ -598,9 +594,9 @@ static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, s
}
/* }}} */
-static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *spl_filesystem_object_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(object);
+ spl_filesystem_object *intern = spl_filesystem_from_obj(object);
zval tmp;
HashTable *rv;
zend_string *pnstr;
@@ -847,19 +843,19 @@ SPL_METHOD(DirectoryIterator, seek)
if (intern->u.dir.index > pos) {
/* we first rewind */
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL);
}
while (intern->u.dir.index < pos) {
int valid = 0;
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval);
valid = zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (!valid) {
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos);
return;
}
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
}
} /* }}} */
@@ -1348,15 +1344,12 @@ SPL_METHOD(SplFileInfo, setFileClass)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileObject;
- zend_error_handling error_handling;
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- intern->file_class = ce;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ intern->file_class = ce;
}
/* }}} */
@@ -1366,15 +1359,12 @@ SPL_METHOD(SplFileInfo, setInfoClass)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileInfo;
- zend_error_handling error_handling;
-
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling );
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- intern->info_class = ce;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ intern->info_class = ce;
}
/* }}} */
@@ -1384,15 +1374,12 @@ SPL_METHOD(SplFileInfo, getFileInfo)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class;
- zend_error_handling error_handling;
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
}
/* }}} */
@@ -1402,22 +1389,20 @@ SPL_METHOD(SplFileInfo, getPathInfo)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class;
- zend_error_handling error_handling;
-
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
+ size_t path_len;
+ char *path;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- size_t path_len;
- char *path = spl_filesystem_object_get_pathname(intern, &path_len);
- if (path) {
- char *dpath = estrndup(path, path_len);
- path_len = php_dirname(dpath, path_len);
- spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
- efree(dpath);
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ return;
}
- zend_restore_error_handling(&error_handling);
+ path = spl_filesystem_object_get_pathname(intern, &path_len);
+ if (path) {
+ char *dpath = estrndup(path, path_len);
+ path_len = php_dirname(dpath, path_len);
+ spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
+ efree(dpath);
+ }
}
/* }}} */
@@ -1864,12 +1849,12 @@ zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zva
/* }}} */
/* {{{ spl_filesystem_object_cast */
-static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)
+static int spl_filesystem_object_cast(zend_object *readobj, zval *writeobj, int type)
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(readobj);
+ spl_filesystem_object *intern = spl_filesystem_from_obj(readobj);
if (type == IS_STRING) {
- if (Z_OBJCE_P(readobj)->__tostring) {
+ if (readobj->ce->__tostring) {
return zend_std_cast_object_tostring(readobj, writeobj, type);
}
@@ -2166,7 +2151,7 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje
return spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, intern->u.file.escape, NULL);
} else {
zend_execute_data *execute_data = EG(current_execute_data);
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(this_ptr), Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
}
if (!Z_ISUNDEF(retval)) {
if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) {
@@ -2839,30 +2824,6 @@ SPL_METHOD(SplFileObject, fgetc)
}
} /* }}} */
-/* {{{ proto string SplFileObject::fgetss([string allowable_tags])
- Get a line from file pointer and strip HTML tags */
-SPL_METHOD(SplFileObject, fgetss)
-{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
- zval arg2;
-
- if(!intern->u.file.stream) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
- }
-
- if (intern->u.file.max_line_len > 0) {
- ZVAL_LONG(&arg2, intern->u.file.max_line_len);
- } else {
- ZVAL_LONG(&arg2, 1024);
- }
-
- spl_filesystem_file_free_line(intern);
- intern->u.file.current_line_num++;
-
- FileFunctionCall(fgetss, ZEND_NUM_ARGS(), &arg2);
-} /* }}} */
-
/* {{{ proto int SplFileObject::fpassthru()
Output all remaining data from a file pointer */
SPL_METHOD(SplFileObject, fpassthru)
@@ -3057,10 +3018,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fseek, 0, 0, 1)
ZEND_ARG_INFO(0, whence)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1)
ZEND_ARG_INFO(0, format)
ZEND_ARG_VARIADIC_INFO(1, vars)
@@ -3099,7 +3056,6 @@ static const zend_function_entry spl_SplFileObject_functions[] = {
SPL_ME(SplFileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fgetc, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fpassthru, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
- SPL_ME(SplFileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fread, arginfo_file_object_fread, ZEND_ACC_PUBLIC)
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index 90e8945a16..88fbd0f052 100644
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.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/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 10aaa1ca01..0f0c543549 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.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, |
@@ -365,7 +363,7 @@ static void spl_dllist_object_free_storage(zend_object *object) /* {{{ */
zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_dllist_object *intern;
zend_class_entry *parent = class_type;
@@ -380,7 +378,7 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval
intern->traverse_position = 0;
if (orig) {
- spl_dllist_object *other = Z_SPLDLLIST_P(orig);
+ spl_dllist_object *other = spl_dllist_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
if (clone_orig) {
@@ -455,13 +453,9 @@ static zend_object *spl_dllist_object_new(zend_class_entry *class_type) /* {{{ *
}
/* }}} */
-static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_dllist_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_dllist_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_dllist_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -469,9 +463,9 @@ static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */
}
/* }}} */
-static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_dllist_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(object);
+ spl_dllist_object *intern = spl_dllist_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -490,9 +484,9 @@ static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {
}
/* }}} */
-static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */
+static HashTable* spl_dllist_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(obj);
+ spl_dllist_object *intern = spl_dllist_from_obj(obj);
spl_ptr_llist_element *current = intern->llist->head, *next;
zval tmp, dllist_array;
zend_string *pnstr;
@@ -534,9 +528,9 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {
}
/* }}}} */
-static HashTable *spl_dllist_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_dllist_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(obj);
+ spl_dllist_object *intern = spl_dllist_from_obj(obj);
spl_ptr_llist_element *current = intern->llist->head;
int i = 0;
@@ -704,7 +698,7 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty)
return;
}
- spl_dllist_object_count_elements(ZEND_THIS, &count);
+ spl_dllist_object_count_elements(Z_OBJ_P(ZEND_THIS), &count);
RETURN_BOOL(count == 0);
}
/* }}} */
@@ -1247,7 +1241,7 @@ SPL_METHOD(SplDoublyLinkedList, __serialize)
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
/* members */
- ZVAL_ARR(&tmp, zend_std_get_properties(ZEND_THIS));
+ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std));
Z_TRY_ADDREF(tmp);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
} /* }}} */
diff --git a/ext/spl/spl_dllist.h b/ext/spl/spl_dllist.h
index 3f53864d25..b42e55fcb6 100644
--- a/ext/spl/spl_dllist.h
+++ b/ext/spl/spl_dllist.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/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 7bedefe2c4..2420e8d49a 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.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/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index c5614a691d..44c6867e03 100644
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.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, |
@@ -33,7 +31,7 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, z
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
+ zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
return 0;
}
/* }}} */
@@ -44,7 +42,7 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, z
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
+ zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
return 0;
}
/* }}} */
diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c
index abe70c2b34..e176776a1f 100644
--- a/ext/spl/spl_exceptions.c
+++ b/ext/spl/spl_exceptions.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/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h
index 2c36287bbb..34962dd625 100644
--- a/ext/spl/spl_exceptions.h
+++ b/ext/spl/spl_exceptions.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/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index d80509f851..52d48374df 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.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, |
@@ -141,9 +139,9 @@ static void spl_fixedarray_copy(spl_fixedarray *to, spl_fixedarray *from) /* {{{
}
/* }}} */
-static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n) /* {{{{ */
+static HashTable* spl_fixedarray_object_get_gc(zend_object *obj, zval **table, int *n) /* {{{{ */
{
- spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj);
+ spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj);
HashTable *ht = zend_std_get_properties(obj);
*table = intern->array.elements;
@@ -153,9 +151,9 @@ static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n)
}
/* }}}} */
-static HashTable* spl_fixedarray_object_get_properties(zval *obj) /* {{{{ */
+static HashTable* spl_fixedarray_object_get_properties(zend_object *obj) /* {{{{ */
{
- spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj);
+ spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj);
HashTable *ht = zend_std_get_properties(obj);
zend_long i = 0;
@@ -202,7 +200,7 @@ static void spl_fixedarray_object_free_storage(zend_object *object) /* {{{ */
zend_object_iterator *spl_fixedarray_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_fixedarray_object *intern;
zend_class_entry *parent = class_type;
@@ -218,7 +216,7 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z
intern->flags = 0;
if (orig && clone_orig) {
- spl_fixedarray_object *other = Z_SPLFIXEDARRAY_P(orig);
+ spl_fixedarray_object *other = spl_fixed_array_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
spl_fixedarray_init(&intern->array, other->array.size);
spl_fixedarray_copy(&intern->array, &other->array);
@@ -295,13 +293,9 @@ static zend_object *spl_fixedarray_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *spl_fixedarray_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_fixedarray_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_fixedarray_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_fixedarray_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -337,11 +331,11 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o
}
/* }}} */
-static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (type == BP_VAR_IS && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
@@ -406,12 +400,12 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o
}
/* }}} */
-static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_fixedarray_object_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
spl_fixedarray_object *intern;
zval tmp;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_set) {
if (!offset) {
@@ -451,11 +445,11 @@ static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_o
}
/* }}} */
-static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset) /* {{{ */
+static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
@@ -500,11 +494,11 @@ static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_obje
}
/* }}} */
-static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_has) {
zval rv;
@@ -522,11 +516,11 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c
}
/* }}} */
-static int spl_fixedarray_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_fixedarray_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
@@ -576,7 +570,7 @@ SPL_METHOD(SplFixedArray, __construct)
SPL_METHOD(SplFixedArray, __wakeup)
{
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
- HashTable *intern_ht = zend_std_get_properties(ZEND_THIS);
+ HashTable *intern_ht = zend_std_get_properties(Z_OBJ_P(ZEND_THIS));
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
diff --git a/ext/spl/spl_fixedarray.h b/ext/spl/spl_fixedarray.h
index 9be62d4b89..de9225c05e 100644
--- a/ext/spl/spl_fixedarray.h
+++ b/ext/spl/spl_fixedarray.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/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 74d7e75667..6a44ab3cfb 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.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/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index 2b9ff7890d..8d23eda474 100644
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.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/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 8191c2901d..73fdf97d99 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.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, |
@@ -128,7 +126,7 @@ static void spl_ptr_heap_pqueue_elem_ctor(void *elem) { /* {{{ */
static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result) { /* {{{ */
zval zresult;
- zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
+ zend_call_method_with_2_params(Z_OBJ_P(object), heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
if (EG(exception)) {
return FAILURE;
@@ -168,7 +166,6 @@ static void spl_pqueue_extract_helper(zval *result, spl_pqueue_elem *elem, int f
static int spl_ptr_heap_zval_max_cmp(void *x, void *y, zval *object) { /* {{{ */
zval *a = x, *b = y;
- zval result;
if (EG(exception)) {
return 0;
@@ -186,14 +183,12 @@ static int spl_ptr_heap_zval_max_cmp(void *x, void *y, zval *object) { /* {{{ */
}
}
- compare_function(&result, a, b);
- return (int)Z_LVAL(result);
+ return zend_compare(a, b);
}
/* }}} */
static int spl_ptr_heap_zval_min_cmp(void *x, void *y, zval *object) { /* {{{ */
zval *a = x, *b = y;
- zval result;
if (EG(exception)) {
return 0;
@@ -211,8 +206,7 @@ static int spl_ptr_heap_zval_min_cmp(void *x, void *y, zval *object) { /* {{{ */
}
}
- compare_function(&result, b, a);
- return (int)Z_LVAL(result);
+ return zend_compare(b, a);
}
/* }}} */
@@ -221,7 +215,6 @@ static int spl_ptr_pqueue_elem_cmp(void *x, void *y, zval *object) { /* {{{ */
spl_pqueue_elem *b = y;
zval *a_priority_p = &a->priority;
zval *b_priority_p = &b->priority;
- zval result;
if (EG(exception)) {
return 0;
@@ -239,8 +232,7 @@ static int spl_ptr_pqueue_elem_cmp(void *x, void *y, zval *object) { /* {{{ */
}
}
- compare_function(&result, a_priority_p, b_priority_p);
- return (int)Z_LVAL(result);
+ return zend_compare(a_priority_p, b_priority_p);
}
/* }}} */
@@ -391,7 +383,7 @@ static void spl_heap_object_free_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_heap_object *intern;
zend_class_entry *parent = class_type;
@@ -403,7 +395,7 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *o
object_properties_init(&intern->std, class_type);
if (orig) {
- spl_heap_object *other = Z_SPLHEAP_P(orig);
+ spl_heap_object *other = spl_heap_from_obj(orig);
intern->std.handlers = other->std.handlers;
intern->ce_get_iterator = other->ce_get_iterator;
@@ -465,13 +457,9 @@ static zend_object *spl_heap_object_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_heap_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_heap_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_heap_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -479,9 +467,9 @@ static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */
}
/* }}} */
-static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_heap_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(object);
+ spl_heap_object *intern = spl_heap_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -501,8 +489,8 @@ static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{
}
/* }}} */
-static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zval *obj, int *is_temp) { /* {{{ */
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zend_object *obj, int *is_temp) { /* {{{ */
+ spl_heap_object *intern = spl_heap_from_obj(obj);
zval tmp, heap_array;
zend_string *pnstr;
HashTable *debug_info;
@@ -550,9 +538,9 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv
}
/* }}} */
-static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_heap_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+ spl_heap_object *intern = spl_heap_from_obj(obj);
*gc_data = (zval *) intern->heap->elements;
*gc_data_count = intern->heap->count;
@@ -560,9 +548,9 @@ static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data
}
/* }}} */
-static HashTable *spl_pqueue_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_pqueue_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+ spl_heap_object *intern = spl_heap_from_obj(obj);
*gc_data = (zval *) intern->heap->elements;
/* Two zvals (value and priority) per pqueue entry */
*gc_data_count = 2 * intern->heap->count;
@@ -571,13 +559,13 @@ static HashTable *spl_pqueue_object_get_gc(zval *obj, zval **gc_data, int *gc_da
}
/* }}} */
-static HashTable* spl_heap_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_heap_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return spl_heap_object_get_debug_info_helper(spl_ce_SplHeap, obj, is_temp);
}
/* }}} */
-static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_pqueue_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return spl_heap_object_get_debug_info_helper(spl_ce_SplPriorityQueue, obj, is_temp);
}
@@ -1199,7 +1187,7 @@ static const zend_function_entry spl_funcs_SplHeap[] = {
SPL_ME(SplHeap, valid, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, recoverFromCorruption, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, isCorrupted, arginfo_splheap_void, ZEND_ACC_PUBLIC)
- ZEND_FENTRY(compare, NULL, NULL, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT)
+ ZEND_FENTRY(compare, NULL, arginfo_heap_compare, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT)
PHP_FE_END
};
/* }}} */
diff --git a/ext/spl/spl_heap.h b/ext/spl/spl_heap.h
index d73fca545e..512e94783d 100644
--- a/ext/spl/spl_heap.h
+++ b/ext/spl/spl_heap.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/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index cce9477ed5..a6ca5066d3 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.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, |
@@ -201,7 +199,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi
level--;
}
if (object->endIteration && object->in_iteration) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endIteration, "endIteration", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL);
}
object->in_iteration = 0;
return FAILURE;
@@ -267,9 +265,9 @@ next_step:
ce = object->iterators[object->level].ce;
zobject = &object->iterators[object->level].zobject;
if (object->callHasChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, "callHasChildren", &retval);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", &retval);
}
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
@@ -304,7 +302,7 @@ next_step:
}
}
if (object->nextElement) {
- zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
}
object->iterators[object->level].state = RS_NEXT;
if (EG(exception)) {
@@ -317,7 +315,7 @@ next_step:
return /* self */;
case RS_SELF:
if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) {
- zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
}
if (object->mode == RIT_SELF_FIRST) {
object->iterators[object->level].state = RS_CHILD;
@@ -329,9 +327,9 @@ next_step:
ce = object->iterators[object->level].ce;
zobject = &object->iterators[object->level].zobject;
if (object->callGetChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->callGetChildren, "callGetChildren", &child);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, "callGetChildren", &child);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", &child);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", &child);
}
if (EG(exception)) {
@@ -367,7 +365,7 @@ next_step:
sub_iter->funcs->rewind(sub_iter);
}
if (object->beginChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->beginChildren, "beginchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginChildren, "beginchildren", NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
@@ -381,7 +379,7 @@ next_step:
/* no more elements */
if (object->level > 0) {
if (object->endChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
@@ -415,7 +413,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
zend_iterator_dtor(sub_iter);
zval_ptr_dtor(&object->iterators[object->level--].zobject);
if (!EG(exception) && (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator)) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
}
}
object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator));
@@ -425,7 +423,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
sub_iter->funcs->rewind(sub_iter);
}
if (!EG(exception) && object->beginIteration && !object->in_iteration) {
- zend_call_method_with_0_params(zthis, object->ce, &object->beginIteration, "beginIteration", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL);
}
object->in_iteration = 1;
spl_recursive_it_move_forward_ex(object, zthis);
@@ -495,7 +493,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -523,7 +521,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|ll", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -784,7 +782,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
RETURN_FALSE;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_FALSE;
}
@@ -809,7 +807,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
return;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_NULL();
}
@@ -1036,7 +1034,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s));
for (level = 0; level < object->level; ++level) {
- zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
+ zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s));
@@ -1046,7 +1044,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
zval_ptr_dtor(&has_next);
}
}
- zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
+ zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s));
@@ -1363,47 +1361,6 @@ static zend_function *spl_dual_it_get_method(zend_object **object, zend_string *
return function_handler;
}
-#if MBO_0
-int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval ***func_params, func;
- zval retval;
- int arg_count;
- int current = 0;
- int success;
- void **p;
- spl_dual_it_object *intern;
-
- intern = Z_SPLDUAL_IT_P(ZEND_THIS);
-
- ZVAL_STRING(&func, method, 0);
-
- p = EG(argument_stack).top_element-2;
- arg_count = (zend_ulong) *p;
-
- func_params = safe_emalloc(sizeof(zval **), arg_count, 0);
-
- current = 0;
- while (arg_count-- > 0) {
- func_params[current] = (zval **) p - (arg_count-current);
- current++;
- }
- arg_count = current; /* restore */
-
- if (call_user_function_ex(EG(function_table), NULL, &func, &retval, arg_count, func_params, 0, NULL) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- RETURN_ZVAL(&retval, 0, 0);
-
- success = SUCCESS;
- } else {
- zend_throw_error(NULL, "Unable to call %s::%s()", intern->inner.ce->name, method);
- success = FAILURE;
- }
-
- efree(func_params);
- return success;
-}
-#endif
-
#define SPL_CHECK_CTOR(intern, classname) \
if (intern->dit_type == DIT_Unknown) { \
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \
@@ -1494,7 +1451,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
ce = ce_cast;
}
if (instanceof_function(ce, zend_ce_aggregate)) {
- zend_call_method_with_0_params(zobject, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
return NULL;
@@ -1513,7 +1470,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_AppendIterator:
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit);
- zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
+ zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0);
zend_restore_error_handling(&error_handling);
return intern;
@@ -1809,7 +1766,7 @@ static inline void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern)
zval retval;
while (spl_dual_it_fetch(intern, 1) == SUCCESS) {
- zend_call_method_with_0_params(zthis, intern->std.ce, NULL, "accept", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), intern->std.ce, NULL, "accept", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
if (zend_is_true(&retval)) {
zval_ptr_dtor(&retval);
@@ -1893,7 +1850,7 @@ SPL_METHOD(RecursiveFilterIterator, hasChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETURN_ZVAL(&retval, 0, 1);
} else {
@@ -1914,7 +1871,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) {
spl_instantiate_arg_ex1(Z_OBJCE_P(ZEND_THIS), return_value, &retval);
}
@@ -1934,7 +1891,7 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) {
spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &retval, &intern->u.cbfilter->fci.function_name);
}
@@ -2225,7 +2182,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception)) {
zval args[5];
@@ -2259,7 +2216,7 @@ SPL_METHOD(RecursiveRegexIterator, accept)
RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0);
}
- zend_call_method_with_0_params(ZEND_THIS, spl_ce_RegexIterator, NULL, "accept", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, "accept", return_value);
}
/* {{{ spl_dual_it_dtor */
@@ -2471,7 +2428,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos)
if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) {
ZVAL_LONG(&zpos, pos);
spl_dual_it_free(intern);
- zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos);
+ zend_call_method_with_1_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "seek", NULL, &zpos);
if (!EG(exception)) {
intern->current.pos = pos;
if (spl_limit_it_valid(intern) == SUCCESS) {
@@ -2621,7 +2578,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
/* Recursion ? */
if (intern->dit_type == DIT_RecursiveCachingIterator) {
zval retval, zchildren, zflags;
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
@@ -2631,7 +2588,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
}
} else {
if (zend_is_true(&retval)) {
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &zchildren);
if (EG(exception)) {
zval_ptr_dtor(&zchildren);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
@@ -3334,7 +3291,7 @@ SPL_METHOD(AppendIterator, append)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "O", &it, zend_ce_iterator) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &it, zend_ce_iterator) == FAILURE) {
return;
}
if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator) == SUCCESS && spl_dual_it_valid(intern) != SUCCESS) {
@@ -3672,7 +3629,6 @@ PHP_MINIT_FUNCTION(spl_iterators)
memcpy(&spl_handlers_dual_it, &std_object_handlers, sizeof(zend_object_handlers));
spl_handlers_dual_it.offset = XtOffsetOf(spl_dual_it_object, std);
spl_handlers_dual_it.get_method = spl_dual_it_get_method;
- /*spl_handlers_dual_it.call_method = spl_dual_it_call_method;*/
spl_handlers_dual_it.clone_obj = NULL;
spl_handlers_dual_it.dtor_obj = spl_dual_it_dtor;
spl_handlers_dual_it.free_obj = spl_dual_it_free_storage;
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index af2f815538..a3b02bf8bc 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.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/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index ba29e0311e..dfc3e13455 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.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, |
@@ -115,10 +113,11 @@ void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */
} /* }}} */
-static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *this, zval *obj) {
+static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *obj) {
if (intern->fptr_get_hash) {
zval rv;
- zend_call_method_with_1_params(this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj);
+ zend_call_method_with_1_params(
+ &intern->std, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj);
if (!Z_ISUNDEF(rv)) {
if (Z_TYPE(rv) == IS_STRING) {
key->key = Z_STR(rv);
@@ -162,11 +161,11 @@ static spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage
}
} /* }}} */
-spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *obj, zval *inf) /* {{{ */
+spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj, zval *inf) /* {{{ */
{
spl_SplObjectStorageElement *pelement, element;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return NULL;
}
@@ -198,11 +197,11 @@ spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *int
return pelement;
} /* }}} */
-static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, zval *obj) /* {{{ */
+static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *obj) /* {{{ */
{
int ret = FAILURE;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return ret;
}
if (key.key) {
@@ -215,17 +214,17 @@ static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, z
return ret;
} /* }}}*/
-void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_SplObjectStorage *other) { /* {{{ */
+void spl_object_storage_addall(spl_SplObjectStorage *intern, spl_SplObjectStorage *other) { /* {{{ */
spl_SplObjectStorageElement *element;
ZEND_HASH_FOREACH_PTR(&other->storage, element) {
- spl_object_storage_attach(intern, this, &element->obj, &element->inf);
+ spl_object_storage_attach(intern, &element->obj, &element->inf);
} ZEND_HASH_FOREACH_END();
intern->index = 0;
} /* }}} */
-static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval *orig) /* {{{ */
+static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zend_object *orig) /* {{{ */
{
spl_SplObjectStorage *intern;
zend_class_entry *parent = class_type;
@@ -256,8 +255,8 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
}
if (orig) {
- spl_SplObjectStorage *other = Z_SPLOBJSTORAGE_P(orig);
- spl_object_storage_addall(intern, orig, other);
+ spl_SplObjectStorage *other = spl_object_storage_from_obj(orig);
+ spl_object_storage_addall(intern, other);
}
return &intern->std;
@@ -265,13 +264,11 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
/* }}} */
/* {{{ spl_object_storage_clone */
-static zend_object *spl_object_storage_clone(zval *zobject)
+static zend_object *spl_object_storage_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
- old_object = Z_OBJ_P(zobject);
- new_object = spl_object_storage_new_ex(old_object->ce, zobject);
+ new_object = spl_object_storage_new_ex(old_object->ce, old_object);
zend_objects_clone_members(new_object, old_object);
@@ -279,9 +276,9 @@ static zend_object *spl_object_storage_clone(zval *zobject)
}
/* }}} */
-static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_object_storage_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
- spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj);
+ spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj);
spl_SplObjectStorageElement *element;
HashTable *props;
zval tmp, storage;
@@ -291,7 +288,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
*is_temp = 1;
- props = Z_OBJPROP_P(obj);
+ props = obj->handlers->get_properties(obj);
debug_info = zend_new_array(zend_hash_num_elements(props) + 1);
zend_hash_copy(debug_info, props, (copy_ctor_func_t)zval_add_ref);
@@ -319,10 +316,10 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
/* }}} */
/* overridden for garbage collection */
-static HashTable *spl_object_storage_get_gc(zval *obj, zval **table, int *n) /* {{{ */
+static HashTable *spl_object_storage_get_gc(zend_object *obj, zval **table, int *n) /* {{{ */
{
int i = 0;
- spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj);
+ spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj);
spl_SplObjectStorageElement *element;
if (intern->storage.nNumOfElements * 2 > intern->gcdata_num) {
@@ -346,20 +343,20 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2) /* {{{ */
{
spl_SplObjectStorageElement *s1 = (spl_SplObjectStorageElement*)Z_PTR_P(e1);
spl_SplObjectStorageElement *s2 = (spl_SplObjectStorageElement*)Z_PTR_P(e2);
- zval result;
-
- if (compare_function(&result, &s1->inf, &s2->inf) == FAILURE) {
- return 1;
- }
- return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
+ return zend_compare(&s1->inf, &s2->inf);
}
/* }}} */
static int spl_object_storage_compare_objects(zval *o1, zval *o2) /* {{{ */
{
- zend_object *zo1 = (zend_object *)Z_OBJ_P(o1);
- zend_object *zo2 = (zend_object *)Z_OBJ_P(o2);
+ zend_object *zo1;
+ zend_object *zo2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ zo1 = (zend_object *)Z_OBJ_P(o1);
+ zo2 = (zend_object *)Z_OBJ_P(o2);
if (zo1->ce != spl_ce_SplObjectStorage || zo2->ce != spl_ce_SplObjectStorage) {
return 1;
@@ -376,11 +373,11 @@ static zend_object *spl_SplObjectStorage_new(zend_class_entry *class_type)
}
/* }}} */
-int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval *obj) /* {{{ */
+int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *obj) /* {{{ */
{
int found;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return 0;
}
@@ -404,7 +401,7 @@ SPL_METHOD(SplObjectStorage, attach)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|z!", &obj, &inf) == FAILURE) {
return;
}
- spl_object_storage_attach(intern, ZEND_THIS, obj, inf);
+ spl_object_storage_attach(intern, obj, inf);
} /* }}} */
/* {{{ proto void SplObjectStorage::detach(object obj)
@@ -417,7 +414,7 @@ SPL_METHOD(SplObjectStorage, detach)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
return;
}
- spl_object_storage_detach(intern, ZEND_THIS, obj);
+ spl_object_storage_detach(intern, obj);
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
intern->index = 0;
@@ -450,7 +447,7 @@ SPL_METHOD(SplObjectStorage, offsetGet)
return;
}
- if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return;
}
@@ -480,7 +477,7 @@ SPL_METHOD(SplObjectStorage, addAll)
other = Z_SPLOBJSTORAGE_P(obj);
- spl_object_storage_addall(intern, ZEND_THIS, other);
+ spl_object_storage_addall(intern, other);
RETURN_LONG(zend_hash_num_elements(&intern->storage));
} /* }}} */
@@ -502,7 +499,7 @@ SPL_METHOD(SplObjectStorage, removeAll)
zend_hash_internal_pointer_reset(&other->storage);
while ((element = zend_hash_get_current_data_ptr(&other->storage)) != NULL) {
- if (spl_object_storage_detach(intern, ZEND_THIS, &element->obj) == FAILURE) {
+ if (spl_object_storage_detach(intern, &element->obj) == FAILURE) {
zend_hash_move_forward(&other->storage);
}
}
@@ -529,8 +526,8 @@ SPL_METHOD(SplObjectStorage, removeAllExcept)
other = Z_SPLOBJSTORAGE_P(obj);
ZEND_HASH_FOREACH_PTR(&intern->storage, element) {
- if (!spl_object_storage_contains(other, ZEND_THIS, &element->obj)) {
- spl_object_storage_detach(intern, ZEND_THIS, &element->obj);
+ if (!spl_object_storage_contains(other, &element->obj)) {
+ spl_object_storage_detach(intern, &element->obj);
}
} ZEND_HASH_FOREACH_END();
@@ -551,7 +548,7 @@ SPL_METHOD(SplObjectStorage, contains)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
return;
}
- RETURN_BOOL(spl_object_storage_contains(intern, ZEND_THIS, obj));
+ RETURN_BOOL(spl_object_storage_contains(intern, obj));
} /* }}} */
/* {{{ proto int SplObjectStorage::count()
@@ -729,7 +726,7 @@ SPL_METHOD(SplObjectStorage, serialize)
/* members */
smart_str_appendl(&buf, "m:", 2);
- ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(ZEND_THIS)));
+ ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(Z_OBJ_P(ZEND_THIS))));
php_var_serialize(&buf, &members, &var_hash); /* finishes the string */
zval_ptr_dtor(&members);
@@ -820,7 +817,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
goto outexcept;
}
- if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, &entry) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, &entry) == FAILURE) {
zval_ptr_dtor(&entry);
zval_ptr_dtor(&inf);
goto outexcept;
@@ -835,7 +832,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
var_push_dtor(&var_hash, &pelement->obj);
}
}
- element = spl_object_storage_attach(intern, ZEND_THIS, &entry, Z_ISUNDEF(inf)?NULL:&inf);
+ element = spl_object_storage_attach(intern, &entry, Z_ISUNDEF(inf)?NULL:&inf);
var_replace(&var_hash, &entry, &element->obj);
var_replace(&var_hash, &inf, &element->inf);
zval_ptr_dtor(&entry);
@@ -897,7 +894,7 @@ SPL_METHOD(SplObjectStorage, __serialize)
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
/* members */
- ZVAL_ARR(&tmp, zend_std_get_properties(ZEND_THIS));
+ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std));
Z_TRY_ADDREF(tmp);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
} /* }}} */
@@ -935,7 +932,7 @@ SPL_METHOD(SplObjectStorage, __unserialize)
return;
}
- spl_object_storage_attach(intern, ZEND_THIS, key, val);
+ spl_object_storage_attach(intern, key, val);
key = NULL;
} else {
key = val;
@@ -1087,7 +1084,7 @@ SPL_METHOD(MultipleIterator, attachIterator)
}
}
- spl_object_storage_attach(intern, ZEND_THIS, iterator, info);
+ spl_object_storage_attach(intern, iterator, info);
}
/* }}} */
@@ -1108,7 +1105,7 @@ SPL_METHOD(MultipleIterator, rewind)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
@@ -1131,7 +1128,7 @@ SPL_METHOD(MultipleIterator, next)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL);
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
@@ -1161,7 +1158,7 @@ SPL_METHOD(MultipleIterator, valid)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = (Z_TYPE(retval) == IS_TRUE);
@@ -1197,7 +1194,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = Z_TYPE(retval) == IS_TRUE;
@@ -1208,9 +1205,9 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
if (valid) {
if (SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT == get_type) {
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval);
} else {
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval);
}
if (Z_ISUNDEF(retval)) {
zend_throw_exception(spl_ce_RuntimeException, "Failed to call sub iterator method", 0);
@@ -1296,8 +1293,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_MultipleIterator_setflags, 0, 0, 1)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO();
+ZEND_BEGIN_ARG_INFO_EX(arginfo_MultipleIterator_construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
+
static const zend_function_entry spl_funcs_MultipleIterator[] = {
- SPL_ME(MultipleIterator, __construct, arginfo_MultipleIterator_setflags, 0)
+ SPL_ME(MultipleIterator, __construct, arginfo_MultipleIterator_construct, 0)
SPL_ME(MultipleIterator, getFlags, arginfo_splobject_void, 0)
SPL_ME(MultipleIterator, setFlags, arginfo_MultipleIterator_setflags, 0)
SPL_ME(MultipleIterator, attachIterator, arginfo_MultipleIterator_attachIterator, 0)
@@ -1324,7 +1325,7 @@ PHP_MINIT_FUNCTION(spl_observer)
spl_handler_SplObjectStorage.offset = XtOffsetOf(spl_SplObjectStorage, std);
spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info;
- spl_handler_SplObjectStorage.compare_objects = spl_object_storage_compare_objects;
+ spl_handler_SplObjectStorage.compare = spl_object_storage_compare_objects;
spl_handler_SplObjectStorage.clone_obj = spl_object_storage_clone;
spl_handler_SplObjectStorage.get_gc = spl_object_storage_get_gc;
spl_handler_SplObjectStorage.dtor_obj = zend_objects_destroy_object;
diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h
index 50d65f63ab..dab2ab7e1e 100644
--- a/ext/spl/spl_observer.h
+++ b/ext/spl/spl_observer.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/ext/spl/tests/CallbackFilterIteratorTest-002.phpt b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
index 6a05aa0aa2..3579508472 100644
--- a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
+++ b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
@@ -42,7 +42,7 @@ try {
}
--EXPECT--
CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given
-Argument 1 passed to CallbackFilterIterator::__construct() must implement interface Iterator, null given
+CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given
CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, no array or string given
CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, array must have exactly two members
some message
diff --git a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
index 7443998013..db0186f218 100644
--- a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
+++ b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
@@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__);
try {
$info->setFileClass('stdClass');
-} catch (UnexpectedValueException $e) {
+} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
diff --git a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
index a280a6e147..9a2e71defe 100644
--- a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
+++ b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
@@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__);
try {
$info->setInfoClass('stdClass');
-} catch (UnexpectedValueException $e) {
+} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
diff --git a/ext/spl/tests/SplFileObject_fputcsv_002.phpt b/ext/spl/tests/SplFileObject_fputcsv_002.phpt
index fdd4112ee6..77f6d76bbf 100644
--- a/ext/spl/tests/SplFileObject_fputcsv_002.phpt
+++ b/ext/spl/tests/SplFileObject_fputcsv_002.phpt
@@ -16,7 +16,7 @@ $file = __DIR__ . '/SplFileObject_fputcsv1.csv';
unlink($file);
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(7) {
[0]=>
int(1)
diff --git a/ext/spl/tests/SplFileObject_seek_error_001.phpt b/ext/spl/tests/SplFileObject_seek_error_001.phpt
index 4de5bcdd4d..8741e3b788 100644
--- a/ext/spl/tests/SplFileObject_seek_error_001.phpt
+++ b/ext/spl/tests/SplFileObject_seek_error_001.phpt
@@ -2,9 +2,7 @@
SplFileObject::seek function - test parameters
--FILE--
<?php
-$obj = New SplFileObject(__FILE__);
-$obj->seek(1,2);
-$obj->seek();
+$obj = new SplFileObject(__FILE__);
try {
$obj->seek(-1);
} catch (LogicException $e) {
@@ -12,7 +10,4 @@ try {
}
?>
--EXPECTF--
-Warning: SplFileObject::seek() expects exactly 1 parameter, 2 given in %s
-
-Warning: SplFileObject::seek() expects exactly 1 parameter, 0 given in %s
-Can't seek file %s to negative line %s
+Can't seek file %s to negative line -1
diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt
index 9295f40e51..ddbf074bf3 100644
--- a/ext/spl/tests/arrayObject___construct_basic2.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic2.phpt
@@ -61,7 +61,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: ArrayObject::$prop in %s on line 40
+Warning: Undefined property: ArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
@@ -89,7 +89,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: MyArrayObject::$prop in %s on line 40
+Warning: Undefined property: MyArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt
index fcd369af84..f162317773 100644
--- a/ext/spl/tests/arrayObject___construct_basic3.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic3.phpt
@@ -61,7 +61,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: ArrayObject::$prop in %s on line 40
+Warning: Undefined property: ArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
@@ -89,7 +89,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: MyArrayObject::$prop in %s on line 40
+Warning: Undefined property: MyArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt
index 6c6fd2949f..094d825bb6 100644
--- a/ext/spl/tests/arrayObject_asort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_asort_basic1.phpt
@@ -15,7 +15,11 @@ $ao1 = new ArrayObject(array(4,2,3));
$ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3));
var_dump($ao1->asort());
var_dump($ao1);
-var_dump($ao2->asort('blah'));
+try {
+ var_dump($ao2->asort('blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($ao2);
var_dump($ao2->asort(SORT_NUMERIC));
var_dump($ao2);
@@ -35,9 +39,7 @@ object(ArrayObject)#%d (1) {
int(4)
}
}
-
-Warning: asort() expects parameter 2 to be int, string given in %sarrayObject_asort_basic1.php on line %d
-bool(false)
+asort() expects parameter 2 to be int, string given
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(3) {
diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/arrayObject_count_basic1.phpt
index 41e1527f93..3271090d08 100644
--- a/ext/spl/tests/arrayObject_count_basic1.phpt
+++ b/ext/spl/tests/arrayObject_count_basic1.phpt
@@ -25,9 +25,6 @@ var_dump(count($c), count($ao));
unset($c[0]);
unset($ao[0]);
var_dump($c->count(), $ao->count());
-
-//Extra args are ignored.
-var_dump($ao->count('blah'));
?>
==ArrayIterator==
<?php
@@ -53,11 +50,8 @@ var_dump(count($c), count($ao));
unset($c[0]);
unset($ao[0]);
var_dump($c->count(), $ao->count());
-
-//Extra args are ignored.
-var_dump($ao->count('blah'));
?>
---EXPECTF--
+--EXPECT--
==ArrayObject==
int(99)
int(0)
@@ -67,9 +61,6 @@ int(99)
int(2)
int(99)
int(1)
-
-Warning: ArrayObject::count() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
==ArrayIterator==
int(99)
int(0)
@@ -79,6 +70,3 @@ int(99)
int(2)
int(99)
int(1)
-
-Warning: ArrayIterator::count() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
index 823256edbc..68f20f7bb6 100644
--- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
+++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
@@ -29,8 +29,8 @@ $ao = new ArrayObject($original);
try {
$copy = $ao->exchangeArray();
$copy['addedToCopy'] = 'added To Copy';
-} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
+} catch (TypeError $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
}
$original->addedToOriginal = 'added To Original';
var_dump($ao, $original, $copy);
@@ -81,8 +81,9 @@ array(2) {
--> exchangeArray() with no arg:
+Exception: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given
-Warning: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given in %s on line 27
+Warning: Undefined variable: copy in %s on line %d
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
object(C)#3 (2) {
@@ -98,16 +99,13 @@ object(C)#3 (2) {
["addedToOriginal"]=>
string(17) "added To Original"
}
-array(1) {
- ["addedToCopy"]=>
- string(13) "added To Copy"
-}
+NULL
--> exchangeArray() with bad arg type:
Exception:Passed variable is not an array or object
-Notice: Undefined variable: copy in %s on line 46
+Warning: Undefined variable: copy in %s on line %d
object(ArrayObject)#3 (1) {
["storage":"ArrayObject":private]=>
object(C)#2 (2) {
diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt
index 1692a02ef1..aa1abbf239 100644
--- a/ext/spl/tests/arrayObject_ksort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt
@@ -14,7 +14,11 @@ $ao1 = new ArrayObject(array(4,2,3));
$ao2 = new ArrayObject(array('b'=>4,'a'=>2,'q'=>3, 99=>'x'));
var_dump($ao1->ksort());
var_dump($ao1);
-var_dump($ao2->ksort('blah'));
+try {
+ var_dump($ao2->ksort('blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($ao2);
var_dump($ao2->ksort(SORT_STRING));
var_dump($ao2);
@@ -34,9 +38,7 @@ object(ArrayObject)#%d (1) {
int(3)
}
}
-
-Warning: ksort() expects parameter 2 to be int, string given in %sarrayObject_ksort_basic1.php on line %d
-bool(false)
+ksort() expects parameter 2 to be int, string given
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(4) {
diff --git a/ext/spl/tests/arrayObject_magicMethods2.phpt b/ext/spl/tests/arrayObject_magicMethods2.phpt
index 18f0520fcd..3f88654a5d 100644
--- a/ext/spl/tests/arrayObject_magicMethods2.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods2.phpt
@@ -102,7 +102,7 @@ object(ArrayObject)#2 (3) {
--> Read existent, non-existent and dynamic:
string(7) "changed"
-Notice: Undefined property: ArrayObject::$nonexistent in %s on line 42
+Warning: Undefined property: ArrayObject::$nonexistent in %s on line %d
NULL
string(11) "new.changed"
Original wrapped object:
diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
index 89efdb6a9f..d0910b3a0a 100644
--- a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
+++ b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
@@ -8,7 +8,7 @@ try {
foreach($ao as $key=>$value) {
echo " $key=>$value\n";
}
-} catch (Exception $e) {
+} catch (TypeError $e) {
var_dump($e->getMessage());
}
@@ -18,7 +18,7 @@ try {
foreach($ao as $key=>$value) {
echo " $key=>$value\n";
}
-} catch (Exception $e) {
+} catch (TypeError $e) {
var_dump($e->getMessage());
}
@@ -43,14 +43,7 @@ try {
?>
--EXPECTF--
-Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4
- a=>1
- b=>2
- c=>3
-
-Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given in %s on line 14
- a=>1
- b=>2
- c=>3
+string(118) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given"
+string(110) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given"
string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given"
string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given"
diff --git a/ext/spl/tests/array_026.phpt b/ext/spl/tests/array_026.phpt
index 8ff6aafb93..7a1784e30e 100644
--- a/ext/spl/tests/array_026.phpt
+++ b/ext/spl/tests/array_026.phpt
@@ -8,9 +8,9 @@ $test['d1']['d3'] = 'world';
var_dump($test, $test3['mmmmm']);
?>
--EXPECTF--
-Notice: Undefined variable: test3 in %s on line %d
+Warning: Undefined variable: test3 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
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
diff --git a/ext/spl/tests/bug45216.phpt b/ext/spl/tests/bug45216.phpt
deleted file mode 100644
index e8b04cb1fb..0000000000
--- a/ext/spl/tests/bug45216.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-SPL: SplFileObject::fgetss (bug 45216)
---CREDITS--
-Perrick Penet <perrick@noparking.net>
-#testfest phpcampparis 2008-06-07
---FILE--
-<?php
-$file = __DIR__ . '/foo.html';
-file_put_contents($file, 'text 0<div class="tested">text 1</div>');
-$handle = fopen($file, 'r');
-
-$object = new SplFileObject($file);
-var_dump($object->fgetss());
-var_dump(fgetss($handle));
-?>
---CLEAN--
-<?php
-unlink(__DIR__ . '/foo.html');
-?>
---EXPECTF--
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(12) "text 0text 1"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(12) "text 0text 1"
diff --git a/ext/spl/tests/bug46051.phpt b/ext/spl/tests/bug46051.phpt
index e993951ffa..d53f87bc47 100644
--- a/ext/spl/tests/bug46051.phpt
+++ b/ext/spl/tests/bug46051.phpt
@@ -6,8 +6,8 @@ Bug #46051 (SplFileInfo::openFile - memory overlap)
$x = new splfileinfo(__FILE__);
try {
-$x->openFile(NULL, NULL, NULL);
-} catch (Exception $e) { }
+ $x->openFile(NULL, NULL, NULL);
+} catch (TypeError $e) { }
var_dump($x->getPathName());
--EXPECTF--
diff --git a/ext/spl/tests/bug54323.phpt b/ext/spl/tests/bug54323.phpt
index df6416a0f1..a2e2522393 100644
--- a/ext/spl/tests/bug54323.phpt
+++ b/ext/spl/tests/bug54323.phpt
@@ -17,7 +17,7 @@ function testAccess($c, $ao) {
var_dump($c->prop, $ao['prop']);
}
--EXPECTF--
-Notice: Undefined property: C::$prop in %sbug54323.php on line 14
+Warning: Undefined property: C::$prop in %s on line %d
Notice: Undefined index: prop in %sbug54323.php on line 14
NULL
diff --git a/ext/spl/tests/bug62978.phpt b/ext/spl/tests/bug62978.phpt
index 972bd07ce1..ec6275346e 100644
--- a/ext/spl/tests/bug62978.phpt
+++ b/ext/spl/tests/bug62978.phpt
@@ -31,9 +31,9 @@ NULL
Notice: Undefined index: epic_magic in %sbug62978.php on line %d
NULL
-Notice: Undefined variable: c in %sbug62978.php 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 index: epic_magic in %sbug62978.php on line %d
diff --git a/ext/spl/tests/bug65545.phpt b/ext/spl/tests/bug65545.phpt
index 76c29cbf48..bd5a7f06db 100644
--- a/ext/spl/tests/bug65545.phpt
+++ b/ext/spl/tests/bug65545.phpt
@@ -6,9 +6,6 @@ $obj = new SplFileObject(__FILE__, 'r');
$data = $obj->fread(5);
var_dump($data);
-$data = $obj->fread();
-var_dump($data);
-
$data = $obj->fread(0);
var_dump($data);
@@ -20,9 +17,6 @@ var_dump(strlen($data) === filesize(__FILE__) - 5);
--EXPECTF--
string(5) "<?php"
-Warning: SplFileObject::fread() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: SplFileObject::fread(): Length parameter must be greater than 0 in %s on line %d
bool(false)
bool(true)
diff --git a/ext/spl/tests/bug72888.phpt b/ext/spl/tests/bug72888.phpt
index d354490f88..c27c8424ef 100644
--- a/ext/spl/tests/bug72888.phpt
+++ b/ext/spl/tests/bug72888.phpt
@@ -14,5 +14,5 @@ var_dump($y);
--EXPECTF--
string(60) "Trying to clone an uncloneable object of class SplFileObject"
-Notice: Undefined variable: y in %sbug72888.php on line %d
+Warning: Undefined variable: y in %s on line %d
NULL
diff --git a/ext/spl/tests/class_implements_variation1.phpt b/ext/spl/tests/class_implements_variation1.phpt
index 9d876d3a36..4c70f2b412 100644
--- a/ext/spl/tests/class_implements_variation1.phpt
+++ b/ext/spl/tests/class_implements_variation1.phpt
@@ -12,8 +12,8 @@ echo "*** Testing class_implements() : variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/spl/tests/class_uses_variation1.phpt b/ext/spl/tests/class_uses_variation1.phpt
index be6aa9ac7f..538c9257e7 100644
--- a/ext/spl/tests/class_uses_variation1.phpt
+++ b/ext/spl/tests/class_uses_variation1.phpt
@@ -12,8 +12,8 @@ echo "*** Testing class_uses() : variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/spl/tests/fileobject_005.phpt b/ext/spl/tests/fileobject_005.phpt
index 41a04dd118..3bfd41c8cc 100644
--- a/ext/spl/tests/fileobject_005.phpt
+++ b/ext/spl/tests/fileobject_005.phpt
@@ -16,14 +16,11 @@ $fo->fwrite("blahlubba");
var_dump($fo->ftruncate(4));
$fo->rewind();
-var_dump($fo->fgets(8));
+var_dump($fo->fgets());
$fo->rewind();
$fo->fwrite("blahlubba");
-// This should throw a warning and return NULL since an argument is missing
-var_dump($fo->ftruncate());
-
?>
==DONE==
--CLEAN--
@@ -33,10 +30,5 @@ unlink($path);
?>
--EXPECTF--
bool(true)
-
-Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+string(4) "blah"
==DONE==
diff --git a/ext/spl/tests/iterator_026.phpt b/ext/spl/tests/iterator_026.phpt
index 8eb77a7baf..963950cd0e 100644
--- a/ext/spl/tests/iterator_026.phpt
+++ b/ext/spl/tests/iterator_026.phpt
@@ -24,13 +24,13 @@ hasNext: yes
1=>2
hasNext: yes
-Notice: Array to string conversion in %siterator_026.php on line %d
+Warning: Array to string conversion in %s on line %d
0=>31
hasNext: yes
1=>32
hasNext: yes
-Notice: Array to string conversion in %siterator_026.php on line %d
+Warning: Array to string conversion in %s on line %d
0=>331
hasNext: no
3=>4
diff --git a/ext/spl/tests/iterator_042.phpt b/ext/spl/tests/iterator_042.phpt
index a344d60e33..46904c0449 100644
--- a/ext/spl/tests/iterator_042.phpt
+++ b/ext/spl/tests/iterator_042.phpt
@@ -41,7 +41,7 @@ foreach($it as $k => $v)
===DONE===
<?php exit(0); ?>
--EXPECTF--
-Error Argument 1 passed to AppendIterator::append() must implement interface Iterator, array given in %siterator_042.php on line %d
+Error AppendIterator::append() expects parameter 1 to be Iterator, array given in %s on line %d
object(ArrayIterator)#%d (1) {
%s"storage"%s"ArrayIterator":private]=>
array(2) {
diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt
index 1271ccaa64..66d03dc359 100644
--- a/ext/spl/tests/iterator_044.phpt
+++ b/ext/spl/tests/iterator_044.phpt
@@ -24,8 +24,16 @@ class MyCachingIterator extends CachingIterator
{
echo "===$k===\n";
var_dump($v);
- var_dump($this->offsetExists($v));
- var_dump($this->offsetGet($v));
+ try {
+ var_dump($this->offsetExists($v));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump($this->offsetGet($v));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
}
}
@@ -52,9 +60,6 @@ catch(Exception $e)
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE);
-var_dump($it->offsetExists());
-var_dump($it->offsetGet());
-
$checks = array(0, new stdClass, new MyFoo, NULL, 2, 'foo', 3);
$it->test($checks);
@@ -71,12 +76,6 @@ $it->test($checks);
--EXPECTF--
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
-
-Warning: CachingIterator::offsetExists() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d
-NULL
-
-Warning: CachingIterator::offsetGet() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d
-NULL
===0===
int(0)
bool(false)
@@ -86,12 +85,8 @@ NULL
===1===
object(stdClass)#%d (0) {
}
-
-Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
-
-Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
+CachingIterator::offsetExists() expects parameter 1 to be string, object given
+CachingIterator::offsetGet() expects parameter 1 to be string, object given
===2===
object(MyFoo)#%d (0) {
}
@@ -131,12 +126,8 @@ int(0)
===1===
object(stdClass)#1 (0) {
}
-
-Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
-
-Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
+CachingIterator::offsetExists() expects parameter 1 to be string, object given
+CachingIterator::offsetGet() expects parameter 1 to be string, object given
===2===
object(MyFoo)#2 (0) {
}
diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt
index c8ffae77a5..fce7ab3655 100644
--- a/ext/spl/tests/iterator_045.phpt
+++ b/ext/spl/tests/iterator_045.phpt
@@ -73,10 +73,6 @@ catch(Exception $e)
$it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE);
-var_dump($it->offsetSet());
-var_dump($it->offsetSet(0));
-var_dump($it->offsetUnset());
-
$checks = array(0 => 25, 1 => 42, 3 => 'FooBar');
$unsets = array(0, 2);
@@ -97,15 +93,6 @@ $it->show();
--EXPECTF--
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
-
-Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 0 given in %siterator_045.php on line %d
-NULL
-
-Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 1 given in %siterator_045.php on line %d
-NULL
-
-Warning: CachingIterator::offsetUnset() expects exactly 1 parameter, 0 given in %siterator_045.php on line %d
-NULL
MyCachingIterator::testSet()
set(0,25)
set(1,42)
diff --git a/ext/spl/tests/iterator_047.phpt b/ext/spl/tests/iterator_047.phpt
index 548f486528..e3e9bba05b 100644
--- a/ext/spl/tests/iterator_047.phpt
+++ b/ext/spl/tests/iterator_047.phpt
@@ -71,7 +71,7 @@ int(0)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(10)
@@ -81,7 +81,7 @@ int(2)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(30)
@@ -105,7 +105,7 @@ int(0)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(10)
@@ -115,7 +115,7 @@ int(2)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(30)
diff --git a/ext/spl/tests/iterator_count.phpt b/ext/spl/tests/iterator_count.phpt
index c0dad0f422..a115a7329c 100644
--- a/ext/spl/tests/iterator_count.phpt
+++ b/ext/spl/tests/iterator_count.phpt
@@ -9,21 +9,11 @@ $array=array('a','b');
$iterator = new ArrayIterator($array);
-iterator_count();
-
-
-iterator_count($iterator,'1');
-
iterator_count('1');
-
?>
--EXPECTF--
-Warning: iterator_count() expects exactly 1 parameter, 0 given in %s
-
-Warning: iterator_count() expects exactly 1 parameter, 2 given in %s
-
-Fatal error: Uncaught TypeError: Argument 1 passed to iterator_count() must implement interface Traversable, string given in %s:%d
+Fatal error: Uncaught TypeError: iterator_count() expects parameter 1 to be Traversable, string given in %s:%d
Stack trace:
#0 %s(%d): iterator_count('1')
#1 {main}
diff --git a/ext/spl/tests/iterator_to_array.phpt b/ext/spl/tests/iterator_to_array.phpt
index f36b99db23..9225f03c00 100644
--- a/ext/spl/tests/iterator_to_array.phpt
+++ b/ext/spl/tests/iterator_to_array.phpt
@@ -9,20 +9,11 @@ $array=array('a','b');
$iterator = new ArrayIterator($array);
-iterator_to_array();
-
-
-iterator_to_array($iterator,'test','test');
-
iterator_to_array('test','test');
?>
--EXPECTF--
-Warning: iterator_to_array() expects at least 1 parameter, 0 given in %s
-
-Warning: iterator_to_array() expects at most 2 parameters, 3 given in %s
-
-Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, string given in %s:%d
+Fatal error: Uncaught TypeError: iterator_to_array() expects parameter 1 to be Traversable, string given in %s:%d
Stack trace:
#0 %s(%d): iterator_to_array('test', 'test')
#1 {main}
diff --git a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
index 4ca9485faf..1920b31639 100644
--- a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
+++ b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
@@ -12,20 +12,12 @@ function gen() {
yield new stdClass => 5;
}
-var_dump(iterator_to_array(gen()));
+try {
+ var_dump(iterator_to_array(gen()));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-array(4) {
- ["foo"]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [""]=>
- int(3)
-}
+--EXPECT--
+Illegal offset type
diff --git a/ext/spl/tests/recursive_tree_iterator_001.phpt b/ext/spl/tests/recursive_tree_iterator_001.phpt
index ac9f281388..9ac4fdbc17 100644
--- a/ext/spl/tests/recursive_tree_iterator_001.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_001.phpt
@@ -1,7 +1,5 @@
--TEST--
SPL: RecursiveTreeIterator
---INI--
-error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
@@ -48,7 +46,7 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
?>
===DONE===
---EXPECT--
+--EXPECTF--
-- flags = BYPASS_KEY --
[0] => |-Array
[0] => | |-a
@@ -60,22 +58,34 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
[0] => |-4
[1] => \-c
-- flags = BYPASS_CURRENT --
+
+Warning: Array to string conversion in %s on line %d
[|-0] => Array
[| |-0] => a
[| \-1] => 1
+
+Warning: Array to string conversion in %s on line %d
[\-a] => Array
[ |-0] => 2
[ |-1] => b
+
+Warning: Array to string conversion in %s on line %d
[ \-3] => Array
[ |-0] => 4
[ \-1] => c
-- flags = BYPASS_KEY|BYPASS_KEY --
+
+Warning: Array to string conversion in %s on line %d
[0] => Array
[0] => a
[1] => 1
+
+Warning: Array to string conversion in %s on line %d
[a] => Array
[0] => 2
[1] => b
+
+Warning: Array to string conversion in %s on line %d
[3] => Array
[0] => 4
[1] => c
diff --git a/ext/spl/tests/recursive_tree_iterator_006.phpt b/ext/spl/tests/recursive_tree_iterator_006.phpt
index 1d1891e4a4..3440a90b6d 100644
--- a/ext/spl/tests/recursive_tree_iterator_006.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_006.phpt
@@ -1,7 +1,5 @@
--TEST--
SPL: RecursiveTreeIterator and IteratorAggregate
---INI--
-error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
@@ -58,7 +56,7 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
?>
===DONE===
---EXPECT--
+--EXPECTF--
-- flags = BYPASS_KEY --
[0] => |-Array
[0] => | |-a
@@ -70,22 +68,34 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
[0] => |-4
[1] => \-c
-- flags = BYPASS_CURRENT --
+
+Warning: Array to string conversion in %s on line %d
[|-0] => Array
[| |-0] => a
[| \-1] => 1
+
+Warning: Array to string conversion in %s on line %d
[\-a] => Array
[ |-0] => 2
[ |-1] => b
+
+Warning: Array to string conversion in %s on line %d
[ \-3] => Array
[ |-0] => 4
[ \-1] => c
-- flags = BYPASS_KEY|BYPASS_KEY --
+
+Warning: Array to string conversion in %s on line %d
[0] => Array
[0] => a
[1] => 1
+
+Warning: Array to string conversion in %s on line %d
[a] => Array
[0] => 2
[1] => b
+
+Warning: Array to string conversion in %s on line %d
[3] => Array
[0] => 4
[1] => c
diff --git a/ext/spl/tests/regexIterator_setMode_error.phpt b/ext/spl/tests/regexIterator_setMode_error.phpt
index 77732b058c..046086102b 100644
--- a/ext/spl/tests/regexIterator_setMode_error.phpt
+++ b/ext/spl/tests/regexIterator_setMode_error.phpt
@@ -17,12 +17,8 @@ try {
var_dump($e->getCode());
}
-$regexIterator->setMode('foo');
-
?>
--EXPECTF--
int(0)
string(14) "Illegal mode 7"
int(0)
-
-Warning: RegexIterator::setMode() expects parameter 1 to be int, string given in %s on line %d
diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt
index 60de68b82a..857d5de685 100644
--- a/ext/spl/tests/spl_004.phpt
+++ b/ext/spl/tests/spl_004.phpt
@@ -44,11 +44,19 @@ var_dump(iterator_apply($it, 'test'));
echo "===ERRORS===\n";
try {
var_dump(iterator_apply($it, 'test', 1));
-} catch (Error $e) {
- my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(iterator_apply($it, 'non_existing_function'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-var_dump(iterator_apply($it, 'non_existing_function'));
-var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
?>
===DONE===
@@ -78,9 +86,7 @@ int(5)
int(6)
int(4)
===ERRORS===
-Error: Argument 3 passed to iterator_apply() must be of the type array or null, int given
-Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
-NULL
-Error: iterator_apply() expects at most 3 parameters, 4 given
-NULL
+iterator_apply() expects parameter 3 to be array, int given
+iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
+iterator_apply() expects at most 3 parameters, 4 given
===DONE===
diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt
index ccebf91f04..58198c2ff1 100644
--- a/ext/spl/tests/spl_autoload_005.phpt
+++ b/ext/spl/tests/spl_autoload_005.phpt
@@ -48,7 +48,7 @@ catch(Exception $e)
===DONE===
<?php exit(0); ?>
--EXPECT--
-Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() should not be called statically)
+Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() cannot be called statically)
MyAutoLoader::autoLoad(TestClass)
MyAutoLoader::autoThrow(TestClass)
Exception: Unavailable
diff --git a/ext/spl/tests/spl_autoload_007.phpt b/ext/spl/tests/spl_autoload_007.phpt
index 3233120790..0a9077e0f7 100644
--- a/ext/spl/tests/spl_autoload_007.phpt
+++ b/ext/spl/tests/spl_autoload_007.phpt
@@ -66,7 +66,7 @@ string(22) "MyAutoLoader::autoLoad"
ok
string(22) "MyAutoLoader::dynaLoad"
-Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
array(2) {
[0]=>
@@ -98,7 +98,7 @@ array(2) {
[1]=>
string(8) "dynaLoad"
}
-Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
array(2) {
[0]=>
diff --git a/ext/spl/tests/spl_autoload_008.phpt b/ext/spl/tests/spl_autoload_008.phpt
index df795d02b6..51fbdd2e9f 100644
--- a/ext/spl/tests/spl_autoload_008.phpt
+++ b/ext/spl/tests/spl_autoload_008.phpt
@@ -80,7 +80,7 @@ Exception: Bla
int(0)
====2====
string(22) "MyAutoLoader::dynaLoad"
-LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
int(0)
====3====
array(2) {
@@ -100,7 +100,7 @@ array(2) {
[1]=>
string(8) "dynaLoad"
}
-LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
int(0)
====5====
array(2) {
diff --git a/ext/spl/tests/spl_heap_is_empty_basic.phpt b/ext/spl/tests/spl_heap_is_empty_basic.phpt
index 47d7ccce9a..4a90734ad4 100644
--- a/ext/spl/tests/spl_heap_is_empty_basic.phpt
+++ b/ext/spl/tests/spl_heap_is_empty_basic.phpt
@@ -21,11 +21,8 @@ $heap->insert(1);
var_dump($heap->isEmpty());
$heap->extract();
var_dump($heap->isEmpty());
-$heap->isEmpty('var');
?>
--EXPECTF--
bool(true)
bool(false)
bool(true)
-
-Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s
diff --git a/ext/spl/tests/spl_object_id.phpt b/ext/spl/tests/spl_object_id.phpt
index ca13b03fee..a4e8518eaf 100644
--- a/ext/spl/tests/spl_object_id.phpt
+++ b/ext/spl/tests/spl_object_id.phpt
@@ -4,18 +4,10 @@ SPL: spl_object_id()
<?php
var_dump(spl_object_id(new stdClass));
-var_dump(spl_object_id(42));
-var_dump(spl_object_id());
$a = new stdClass();
var_dump(spl_object_id(new stdClass) === spl_object_id($a));
?>
--EXPECTF--
int(%d)
-
-Warning: spl_object_id() expects parameter 1 to be object, int given in %sspl_object_id.php on line %d
-NULL
-
-Warning: spl_object_id() expects exactly 1 parameter, 0 given in %sspl_object_id.php on line %d
-NULL
bool(false)
diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h
index ca09e341ab..9dff343f90 100644
--- a/ext/sqlite3/php_sqlite3.h
+++ b/ext/sqlite3/php_sqlite3.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/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h
index f189ea30af..93bdc3b423 100644
--- a/ext/sqlite3/php_sqlite3_structs.h
+++ b/ext/sqlite3/php_sqlite3_structs.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/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 1c337ee6cb..e66fc1b192 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.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, |
@@ -25,6 +23,7 @@
#include "ext/standard/info.h"
#include "php_sqlite3.h"
#include "php_sqlite3_structs.h"
+#include "sqlite3_arginfo.h"
#include "main/SAPI.h"
#include <sqlite3.h>
@@ -108,7 +107,7 @@ PHP_METHOD(sqlite3, open)
db_obj = Z_SQLITE3_DB_P(object);
- if (FAILURE == zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
return;
}
@@ -322,7 +321,7 @@ PHP_METHOD(sqlite3, enableExtendedResultCodes)
int ret;
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3)
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &enable) == FAILURE) {
return;
}
@@ -1087,7 +1086,7 @@ PHP_METHOD(sqlite3, createCollation)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &collation_name, &collation_name_len, &callback_func) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (!collation_name_len) {
@@ -1299,6 +1298,11 @@ PHP_METHOD(sqlite3, openBlob)
return;
}
+ if (ZEND_NUM_ARGS() >= 4 && CHECK_NULL_PATH(dbname, dbname_len)) {
+ zend_value_error("dbname must not contain NUL bytes");
+ return;
+ }
+
sqlite_flags = (flags & SQLITE_OPEN_READWRITE) ? 1 : 0;
if (sqlite3_blob_open(db_obj->db, dbname, table, column, rowid, sqlite_flags, &blob) != SQLITE_OK) {
@@ -1367,6 +1371,13 @@ PHP_METHOD(sqlite3, backup)
return;
}
+ if ((ZEND_NUM_ARGS() >= 2 && CHECK_NULL_PATH(source_dbname, source_dbname_length))
+ || (ZEND_NUM_ARGS() >= 3 && CHECK_NULL_PATH(destination_dbname, destination_dbname_length))
+ ) {
+ zend_value_error("dbname must not contain NUL bytes");
+ return;
+ }
+
destination_obj = Z_SQLITE3_DB_P(destination_zval);
SQLITE3_CHECK_INITIALIZED(destination_obj, destination_obj->initialised, SQLite3)
@@ -1734,9 +1745,8 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa
}
/* }}} */
-/* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type])
- Bind Parameter to a stmt variable. */
-PHP_METHOD(sqlite3stmt, bindParam)
+/* {{{ Common implementation of ::bindParam() and ::bindValue */
+static void sqlite3stmt_bind(INTERNAL_FUNCTION_PARAMETERS)
{
php_sqlite3_stmt *stmt_obj;
zval *object = ZEND_THIS;
@@ -1773,42 +1783,19 @@ PHP_METHOD(sqlite3stmt, bindParam)
}
/* }}} */
+/* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type])
+ Bind Parameter to a stmt variable. */
+PHP_METHOD(sqlite3stmt, bindParam)
+{
+ sqlite3stmt_bind(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+}
+/* }}} */
+
/* {{{ proto bool SQLite3Stmt::bindValue(int parameter_number, mixed parameter [, int type])
Bind Value of a parameter to a stmt variable. */
PHP_METHOD(sqlite3stmt, bindValue)
{
- php_sqlite3_stmt *stmt_obj;
- zval *object = ZEND_THIS;
- struct php_sqlite3_bound_param param = {0};
- zval *parameter;
- stmt_obj = Z_SQLITE3_STMT_P(object);
-
- param.param_number = -1;
- param.type = SQLITE3_TEXT;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz|l", &param.param_number, &parameter, &param.type) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &param.name, &parameter, &param.type) == FAILURE) {
- return;
- }
- }
-
- SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
- SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt);
-
- ZVAL_COPY(&param.parameter, parameter);
-
- if (ZEND_NUM_ARGS() < 3) {
- PHP_SQLITE3_SET_TYPE(parameter, param);
- }
-
- if (!register_bound_parameter_to_sqlite(&param, stmt_obj)) {
- if (!Z_ISUNDEF(param.parameter)) {
- zval_ptr_dtor(&(param.parameter));
- ZVAL_UNDEF(&param.parameter);
- }
- RETURN_FALSE;
- }
- RETURN_TRUE;
+ sqlite3stmt_bind(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
@@ -1890,7 +1877,7 @@ PHP_METHOD(sqlite3stmt, __construct)
stmt_obj = Z_SQLITE3_STMT_P(object);
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "OS", &db_zval, php_sqlite3_sc_entry, &sql) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &db_zval, php_sqlite3_sc_entry, &sql) == FAILURE) {
return;
}
@@ -2106,174 +2093,65 @@ PHP_METHOD(sqlite3result, __construct)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_open, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, encryption_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_busytimeout, 0)
- ZEND_ARG_INFO(0, ms)
-ZEND_END_ARG_INFO()
-
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_loadextension, 0)
- ZEND_ARG_INFO(0, shared_library)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_escapestring, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_query, 0, 0, 1)
- ZEND_ARG_INFO(0, query)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_querysingle, 0, 0, 1)
- ZEND_ARG_INFO(0, query)
- ZEND_ARG_INFO(0, entire_row)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_createfunction, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, argument_count)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_createaggregate, 0, 0, 3)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, step_callback)
- ZEND_ARG_INFO(0, final_callback)
- ZEND_ARG_INFO(0, argument_count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_createcollation, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_openblob, 0, 0, 3)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, column)
- ZEND_ARG_INFO(0, rowid)
- ZEND_ARG_INFO(0, dbname)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_enableexceptions, 0, 0, 0)
- ZEND_ARG_INFO(0, enableExceptions)
-ZEND_END_ARG_INFO()
-
-#if SQLITE_VERSION_NUMBER >= 3006011
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_backup, 0, 0, 1)
- ZEND_ARG_INFO(0, destination_db)
- ZEND_ARG_INFO(0, source_dbname)
- ZEND_ARG_INFO(0, destination_dbname)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindparam, 0, 0, 2)
- ZEND_ARG_INFO(0, param_number)
- ZEND_ARG_INFO(1, param)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindvalue, 0, 0, 2)
- ZEND_ARG_INFO(0, param_number)
- ZEND_ARG_INFO(0, param)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, sqlite3)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_getsql, 0, 0, 0)
- ZEND_ARG_INFO(0, expanded)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_columnname, 0, 0, 1)
- ZEND_ARG_INFO(0, column_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_columntype, 0, 0, 1)
- ZEND_ARG_INFO(0, column_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_fetcharray, 0, 0, 0)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_enableextended, 0, 0, 1)
- ZEND_ARG_INFO(0, enable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ php_sqlite3_class_methods */
static const zend_function_entry php_sqlite3_class_methods[] = {
- PHP_ME(sqlite3, open, arginfo_sqlite3_open, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, close, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, exec, arginfo_sqlite3_query, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, version, arginfo_sqlite3_void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(sqlite3, lastInsertRowID, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, lastErrorCode, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, lastExtendedErrorCode, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, enableExtendedResultCodes, arginfo_sqlite3_enableextended, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, lastErrorMsg, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, busyTimeout, arginfo_sqlite3_busytimeout, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, open, arginfo_class_SQLite3_open, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, close, arginfo_class_SQLite3_close, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, exec, arginfo_class_SQLite3_query, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, version, arginfo_class_SQLite3_version, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(sqlite3, lastInsertRowID, arginfo_class_SQLite3_lastInsertRowID, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, lastErrorCode, arginfo_class_SQLite3_lastErrorCode, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, lastExtendedErrorCode, arginfo_class_SQLite3_lastExtendedErrorCode, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, enableExtendedResultCodes, arginfo_class_SQLite3_enableExtendedResultCodes, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, lastErrorMsg, arginfo_class_SQLite3_lastErrorMsg, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, busyTimeout, arginfo_class_SQLite3_busyTimeout, ZEND_ACC_PUBLIC)
#ifndef SQLITE_OMIT_LOAD_EXTENSION
- PHP_ME(sqlite3, loadExtension, arginfo_sqlite3_loadextension, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, loadExtension, arginfo_class_SQLite3_loadExtension, ZEND_ACC_PUBLIC)
#endif
- PHP_ME(sqlite3, changes, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, escapeString, arginfo_sqlite3_escapestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(sqlite3, prepare, arginfo_sqlite3_query, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, query, arginfo_sqlite3_query, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, querySingle, arginfo_sqlite3_querysingle, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, createFunction, arginfo_sqlite3_createfunction, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, createAggregate, arginfo_sqlite3_createaggregate, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, createCollation, arginfo_sqlite3_createcollation, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, openBlob, arginfo_sqlite3_openblob, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, enableExceptions, arginfo_sqlite3_enableexceptions, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, changes, arginfo_class_SQLite3_changes, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, escapeString, arginfo_class_SQLite3_escapeString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(sqlite3, prepare, arginfo_class_SQLite3_prepare, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, query, arginfo_class_SQLite3_query, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, querySingle, arginfo_class_SQLite3_querySingle, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, createFunction, arginfo_class_SQLite3_createFunction, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, createAggregate, arginfo_class_SQLite3_createAggregate, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, createCollation, arginfo_class_SQLite3_createCollation, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, openBlob, arginfo_class_SQLite3_openBlob, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, enableExceptions, arginfo_class_SQLite3_enableExceptions, ZEND_ACC_PUBLIC)
#if SQLITE_VERSION_NUMBER >= 3006011
- PHP_ME(sqlite3, backup, arginfo_sqlite3_backup, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, backup, arginfo_class_SQLite3_backup, ZEND_ACC_PUBLIC)
#endif
/* Aliases */
- PHP_MALIAS(sqlite3, __construct, open, arginfo_sqlite3_open, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(sqlite3, __construct, open, arginfo_class_SQLite3___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
/* {{{ php_sqlite3_stmt_class_methods */
static const zend_function_entry php_sqlite3_stmt_class_methods[] = {
- PHP_ME(sqlite3stmt, paramCount, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, close, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, reset, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, clear, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, execute, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, bindParam, arginfo_sqlite3stmt_bindparam, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, bindValue, arginfo_sqlite3stmt_bindvalue, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, readOnly, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, getSQL, arginfo_sqlite3stmt_getsql, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, __construct, arginfo_sqlite3stmt_construct, ZEND_ACC_PRIVATE)
+ PHP_ME(sqlite3stmt, paramCount, arginfo_class_SQLite3Stmt_paramCount, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, close, arginfo_class_SQLite3Stmt_close, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, reset, arginfo_class_SQLite3Stmt_reset, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, clear, arginfo_class_SQLite3Stmt_clear, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, execute, arginfo_class_SQLite3Stmt_execute, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, bindParam, arginfo_class_SQLite3Stmt_bindParam, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, bindValue, arginfo_class_SQLite3Stmt_bindValue, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, readOnly, arginfo_class_SQLite3Stmt_readOnly, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, getSQL, arginfo_class_SQLite3Stmt_getSQL, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, __construct, arginfo_class_SQLite3Stmt___construct, ZEND_ACC_PRIVATE)
PHP_FE_END
};
/* }}} */
/* {{{ php_sqlite3_result_class_methods */
static const zend_function_entry php_sqlite3_result_class_methods[] = {
- PHP_ME(sqlite3result, numColumns, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, columnName, arginfo_sqlite3result_columnname, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, columnType, arginfo_sqlite3result_columntype, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, fetchArray, arginfo_sqlite3result_fetcharray, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, reset, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, finalize, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, __construct, arginfo_sqlite3_void, ZEND_ACC_PRIVATE)
+ PHP_ME(sqlite3result, numColumns, arginfo_class_SQLite3Result_numColumns, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, columnName, arginfo_class_SQLite3Result_columnName, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, columnType, arginfo_class_SQLite3Result_columnType, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, fetchArray, arginfo_class_SQLite3Result_fetchArray, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, reset, arginfo_class_SQLite3Result_reset, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, finalize, arginfo_class_SQLite3Result_finalize, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, __construct, arginfo_class_SQLite3Result___construct, ZEND_ACC_PRIVATE)
PHP_FE_END
};
/* }}} */
diff --git a/ext/sqlite3/sqlite3.stub.php b/ext/sqlite3/sqlite3.stub.php
new file mode 100644
index 0000000000..ede86d0927
--- /dev/null
+++ b/ext/sqlite3/sqlite3.stub.php
@@ -0,0 +1,128 @@
+<?php
+
+class SQLite3
+{
+ function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryption_key = '') {}
+
+ /** @return void */
+ function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryption_key = '') {}
+
+ /** @return bool */
+ function close() {}
+
+ /** @return array */
+ function version() {}
+
+ /** @return int */
+ function lastInsertRowID() {}
+
+ /** @return int */
+ function lastErrorCode() {}
+
+ /** @return int */
+ function lastExtendedErrorCode() {}
+
+ /** @return string */
+ function lastErrorMsg() {}
+
+ /** @return int */
+ function changes() {}
+
+ /** @return bool */
+ function busyTimeout(int $ms) {}
+
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+ /** @return bool */
+ function loadExtension(string $shared_library) {}
+#endif
+
+#if SQLITE_VERSION_NUMBER >= 3006011
+ /** @return bool */
+ function backup(SQLite3 $destination_db, string $source_dbname = "main", string $destination_dbname = "main") {}
+#endif
+
+ /** @return string */
+ function escapeString(string $value) {}
+
+ /** @return SQLite3Stmt|false */
+ function prepare(string $query) {}
+
+ /** @return SQLite3Result|false|null */
+ function query(string $query) {}
+
+ /** @return mixed */
+ function querySingle(string $query, bool $entire_row = false) {}
+
+ /** @return bool */
+ function createFunction(string $name, $callback, int $argument_count = -1, int $flags = 0) {}
+
+ /** @return bool */
+ function createAggregate(string $name, $step_callback, $final_callback, int $argument_count = -1) {}
+
+ /** @return bool */
+ function createCollation(string $name, $callback) {}
+
+ /** @return resource|false */
+ function openBlob(string $table, string $column, int $rowid, string $dbname = "main", int $flags = SQLITE3_OPEN_READONLY) {}
+
+ /** @return bool */
+ function enableExceptions(bool $enableExceptions = false) {}
+
+ /** @return bool */
+ function enableExtendedResultCodes(bool $enable = true) {}
+}
+
+class SQLite3Stmt
+{
+ function __construct(SQLite3 $sqlite3, string $sql) {}
+
+ /** @return bool */
+ function bindParam($param_number, &$param, int $type = UNKNOWN) {}
+
+ /** @return bool */
+ function bindValue($param_number, $param, int $type = UNKNOWN) {}
+
+ /** @return bool */
+ function clear() {}
+
+ /** @return bool */
+ function close() {}
+
+ /** @return SQLite3Result|false */
+ function execute() {}
+
+ /** @return string|false */
+ function getSQL(bool $expanded = false) {}
+
+ /** @return int */
+ function paramCount() {}
+
+ /** @return bool */
+ function readOnly() {}
+
+ /** @return bool */
+ function reset() {}
+}
+
+class SQLite3Result
+{
+ function __construct() {}
+
+ /** @return int */
+ function numColumns() {}
+
+ /** @return string|false */
+ function columnName(int $column_number) {}
+
+ /** @return int|false */
+ function columnType(int $column_number) {}
+
+ /** @return array|false */
+ function fetchArray(int $mode = SQLITE3_BOTH) {}
+
+ /** @return bool */
+ function reset() {}
+
+ /** @return bool */
+ function finalize() {}
+}
diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h
new file mode 100644
index 0000000000..554ecdf5eb
--- /dev/null
+++ b/ext/sqlite3/sqlite3_arginfo.h
@@ -0,0 +1,143 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encryption_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3_open arginfo_class_SQLite3___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3_version arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastInsertRowID arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastErrorCode arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastExtendedErrorCode arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastErrorMsg arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_changes arginfo_class_SQLite3_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_busyTimeout, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, ms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_loadExtension, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, shared_library, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if SQLITE_VERSION_NUMBER >= 3006011
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_backup, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, destination_db, SQLite3, 0)
+ ZEND_ARG_TYPE_INFO(0, source_dbname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, destination_dbname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_escapeString, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_prepare, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3_query arginfo_class_SQLite3_prepare
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_querySingle, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entire_row, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_createFunction, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, callback)
+ ZEND_ARG_TYPE_INFO(0, argument_count, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_createAggregate, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, step_callback)
+ ZEND_ARG_INFO(0, final_callback)
+ ZEND_ARG_TYPE_INFO(0, argument_count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_createCollation, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_openBlob, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, rowid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dbname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_enableExceptions, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, enableExceptions, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_enableExtendedResultCodes, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt___construct, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, sqlite3, SQLite3, 0)
+ ZEND_ARG_TYPE_INFO(0, sql, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_bindParam, 0, 0, 2)
+ ZEND_ARG_INFO(0, param_number)
+ ZEND_ARG_INFO(1, param)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_bindValue, 0, 0, 2)
+ ZEND_ARG_INFO(0, param_number)
+ ZEND_ARG_INFO(0, param)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Stmt_clear arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_close arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_execute arginfo_class_SQLite3_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_getSQL, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, expanded, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Stmt_paramCount arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_readOnly arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_reset arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Result___construct arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Result_numColumns arginfo_class_SQLite3_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Result_columnName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, column_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Result_columnType arginfo_class_SQLite3Result_columnName
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Result_fetchArray, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Result_reset arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Result_finalize arginfo_class_SQLite3_close
diff --git a/ext/sqlite3/tests/sqlite3_33_reset.phpt b/ext/sqlite3/tests/sqlite3_33_reset.phpt
index 531874ceb6..48abc829c7 100644
--- a/ext/sqlite3/tests/sqlite3_33_reset.phpt
+++ b/ext/sqlite3/tests/sqlite3_33_reset.phpt
@@ -15,13 +15,11 @@ $db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
-$stmt->reset("dummy");
$stmt->reset();
//var_dump($db);
//var_dump($db->close());
echo "Done\n";
?>
---EXPECTF--
-Warning: SQLite3Stmt::reset() expects exactly 0 parameters, 1 given in %s on line %d
+--EXPECT--
Done
diff --git a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
index 767f9d0065..d921b99dd7 100644
--- a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
+++ b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
@@ -17,7 +17,6 @@ try{
}
var_dump($db->enableExceptions(false));
$db->query("SELECT * FROM non_existent_table");
-var_dump($db->enableExceptions("wrong_type","wrong_type"));
echo "Closing database\n";
var_dump($db->close());
echo "Done\n";
@@ -28,9 +27,6 @@ no such table: non_existent_table
bool(true)
Warning: SQLite3::query(): no such table: non_existent_table in %s on line %d
-
-Warning: SQLite3::enableExceptions() expects at most 1 parameter, 2 given in %s on line %d
-NULL
Closing database
bool(true)
Done
diff --git a/ext/standard/array.c b/ext/standard/array.c
index d44e5d50e7..8fe281da26 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.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, |
@@ -365,7 +363,6 @@ static int php_array_data_compare(const void *a, const void *b) /* {{{ */
{
Bucket *f;
Bucket *s;
- zval result;
zval *first;
zval *second;
@@ -381,12 +378,7 @@ static int php_array_data_compare(const void *a, const void *b) /* {{{ */
if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) {
second = Z_INDIRECT_P(second);
}
- if (compare_function(&result, first, second) == FAILURE) {
- return 0;
- }
-
- ZEND_ASSERT(Z_TYPE(result) == IS_LONG);
- return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
+ return zend_compare(first, second);
}
/* }}} */
@@ -696,13 +688,12 @@ PHP_FUNCTION(krsort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_key_compare_func(sort_type, 1);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -719,13 +710,12 @@ PHP_FUNCTION(ksort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_key_compare_func(sort_type, 0);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -791,7 +781,7 @@ PHP_FUNCTION(count)
/* first, we check if the handler is defined */
if (Z_OBJ_HT_P(array)->count_elements) {
RETVAL_LONG(1);
- if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) {
+ if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) {
return;
}
if (EG(exception)) {
@@ -800,7 +790,7 @@ PHP_FUNCTION(count)
}
/* if not and the object implements Countable we call its count() method */
if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {
- zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETVAL_LONG(zval_get_long(&retval));
zval_ptr_dtor(&retval);
@@ -830,13 +820,9 @@ static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */
ZEND_PARSE_PARAMETERS_END();
if (fold_case) {
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0) == FAILURE) {
- return;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0);
} else {
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_compare, 0) == FAILURE) {
- return;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_compare, 0);
}
RETURN_TRUE;
@@ -871,13 +857,12 @@ PHP_FUNCTION(asort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 0);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -894,13 +879,12 @@ PHP_FUNCTION(arsort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 1);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -917,13 +901,12 @@ PHP_FUNCTION(sort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 0);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 1) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 1);
+
RETURN_TRUE;
}
/* }}} */
@@ -940,13 +923,12 @@ PHP_FUNCTION(rsort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 1);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 1) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 1);
+
RETURN_TRUE;
}
/* }}} */
@@ -1016,7 +998,6 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func,
{
zval *array;
zend_array *arr;
- zend_bool retval;
PHP_ARRAY_CMP_FUNC_VARS;
PHP_ARRAY_CMP_FUNC_BACKUP();
@@ -1035,13 +1016,13 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func,
/* Copy array, so the in-place modifications will not be visible to the callback function */
arr = zend_array_dup(arr);
- retval = zend_hash_sort(arr, compare_func, renumber) != FAILURE;
+ zend_hash_sort(arr, compare_func, renumber);
zval_ptr_dtor(array);
ZVAL_ARR(array, arr);
PHP_ARRAY_CMP_FUNC_RESTORE();
- RETURN_BOOL(retval);
+ RETURN_TRUE;
}
/* }}} */
@@ -1254,7 +1235,9 @@ PHP_FUNCTION(key)
}
/* }}} */
-/* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+/* {{{
+ * proto mixed min(array values)
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
Return the lowest value in an array or a series of arguments */
PHP_FUNCTION(min)
{
@@ -1270,14 +1253,14 @@ PHP_FUNCTION(min)
zval *result;
if (Z_TYPE(args[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "When only one parameter is given, it must be an array");
- RETVAL_NULL();
+ zend_type_error("When only one parameter is given, it must be an array");
+ return;
} else {
if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 0)) != NULL) {
ZVAL_COPY_DEREF(return_value, result);
} else {
- php_error_docref(NULL, E_WARNING, "Array must contain at least one element");
- RETVAL_FALSE;
+ zend_throw_error(NULL, "Array must contain at least one element");
+ return;
}
}
} else {
@@ -1299,7 +1282,9 @@ PHP_FUNCTION(min)
}
/* }}} */
-/* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+/* {{{
+ * proto mixed max(array values)
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
Return the highest value in an array or a series of arguments */
PHP_FUNCTION(max)
{
@@ -1315,14 +1300,14 @@ PHP_FUNCTION(max)
zval *result;
if (Z_TYPE(args[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "When only one parameter is given, it must be an array");
- RETVAL_NULL();
+ zend_type_error("When only one parameter is given, it must be an array");
+ return;
} else {
if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 1)) != NULL) {
ZVAL_COPY_DEREF(return_value, result);
} else {
- php_error_docref(NULL, E_WARNING, "Array must contain at least one element");
- RETVAL_FALSE;
+ zend_throw_error(NULL, "Array must contain at least one element");
+ return;
}
}
} else {
@@ -1409,7 +1394,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */
SEPARATE_ARRAY(zv);
thash = Z_ARRVAL_P(zv);
if (GC_IS_RECURSIVE(thash)) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
result = FAILURE;
break;
}
@@ -1460,7 +1445,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */
target_hash = Z_OBJPROP_P(array);
pos = zend_hash_iterator_pos(ht_iter, target_hash);
} else {
- php_error_docref(NULL, E_WARNING, "Iterated value is no longer an array or object");
+ zend_type_error("Iterated value is no longer an array or object");
result = FAILURE;
break;
}
@@ -1716,16 +1701,16 @@ static zend_always_inline int php_valid_var_name(const char *var_name, size_t va
}
/* }}} */
-PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */
+PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */
{
- ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
- memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix));
+ ZVAL_NEW_STR(result, zend_string_alloc(ZSTR_LEN(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
+ memcpy(Z_STRVAL_P(result), ZSTR_VAL(prefix), ZSTR_LEN(prefix));
if (add_underscore) {
- Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_';
+ Z_STRVAL_P(result)[ZSTR_LEN(prefix)] = '_';
}
- memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1);
+ memcpy(Z_STRVAL_P(result) + ZSTR_LEN(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1);
return SUCCESS;
}
@@ -1904,7 +1889,7 @@ static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table
}
/* }}} */
-static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -1960,7 +1945,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s
}
/* }}} */
-static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2011,7 +1996,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo
}
/* }}} */
-static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2085,7 +2070,7 @@ prefix:
}
/* }}} */
-static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2151,7 +2136,7 @@ prefix:
}
/* }}} */
-static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2198,7 +2183,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_
}
/* }}} */
-static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2245,7 +2230,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl
}
/* }}} */
-static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2300,7 +2285,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym
}
/* }}} */
-static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2441,9 +2426,10 @@ static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /*
Imports variables into symbol table from an array */
PHP_FUNCTION(extract)
{
- zval *var_array_param, *prefix = NULL;
+ zval *var_array_param;
zend_long extract_refs;
zend_long extract_type = EXTR_OVERWRITE;
+ zend_string *prefix = NULL;
zend_long count;
zend_array *symbol_table;
@@ -2451,7 +2437,7 @@ PHP_FUNCTION(extract)
Z_PARAM_ARRAY_EX2(var_array_param, 0, 1, 0)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(extract_type)
- Z_PARAM_ZVAL(prefix)
+ Z_PARAM_STR(prefix)
ZEND_PARSE_PARAMETERS_END();
extract_refs = (extract_type & EXTR_REFS);
@@ -2461,22 +2447,18 @@ PHP_FUNCTION(extract)
extract_type &= 0xff;
if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
- php_error_docref(NULL, E_WARNING, "Invalid extract type");
+ zend_throw_error(NULL, "Invalid extract type");
return;
}
if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) {
- php_error_docref(NULL, E_WARNING, "specified extract type requires the prefix parameter");
+ zend_throw_error(NULL, "Specified extract type requires the prefix parameter");
return;
}
if (prefix) {
- if (!try_convert_to_string(prefix)) {
- return;
- }
-
- if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) {
- php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier");
+ if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) {
+ zend_throw_error(NULL, "Prefix is not a valid identifier");
return;
}
}
@@ -2486,6 +2468,7 @@ PHP_FUNCTION(extract)
}
symbol_table = zend_rebuild_symbol_table();
+ ZEND_ASSERT(symbol_table && "A symbol table should always be available here");
if (extract_refs) {
switch (extract_type) {
@@ -2568,7 +2551,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
if (Z_REFCOUNTED_P(entry)) {
if (Z_IS_RECURSIVE_P(entry)) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
return;
}
Z_PROTECT_RECURSION_P(entry);
@@ -2600,9 +2583,7 @@ PHP_FUNCTION(compact)
}
symbol_table = zend_rebuild_symbol_table();
- if (UNEXPECTED(symbol_table == NULL)) {
- return;
- }
+ ZEND_ASSERT(symbol_table && "A symbol table should always be available here");
/* compact() is probably most used with a single array of var_names
or multiple string names, rather than a combination of both.
@@ -2634,11 +2615,11 @@ PHP_FUNCTION(array_fill)
if (EXPECTED(num > 0)) {
if (sizeof(num) > 4 && UNEXPECTED(EXPECTED(num > 0x7fffffff))) {
- php_error_docref(NULL, E_WARNING, "Too many elements");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Too many elements");
+ return;
} else if (UNEXPECTED(start_key > ZEND_LONG_MAX - num + 1)) {
- php_error_docref(NULL, E_WARNING, "Cannot add element to the array as the next element is already occupied");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ return;
} else if (EXPECTED(start_key >= 0) && EXPECTED(start_key < num)) {
/* create packed array */
Bucket *p;
@@ -2683,8 +2664,8 @@ PHP_FUNCTION(array_fill)
} else if (EXPECTED(num == 0)) {
RETURN_EMPTY_ARRAY();
} else {
- php_error_docref(NULL, E_WARNING, "Number of elements can't be negative");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Number of elements can't be negative");
+ return;
}
}
/* }}} */
@@ -2721,8 +2702,9 @@ PHP_FUNCTION(array_fill_keys)
#define RANGE_CHECK_DOUBLE_INIT_ARRAY(start, end) do { \
double __calc_size = ((start - end) / step) + 1; \
if (__calc_size >= (double)HT_MAX_SIZE) { \
- php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, \
+ "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \
+ return; \
} \
size = (uint32_t)_php_math_round(__calc_size, 0, PHP_ROUND_HALF_UP); \
array_init_size(return_value, size); \
@@ -2732,8 +2714,9 @@ PHP_FUNCTION(array_fill_keys)
#define RANGE_CHECK_LONG_INIT_ARRAY(start, end) do { \
zend_ulong __calc_size = ((zend_ulong) start - end) / lstep; \
if (__calc_size >= HT_MAX_SIZE - 1) { \
- php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, \
+ "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \
+ return; \
} \
size = (uint32_t)(__calc_size + 1); \
array_init_size(return_value, size); \
@@ -2752,24 +2735,11 @@ PHP_FUNCTION(range)
Z_PARAM_ZVAL(zlow)
Z_PARAM_ZVAL(zhigh)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL(zstep)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_NUMBER(zstep)
+ ZEND_PARSE_PARAMETERS_END();
if (zstep) {
- if (Z_TYPE_P(zstep) == IS_DOUBLE) {
- is_step_double = 1;
- } else if (Z_TYPE_P(zstep) == IS_STRING) {
- int type = is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0);
- if (type == IS_DOUBLE) {
- is_step_double = 1;
- }
- if (type == 0) {
- /* bad number */
- php_error_docref(NULL, E_WARNING, "Invalid range string - must be numeric");
- RETURN_FALSE;
- }
- }
-
+ is_step_double = Z_TYPE_P(zstep) == IS_DOUBLE;
step = zval_get_double(zstep);
/* We only want positive step values. */
@@ -2842,8 +2812,8 @@ double_str:
high = zval_get_double(zhigh);
if (zend_isinf(high) || zend_isinf(low)) {
- php_error_docref(NULL, E_WARNING, "Invalid range supplied: start=%0.0f end=%0.0f", low, high);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Invalid range supplied: start=%0.0f end=%0.0f", low, high);
+ return;
}
if (low > high) { /* Negative steps */
@@ -2935,8 +2905,8 @@ long_str:
}
err:
if (err) {
- php_error_docref(NULL, E_WARNING, "step exceeds the specified range");
- RETURN_FALSE;
+ zend_throw_error(NULL, "step exceeds the specified range");
+ return;
}
}
/* }}} */
@@ -3033,7 +3003,7 @@ PHP_FUNCTION(shuffle)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY_EX(array, 0, 1)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_array_data_shuffle(array);
@@ -3198,8 +3168,8 @@ PHP_FUNCTION(array_push)
if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var) == NULL) {
Z_TRY_DELREF(new_var);
- php_error_docref(NULL, E_WARNING, "Cannot add element to the array as the next element is already occupied");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ return;
}
}
@@ -3243,7 +3213,7 @@ PHP_FUNCTION(array_pop)
}
ZVAL_COPY_DEREF(return_value, val);
- if (!p->key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && p->h >= (zend_ulong)(Z_ARRVAL_P(stack)->nNextFreeElement - 1)) {
+ if (!p->key && (zend_long)p->h == (Z_ARRVAL_P(stack)->nNextFreeElement - 1)) {
Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1;
}
@@ -3431,19 +3401,20 @@ PHP_FUNCTION(array_splice)
HashTable *rem_hash = NULL;
zend_long offset,
length = 0;
+ zend_bool length_is_null = 1;
int num_in; /* Number of elements in the input array */
ZEND_PARSE_PARAMETERS_START(2, 4)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG(length)
+ Z_PARAM_LONG_OR_NULL(length, length_is_null)
Z_PARAM_ZVAL(repl_array)
ZEND_PARSE_PARAMETERS_END();
num_in = zend_hash_num_elements(Z_ARRVAL_P(array));
- if (ZEND_NUM_ARGS() < 3) {
+ if (length_is_null) {
length = num_in;
}
@@ -3474,6 +3445,9 @@ PHP_FUNCTION(array_splice)
/* Initialize return value */
array_init_size(return_value, size > 0 ? (uint32_t)size : 0);
rem_hash = Z_ARRVAL_P(return_value);
+ } else {
+ /* The return value will not be used, but make sure it still has the correct type. */
+ RETVAL_EMPTY_ARRAY();
}
/* Perform splice */
@@ -3485,14 +3459,14 @@ PHP_FUNCTION(array_splice)
Returns elements specified by offset and length */
PHP_FUNCTION(array_slice)
{
- zval *input, /* Input array */
- *z_length = NULL, /* How many elements to get */
- *entry; /* An array entry */
- zend_long offset, /* Offset to get elements from */
- length = 0;
- zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */
- int num_in, /* Number of elements in the input array */
- pos; /* Current position in the array */
+ zval *input; /* Input array */
+ zval *entry; /* An array entry */
+ zend_long offset; /* Offset to get elements from */
+ zend_long length = 0; /* How many elements to get */
+ zend_bool length_is_null = 1; /* Whether an explicit length has been omitted */
+ zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array */
+ uint32_t num_in; /* Number of elements in the input array */
+ uint32_t pos; /* Current position in the array */
zend_string *string_key;
zend_ulong num_key;
@@ -3500,7 +3474,7 @@ PHP_FUNCTION(array_slice)
Z_PARAM_ARRAY(input)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL(z_length)
+ Z_PARAM_LONG_OR_NULL(length, length_is_null)
Z_PARAM_BOOL(preserve_keys)
ZEND_PARSE_PARAMETERS_END();
@@ -3508,14 +3482,12 @@ PHP_FUNCTION(array_slice)
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
/* We want all entries from offset to the end if length is not passed or is null */
- if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) {
+ if (length_is_null) {
length = num_in;
- } else {
- length = zval_get_long(z_length);
}
/* Clamp the offset.. */
- if (offset > num_in) {
+ if (offset > (zend_long) num_in) {
RETURN_EMPTY_ARRAY();
} else if (offset < 0 && (offset = (num_in + offset)) < 0) {
offset = 0;
@@ -3601,7 +3573,7 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
ZVAL_DEREF(dest_zval);
thash = Z_TYPE_P(dest_zval) == IS_ARRAY ? Z_ARRVAL_P(dest_zval) : NULL;
if ((thash && GC_IS_RECURSIVE(thash)) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
return 0;
}
@@ -3722,7 +3694,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src) /* {{{ *
if (Z_IS_RECURSIVE_P(dest_zval) ||
Z_IS_RECURSIVE_P(src_zval) ||
(Z_ISREF_P(src_entry) && Z_ISREF_P(dest_entry) && Z_REF_P(src_entry) == Z_REF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
return 0;
}
@@ -3771,8 +3743,8 @@ static zend_always_inline void php_array_replace_wrapper(INTERNAL_FUNCTION_PARAM
zval *arg = args + i;
if (Z_TYPE_P(arg) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
+ return;
}
}
@@ -3815,8 +3787,8 @@ static zend_always_inline void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMET
zval *arg = args + i;
if (Z_TYPE_P(arg) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
+ return;
}
count += zend_hash_num_elements(Z_ARRVAL_P(arg));
}
@@ -3957,7 +3929,7 @@ PHP_FUNCTION(array_keys)
/* Base case: empty input */
if (!elem_count) {
- RETURN_ZVAL(input, 1, 0)
+ RETURN_ZVAL(input, 1, 0);
}
/* Initialize return array */
@@ -4016,7 +3988,7 @@ PHP_FUNCTION(array_keys)
}
/* }}} */
-/* {{{ proto mixed array_key_first(array stack)
+/* {{{ proto int|string|false array_key_first(array stack)
Get the key of the first element of the array */
PHP_FUNCTION(array_key_first)
{
@@ -4032,7 +4004,7 @@ PHP_FUNCTION(array_key_first)
}
/* }}} */
-/* {{{ proto mixed array_key_last(array stack)
+/* {{{ proto int|string|false array_key_last(array stack)
Get the key of the last element of the array */
PHP_FUNCTION(array_key_last)
{
@@ -4130,7 +4102,7 @@ PHP_FUNCTION(array_count_values)
Z_LVAL_P(tmp)++;
}
} else {
- php_error_docref(NULL, E_WARNING, "Can only count STRING and INTEGER values!");
+ php_error_docref(NULL, E_WARNING, "Can only count string and integer values, entry skipped");
}
} ZEND_HASH_FOREACH_END();
}
@@ -4158,7 +4130,7 @@ zend_bool array_column_param_helper(zval *param,
return 1;
default:
- php_error_docref(NULL, E_WARNING, "The %s key should be either a string or an integer", name);
+ zend_type_error("The %s key should be either a string or an integer", name);
return 0;
}
}
@@ -4172,9 +4144,12 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
/* The has_property check is first performed in "exists" mode (which returns true for
* properties that are null but exist) and then in "has" mode to handle objects that
* implement __isset (which is not called in "exists" mode). */
- if (Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_EXISTS, NULL)
- || Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_ISSET, NULL)) {
- prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv);
+ zend_string *str, *tmp_str;
+
+ str = zval_get_tmp_string(name, &tmp_str);
+ if (Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_EXISTS, NULL)
+ || Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_ISSET, NULL)) {
+ prop = Z_OBJ_HANDLER_P(data, read_property)(Z_OBJ_P(data), str, BP_VAR_R, NULL, rv);
if (prop) {
ZVAL_DEREF(prop);
if (prop != rv) {
@@ -4182,6 +4157,7 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
}
}
}
+ zend_tmp_string_release(tmp_str);
} else if (Z_TYPE_P(data) == IS_ARRAY) {
if (Z_TYPE_P(name) == IS_STRING) {
prop = zend_symtable_find(Z_ARRVAL_P(data), Z_STR_P(name));
@@ -4217,7 +4193,7 @@ PHP_FUNCTION(array_column)
if ((column && !array_column_param_helper(column, "column")) ||
(index && !array_column_param_helper(index, "index"))) {
- RETURN_FALSE;
+ return;
}
array_init_size(return_value, zend_hash_num_elements(input));
@@ -4372,8 +4348,8 @@ PHP_FUNCTION(array_pad)
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
pad_size_abs = ZEND_ABS(pad_size);
if (pad_size_abs < 0 || pad_size_abs - input_size > Z_L(1048576)) {
- php_error_docref(NULL, E_WARNING, "You may only pad up to 1048576 elements at a time");
- RETURN_FALSE;
+ zend_throw_error(NULL, "You may only pad up to 1048576 elements at a time");
+ return;
}
if (input_size >= pad_size_abs) {
@@ -4469,7 +4445,7 @@ PHP_FUNCTION(array_flip)
}
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
} else {
- php_error_docref(NULL, E_WARNING, "Can only flip STRING and INTEGER values!");
+ php_error_docref(NULL, E_WARNING, "Can only flip string and integer values, entry skipped");
}
} ZEND_HASH_FOREACH_END();
}
@@ -4693,7 +4669,7 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
}
if (argc < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, argc);
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, argc);
return;
}
@@ -4703,8 +4679,8 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
for (i = 0; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ return;
}
}
@@ -4788,12 +4764,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
param_spec = "+f";
intersect_data_compare_func = php_array_user_compare;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. This should never happen. Please report as a bug", data_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
return;
}
@@ -4840,12 +4816,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
fci_key = &fci2;
fci_key_cache = &fci2_cache;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type / key_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
return;
}
@@ -4854,7 +4830,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
}
} else {
- php_error_docref(NULL, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior);
+ ZEND_ASSERT(0 && "Invalid behavior");
return;
}
@@ -4874,7 +4850,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
for (i = 0; i < arr_argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
arr_argc = i; /* only free up to i - 1 */
goto out;
}
@@ -5092,7 +5068,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
argc = ZEND_NUM_ARGS();
if (data_compare_type == DIFF_COMP_DATA_USER) {
if (argc < 3) {
- php_error_docref(NULL, E_WARNING, "at least 3 parameters are required, %d given", ZEND_NUM_ARGS());
+ zend_argument_count_error("At least 3 parameters are required, %d given", ZEND_NUM_ARGS());
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+f", &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) {
@@ -5101,7 +5077,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
diff_data_compare_func = zval_user_compare;
} else {
if (argc < 2) {
- php_error_docref(NULL, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS());
+ zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS());
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
@@ -5114,8 +5090,8 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
for (i = 0; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ return;
}
}
@@ -5204,7 +5180,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
return;
}
@@ -5251,12 +5227,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
fci_key = &fci2;
fci_key_cache = &fci2_cache;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type / key_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
return;
}
@@ -5265,7 +5241,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
} else {
- php_error_docref(NULL, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior);
+ ZEND_ASSERT(0 && "Invalid behavior");
return;
}
@@ -5285,7 +5261,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
for (i = 0; i < arr_argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
arr_argc = i; /* only free up to i - 1 */
goto out;
}
@@ -5453,7 +5429,7 @@ PHP_FUNCTION(array_diff)
zval dummy;
if (ZEND_NUM_ARGS() < 2) {
- php_error_docref(NULL, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS());
+ zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS());
return;
}
@@ -5462,16 +5438,16 @@ PHP_FUNCTION(array_diff)
ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE(args[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0]));
- RETURN_NULL();
+ zend_type_error("Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0]));
+ return;
}
num = zend_hash_num_elements(Z_ARRVAL(args[0]));
if (num == 0) {
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ return;
}
}
RETURN_EMPTY_ARRAY();
@@ -5487,8 +5463,8 @@ PHP_FUNCTION(array_diff)
if (!value) {
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ return;
}
}
RETURN_EMPTY_ARRAY();
@@ -5498,8 +5474,8 @@ PHP_FUNCTION(array_diff)
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ return;
}
if (!found) {
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[i]), value) {
@@ -5528,8 +5504,8 @@ PHP_FUNCTION(array_diff)
num = 0;
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ return;
}
num += zend_hash_num_elements(Z_ARRVAL(args[i]));
}
@@ -5636,7 +5612,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b) /* {{{ */
#define MULTISORT_ABORT \
efree(func); \
efree(arrays); \
- RETURN_FALSE;
+ return;
static void array_bucket_p_sawp(void *p, void *q) /* {{{ */ {
Bucket *t;
@@ -5713,7 +5689,7 @@ PHP_FUNCTION(array_multisort)
sort_order = Z_LVAL_P(arg) == PHP_SORT_DESC ? PHP_SORT_DESC : PHP_SORT_ASC;
parse_state[MULTISORT_ORDER] = 0;
} else {
- php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
+ zend_type_error("Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
MULTISORT_ABORT;
}
break;
@@ -5729,19 +5705,19 @@ PHP_FUNCTION(array_multisort)
sort_type = (int)Z_LVAL_P(arg);
parse_state[MULTISORT_TYPE] = 0;
} else {
- php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
+ zend_type_error("Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
MULTISORT_ABORT;
}
break;
default:
- php_error_docref(NULL, E_WARNING, "Argument #%d is an unknown sort flag", i + 1);
+ zend_type_error("Argument #%d is an unknown sort flag", i + 1);
MULTISORT_ABORT;
break;
}
} else {
- php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or a sort flag", i + 1);
+ zend_type_error("Argument #%d is expected to be an array or a sort flag", i + 1);
MULTISORT_ABORT;
}
}
@@ -5752,7 +5728,7 @@ PHP_FUNCTION(array_multisort)
array_size = zend_hash_num_elements(Z_ARRVAL_P(arrays[0]));
for (i = 0; i < num_arrays; i++) {
if (zend_hash_num_elements(Z_ARRVAL_P(arrays[i])) != (uint32_t)array_size) {
- php_error_docref(NULL, E_WARNING, "Array sizes are inconsistent");
+ zend_throw_error(NULL, "Array sizes are inconsistent");
MULTISORT_ABORT;
}
}
@@ -5824,7 +5800,7 @@ PHP_FUNCTION(array_multisort)
}
/* }}} */
-/* {{{ proto mixed array_rand(array input [, int num_req])
+/* {{{ proto int|string|array array_rand(array input [, int num_req])
Return key/keys for random entry/entries in the array */
PHP_FUNCTION(array_rand)
{
@@ -5848,7 +5824,7 @@ PHP_FUNCTION(array_rand)
num_avail = zend_hash_num_elements(Z_ARRVAL_P(input));
if (num_avail == 0) {
- php_error_docref(NULL, E_WARNING, "Array is empty");
+ zend_throw_error(NULL, "Array is empty");
return;
}
@@ -5889,7 +5865,7 @@ PHP_FUNCTION(array_rand)
}
if (num_req <= 0 || num_req > num_avail) {
- php_error_docref(NULL, E_WARNING, "Second argument has to be between 1 and the number of elements in the array");
+ zend_throw_error(NULL, "Second argument has to be between 1 and the number of elements in the array");
return;
}
@@ -5935,7 +5911,7 @@ PHP_FUNCTION(array_rand)
}
/* }}} */
-/* {{{ proto mixed array_sum(array input)
+/* {{{ proto int|float array_sum(array input)
Returns the sum of the array entries */
PHP_FUNCTION(array_sum)
{
@@ -5960,7 +5936,7 @@ PHP_FUNCTION(array_sum)
}
/* }}} */
-/* {{{ proto mixed array_product(array input)
+/* {{{ proto int|float array_product(array input)
Returns the product of the array entries */
PHP_FUNCTION(array_product)
{
@@ -6063,7 +6039,7 @@ PHP_FUNCTION(array_reduce)
}
/* }}} */
-/* {{{ proto array array_filter(array input [, mixed callback])
+/* {{{ proto array array_filter(array input [, mixed callback [, int use_type]])
Filters elements from the array via the callback. */
PHP_FUNCTION(array_filter)
{
@@ -6172,8 +6148,6 @@ PHP_FUNCTION(array_map)
Z_PARAM_VARIADIC('+', arrays, n_arrays)
ZEND_PARSE_PARAMETERS_END();
- RETVAL_NULL();
-
if (n_arrays == 1) {
zend_ulong num_key;
zend_string *str_key;
@@ -6181,7 +6155,7 @@ PHP_FUNCTION(array_map)
int ret;
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0]));
+ zend_type_error("Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0]));
return;
}
maxlen = zend_hash_num_elements(Z_ARRVAL(arrays[0]));
@@ -6222,7 +6196,7 @@ PHP_FUNCTION(array_map)
for (i = 0; i < n_arrays; i++) {
if (Z_TYPE(arrays[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i]));
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i]));
efree(array_pos);
return;
}
@@ -6381,7 +6355,7 @@ PHP_FUNCTION(array_chunk)
/* Do bounds checking for size parameter. */
if (size < 1) {
- php_error_docref(NULL, E_WARNING, "Size parameter expected to be greater than 0");
+ zend_throw_error(NULL, "Size parameter expected to be greater than 0");
return;
}
@@ -6446,8 +6420,8 @@ PHP_FUNCTION(array_combine)
num_values = zend_hash_num_elements(values);
if (num_keys != num_values) {
- php_error_docref(NULL, E_WARNING, "Both parameters should have an equal number of elements");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Both parameters should have an equal number of elements");
+ return;
}
if (!num_keys) {
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 9f315d0581..8c276eeda8 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.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, |
@@ -29,7 +27,6 @@ ZEND_BEGIN_MODULE_GLOBALS(assert)
zend_bool active;
zend_bool bail;
zend_bool warning;
- zend_bool quiet_eval;
zend_bool exception;
ZEND_END_MODULE_GLOBALS(assert)
@@ -46,7 +43,6 @@ enum {
ASSERT_CALLBACK,
ASSERT_BAIL,
ASSERT_WARNING,
- ASSERT_QUIET_EVAL,
ASSERT_EXCEPTION
};
@@ -81,7 +77,6 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals)
STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals)
PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback)
- STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals)
STD_PHP_INI_ENTRY("assert.exception", "0", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals)
PHP_INI_END()
@@ -104,7 +99,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */
REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT);
INIT_CLASS_ENTRY(ce, "AssertionError", NULL);
@@ -147,9 +141,6 @@ PHP_FUNCTION(assert)
{
zval *assertion;
zval *description = NULL;
- int val;
- char *myeval = NULL;
- char *compiled_string_description;
if (! ASSERTG(active)) {
RETURN_TRUE;
@@ -161,51 +152,7 @@ PHP_FUNCTION(assert)
Z_PARAM_ZVAL(description)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(assertion) == IS_STRING) {
- zval retval;
- int old_error_reporting = 0; /* shut up gcc! */
-
- if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated");
-
- myeval = Z_STRVAL_P(assertion);
-
- if (ASSERTG(quiet_eval)) {
- old_error_reporting = EG(error_reporting);
- EG(error_reporting) = 0;
- }
-
- compiled_string_description = zend_make_compiled_string_description("assert code");
- if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) {
- efree(compiled_string_description);
- if (!description) {
- zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval);
- } else {
- zend_string *str = zval_get_string(description);
- zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval);
- zend_string_release_ex(str, 0);
- }
- if (ASSERTG(bail)) {
- zend_bailout();
- }
- RETURN_FALSE;
- }
- efree(compiled_string_description);
-
- if (ASSERTG(quiet_eval)) {
- EG(error_reporting) = old_error_reporting;
- }
-
- convert_to_boolean(&retval);
- val = Z_TYPE(retval) == IS_TRUE;
- } else {
- val = zend_is_true(assertion);
- }
-
- if (val) {
+ if (zend_is_true(assertion)) {
RETURN_TRUE;
}
@@ -220,8 +167,8 @@ PHP_FUNCTION(assert)
const char *filename = zend_get_executed_filename();
ZVAL_STRING(&args[0], SAFE_STRING(filename));
- ZVAL_LONG (&args[1], lineno);
- ZVAL_STRING(&args[2], SAFE_STRING(myeval));
+ ZVAL_LONG(&args[1], lineno);
+ ZVAL_NULL(&args[2]);
ZVAL_FALSE(&retval);
@@ -255,18 +202,10 @@ PHP_FUNCTION(assert)
}
} else if (ASSERTG(warning)) {
if (!description) {
- if (myeval) {
- php_error_docref(NULL, E_WARNING, "Assertion \"%s\" failed", myeval);
- } else {
- php_error_docref(NULL, E_WARNING, "Assertion failed");
- }
+ php_error_docref(NULL, E_WARNING, "Assertion failed");
} else {
zend_string *str = zval_get_string(description);
- if (myeval) {
- php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval);
- } else {
- php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str));
- }
+ php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str));
zend_string_release_ex(str, 0);
}
}
@@ -328,22 +267,6 @@ PHP_FUNCTION(assert_options)
RETURN_LONG(oldint);
break;
- case ASSERT_QUIET_EVAL:
- oldint = ASSERTG(quiet_eval);
- if (ac == 2) {
- zend_string *value_str = zval_try_get_string(value);
- if (UNEXPECTED(!value_str)) {
- return;
- }
-
- key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0);
- zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
- zend_string_release_ex(key, 0);
- zend_string_release_ex(value_str, 0);
- }
- RETURN_LONG(oldint);
- break;
-
case ASSERT_WARNING:
oldint = ASSERTG(warning);
if (ac == 2) {
@@ -391,10 +314,10 @@ PHP_FUNCTION(assert_options)
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown value " ZEND_LONG_FMT, what);
+ zend_throw_error(NULL, "Unknown value " ZEND_LONG_FMT, what);
break;
}
- RETURN_FALSE;
+ return;
}
/* }}} */
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 0dd4045887..2229af960e 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.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, |
@@ -941,7 +939,7 @@ PHP_FUNCTION(base64_encode)
}
/* }}} */
-/* {{{ proto string base64_decode(string str[, bool strict])
+/* {{{ proto string|false base64_decode(string str[, bool strict])
Decodes string using MIME base64 algorithm */
PHP_FUNCTION(base64_decode)
{
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
index faf245c5d9..17bc45cd8b 100644
--- a/ext/standard/base64.h
+++ b/ext/standard/base64.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/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 001e37fa70..1c3ad1d2bd 100644..100755
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.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, |
@@ -121,481 +119,7 @@ static void user_shutdown_function_dtor(zval *zv);
static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry);
/* {{{ arginfo */
-/* {{{ main/main.c */
-ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0)
- ZEND_ARG_INFO(0, seconds)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ main/sapi.c */
-ZEND_BEGIN_ARG_INFO(arginfo_header_register_callback, 0)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ main/output.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0)
- ZEND_ARG_INFO(0, user_function)
- ZEND_ARG_INFO(0, chunk_size)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_clean, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_end_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_end_clean, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_clean, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_contents, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_level, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_length, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_list_handlers, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_status, 0, 0, 0)
- ZEND_ARG_INFO(0, full_status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_implicit_flush, 0, 0, 0)
- ZEND_ARG_INFO(0, flag)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_output_reset_rewrite_vars, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_output_add_rewrite_var, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ main/streams/userspace.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_wrapper_register, 0, 0, 2)
- ZEND_ARG_INFO(0, protocol)
- ZEND_ARG_INFO(0, classname)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_unregister, 0)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_restore, 0)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ array.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_krsort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ksort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_count, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_natsort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_natcasesort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_asort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arsort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rsort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_usort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, cmp_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_uasort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, cmp_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_uksort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, cmp_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_end, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_prev, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_next, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reset, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_current, 0)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_key, 0)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_max, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk, 0, 0, 2)
- ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, funcname)
- ZEND_ARG_INFO(0, userdata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk_recursive, 0, 0, 2)
- ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, funcname)
- ZEND_ARG_INFO(0, userdata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_in_array, 0, 0, 2)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_extract, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, extract_type)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_compact, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, var_names)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_fill, 0)
- ZEND_ARG_INFO(0, start_key)
- ZEND_ARG_INFO(0, num)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_fill_keys, 0)
- ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_range, 0, 0, 2)
- ZEND_ARG_INFO(0, low)
- ZEND_ARG_INFO(0, high)
- ZEND_ARG_INFO(0, step)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_shuffle, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_push, 0, 0, 1)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
- ZEND_ARG_VARIADIC_INFO(0, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_pop, 0)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_shift, 0)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unshift, 0, 0, 1)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
- ZEND_ARG_VARIADIC_INFO(0, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_splice, 0, 0, 2)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, replacement) /* ARRAY_INFO(0, arg, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_slice, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, preserve_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge, 0, 0, 0)
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge_recursive, 0, 0, 0)
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace, 0, 0, 1)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace_recursive, 0, 0, 1)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_keys, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, search_value)
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_key_first, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_key_last, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_values, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_count_values, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_column, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, column_key)
- ZEND_ARG_INFO(0, index_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reverse, 0, 0, 1)
- ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, preserve_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_pad, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, pad_size)
- ZEND_ARG_INFO(0, pad_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_flip, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_change_key_case, 0, 0, 1)
- ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, case)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unique, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_key, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_ukey, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_assoc, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_assoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_compare_func)
- ZEND_ARG_INFO(0, callback_key_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_key, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_diff_ukey, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_udiff, 0)
- ZEND_ARG_INFO(0, arr1)
- ZEND_ARG_INFO(0, arr2)
- ZEND_ARG_INFO(0, callback_data_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_assoc, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_diff_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_assoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_comp_func)
- ZEND_ARG_INFO(0, callback_key_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
- ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, num_req)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_sum, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_product, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, initial)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_filter, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, use_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_map, 0, 0, 2)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_array_key_exists, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, search)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_chunk, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, preserve_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_combine, 0)
- ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */
- ZEND_ARG_INFO(0, values) /* ARRAY_INFO(0, values, 0) */
-ZEND_END_ARG_INFO()
-/* }}} */
/* {{{ basic_functions.c */
ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_gpc, 0)
ZEND_END_ARG_INFO()
@@ -607,18 +131,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_constant, 0)
ZEND_ARG_INFO(0, const_name)
ZEND_END_ARG_INFO()
-#ifdef HAVE_INET_NTOP
-ZEND_BEGIN_ARG_INFO(arginfo_inet_ntop, 0)
- ZEND_ARG_INFO(0, in_addr)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_INET_PTON
-ZEND_BEGIN_ARG_INFO(arginfo_inet_pton, 0)
- ZEND_ARG_INFO(0, ip_address)
-ZEND_END_ARG_INFO()
-#endif
-
ZEND_BEGIN_ARG_INFO(arginfo_ip2long, 0)
ZEND_ARG_INFO(0, ip_address)
ZEND_END_ARG_INFO()
@@ -803,7 +315,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_unregister_tick_function, 0)
ZEND_ARG_INFO(0, function_name)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_uploaded_file, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_uploaded_file, _IS_BOOL, 0)
ZEND_ARG_INFO(0, path)
ZEND_END_ARG_INFO()
@@ -834,46 +346,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0)
ZEND_END_ARG_INFO()
#endif
/* }}} */
-/* {{{ assert.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_assert, 0, 0, 1)
- ZEND_ARG_INFO(0, assertion)
- ZEND_ARG_INFO(0, description)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1)
- ZEND_ARG_INFO(0, what)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ base64.c */
-ZEND_BEGIN_ARG_INFO(arginfo_base64_encode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-/* }}} */
/* {{{ browscap.c */
ZEND_BEGIN_ARG_INFO_EX(arginfo_get_browser, 0, 0, 0)
ZEND_ARG_INFO(0, browser_name)
ZEND_ARG_INFO(0, return_array)
ZEND_END_ARG_INFO()
/* }}} */
-/* {{{ crc32.c */
-ZEND_BEGIN_ARG_INFO(arginfo_crc32, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-/* {{{ crypt.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_crypt, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, salt)
-ZEND_END_ARG_INFO()
-/* }}} */
/* {{{ cyr_convert.c */
ZEND_BEGIN_ARG_INFO(arginfo_convert_cyr_string, 0)
ZEND_ARG_INFO(0, str)
@@ -1094,12 +572,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0)
ZEND_ARG_INFO(0, fp)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, format)
@@ -1310,27 +782,27 @@ ZEND_BEGIN_ARG_INFO(arginfo_filetype, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_writable, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_writable, _IS_BOOL, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_readable, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_readable, _IS_BOOL, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_executable, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_executable, _IS_BOOL, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_file, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_file, _IS_BOOL, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_dir, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_dir, _IS_BOOL, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_link, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_link, _IS_BOOL, 0)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
@@ -1396,95 +868,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pfsockopen, 0, 0, 1)
ZEND_ARG_INFO(0, timeout)
ZEND_END_ARG_INFO()
/* }}} */
-/* {{{ ftok.c */
-#if HAVE_FTOK
-ZEND_BEGIN_ARG_INFO(arginfo_ftok, 0)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, proj)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ head.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_header, 0, 0, 1)
- ZEND_ARG_INFO(0, header)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, http_response_code)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_header_remove, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_setcookie, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, expires_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_setrawcookie, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, expires_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_headers_sent, 0, 0, 0)
- ZEND_ARG_INFO(1, file)
- ZEND_ARG_INFO(1, line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0)
- ZEND_ARG_INFO(0, response_code)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ hrtime.c */
-ZEND_BEGIN_ARG_INFO(arginfo_hrtime, 0)
- ZEND_ARG_INFO(0, get_as_number)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ html.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, double_encode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlentities, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, double_encode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_html_translation_table, 0, 0, 0)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-/* }}} */
/* {{{ http.c */
ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0, 1)
ZEND_ARG_INFO(0, formdata)
@@ -1545,12 +928,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_iptcparse, 0)
ZEND_ARG_INFO(0, iptcdata)
ZEND_END_ARG_INFO()
/* }}} */
-
-/* {{{ lcg.c */
-ZEND_BEGIN_ARG_INFO(arginfo_lcg_value, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ levenshtein.c */
ZEND_BEGIN_ARG_INFO_EX(arginfo_levenshtein, 0, 0, 2)
ZEND_ARG_INFO(0, str1)
@@ -1613,71 +990,71 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_round, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_sin, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_sin, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_cos, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_cos, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_tan, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_tan, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_asin, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_asin, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_acos, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_acos, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_atan, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_atan, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_atan2, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_atan2, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, y)
ZEND_ARG_INFO(0, x)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_sinh, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_sinh, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_cosh, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_cosh, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_tanh, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_tanh, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_asinh, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_asinh, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_acosh, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_acosh, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_atanh, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_atanh, IS_DOUBLE, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_pi, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_pi, IS_DOUBLE, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_finite, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_finite, _IS_BOOL, 0)
ZEND_ARG_INFO(0, val)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_infinite, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_infinite, _IS_BOOL, 0)
ZEND_ARG_INFO(0, val)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_nan, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_nan, _IS_BOOL, 0)
ZEND_ARG_INFO(0, val)
ZEND_END_ARG_INFO()
@@ -1766,28 +1143,17 @@ ZEND_BEGIN_ARG_INFO(arginfo_fmod, 0)
ZEND_ARG_INFO(0, y)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_intdiv, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_fdiv, 0)
ZEND_ARG_INFO(0, dividend)
ZEND_ARG_INFO(0, divisor)
ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ md5.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_md5, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ metaphone.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, phones)
+ZEND_BEGIN_ARG_INFO(arginfo_intdiv, 0)
+ ZEND_ARG_INFO(0, dividend)
+ ZEND_ARG_INFO(0, divisor)
ZEND_END_ARG_INFO()
/* }}} */
+
/* {{{ microtime.c */
#ifdef HAVE_GETTIMEOFDAY
ZEND_BEGIN_ARG_INFO_EX(arginfo_microtime, 0, 0, 0)
@@ -1817,22 +1183,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_unpack, 0, 0, 2)
ZEND_ARG_INFO(0, offset)
ZEND_END_ARG_INFO()
/* }}} */
-/* {{{ pageinfo.c */
-ZEND_BEGIN_ARG_INFO(arginfo_getmyuid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getmygid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getmypid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getmyinode, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getlastmod, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
/* {{{ password.c */
ZEND_BEGIN_ARG_INFO_EX(arginfo_password_hash, 0, 0, 2)
ZEND_ARG_INFO(0, password)
@@ -1913,17 +1263,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_random_int, 0, 0, 2)
ZEND_ARG_INFO(0, max)
ZEND_END_ARG_INFO()
/* }}} */
-/* {{{ sha1.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-/* }}} */
/* {{{ soundex.c */
ZEND_BEGIN_ARG_INFO(arginfo_soundex, 0)
ZEND_ARG_INFO(0, str)
@@ -2133,377 +1472,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_shutdown, 0)
ZEND_END_ARG_INFO()
#endif
/* }}} */
-/* {{{ string.c */
-ZEND_BEGIN_ARG_INFO(arginfo_bin2hex, 0)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hex2bin, 0)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, mask)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strcspn, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, mask)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-#if HAVE_NL_LANGINFO
-ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0)
- ZEND_ARG_INFO(0, item)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, character_mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rtrim, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, character_mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ltrim, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, character_mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_wordwrap, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, width)
- ZEND_ARG_INFO(0, break)
- ZEND_ARG_INFO(0, cut)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_explode, 0, 0, 2)
- ZEND_ARG_INFO(0, separator)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_implode, 0)
- ZEND_ARG_INFO(0, glue)
- ZEND_ARG_INFO(0, pieces)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strtok, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, token)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strtoupper, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strtolower, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_basename, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, suffix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dirname, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, levels)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pathinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stristr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strstr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strrpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strrchr, 0)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_chunk_split, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, chunklen)
- ZEND_ARG_INFO(0, ending)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_quotemeta, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ord, 0)
- ZEND_ARG_INFO(0, character)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_chr, 0)
- ZEND_ARG_INFO(0, codepoint)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ucfirst, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, delimiters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, from)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strrev, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_similar_text, 0, 0, 2)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
- ZEND_ARG_INFO(1, percent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_addcslashes, 0)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, charlist)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_addslashes, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stripcslashes, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stripslashes, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, search)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, replace_count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_ireplace, 0, 0, 3)
- ZEND_ARG_INFO(0, search)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, replace_count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrev, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, max_chars_per_line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrevc, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, max_chars_per_line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_nl2br, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, is_xhtml)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strip_tags, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2)
- ZEND_ARG_INFO(0, category)
- ZEND_ARG_VARIADIC_INFO(0, locales)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1)
- ZEND_ARG_INFO(0, encoded_string)
- ZEND_ARG_INFO(1, result)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_getcsv, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, delimiter)
- ZEND_ARG_INFO(0, enclosure)
- ZEND_ARG_INFO(0, escape)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_str_repeat, 0)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, mult)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_count_chars, 0, 0, 1)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strnatcmp, 0)
- ZEND_ARG_INFO(0, s1)
- ZEND_ARG_INFO(0, s2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_localeconv, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strnatcasecmp, 0)
- ZEND_ARG_INFO(0, s1)
- ZEND_ARG_INFO(0, s2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_count, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_pad, 0, 0, 2)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, pad_length)
- ZEND_ARG_INFO(0, pad_string)
- ZEND_ARG_INFO(0, pad_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(1, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_str_rot13, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_str_shuffle, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_word_count, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, charlist)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_STRFMON
-ZEND_BEGIN_ARG_INFO(arginfo_money_format, 0)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_split, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, split_length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strpbrk, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, char_list)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3)
- ZEND_ARG_INFO(0, main_str)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, case_sensitivity)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ syslog.c */
-#ifdef HAVE_SYSLOG_H
-ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0)
- ZEND_ARG_INFO(0, ident)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, facility)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_syslog, 0)
- ZEND_ARG_INFO(0, priority)
- ZEND_ARG_INFO(0, message)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
/* {{{ type.c */
ZEND_BEGIN_ARG_INFO(arginfo_gettype, 0)
ZEND_ARG_INFO(0, var)
@@ -2531,57 +1499,57 @@ ZEND_BEGIN_ARG_INFO(arginfo_boolval, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_null, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_resource, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_resource, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_bool, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_bool, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_int, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_int, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_float, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_float, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_string, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_string, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_array, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_array, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_object, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_object, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_numeric, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_numeric, _IS_BOOL, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_scalar, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_scalar, _IS_BOOL, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_is_callable, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_callable, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_ARG_INFO(0, syntax_only)
ZEND_ARG_INFO(1, callable_name)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_is_iterable, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_iterable, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_is_countable, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_countable, _IS_BOOL, 0)
ZEND_ARG_INFO(0, var)
ZEND_END_ARG_INFO()
/* }}} */
@@ -2727,6 +1695,8 @@ ZEND_END_ARG_INFO()
/* }}} */
/* }}} */
+#include "basic_functions_arginfo.h"
+
static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(constant, arginfo_constant)
PHP_FE(bin2hex, arginfo_bin2hex)
@@ -2968,6 +1938,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(base_convert, arginfo_base_convert)
PHP_FE(number_format, arginfo_number_format)
PHP_FE(fmod, arginfo_fmod)
+ PHP_FE(fdiv, arginfo_fdiv)
PHP_FE(intdiv, arginfo_intdiv)
#ifdef HAVE_INET_NTOP
PHP_RAW_NAMED_FE(inet_ntop, zif_inet_ntop, arginfo_inet_ntop)
@@ -3130,7 +2101,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(feof, arginfo_feof)
PHP_FE(fgetc, arginfo_fgetc)
PHP_FE(fgets, arginfo_fgets)
- PHP_DEP_FE(fgetss, arginfo_fgetss)
PHP_FE(fread, arginfo_fread)
PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen)
PHP_FE(fpassthru, arginfo_fpassthru)
@@ -3918,7 +2888,7 @@ PHP_FUNCTION(constant)
/* }}} */
#ifdef HAVE_INET_NTOP
-/* {{{ proto string inet_ntop(string in_addr)
+/* {{{ proto string|false inet_ntop(string in_addr)
Converts a packed inet address to a human readable IP address string */
PHP_NAMED_FUNCTION(zif_inet_ntop)
{
@@ -3929,7 +2899,7 @@ PHP_NAMED_FUNCTION(zif_inet_ntop)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(address, address_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#ifdef HAVE_IPV6
if (address_len == 16) {
@@ -3950,7 +2920,7 @@ PHP_NAMED_FUNCTION(zif_inet_ntop)
#endif /* HAVE_INET_NTOP */
#ifdef HAVE_INET_PTON
-/* {{{ proto string inet_pton(string ip_address)
+/* {{{ proto string|false inet_pton(string ip_address)
Converts a human readable IP address to a packed binary string */
PHP_NAMED_FUNCTION(php_inet_pton)
{
@@ -3961,7 +2931,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(address, address_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
memset(buffer, 0, sizeof(buffer));
@@ -3985,7 +2955,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
/* }}} */
#endif /* HAVE_INET_PTON */
-/* {{{ proto int ip2long(string ip_address)
+/* {{{ proto int|false ip2long(string ip_address)
Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */
PHP_FUNCTION(ip2long)
{
@@ -4023,7 +2993,7 @@ PHP_FUNCTION(ip2long)
}
/* }}} */
-/* {{{ proto string long2ip(int proper_address)
+/* {{{ proto string|false long2ip(int proper_address)
Converts an (IPv4) Internet network address into a string in Internet standard dotted format */
PHP_FUNCTION(long2ip)
{
@@ -4058,7 +3028,7 @@ PHP_FUNCTION(long2ip)
* System Functions *
********************/
-/* {{{ proto string getenv(string varname[, bool local_only]
+/* {{{ proto string|array|false getenv([ string varname[, bool local_only]])
Get the value of an environment variable or every available environment variable
if no varname is present */
PHP_FUNCTION(getenv)
@@ -4071,7 +3041,7 @@ PHP_FUNCTION(getenv)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(str, str_len)
Z_PARAM_BOOL(local_only)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!str) {
array_init(return_value);
@@ -4353,7 +3323,7 @@ static int parse_opts(char * opts, opt_struct ** result)
}
/* }}} */
-/* {{{ proto array getopt(string options [, array longopts [, int &optind]])
+/* {{{ proto array|false getopt(string options [, array longopts [, int &optind]])
Get options from the command line argument list */
PHP_FUNCTION(getopt)
{
@@ -4374,7 +3344,7 @@ PHP_FUNCTION(getopt)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(p_longopts)
Z_PARAM_ZVAL(zoptind)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Init zoptind to 1 */
if (zoptind) {
@@ -4555,7 +3525,7 @@ PHP_FUNCTION(sleep)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(num)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (num < 0) {
php_error_docref(NULL, E_WARNING, "Number of seconds must be greater than or equal to 0");
@@ -4585,7 +3555,12 @@ PHP_FUNCTION(usleep)
php_error_docref(NULL, E_WARNING, "Number of microseconds must be greater than or equal to 0");
RETURN_FALSE;
}
- usleep((unsigned int)num);
+ if (usleep((unsigned int)num) < 0) {
+#if ZEND_DEBUG
+ php_error_docref(NULL, E_NOTICE, "usleep() failed with errno %d: %s",
+ errno, strerror(errno));
+#endif
+ }
#endif
}
/* }}} */
@@ -4629,7 +3604,7 @@ PHP_FUNCTION(time_nanosleep)
}
/* }}} */
-/* {{{ proto mixed time_sleep_until(float timestamp)
+/* {{{ proto bool time_sleep_until(float timestamp)
Make the script sleep until the specified time */
PHP_FUNCTION(time_sleep_until)
{
@@ -4728,7 +3703,7 @@ static void add_config_entries(HashTable *hash, zval *return_value) /* {{{ */
}
/* }}} */
-/* {{{ proto mixed get_cfg_var(string option_name)
+/* {{{ proto string|array|false get_cfg_var(string option_name)
Get the value of a PHP configuration option */
PHP_FUNCTION(get_cfg_var)
{
@@ -4756,7 +3731,7 @@ PHP_FUNCTION(get_cfg_var)
}
/* }}} */
-/* {{{ proto int get_magic_quotes_runtime(void)
+/* {{{ proto false get_magic_quotes_runtime(void)
Get the current active configuration setting of magic_quotes_runtime */
PHP_FUNCTION(get_magic_quotes_runtime)
{
@@ -4767,7 +3742,7 @@ PHP_FUNCTION(get_magic_quotes_runtime)
}
/* }}} */
-/* {{{ proto int get_magic_quotes_gpc(void)
+/* {{{ proto false get_magic_quotes_gpc(void)
Get the current active configuration setting of magic_quotes_gpc */
PHP_FUNCTION(get_magic_quotes_gpc)
{
@@ -5181,7 +4156,7 @@ PHPAPI void php_free_shutdown_functions(void) /* {{{ */
}
/* }}} */
-/* {{{ proto void register_shutdown_function(callback function) U
+/* {{{ proto false|null register_shutdown_function(callback function) U
Register a user-level function to be called on request termination */
PHP_FUNCTION(register_shutdown_function)
{
@@ -5280,7 +4255,7 @@ PHP_FUNCTION(highlight_file)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(i)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(filename)) {
RETURN_FALSE;
@@ -5321,7 +4296,7 @@ PHP_FUNCTION(php_strip_whitespace)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(filename, filename_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_output_start_default();
@@ -5357,7 +4332,7 @@ PHP_FUNCTION(highlight_string)
Z_PARAM_ZVAL(expr)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(i)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!try_convert_to_string(expr)) {
return;
@@ -5394,7 +4369,7 @@ PHP_FUNCTION(highlight_string)
}
/* }}} */
-/* {{{ proto string ini_get(string varname)
+/* {{{ proto string|false ini_get(string varname)
Get a configuration option */
PHP_FUNCTION(ini_get)
{
@@ -5424,7 +4399,7 @@ PHP_FUNCTION(ini_get)
}
/* }}} */
-/* {{{ proto array ini_get_all([string extension[, bool details = true]])
+/* {{{ proto array|false ini_get_all([string extension[, bool details = true]])
Get all configuration options */
PHP_FUNCTION(ini_get_all)
{
@@ -5506,7 +4481,7 @@ static int php_ini_check_path(char *option_name, size_t option_len, char *new_op
}
/* }}} */
-/* {{{ proto string ini_set(string varname, string newvalue)
+/* {{{ proto string|false ini_set(string varname, string newvalue)
Set a configuration option, returns false on error and the old value of the configuration option on success */
PHP_FUNCTION(ini_set)
{
@@ -5576,7 +4551,7 @@ PHP_FUNCTION(ini_restore)
}
/* }}} */
-/* {{{ proto string set_include_path(string new_include_path)
+/* {{{ proto string|false set_include_path(string new_include_path)
Sets the include_path configuration option */
PHP_FUNCTION(set_include_path)
{
@@ -5606,7 +4581,7 @@ PHP_FUNCTION(set_include_path)
}
/* }}} */
-/* {{{ proto string get_include_path()
+/* {{{ proto string|false get_include_path()
Get the current include_path configuration option */
PHP_FUNCTION(get_include_path)
{
@@ -5652,7 +4627,7 @@ PHP_FUNCTION(print_r)
Z_PARAM_ZVAL(var)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(do_return)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (do_return) {
RETURN_STR(zend_print_zval_r_to_str(var, 0));
@@ -5667,6 +4642,10 @@ PHP_FUNCTION(print_r)
Returns true if client disconnected */
PHP_FUNCTION(connection_aborted)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
}
/* }}} */
@@ -5675,6 +4654,10 @@ PHP_FUNCTION(connection_aborted)
Returns the connection status bitfield */
PHP_FUNCTION(connection_status)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETURN_LONG(PG(connection_status));
}
/* }}} */
@@ -5704,7 +4687,7 @@ PHP_FUNCTION(ignore_user_abort)
/* }}} */
#if HAVE_GETSERVBYNAME
-/* {{{ proto int getservbyname(string service, string protocol)
+/* {{{ proto int|false getservbyname(string service, string protocol)
Returns port associated with service. Protocol must be "tcp" or "udp" */
PHP_FUNCTION(getservbyname)
{
@@ -5747,7 +4730,7 @@ PHP_FUNCTION(getservbyname)
#endif
#if HAVE_GETSERVBYPORT
-/* {{{ proto string getservbyport(int port, string protocol)
+/* {{{ proto string|false getservbyport(int port, string protocol)
Returns service name associated with port. Protocol must be "tcp" or "udp" */
PHP_FUNCTION(getservbyport)
{
@@ -5773,7 +4756,7 @@ PHP_FUNCTION(getservbyport)
#endif
#if HAVE_GETPROTOBYNAME
-/* {{{ proto int getprotobyname(string name)
+/* {{{ proto int|false getprotobyname(string name)
Returns protocol number associated with name as per /etc/protocols */
PHP_FUNCTION(getprotobyname)
{
@@ -5797,7 +4780,7 @@ PHP_FUNCTION(getprotobyname)
#endif
#if HAVE_GETPROTOBYNUMBER
-/* {{{ proto string getprotobynumber(int proto)
+/* {{{ proto string|false getprotobynumber(int proto)
Returns protocol name associated with protocol number proto */
PHP_FUNCTION(getprotobynumber)
{
@@ -6056,7 +5039,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3,
}
/* }}} */
-/* {{{ proto array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]])
+/* {{{ proto array|false parse_ini_file(string filename [, bool process_sections [, int scanner_mode]])
Parse configuration file */
PHP_FUNCTION(parse_ini_file)
{
@@ -6072,7 +5055,7 @@ PHP_FUNCTION(parse_ini_file)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(process_sections)
Z_PARAM_LONG(scanner_mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (filename_len == 0) {
php_error_docref(NULL, E_WARNING, "Filename cannot be empty!");
@@ -6098,7 +5081,7 @@ PHP_FUNCTION(parse_ini_file)
}
/* }}} */
-/* {{{ proto array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]])
+/* {{{ proto array|false parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]])
Parse configuration string */
PHP_FUNCTION(parse_ini_string)
{
@@ -6113,7 +5096,7 @@ PHP_FUNCTION(parse_ini_string)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(process_sections)
Z_PARAM_LONG(scanner_mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (INT_MAX - str_len < ZEND_MMAP_AHEAD) {
RETVAL_FALSE;
@@ -6155,7 +5138,7 @@ PHP_FUNCTION(config_get_hash) /* {{{ */
#endif
#ifdef HAVE_GETLOADAVG
-/* {{{ proto array sys_getloadavg()
+/* {{{ proto array|false sys_getloadavg()
*/
PHP_FUNCTION(sys_getloadavg)
{
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 7e0fa6b7f0..140a51dde2 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.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, |
@@ -156,7 +154,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap);
/* Left for BC (not binary safe!) */
PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers);
PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers);
-PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore);
+PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore);
#define MT_N (624)
@@ -221,12 +219,6 @@ typedef struct _php_basic_globals {
HashTable url_adapt_session_hosts_ht;
url_adapt_state_ex_t url_adapt_output_ex;
HashTable url_adapt_output_hosts_ht;
-
-#ifdef HAVE_MMAP
- void *mmap_file;
- size_t mmap_len;
-#endif
-
HashTable *user_filter_map;
/* file.c */
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
new file mode 100755
index 0000000000..cacaa7ba3a
--- /dev/null
+++ b/ext/standard/basic_functions.stub.php
@@ -0,0 +1,598 @@
+<?php
+
+/* main/main.c */
+
+function set_time_limit(int $seconds): bool {}
+
+/* main/SAPI.c */
+
+// TODO: Make this a proper callable argument?
+function header_register_callback($callback): bool {}
+
+/* main/output.c */
+
+function ob_start(
+ $user_function = null, int $chunk_size = 0, int $flags = PHP_OUTPUT_HANDLER_STDFLAGS): bool {}
+
+function ob_flush(): bool {}
+
+function ob_clean(): bool {}
+
+function ob_end_flush(): bool {}
+
+function ob_end_clean(): bool {}
+
+/** @return string|false */
+function ob_get_flush() {}
+
+/** @return string|false */
+function ob_get_clean() {}
+
+/** @return string|false */
+function ob_get_contents() {}
+
+function ob_get_level(): int {}
+
+/** @return int|false */
+function ob_get_length() {}
+
+function ob_list_handlers(): array {}
+
+function ob_get_status(bool $full_status = false): array {}
+
+// TODO: Shouldn't this be a bool argument?
+function ob_implicit_flush(int $flag = 1): void {}
+
+function output_reset_rewrite_vars(): bool {}
+
+function output_add_rewrite_var(string $name, string $value): bool {}
+
+/* main/streams/userspace.c */
+
+function stream_wrapper_register(string $protocol, string $classname, int $flags = 0): bool {}
+
+function stream_wrapper_unregister(string $protocol): bool {}
+
+function stream_wrapper_restore(string $protocol): bool {}
+
+/* array.c */
+
+function array_push(array &$stack, ...$args): int {}
+
+function krsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function ksort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+/** @param array|Countable $array */
+function count($var, int $mode = COUNT_NORAML): int {}
+
+function natsort(array &$arg): bool {}
+
+function natcasesort(array &$arg): bool {}
+
+function asort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function arsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function sort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function rsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function usort(array &$arg, callable $cmp_function): bool {}
+
+function uasort(array &$arg, callable $cmp_function): bool {}
+
+function uksort(array &$arg, callable $cmp_function): bool {}
+
+/**
+ * @param array|object $arg
+ * @return mixed
+ */
+function end(array &$arg) {}
+
+/**
+ * @param array|object $arg
+ * @return mixed
+ */
+function prev(&$arg) {}
+
+/**
+ * @param array|object $arg
+ * @return mixed
+ */
+function next(&$arg) {}
+
+/**
+ * @param array|object $arg
+ * @return mixed
+ */
+function reset(&$arg) {}
+
+/**
+ * @param array|object $arg
+ * @return mixed
+ */
+function current($arg) {}
+
+/**
+ * @param array|object $arg
+ * @return int|string|null
+ */
+function key($arg) {}
+
+/** @return mixed */
+function min($arg, ...$args) {}
+
+/** @return mixed */
+function max($arg, ...$args) {}
+
+/** @param array|object $input */
+function array_walk(&$input, callable $funcname, $userdata = null): bool {}
+
+/** @param array|object $input */
+function array_walk_recursive(&$input, callable $funcname, $userdata = null): bool {}
+
+function in_array($needle, array $haystack, bool $strict = false): bool {}
+
+/** @return int|string|false */
+function array_search($needle, array $haystack, bool $strict = false) {}
+
+/** @prefer-ref $arg */
+function extract(array &$arg, int $extract_type = EXTR_OVERWRITE, string $prefix = ""): int {}
+
+function compact($var_name, ...$var_names): array {}
+
+function array_fill(int $start_key, int $num, $val): array {}
+
+function array_fill_keys(array $keys, $val): array {}
+
+/**
+ * @param int|float|string $low
+ * @param int|float|string $high
+ * @param int|float $step
+ */
+function range($low, $high, $step = 1): array {}
+
+function shuffle(array &$arg): bool {}
+
+/** @return mixed */
+function array_pop(array &$stack) {}
+
+/** @return mixed */
+function array_shift(array &$stack) {}
+
+function array_unshift(array &$stack, ...$vars): int {}
+
+function array_splice(array &$arg, int $offset, ?int $length = null, $replacement = []): array {}
+
+function array_slice(array $arg, int $offset, ?int $length = null, bool $preserve_keys = false): array {}
+
+function array_merge(array ...$arrays): array {}
+
+function array_merge_recursive(array ...$arrays): array {}
+
+function array_replace(array $arr1, array ...$arrays): array {}
+
+function array_replace_recursive(array $arr1, array ...$arrays): array {}
+
+function array_keys(array $arg, $search_value = UNKNOWN, bool $strict = false): array {}
+
+/** @return int|string|null */
+function array_key_first(array $arg) {}
+
+/** @return int|string|null */
+function array_key_last(array $arg) {}
+
+function array_values(array $arg): array {}
+
+function array_count_values(array $arg): array {}
+
+/**
+ * @param int|string|null $column_key
+ * @param int|string|null $index_key
+ */
+function array_column(array $arg, $column_key, $index_key = null): array {}
+
+function array_reverse(array $input, bool $preserve_keys = false): array {}
+
+function array_pad(array $arg, int $pad_size, $pad_value): array {}
+
+function array_flip(array $arg): array {}
+
+function array_change_key_case(array $input, int $case = CASE_LOWER): array {}
+
+function array_unique(array $arg, int $flags = SORT_STRING): array {}
+
+function array_intersect_key(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_intersect_ukey(array $arr1, array $arr2, ...$rest): array {}
+
+function array_intersect(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_uintersect(array $arr1, array $arr2, ...$rest): array {}
+
+function array_intersect_assoc(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_uintersect_assoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_intersect_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_uintersect_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_diff_key(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_diff_ukey(array $arr1, array $arr2, ...$rest): array {}
+
+function array_diff(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_udiff(array $arr1, array $arr2, ...$rest): array {}
+
+function array_diff_assoc(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_diff_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_udiff_assoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_udiff_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+/**
+ * @prefer-ref $arr1
+ * @prefer-ref $sort_order
+ * @prefer-ref $sort_flags
+ * @prefer-ref $arr2
+ */
+function array_multisort(&$arr1, $sort_order = SORT_ASC, $sort_flags = SORT_REGULAR, &...$arr2): bool {}
+
+/** @return int|string|array */
+function array_rand(array $arg, int $num_req = 1) {}
+
+/** @return int|float */
+function array_sum(array $arg) {}
+
+/** @return int|float */
+function array_product(array $arg) {}
+
+function array_reduce(array $arg, callable $callback, $initial = null) {}
+
+function array_filter(array $arg, callable $callback = UNKNOWN, int $use_keys = 0): array {}
+
+function array_map(?callable $callback, array $arr1, array ...$arrays): array {}
+
+/**
+ * @param int|string $key
+ * @param array|object $search
+ */
+function array_key_exists($key, $search): bool {}
+
+function array_chunk(array $arg, int $size, bool $preserve_keys = false): array {}
+
+function array_combine(array $keys, array $values): array {}
+
+/* base64.c */
+
+function base64_encode(string $str): string {}
+
+/** @return string|false */
+function base64_decode(string $str, bool $strict = false) {}
+
+/* crc32.c */
+
+function crc32(string $str): int {}
+
+/* crypt.c */
+
+function crypt(string $str, string $salt = UNKNOWN): string {}
+
+/* ftok.c */
+
+#if HAVE_FTOK
+function ftok(string $pathname, string $proj): int {}
+#endif
+
+/* hrtime.c */
+
+/** @return array|int|float|false */
+function hrtime(bool $get_as_number = false) {}
+
+/* lcg.c */
+
+function lcg_value(): float {}
+
+/* md5.c */
+
+function md5(string $str, bool $raw_output = false): string {}
+
+/** @return string|false */
+function md5_file(string $filename, bool $raw_output = false) {}
+
+/* pageinfo.c */
+
+/** @return int|false */
+function getmyuid() {}
+
+/** @return int|false */
+function getmygid() {}
+
+/** @return int|false */
+function getmypid() {}
+
+/** @return int|false */
+function getmyinode() {}
+
+function getlastmod(): int {}
+
+/* sha1.c */
+
+function sha1(string $str, bool $raw_output = false): string {}
+
+/** @return string|false */
+function sha1_file(string $filename, bool $raw_output = false) {}
+
+/* syslog.c */
+
+#ifdef HAVE_SYSLOG_H
+function openlog (string $ident, int $option, int $facility): bool {}
+
+function closelog (): bool {}
+
+function syslog (int $priority, string $message): bool {}
+#endif
+
+#ifdef HAVE_INET_NTOP
+/** @return string|false */
+function inet_ntop (string $in_addr) {}
+#endif
+
+#ifdef HAVE_INET_PTON
+/** @return string|false */
+function inet_pton (string $ip_address) {}
+#endif
+
+/* metaphone.c */
+
+/** @return string|false */
+function metaphone(string $text, int $phones = 0) {}
+
+/* {{{ head.c */
+function header(string $string, bool $replace = true, int $http_response_code = 0): void { }
+
+function header_remove(string $name = UNKNOWN): void { }
+
+/** @param int|array $expires_or_options */
+function setrawcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {}
+
+
+/** @param int|array $expires_or_options */
+function setcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {}
+
+/** @return int|bool */
+function http_response_code(int $response_code = 0) {}
+
+function headers_sent(&$file = null, &$line = null): bool {}
+
+function headers_list(): array { }
+
+/* {{{ html.c */
+
+function htmlspecialchars(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {}
+
+/** @return string|false */
+function htmlspecialchars_decode(string $string, int $quote_style = ENT_COMPAT) {}
+
+/** @return string|false */
+function html_entity_decode(string $string, int $quote_style = ENT_COMPAT, string $encoding = UNKNOWN) {}
+
+function htmlentities(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {}
+
+function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $quote_style = ENT_COMPAT, string $encoding = "UTF-8"): array {}
+
+/* }}} */
+
+/* assert.c */
+
+/** @param mixed $assertion */
+function assert($assertion, $description = null): bool {}
+
+/** @return int|string|bool|null */
+function assert_options(int $what, $value = UNKNOWN) {}
+
+/* string.c */
+
+function bin2hex(string $data): string {}
+
+/** @return string|false */
+function hex2bin(string $data) {}
+
+/** @return int|false */
+function strspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN) {}
+
+/** @return int|false */
+function strcspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN) {}
+
+#if HAVE_NL_LANGINFO
+/** @return string|false */
+function nl_langinfo(int $item) {}
+#endif
+
+function strcoll(string $str1, string $str2): int {}
+
+function trim(string $str, string $character_mask = " \n\r\t\v\0"): string {}
+
+function rtrim(string $str, string $character_mask = " \n\r\t\v\0"): string {}
+
+function ltrim(string $str, string $character_mask = " \n\r\t\v\0"): string {}
+
+function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut = false): string {}
+
+function explode(string $separator, string $str, int $limit = PHP_INT_MAX): array {}
+
+/**
+ * @param string $glue Optional - defaults to empty string
+ * @param array $pieces
+ */
+function implode($glue, $pieces = UNKNOWN): string {}
+
+/**
+ * @param string $str Optional - defaults to previous string
+ * @param string $token
+ * @return string|false
+ */
+function strtok(string $str, string $token = UNKNOWN) {}
+
+function strtoupper(string $str): string {}
+
+function strtolower(string $str): string {}
+
+function basename(string $path, string $suffix = ""): string {}
+
+function dirname(string $path, int $levels = 1): string {}
+
+/** @return array|string */
+function pathinfo(string $path, int $options = UNKNOWN) {}
+
+/** @return string|false */
+function stristr(string $haystack, string $needle, bool $before_needle = false) {}
+
+/** @return string|false */
+function strstr(string $haystack, string $needle, bool $before_needle = false) {}
+
+/** @return int|false */
+function strpos(string $haystack, string $needle, int $offset = 0) {}
+
+/** @return int|false */
+function stripos(string $haystack, string $needle, int $offset = 0) {}
+
+/** @return int|false */
+function strrpos(string $haystack, string $needle, int $offset = 0) {}
+
+/** @return int|false */
+function strripos(string $haystack, string $needle, int $offset = 0) {}
+
+/** @return string|false */
+function strrchr(string $haystack, string $needle) {}
+
+function chunk_split(string $str, int $chunklen = 76, string $ending = "\r\n"): string {}
+
+/** @return string|false */
+function substr(string $str, int $start, ?int $length = null) {}
+
+/**
+ * @param mixed $str
+ * @param mixed $replace
+ * @param mixed $start
+ * @param mixed $length
+ * @return string|array|false
+ */
+function substr_replace($str, $replace, $start, $length = UNKNOWN) {}
+
+function quotemeta(string $str): string {}
+
+function ord(string $character): int {}
+
+function chr(int $codepoint): string {}
+
+function ucfirst(string $str): string {}
+
+function lcfirst(string $str): string {}
+
+function ucwords(string $str, string $delimiters = " \t\r\n\f\v"): string {}
+
+/**
+ * @param string|array $from
+ * @return string|false
+ */
+function strtr(string $str, $from, string $to = UNKNOWN) {}
+
+function strrev(string $str): string {}
+
+/** @param float $percent */
+function similar_text(string $str1, string $str2, &$percent = null): int {}
+
+function addcslashes(string $str, string $charlist): string {}
+
+function addslashes(string $str): string {}
+
+function stripcslashes(string $str): string {}
+
+function stripslashes(string $str): string {}
+
+/**
+ * @param string|array $search
+ * @param string|array $replace
+ * @param string|array $subject
+ * @param int $replace_count
+ * @return string|array
+ */
+function str_replace($search, $replace, $subject, &$replace_count = UNKNOWN) {}
+
+/**
+ * @param string|array $search
+ * @param string|array $replace
+ * @param string|array $subject
+ * @param int $replace_count
+ * @return string|array
+ */
+function str_ireplace($search, $replace, $subject, &$replace_count = UNKNOWN) {}
+
+function hebrev(string $str, int $max_chars_per_line = 0): string {}
+
+function hebrevc(string $str, int $max_chars_per_line = 0): string {}
+
+function nl2br(string $str, bool $is_xhtml = true): string {}
+
+/** @param mixed $allowable_tags */
+function strip_tags(string $str, $allowable_tags = UNKNOWN): string {}
+
+/**
+ * @param string|array $locales
+ * @return string|false
+ */
+function setlocale(int $category, $locales, ...$rest) {}
+
+/** @param array $result */
+function parse_str(string $encoded_string, &$result): void {}
+
+function str_getcsv(string $string, string $delimiter = ',', string $enclosure = '"', string $escape = '\\'): array {}
+
+function str_repeat(string $input, int $mult): string {}
+
+/** @return array|string */
+function count_chars(string $input, int $mode = 0) {}
+
+function strnatcmp(string $s1, string $s2): int {}
+
+function localeconv(): array {}
+
+function strnatcasecmp(string $s1, string $s2): int {}
+
+/** @return int|false */
+function substr_count(string $haystack, string $needle, int $offset = 0, ?int $length = null) {}
+
+function str_pad(string $input, int $pad_length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT): string {}
+
+/** @return array|int|null */
+function sscanf(string $str, string $format, &...$vars) {}
+
+function str_rot13(string $str): string {}
+
+function str_shuffle(string $str): string {}
+
+/** @return array|int */
+function str_word_count(string $str, int $format = 0, string $charlist = UNKNOWN) {}
+
+#ifdef HAVE_STRFMON
+/** @return string|false */
+function money_format(string $format, float $value) {}
+#endif
+
+function str_split(string $str, int $split_length = 1): array {}
+
+/** @return string|false */
+function strpbrk(string $haystack, string $char_list) {}
+
+/** @return int|false */
+function substr_compare(string $main_str, string $str, int $offset, ?int $length = null, bool $case_insensitivity = false) {}
+
+function utf8_encode(string $data): string {}
+
+function utf8_decode(string $data): string {}
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
new file mode 100755
index 0000000000..40bac9cc7e
--- /dev/null
+++ b/ext/standard/basic_functions_arginfo.h
@@ -0,0 +1,807 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_register_callback, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_start, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, user_function)
+ ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_flush, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ob_clean arginfo_ob_flush
+
+#define arginfo_ob_end_flush arginfo_ob_flush
+
+#define arginfo_ob_end_clean arginfo_ob_flush
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_flush, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ob_get_clean arginfo_ob_get_flush
+
+#define arginfo_ob_get_contents arginfo_ob_get_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_get_level, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ob_get_length arginfo_ob_get_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_list_handlers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_get_status, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, full_status, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_implicit_flush, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, flag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_output_reset_rewrite_vars arginfo_ob_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_output_add_rewrite_var, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_wrapper_register, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_wrapper_unregister, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_wrapper_restore arginfo_stream_wrapper_unregister
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_push, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_krsort, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, sort_flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ksort arginfo_krsort
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, var)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_natsort, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_natcasesort arginfo_natsort
+
+#define arginfo_asort arginfo_krsort
+
+#define arginfo_arsort arginfo_krsort
+
+#define arginfo_sort arginfo_krsort
+
+#define arginfo_rsort arginfo_krsort
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_usort, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, cmp_function, IS_CALLABLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_uasort arginfo_usort
+
+#define arginfo_uksort arginfo_usort
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_end, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_prev, 0, 0, 1)
+ ZEND_ARG_INFO(1, arg)
+ZEND_END_ARG_INFO()
+
+#define arginfo_next arginfo_prev
+
+#define arginfo_reset arginfo_prev
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_current, 0, 0, 1)
+ ZEND_ARG_INFO(0, arg)
+ZEND_END_ARG_INFO()
+
+#define arginfo_key arginfo_current
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1)
+ ZEND_ARG_INFO(0, arg)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+#define arginfo_max arginfo_min
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_walk, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, input)
+ ZEND_ARG_TYPE_INFO(0, funcname, IS_CALLABLE, 0)
+ ZEND_ARG_INFO(0, userdata)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_walk_recursive arginfo_array_walk
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_in_array, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, needle)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2)
+ ZEND_ARG_INFO(0, needle)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extract, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_compact, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, var_name)
+ ZEND_ARG_VARIADIC_INFO(0, var_names)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill, 0, 3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, start_key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0)
+ ZEND_ARG_INFO(0, val)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill_keys, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, val)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_range, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, low)
+ ZEND_ARG_INFO(0, high)
+ ZEND_ARG_INFO(0, step)
+ZEND_END_ARG_INFO()
+
+#define arginfo_shuffle arginfo_natsort
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_pop, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_shift arginfo_array_pop
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unshift, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_INFO(0, vars)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_splice, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_INFO(0, replacement)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_slice, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_merge, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_merge_recursive arginfo_array_merge
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_replace, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_replace_recursive arginfo_array_replace
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_keys, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, search_value)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_key_first, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_key_last arginfo_array_key_first
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_values, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_count_values arginfo_array_values
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_column, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, column_key)
+ ZEND_ARG_INFO(0, index_key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_reverse, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_pad, 0, 3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_size, IS_LONG, 0)
+ ZEND_ARG_INFO(0, pad_value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_flip arginfo_array_values
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_change_key_case, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, case, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unique, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_key, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr2, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_ukey, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr2, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_INFO(0, rest)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_intersect arginfo_array_intersect_key
+
+#define arginfo_array_uintersect arginfo_array_intersect_ukey
+
+#define arginfo_array_intersect_assoc arginfo_array_intersect_key
+
+#define arginfo_array_uintersect_assoc arginfo_array_intersect_ukey
+
+#define arginfo_array_intersect_uassoc arginfo_array_intersect_ukey
+
+#define arginfo_array_uintersect_uassoc arginfo_array_intersect_ukey
+
+#define arginfo_array_diff_key arginfo_array_intersect_key
+
+#define arginfo_array_diff_ukey arginfo_array_intersect_ukey
+
+#define arginfo_array_diff arginfo_array_intersect_key
+
+#define arginfo_array_udiff arginfo_array_intersect_ukey
+
+#define arginfo_array_diff_assoc arginfo_array_intersect_key
+
+#define arginfo_array_diff_uassoc arginfo_array_intersect_ukey
+
+#define arginfo_array_udiff_assoc arginfo_array_intersect_ukey
+
+#define arginfo_array_udiff_uassoc arginfo_array_intersect_ukey
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_multisort, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
+ ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, num_req, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_sum arginfo_array_key_first
+
+#define arginfo_array_product arginfo_array_key_first
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_INFO(0, initial)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, use_keys, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_map, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_key_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, search)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_chunk, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_combine, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, values, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_base64_encode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_crc32, 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_crypt, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_FTOK
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftok, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, proj, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_hrtime, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, get_as_number, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lcg_value, 0, 0, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_md5, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getmyuid arginfo_ob_get_flush
+
+#define arginfo_getmygid arginfo_ob_get_flush
+
+#define arginfo_getmypid arginfo_ob_get_flush
+
+#define arginfo_getmyinode arginfo_ob_get_flush
+
+#define arginfo_getlastmod arginfo_ob_get_level
+
+#define arginfo_sha1 arginfo_md5
+
+#define arginfo_sha1_file arginfo_md5_file
+
+#if defined(HAVE_SYSLOG_H)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openlog, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, ident, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, facility, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYSLOG_H)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_closelog, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYSLOG_H)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_syslog, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_INET_NTOP)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_inet_ntop, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, in_addr, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_INET_PTON)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_inet_pton, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, ip_address, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, phones, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, replace, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, http_response_code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_remove, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_setrawcookie, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(0, expires_or_options)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, secure, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, httponly, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_setcookie arginfo_setrawcookie
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, response_code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_headers_sent, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, file)
+ ZEND_ARG_INFO(1, line)
+ZEND_END_ARG_INFO()
+
+#define arginfo_headers_list arginfo_ob_list_handlers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_htmlspecialchars, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, double_encode, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_htmlentities arginfo_htmlspecialchars
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_html_translation_table, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_assert, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, assertion)
+ ZEND_ARG_INFO(0, description)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bin2hex, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_hex2bin, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mask, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strcspn arginfo_strspn
+
+#if HAVE_NL_LANGINFO
+ZEND_BEGIN_ARG_INFO_EX(arginfo_nl_langinfo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, item, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strcoll, 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_WITH_RETURN_TYPE_INFO_EX(arginfo_trim, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, character_mask, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_rtrim arginfo_trim
+
+#define arginfo_ltrim arginfo_trim
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_wordwrap, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, break, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cut, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_explode, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, separator, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_implode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, glue)
+ ZEND_ARG_INFO(0, pieces)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strtok, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, token, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strtoupper arginfo_base64_encode
+
+#define arginfo_strtolower arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_basename, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, suffix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dirname, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, levels, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pathinfo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stristr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, before_needle, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strstr arginfo_stristr
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strpos, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stripos arginfo_strpos
+
+#define arginfo_strrpos arginfo_strpos
+
+#define arginfo_strripos arginfo_strpos
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strrchr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chunk_split, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, chunklen, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ending, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_substr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_replace, 0, 0, 3)
+ ZEND_ARG_INFO(0, str)
+ ZEND_ARG_INFO(0, replace)
+ ZEND_ARG_INFO(0, start)
+ ZEND_ARG_INFO(0, length)
+ZEND_END_ARG_INFO()
+
+#define arginfo_quotemeta arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ord, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, character, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chr, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, codepoint, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ucfirst arginfo_base64_encode
+
+#define arginfo_lcfirst arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ucwords, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, delimiters, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_INFO(0, from)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strrev arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_similar_text, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ ZEND_ARG_INFO(1, percent)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_addcslashes, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_addslashes arginfo_base64_encode
+
+#define arginfo_stripcslashes arginfo_base64_encode
+
+#define arginfo_stripslashes arginfo_base64_encode
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_str_replace, 0, 0, 3)
+ ZEND_ARG_INFO(0, search)
+ ZEND_ARG_INFO(0, replace)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_INFO(1, replace_count)
+ZEND_END_ARG_INFO()
+
+#define arginfo_str_ireplace arginfo_str_replace
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hebrev, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, max_chars_per_line, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_hebrevc arginfo_hebrev
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_nl2br, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_xhtml, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strip_tags, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_INFO(0, allowable_tags)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, category, IS_LONG, 0)
+ ZEND_ARG_INFO(0, locales)
+ ZEND_ARG_VARIADIC_INFO(0, rest)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_parse_str, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_INFO(1, result)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_getcsv, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, delimiter, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, enclosure, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_repeat, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mult, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_count_chars, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strnatcmp, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, s1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, s2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_localeconv arginfo_ob_list_handlers
+
+#define arginfo_strnatcasecmp arginfo_strnatcmp
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_count, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_pad, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(1, vars)
+ZEND_END_ARG_INFO()
+
+#define arginfo_str_rot13 arginfo_base64_encode
+
+#define arginfo_str_shuffle arginfo_base64_encode
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_str_word_count, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_STRFMON)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_money_format, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_split, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, split_length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strpbrk, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, char_list, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, main_str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, case_insensitivity, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_utf8_encode arginfo_bin2hex
+
+#define arginfo_utf8_decode arginfo_bin2hex
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 508f725a28..a98810bc43 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.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/ext/standard/config.m4 b/ext/standard/config.m4
index 9f85ec2b70..5b49e5d661 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -5,6 +5,10 @@ AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io],
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
int main(int argc, char **argv)
{
@@ -67,6 +71,9 @@ AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char *encrypted = crypt("rasmuslerdorf","rl");
@@ -92,6 +99,9 @@ AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
@@ -117,6 +127,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[15], answer[40];
@@ -152,6 +165,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[30], answer[70];
@@ -184,6 +200,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[21], answer[21+86];
@@ -215,6 +234,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[21], answer[21+43];
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index c3ca59036c..1393483278 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.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/ext/standard/crc32.h b/ext/standard/crc32.h
index 300af378fc..21dd4079c5 100644
--- a/ext/standard/crc32.h
+++ b/ext/standard/crc32.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/ext/standard/credits.c b/ext/standard/credits.c
index 556ffd73dd..9f7cc55039 100644
--- a/ext/standard/credits.c
+++ b/ext/standard/credits.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/ext/standard/credits.h b/ext/standard/credits.h
index dcf4669c44..e4de3ea503 100644
--- a/ext/standard/credits.h
+++ b/ext/standard/credits.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/ext/standard/crypt.c b/ext/standard/crypt.c
index b727575fad..86cddc8e53 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.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/ext/standard/css.c b/ext/standard/css.c
index 0e4afd9907..9009d95291 100644
--- a/ext/standard/css.c
+++ b/ext/standard/css.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/ext/standard/css.h b/ext/standard/css.h
index 09fbb43af0..f0b61d397a 100644
--- a/ext/standard/css.h
+++ b/ext/standard/css.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/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
index e9f45eb61f..8f0fa538dd 100644
--- a/ext/standard/cyr_convert.c
+++ b/ext/standard/cyr_convert.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/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
index dcdc023f24..edbe46b46d 100644
--- a/ext/standard/cyr_convert.h
+++ b/ext/standard/cyr_convert.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/ext/standard/datetime.c b/ext/standard/datetime.c
index b1f0f26557..ba70db4b06 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.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, |
@@ -69,7 +67,7 @@ PHPAPI char *php_std_date(time_t t)
char *strptime(const char *s, const char *format, struct tm *tm);
#endif
-/* {{{ proto string strptime(string timestamp, string format)
+/* {{{ proto array|false strptime(string timestamp, string format)
Parse a time/date generated with strftime() */
PHP_FUNCTION(strptime)
{
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
index 1718aede4b..afdabd4152 100644
--- a/ext/standard/datetime.h
+++ b/ext/standard/datetime.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/ext/standard/dir.c b/ext/standard/dir.c
index e81855fc29..e57cc4582e 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.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, |
@@ -68,21 +66,21 @@ static zend_class_entry *dir_class_entry_ptr;
myself = getThis(); \
if (myself) { \
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(myself), "handle", sizeof("handle")-1)) == NULL) { \
- php_error_docref(NULL, E_WARNING, "Unable to find my handle property"); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Unable to find my handle property"); \
+ return; \
} \
if ((dirp = (php_stream *)zend_fetch_resource_ex(tmp, "Directory", php_file_le_stream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
} else { \
if (!DIRG(default_dir) || \
(dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
} \
} else { \
if ((dirp = (php_stream *)zend_fetch_resource(Z_RES_P(id), "Directory", php_file_le_stream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
}
@@ -239,7 +237,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
}
/* }}} */
-/* {{{ proto mixed opendir(string path[, resource context])
+/* {{{ proto resource|false opendir(string path[, resource context])
Open a directory and return a dir_handle */
PHP_FUNCTION(opendir)
{
@@ -247,7 +245,7 @@ PHP_FUNCTION(opendir)
}
/* }}} */
-/* {{{ proto object dir(string directory[, resource context])
+/* {{{ proto object|false dir(string directory[, resource context])
Directory class with properties, handle and class and methods read, rewind and close */
PHP_FUNCTION(getdir)
{
@@ -255,7 +253,7 @@ PHP_FUNCTION(getdir)
}
/* }}} */
-/* {{{ proto void closedir([resource dir_handle])
+/* {{{ proto bool closedir([resource dir_handle])
Close directory connection identified by the dir_handle */
PHP_FUNCTION(closedir)
{
@@ -266,8 +264,8 @@ PHP_FUNCTION(closedir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
- RETURN_FALSE;
+ zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ return;
}
res = dirp->res;
@@ -290,7 +288,7 @@ PHP_FUNCTION(chroot)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
ret = chroot(str);
if (ret != 0) {
@@ -322,7 +320,7 @@ PHP_FUNCTION(chdir)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(str)) {
RETURN_FALSE;
@@ -382,15 +380,15 @@ PHP_FUNCTION(rewinddir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
- RETURN_FALSE;
+ zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ return;
}
php_stream_rewinddir(dirp);
}
/* }}} */
-/* {{{ proto string readdir([resource dir_handle])
+/* {{{ proto string|false readdir([resource dir_handle])
Read directory entry from dir_handle */
PHP_NAMED_FUNCTION(php_if_readdir)
{
@@ -401,8 +399,8 @@ PHP_NAMED_FUNCTION(php_if_readdir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
- RETURN_FALSE;
+ zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ return;
}
if (php_stream_readdir(dirp, &entry)) {
@@ -413,7 +411,7 @@ PHP_NAMED_FUNCTION(php_if_readdir)
/* }}} */
#ifdef HAVE_GLOB
-/* {{{ proto array glob(string pattern [, int flags])
+/* {{{ proto array|false glob(string pattern [, int flags])
Find pathnames matching a pattern */
PHP_FUNCTION(glob)
{
@@ -546,7 +544,7 @@ no_results:
/* }}} */
#endif
-/* {{{ proto array scandir(string dir [, int sorting_order [, resource context]])
+/* {{{ proto array|false scandir(string dir [, int sorting_order [, resource context]])
List files & directories inside the specified path */
PHP_FUNCTION(scandir)
{
@@ -566,8 +564,8 @@ PHP_FUNCTION(scandir)
ZEND_PARSE_PARAMETERS_END();
if (dirn_len < 1) {
- php_error_docref(NULL, E_WARNING, "Directory name cannot be empty");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Directory name cannot be empty");
+ return;
}
if (zcontext) {
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index bef2e51e6f..1edfb944fc 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.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/ext/standard/dl.h b/ext/standard/dl.h
index 0255523020..d51df044d2 100644
--- a/ext/standard/dl.h
+++ b/ext/standard/dl.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/ext/standard/dns.c b/ext/standard/dns.c
index d461a39c34..c3a9b9cde6 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.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, |
@@ -120,7 +118,7 @@ static zend_string *php_gethostbyaddr(char *ip);
static zend_string *php_gethostbyname(char *name);
#ifdef HAVE_GETHOSTNAME
-/* {{{ proto string gethostname()
+/* {{{ proto string|false gethostname()
Get the host name of the current machine */
PHP_FUNCTION(gethostname)
{
@@ -144,7 +142,7 @@ PHP_FUNCTION(gethostname)
we can have a dns.c, dns_unix.c and dns_win32.c instead of a messy dns.c full of #ifdef
*/
-/* {{{ proto string gethostbyaddr(string ip_address)
+/* {{{ proto string|false gethostbyaddr(string ip_address)
Get the Internet host name corresponding to a given IP address */
PHP_FUNCTION(gethostbyaddr)
{
@@ -227,7 +225,7 @@ PHP_FUNCTION(gethostbyname)
}
/* }}} */
-/* {{{ proto array gethostbynamel(string hostname)
+/* {{{ proto array|false gethostbynamel(string hostname)
Return a list of IP addresses that a given hostname resolves to. */
PHP_FUNCTION(gethostbynamel)
{
diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c
index 9f4b1e768b..5dc39a104b 100644
--- a/ext/standard/dns_win32.c
+++ b/ext/standard/dns_win32.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/ext/standard/exec.c b/ext/standard/exec.c
index da8b5712cf..ffa4d444dd 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.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, |
@@ -217,7 +215,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
Z_PARAM_ZVAL(ret_array)
}
Z_PARAM_ZVAL(ret_code)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!cmd_len) {
php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
@@ -249,7 +247,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
}
/* }}} */
-/* {{{ proto string exec(string command [, array &output [, int &return_value]])
+/* {{{ proto string|false exec(string command [, array &output [, int &return_value]])
Execute an external program */
PHP_FUNCTION(exec)
{
@@ -257,7 +255,7 @@ PHP_FUNCTION(exec)
}
/* }}} */
-/* {{{ proto int system(string command [, int &return_value])
+/* {{{ proto int|false system(string command [, int &return_value])
Execute an external program and display output */
PHP_FUNCTION(system)
{
@@ -265,7 +263,7 @@ PHP_FUNCTION(system)
}
/* }}} */
-/* {{{ proto void passthru(string command [, int &return_value])
+/* {{{ proto bool passthru(string command [, int &return_value])
Execute an external program and display raw output */
PHP_FUNCTION(passthru)
{
@@ -485,7 +483,7 @@ PHP_FUNCTION(escapeshellcmd)
if (command_len) {
if (command_len != strlen(command)) {
- php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes");
+ zend_type_error("Input string contains NULL bytes");
return;
}
RETVAL_STR(php_escape_shell_cmd(command));
@@ -506,17 +504,16 @@ PHP_FUNCTION(escapeshellarg)
Z_PARAM_STRING(argument, argument_len)
ZEND_PARSE_PARAMETERS_END();
- if (argument) {
- if (argument_len != strlen(argument)) {
- php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes");
- return;
- }
- RETVAL_STR(php_escape_shell_arg(argument));
+ if (argument_len != strlen(argument)) {
+ zend_type_error("Input string contains NULL bytes");
+ return;
}
+
+ RETVAL_STR(php_escape_shell_arg(argument));
}
/* }}} */
-/* {{{ proto string shell_exec(string cmd)
+/* {{{ proto string|false shell_exec(string cmd)
Execute command via shell and return complete output as string */
PHP_FUNCTION(shell_exec)
{
@@ -558,7 +555,7 @@ PHP_FUNCTION(proc_nice)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(pri)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
errno = 0;
php_ignore_value(nice(pri));
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
index 4849fe044c..b92c6dce8e 100644
--- a/ext/standard/exec.h
+++ b/ext/standard/exec.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/ext/standard/file.c b/ext/standard/file.c
index 12effbdb29..c7727a65b8 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.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, |
@@ -375,7 +373,7 @@ PHP_FUNCTION(flock)
#define PHP_META_UNSAFE ".\\+*?[^]$() "
-/* {{{ proto array get_meta_tags(string filename [, bool use_include_path])
+/* {{{ proto array|false get_meta_tags(string filename [, bool use_include_path])
Extracts all meta tag content attributes from a file and returns an array */
PHP_FUNCTION(get_meta_tags)
{
@@ -520,7 +518,7 @@ PHP_FUNCTION(get_meta_tags)
}
/* }}} */
-/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]])
+/* {{{ proto string|false file_get_contents(string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]])
Read the entire file into a string */
PHP_FUNCTION(file_get_contents)
{
@@ -578,7 +576,7 @@ PHP_FUNCTION(file_get_contents)
}
/* }}} */
-/* {{{ proto int file_put_contents(string file, mixed data [, int flags [, resource context]])
+/* {{{ proto int|false file_put_contents(string file, mixed data [, int flags [, resource context]])
Write/Create a file with contents data and return the number of bytes written */
PHP_FUNCTION(file_put_contents)
{
@@ -694,7 +692,7 @@ PHP_FUNCTION(file_put_contents)
if (Z_OBJ_HT_P(data) != NULL) {
zval out;
- if (zend_std_cast_object_tostring(data, &out, IS_STRING) == SUCCESS) {
+ if (zend_std_cast_object_tostring(Z_OBJ_P(data), &out, IS_STRING) == SUCCESS) {
numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out));
if (numbytes != Z_STRLEN(out)) {
php_error_docref(NULL, E_WARNING, "Only %zd of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out));
@@ -720,7 +718,7 @@ PHP_FUNCTION(file_put_contents)
#define PHP_FILE_BUF_SIZE 80
-/* {{{ proto array file(string filename [, int flags[, resource context]])
+/* {{{ proto array|false file(string filename [, int flags[, resource context]])
Read entire file into an array */
PHP_FUNCTION(file)
{
@@ -816,7 +814,7 @@ parse_eol:
}
/* }}} */
-/* {{{ proto string tempnam(string dir, string prefix)
+/* {{{ proto string|false tempnam(string dir, string prefix)
Create a unique filename in a directory */
PHP_FUNCTION(tempnam)
{
@@ -887,7 +885,7 @@ PHP_NAMED_FUNCTION(php_if_fopen)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(use_include_path)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -910,7 +908,7 @@ PHPAPI PHP_FUNCTION(fclose)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -927,7 +925,7 @@ PHPAPI PHP_FUNCTION(fclose)
}
/* }}} */
-/* {{{ proto resource popen(string command, string mode)
+/* {{{ proto resource|false popen(string command, string mode)
Execute a command and open either a read or a write pipe to it */
PHP_FUNCTION(popen)
{
@@ -981,7 +979,7 @@ PHP_FUNCTION(pclose)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1001,7 +999,7 @@ PHPAPI PHP_FUNCTION(feof)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1029,7 +1027,7 @@ PHPAPI PHP_FUNCTION(fgets)
Z_PARAM_RESOURCE(res)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1076,7 +1074,7 @@ PHPAPI PHP_FUNCTION(fgetc)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1093,55 +1091,6 @@ PHPAPI PHP_FUNCTION(fgetc)
}
/* }}} */
-/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]])
- Get a line from file pointer and strip HTML tags */
-PHPAPI PHP_FUNCTION(fgetss)
-{
- zval *fd;
- zend_long bytes = 0;
- size_t len = 0;
- size_t actual_len, retval_len;
- char *buf = NULL, *retval;
- php_stream *stream;
- char *allowed_tags=NULL;
- size_t allowed_tags_len=0;
-
- ZEND_PARSE_PARAMETERS_START(1, 3)
- Z_PARAM_RESOURCE(fd)
- Z_PARAM_OPTIONAL
- Z_PARAM_LONG(bytes)
- Z_PARAM_STRING(allowed_tags, allowed_tags_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- PHP_STREAM_TO_ZVAL(stream, fd);
-
- if (ZEND_NUM_ARGS() >= 2) {
- if (bytes <= 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
- RETURN_FALSE;
- }
-
- len = (size_t) bytes;
- buf = safe_emalloc(sizeof(char), (len + 1), 0);
- /*needed because recv doesn't set null char at end*/
- memset(buf, 0, len + 1);
- }
-
- if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) {
- if (buf != NULL) {
- efree(buf);
- }
- RETURN_FALSE;
- }
-
- retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len);
-
- // TODO: avoid reallocation ???
- RETVAL_STRINGL(retval, retval_len);
- efree(retval);
-}
-/* }}} */
-
/* {{{ proto mixed fscanf(resource stream, string format [, string ...])
Implements a mostly ANSI compatible fscanf() */
PHP_FUNCTION(fscanf)
@@ -1201,7 +1150,7 @@ PHPAPI PHP_FUNCTION(fwrite)
Z_PARAM_STRING(input, inputlen)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 2) {
num_bytes = inputlen;
@@ -1236,7 +1185,7 @@ PHPAPI PHP_FUNCTION(fflush)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1257,7 +1206,7 @@ PHPAPI PHP_FUNCTION(rewind)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1278,7 +1227,7 @@ PHPAPI PHP_FUNCTION(ftell)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1303,7 +1252,7 @@ PHPAPI PHP_FUNCTION(fseek)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(whence)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1353,7 +1302,7 @@ PHP_FUNCTION(mkdir)
Z_PARAM_LONG(mode)
Z_PARAM_BOOL(recursive)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1374,7 +1323,7 @@ PHP_FUNCTION(rmdir)
Z_PARAM_PATH(dir, dir_len)
Z_PARAM_OPTIONAL
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1399,7 +1348,7 @@ PHP_FUNCTION(readfile)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(use_include_path)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1430,7 +1379,7 @@ PHP_FUNCTION(umask)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(mask)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0) {
umask(oldumask);
@@ -1452,7 +1401,7 @@ PHPAPI PHP_FUNCTION(fpassthru)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1476,7 +1425,7 @@ PHP_FUNCTION(rename)
Z_PARAM_PATH(new_name, new_name_len)
Z_PARAM_OPTIONAL
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0);
@@ -1515,7 +1464,7 @@ PHP_FUNCTION(unlink)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_OPTIONAL
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1545,7 +1494,7 @@ PHP_NAMED_FUNCTION(php_if_ftruncate)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(fp)
Z_PARAM_LONG(size)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (size < 0) {
php_error_docref(NULL, E_WARNING, "Negative size is not supported");
@@ -1579,7 +1528,7 @@ PHP_NAMED_FUNCTION(php_if_fstat)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(fp)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, fp);
@@ -1798,7 +1747,7 @@ PHPAPI PHP_FUNCTION(fread)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(res)
Z_PARAM_LONG(len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1986,7 +1935,7 @@ PHPAPI ssize_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, cha
}
/* }}} */
-/* {{{ proto array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]])
+/* {{{ proto array|false fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]])
Get line from file pointer and parse for CSV fields */
PHP_FUNCTION(fgetcsv)
{
@@ -1994,8 +1943,6 @@ PHP_FUNCTION(fgetcsv)
char enclosure = '"'; /* allow this to be set as parameter */
int escape = (unsigned char) '\\';
- /* first section exactly as php_fgetss */
-
zend_long len = 0;
size_t buf_len;
char *buf;
@@ -2349,7 +2296,7 @@ out:
/* }}} */
#if HAVE_REALPATH || defined(ZTS)
-/* {{{ proto string realpath(string path)
+/* {{{ proto string|false realpath(string path)
Return the resolved path */
PHP_FUNCTION(realpath)
{
diff --git a/ext/standard/file.h b/ext/standard/file.h
index a414f722fd..4e368cf545 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.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, |
@@ -35,7 +33,6 @@ PHPAPI PHP_FUNCTION(fread);
PHPAPI PHP_FUNCTION(fgetc);
PHPAPI PHP_FUNCTION(fgets);
PHP_FUNCTION(fscanf);
-PHPAPI PHP_FUNCTION(fgetss);
PHP_FUNCTION(fgetcsv);
PHP_FUNCTION(fputcsv);
PHPAPI PHP_FUNCTION(fwrite);
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index bf2bc752b0..f2514d16d2 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.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, |
@@ -178,7 +176,7 @@ static int php_disk_total_space(char *path, double *space) /* {{{ */
/* }}} */
/* }}} */
-/* {{{ proto float disk_total_space(string path)
+/* {{{ proto float|false disk_total_space(string path)
Get total disk space for filesystem that path is on */
PHP_FUNCTION(disk_total_space)
{
@@ -273,7 +271,7 @@ static int php_disk_free_space(char *path, double *space) /* {{{ */
/* }}} */
/* }}} */
-/* {{{ proto float disk_free_space(string path)
+/* {{{ proto float|false disk_free_space(string path)
Get free disk space for filesystem that path is on */
PHP_FUNCTION(disk_free_space)
{
@@ -342,7 +340,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_ZVAL(group)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) {
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 83fcf2dcbf..0bb83da141 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.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, |
@@ -166,136 +164,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = {
};
/* }}} */
-/* {{{ strip_tags filter implementation */
-typedef struct _php_strip_tags_filter {
- const char *allowed_tags;
- int allowed_tags_len;
- uint8_t state;
- uint8_t persistent;
-} php_strip_tags_filter;
-
-static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent)
-{
- if (allowed_tags != NULL) {
- if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) {
- return FAILURE;
- }
- memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1);
- inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags);
- } else {
- inst->allowed_tags = NULL;
- }
- inst->state = 0;
- inst->persistent = persistent;
-
- return SUCCESS;
-}
-
-static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst)
-{
- if (inst->allowed_tags != NULL) {
- pefree((void *)inst->allowed_tags, inst->persistent);
- }
-}
-
-static php_stream_filter_status_t strfilter_strip_tags_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- )
-{
- php_stream_bucket *bucket;
- size_t consumed = 0;
- php_strip_tags_filter *inst = (php_strip_tags_filter *) Z_PTR(thisfilter->abstract);
-
- while (buckets_in->head) {
- bucket = php_stream_bucket_make_writeable(buckets_in->head);
- consumed = bucket->buflen;
-
- bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), inst->allowed_tags, inst->allowed_tags_len);
-
- php_stream_bucket_append(buckets_out, bucket);
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-}
-
-static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter)
-{
- assert(Z_PTR(thisfilter->abstract) != NULL);
-
- php_strip_tags_filter_dtor((php_strip_tags_filter *)Z_PTR(thisfilter->abstract));
-
- pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent);
-}
-
-static const php_stream_filter_ops strfilter_strip_tags_ops = {
- strfilter_strip_tags_filter,
- strfilter_strip_tags_dtor,
- "string.strip_tags"
-};
-
-static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent)
-{
- php_strip_tags_filter *inst;
- php_stream_filter *filter = NULL;
- zend_string *allowed_tags = NULL;
-
- php_error_docref(NULL, E_DEPRECATED, "The string.strip_tags filter is deprecated");
-
- if (filterparams != NULL) {
- if (Z_TYPE_P(filterparams) == IS_ARRAY) {
- smart_str tags_ss = {0};
- zval *tmp;
-
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) {
- convert_to_string_ex(tmp);
- smart_str_appendc(&tags_ss, '<');
- smart_str_append(&tags_ss, Z_STR_P(tmp));
- smart_str_appendc(&tags_ss, '>');
- } ZEND_HASH_FOREACH_END();
- smart_str_0(&tags_ss);
- allowed_tags = tags_ss.s;
- } else {
- allowed_tags = zval_get_string(filterparams);
- }
-
- /* Exception during string conversion. */
- if (EG(exception)) {
- if (allowed_tags) {
- zend_string_release(allowed_tags);
- }
- return NULL;
- }
- }
-
- inst = pemalloc(sizeof(php_strip_tags_filter), persistent);
- if (php_strip_tags_filter_ctor(inst, allowed_tags, persistent) == SUCCESS) {
- filter = php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent);
- } else {
- pefree(inst, persistent);
- }
-
- if (allowed_tags) {
- zend_string_release(allowed_tags);
- }
-
- return filter;
-}
-
-static const php_stream_filter_factory strfilter_strip_tags_factory = {
- strfilter_strip_tags_create
-};
-
-/* }}} */
-
/* {{{ base64 / quoted_printable stream filter implementation */
typedef enum _php_conv_err_t {
@@ -2044,7 +1912,6 @@ static const struct {
{ &strfilter_rot13_ops, &strfilter_rot13_factory },
{ &strfilter_toupper_ops, &strfilter_toupper_factory },
{ &strfilter_tolower_ops, &strfilter_tolower_factory },
- { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory },
{ &strfilter_convert_ops, &strfilter_convert_factory },
{ &consumed_filter_ops, &consumed_filter_factory },
{ &chunked_filter_ops, &chunked_filter_factory },
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index fd9a2e0985..ecf28d8513 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.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/ext/standard/flock_compat.h b/ext/standard/flock_compat.h
index 49a68bf431..7c875792c6 100644
--- a/ext/standard/flock_compat.h
+++ b/ext/standard/flock_compat.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/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 4ee68adefa..b91a41de54 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.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, |
@@ -662,7 +660,7 @@ php_formatted_print_get_array(zval *array, int *argc)
}
/* }}} */
-/* {{{ proto string sprintf(string format [, mixed arg1 [, mixed ...]])
+/* {{{ proto string|false sprintf(string format [, mixed arg1 [, mixed ...]])
Return a formatted string */
PHP_FUNCTION(user_sprintf)
{
@@ -673,7 +671,7 @@ PHP_FUNCTION(user_sprintf)
ZEND_PARSE_PARAMETERS_START(1, -1)
Z_PARAM_ZVAL(format)
Z_PARAM_VARIADIC('*', args, argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
result = php_formatted_print(format, args, argc);
if (result == NULL) {
@@ -683,7 +681,7 @@ PHP_FUNCTION(user_sprintf)
}
/* }}} */
-/* {{{ proto string vsprintf(string format, array args)
+/* {{{ proto string|false vsprintf(string format, array args)
Return a formatted string */
PHP_FUNCTION(vsprintf)
{
@@ -694,7 +692,7 @@ PHP_FUNCTION(vsprintf)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_ZVAL(format)
Z_PARAM_ZVAL(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
args = php_formatted_print_get_array(array, &argc);
@@ -707,7 +705,7 @@ PHP_FUNCTION(vsprintf)
}
/* }}} */
-/* {{{ proto int printf(string format [, mixed arg1 [, mixed ...]])
+/* {{{ proto int|false printf(string format [, mixed arg1 [, mixed ...]])
Output a formatted string */
PHP_FUNCTION(user_printf)
{
@@ -719,7 +717,7 @@ PHP_FUNCTION(user_printf)
ZEND_PARSE_PARAMETERS_START(1, -1)
Z_PARAM_ZVAL(format)
Z_PARAM_VARIADIC('*', args, argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
result = php_formatted_print(format, args, argc);
if (result == NULL) {
@@ -731,7 +729,7 @@ PHP_FUNCTION(user_printf)
}
/* }}} */
-/* {{{ proto int vprintf(string format, array args)
+/* {{{ proto int|false vprintf(string format, array args)
Output a formatted string */
PHP_FUNCTION(vprintf)
{
@@ -743,7 +741,7 @@ PHP_FUNCTION(vprintf)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_ZVAL(format)
Z_PARAM_ZVAL(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
args = php_formatted_print_get_array(array, &argc);
@@ -758,7 +756,7 @@ PHP_FUNCTION(vprintf)
}
/* }}} */
-/* {{{ proto int fprintf(resource stream, string format [, mixed arg1 [, mixed ...]])
+/* {{{ proto int|false fprintf(resource stream, string format [, mixed arg1 [, mixed ...]])
Output a formatted string into a stream */
PHP_FUNCTION(fprintf)
{
@@ -775,7 +773,7 @@ PHP_FUNCTION(fprintf)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_ZVAL(format)
Z_PARAM_VARIADIC('*', args, argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -791,7 +789,7 @@ PHP_FUNCTION(fprintf)
}
/* }}} */
-/* {{{ proto int vfprintf(resource stream, string format, array args)
+/* {{{ proto int|false vfprintf(resource stream, string format, array args)
Output a formatted string into a stream */
PHP_FUNCTION(vfprintf)
{
@@ -808,7 +806,7 @@ PHP_FUNCTION(vfprintf)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_ZVAL(format)
Z_PARAM_ZVAL(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index fe8fbea85c..6ba41f23d5 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.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, |
@@ -56,7 +54,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
Z_PARAM_ZVAL(zerrno)
Z_PARAM_ZVAL(zerrstr)
Z_PARAM_DOUBLE(timeout)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (persistent) {
spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port);
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index b6fee88d89..0547ee6073 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.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/ext/standard/ftok.c b/ext/standard/ftok.c
index 9e4af788e3..0e1210acc9 100644
--- a/ext/standard/ftok.c
+++ b/ext/standard/ftok.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/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 3a7dec4a3b..2c01e88f4f 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.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/ext/standard/head.c b/ext/standard/head.c
index 91b12108bf..9893d3edf9 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.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/ext/standard/head.h b/ext/standard/head.h
index 824a7e8d4f..4e1ae0b4c3 100644
--- a/ext/standard/head.h
+++ b/ext/standard/head.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/ext/standard/hrtime.c b/ext/standard/hrtime.c
index 2a6707f7bd..088bf6d9d8 100644
--- a/ext/standard/hrtime.c
+++ b/ext/standard/hrtime.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, |
@@ -183,7 +181,7 @@ PHP_FUNCTION(hrtime)
add_next_index_long(return_value, (zend_long)(t % (php_hrtime_t)NANO_IN_SEC));
}
#else
- RETURN_FALSE
+ RETURN_FALSE;
#endif
}
/* }}} */
diff --git a/ext/standard/hrtime.h b/ext/standard/hrtime.h
index 2fef187c9a..7ec36dadc1 100644
--- a/ext/standard/hrtime.h
+++ b/ext/standard/hrtime.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/ext/standard/html.c b/ext/standard/html.c
index e9c46ba083..8a597f05f9 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.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/ext/standard/html.h b/ext/standard/html.h
index df0e9ba377..a43c0c823d 100644
--- a/ext/standard/html.h
+++ b/ext/standard/html.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/ext/standard/html_tables.h b/ext/standard/html_tables.h
index b9daaf7a5f..40d84d3e66 100644
--- a/ext/standard/html_tables.h
+++ b/ext/standard/html_tables.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/ext/standard/html_tables/html_table_gen.php b/ext/standard/html_tables/html_table_gen.php
index 83e123738c..dbc0b4d42c 100755
--- a/ext/standard/html_tables/html_table_gen.php
+++ b/ext/standard/html_tables/html_table_gen.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,8 +22,6 @@
$t = <<<CODE
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/http.c b/ext/standard/http.c
index dbd71add81..4b6866d3f8 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.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, |
@@ -230,7 +228,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
}
/* }}} */
-/* {{{ proto string http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]])
+/* {{{ proto string|false http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]])
Generates a form-encoded query string from an associative array or object. */
PHP_FUNCTION(http_build_query)
{
@@ -246,7 +244,7 @@ PHP_FUNCTION(http_build_query)
Z_PARAM_STRING(prefix, prefix_len)
Z_PARAM_STRING(arg_sep, arg_sep_len)
Z_PARAM_LONG(enc_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : NULL), arg_sep, (int)enc_type) == FAILURE) {
if (formstr.s) {
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 9632bd344e..dfda9d63f8 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.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/ext/standard/image.c b/ext/standard/image.c
index aaaf81ae9e..6426410710 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.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, |
@@ -1223,7 +1221,7 @@ PHP_FUNCTION(image_type_to_mime_type)
}
/* }}} */
-/* {{{ proto string image_type_to_extension(int imagetype [, bool include_dot])
+/* {{{ proto string|false image_type_to_extension(int imagetype [, bool include_dot])
Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
PHP_FUNCTION(image_type_to_extension)
{
@@ -1235,7 +1233,7 @@ PHP_FUNCTION(image_type_to_extension)
Z_PARAM_LONG(image_type)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(inc_dot)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (image_type) {
case IMAGE_FILETYPE_GIF:
@@ -1298,14 +1296,14 @@ PHP_FUNCTION(image_type_to_extension)
/* {{{ php_imagetype
detect filetype from first bytes */
-PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
+PHPAPI int php_getimagetype(php_stream * stream, char *input, char *filetype)
{
char tmp[12];
int twelve_bytes_read;
if ( !filetype) filetype = tmp;
if((php_stream_read(stream, filetype, 3)) != 3) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
@@ -1316,7 +1314,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
return IMAGE_FILETYPE_JPEG;
} else if (!memcmp(filetype, php_sig_png, 3)) {
if (php_stream_read(stream, filetype+3, 5) != 5) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
if (!memcmp(filetype, php_sig_png, 8)) {
@@ -1337,7 +1335,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
return IMAGE_FILETYPE_JPC;
} else if (!memcmp(filetype, php_sig_riff, 3)) {
if (php_stream_read(stream, filetype+3, 9) != 9) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
if (!memcmp(filetype+8, php_sig_webp, 4)) {
@@ -1348,7 +1346,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
}
if (php_stream_read(stream, filetype+3, 1) != 1) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
/* BYTES READ: 4 */
@@ -1375,7 +1373,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
return IMAGE_FILETYPE_WBMP;
}
if (!twelve_bytes_read) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
if (php_get_xbm(stream, NULL)) {
@@ -1385,7 +1383,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
}
/* }}} */
-static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
+static void php_getimagesize_from_stream(php_stream *stream, char *input, zval *info, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
int itype = 0;
struct gfxinfo *result = NULL;
@@ -1394,7 +1392,7 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA
RETURN_FALSE;
}
- itype = php_getimagetype(stream, NULL);
+ itype = php_getimagetype(stream, input, NULL);
switch( itype) {
case IMAGE_FILETYPE_GIF:
result = php_handle_gif(stream);
@@ -1510,15 +1508,15 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
}
if (!stream) {
- RETURN_FALSE;
+ RETURN_FALSE;
}
- php_getimagesize_from_stream(stream, info, INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ php_getimagesize_from_stream(stream, input, info, INTERNAL_FUNCTION_PARAM_PASSTHRU);
php_stream_close(stream);
}
/* }}} */
-/* {{{ proto array getimagesize(string imagefile [, array info])
+/* {{{ proto array|false getimagesize(string imagefile [, array info])
Get the size of an image as 4-element array */
PHP_FUNCTION(getimagesize)
{
@@ -1526,7 +1524,7 @@ PHP_FUNCTION(getimagesize)
}
/* }}} */
-/* {{{ proto array getimagesizefromstring(string data [, array info])
+/* {{{ proto array|false getimagesizefromstring(string data [, array info])
Get the size of an image as 4-element array */
PHP_FUNCTION(getimagesizefromstring)
{
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index f38fae5f53..5e4c6ca203 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.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, |
@@ -32,7 +30,7 @@ static zend_object_handlers php_incomplete_object_handlers;
/* {{{ incomplete_class_message
*/
-static void incomplete_class_message(zval *object, int error_type)
+static void incomplete_class_message(zend_object *object, int error_type)
{
zend_string *class_name;
@@ -47,7 +45,7 @@ static void incomplete_class_message(zval *object, int error_type)
}
/* }}} */
-static zval *incomplete_class_get_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *incomplete_class_get_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
@@ -60,27 +58,27 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type,
}
/* }}} */
-static zval *incomplete_class_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *incomplete_class_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return value;
}
/* }}} */
-static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *incomplete_class_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return &EG(error_zval);
}
/* }}} */
-static void incomplete_class_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static void incomplete_class_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
}
/* }}} */
-static int incomplete_class_has_property(zval *object, zval *member, int check_empty, void **cache_slot) /* {{{ */
+static int incomplete_class_has_property(zend_object *object, zend_string *member, int check_empty, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return 0;
@@ -89,10 +87,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e
static zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */
{
- zval zobject;
-
- ZVAL_OBJ(&zobject, *object);
- incomplete_class_message(&zobject, E_ERROR);
+ incomplete_class_message(*object, E_ERROR);
return NULL;
}
/* }}} */
@@ -132,15 +127,14 @@ PHPAPI zend_class_entry *php_create_incomplete_class(void)
/* {{{ php_lookup_class_name
*/
-PHPAPI zend_string *php_lookup_class_name(zval *object)
+PHPAPI zend_string *php_lookup_class_name(zend_object *object)
{
- zval *val;
- HashTable *object_properties;
-
- object_properties = Z_OBJPROP_P(object);
+ if (object->properties) {
+ zval *val = zend_hash_str_find(object->properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1);
- if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL && Z_TYPE_P(val) == IS_STRING) {
- return zend_string_copy(Z_STR_P(val));
+ if (val != NULL && Z_TYPE_P(val) == IS_STRING) {
+ return zend_string_copy(Z_STR_P(val));
+ }
}
return NULL;
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 1e58b31a0f..bb3c71d9b5 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.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, |
@@ -770,7 +768,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
}
if (flag & PHP_INFO_GENERAL) {
- char *zend_version = get_zend_version();
+ const char *zend_version = get_zend_version();
char temp_api[10];
php_uname = php_get_uname('a');
@@ -1245,7 +1243,7 @@ void register_phpinfo_constants(INIT_FUNC_ARGS)
}
/* }}} */
-/* {{{ proto void phpinfo([int what])
+/* {{{ proto bool phpinfo([int what])
Output a page of useful information about PHP and the current request */
PHP_FUNCTION(phpinfo)
{
@@ -1266,7 +1264,7 @@ PHP_FUNCTION(phpinfo)
/* }}} */
-/* {{{ proto string phpversion([string extension])
+/* {{{ proto string|false phpversion([string extension])
Return the current PHP version */
PHP_FUNCTION(phpversion)
{
@@ -1291,7 +1289,7 @@ PHP_FUNCTION(phpversion)
}
/* }}} */
-/* {{{ proto void phpcredits([int flag])
+/* {{{ proto bool phpcredits([int flag])
Prints the list of people who've contributed to the PHP project */
PHP_FUNCTION(phpcredits)
{
@@ -1307,7 +1305,7 @@ PHP_FUNCTION(phpcredits)
}
/* }}} */
-/* {{{ proto string php_sapi_name(void)
+/* {{{ proto string|false php_sapi_name(void)
Return the current SAPI module name */
PHP_FUNCTION(php_sapi_name)
{
@@ -1324,7 +1322,7 @@ PHP_FUNCTION(php_sapi_name)
/* }}} */
-/* {{{ proto string php_uname(void)
+/* {{{ proto string php_uname([ string $mode = "a"])
Return information about the system PHP was built on */
PHP_FUNCTION(php_uname)
{
@@ -1341,7 +1339,7 @@ PHP_FUNCTION(php_uname)
/* }}} */
-/* {{{ proto string php_ini_scanned_files(void)
+/* {{{ proto string|false php_ini_scanned_files(void)
Return comma-separated string of .ini files parsed from the additional ini dir */
PHP_FUNCTION(php_ini_scanned_files)
{
@@ -1357,7 +1355,7 @@ PHP_FUNCTION(php_ini_scanned_files)
}
/* }}} */
-/* {{{ proto string php_ini_loaded_file(void)
+/* {{{ proto string|false php_ini_loaded_file(void)
Return the actual loaded ini filename */
PHP_FUNCTION(php_ini_loaded_file)
{
diff --git a/ext/standard/info.h b/ext/standard/info.h
index 479e5478c5..b965448a44 100644
--- a/ext/standard/info.h
+++ b/ext/standard/info.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/ext/standard/iptc.c b/ext/standard/iptc.c
index f3c17dadd9..2d4577b462 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.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, |
@@ -180,7 +178,7 @@ static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf)
static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
-/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool])
+/* {{{ proto string|false iptcembed(string iptcdata, string jpeg_file_name [, int spool])
Embed binary IPTC data into a JPEG image. */
PHP_FUNCTION(iptcembed)
{
@@ -311,7 +309,7 @@ PHP_FUNCTION(iptcembed)
}
/* }}} */
-/* {{{ proto array iptcparse(string iptcdata)
+/* {{{ proto array|false iptcparse(string iptcdata)
Parse binary IPTC-data into associative array */
PHP_FUNCTION(iptcparse)
{
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index c649137eb6..992c3691ce 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.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/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
index a03e3441cb..3147c2bbe6 100644
--- a/ext/standard/levenshtein.c
+++ b/ext/standard/levenshtein.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/ext/standard/link.c b/ext/standard/link.c
index 1117049344..3172b34d66 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.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, |
@@ -62,7 +60,7 @@
#define VOLUME_NAME_DOS 0x0
#endif
-/* {{{ proto string readlink(string filename)
+/* {{{ proto string|false readlink(string filename)
Return the target of a symbolic link */
PHP_FUNCTION(readlink)
{
@@ -96,7 +94,7 @@ PHP_FUNCTION(readlink)
}
/* }}} */
-/* {{{ proto int linkinfo(string filename)
+/* {{{ proto int|false linkinfo(string filename)
Returns the st_dev field of the UNIX C stat structure describing the link */
PHP_FUNCTION(linkinfo)
{
@@ -130,7 +128,7 @@ PHP_FUNCTION(linkinfo)
}
/* }}} */
-/* {{{ proto int symlink(string target, string link)
+/* {{{ proto bool symlink(string target, string link)
Create a symbolic link */
PHP_FUNCTION(symlink)
{
@@ -189,7 +187,7 @@ PHP_FUNCTION(symlink)
}
/* }}} */
-/* {{{ proto int link(string target, string link)
+/* {{{ proto bool link(string target, string link)
Create a hard link */
PHP_FUNCTION(link)
{
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index c1a21c4059..775cd0da54 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.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, |
@@ -275,7 +273,7 @@ PHPAPI zend_string *php_mail_build_headers(zval *headers)
}
-/* {{{ proto int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+/* {{{ proto bool mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
Send an email message */
PHP_FUNCTION(mail)
{
diff --git a/ext/standard/math.c b/ext/standard/math.c
index ba7e3944aa..be3516400a 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.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, |
@@ -283,18 +281,16 @@ static double php_expm1(double x)
}
/* }}}*/
-/* {{{ proto int abs(int number)
+/* {{{ proto int|float abs(int number)
Return the absolute value of the number */
PHP_FUNCTION(abs)
{
zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
ZEND_PARSE_PARAMETERS_END();
- convert_scalar_to_number_ex(value);
-
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(fabs(Z_DVAL_P(value)));
} else if (Z_TYPE_P(value) == IS_LONG) {
@@ -303,8 +299,9 @@ PHP_FUNCTION(abs)
} else {
RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value));
}
+ } else {
+ ZEND_ASSERT(0 && "Unexpected type");
}
- RETURN_FALSE;
}
/* }}} */
@@ -315,17 +312,16 @@ PHP_FUNCTION(ceil)
zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
ZEND_PARSE_PARAMETERS_END();
- convert_scalar_to_number_ex(value);
-
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(ceil(Z_DVAL_P(value)));
} else if (Z_TYPE_P(value) == IS_LONG) {
RETURN_DOUBLE(zval_get_double(value));
+ } else {
+ ZEND_ASSERT(0 && "Unexpected type");
}
- RETURN_FALSE;
}
/* }}} */
@@ -336,21 +332,20 @@ PHP_FUNCTION(floor)
zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
ZEND_PARSE_PARAMETERS_END();
- convert_scalar_to_number_ex(value);
-
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(floor(Z_DVAL_P(value)));
} else if (Z_TYPE_P(value) == IS_LONG) {
RETURN_DOUBLE(zval_get_double(value));
+ } else {
+ ZEND_ASSERT(0 && "Unexpected type");
}
- RETURN_FALSE;
}
/* }}} */
-/* {{{ proto float round(float number [, int precision [, int mode]])
+/* {{{ proto float|false round(float number [, int precision [, int mode]])
Returns the number rounded to specified precision */
PHP_FUNCTION(round)
{
@@ -575,6 +570,10 @@ PHP_FUNCTION(atanh)
Returns an approximation of pi */
PHP_FUNCTION(pi)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
RETURN_DOUBLE(M_PI);
}
/* }}} */
@@ -683,7 +682,7 @@ PHP_FUNCTION(log1p)
}
/* }}} */
-/* {{{ proto float log(float number, [float base])
+/* {{{ proto float|false log(float number, [float base])
Returns the natural logarithm of the number, or the base log if base is specified */
PHP_FUNCTION(log)
{
@@ -846,7 +845,7 @@ PHPAPI zend_long _php_math_basetolong(zval *arg, int base)
/*
* Convert a string representation of a base(2-36) number to a zval.
*/
-PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
+PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret)
{
zend_long num = 0;
double fnum = 0;
@@ -856,11 +855,8 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
int cutlim;
int invalidchars = 0;
- if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
- return FAILURE;
- }
- s = Z_STRVAL_P(arg);
- e = s + Z_STRLEN_P(arg);
+ s = ZSTR_VAL(str);
+ e = s + ZSTR_LEN(str);
/* Skip leading whitespace */
while (s < e && isspace(*s)) s++;
@@ -920,7 +916,6 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
} else {
ZVAL_LONG(ret, num);
}
- return SUCCESS;
}
/* }}} */
@@ -994,54 +989,45 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base)
}
/* }}} */
-/* {{{ proto int bindec(string binary_number)
+/* {{{ proto int|float bindec(string binary_number)
Returns the decimal equivalent of the binary number */
PHP_FUNCTION(bindec)
{
- zval *arg;
+ zend_string *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(arg)
+ Z_PARAM_STR(arg)
ZEND_PARSE_PARAMETERS_END();
- convert_to_string_ex(arg);
- if (_php_math_basetozval(arg, 2, return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(arg, 2, return_value);
}
/* }}} */
-/* {{{ proto int hexdec(string hexadecimal_number)
+/* {{{ proto int|flat hexdec(string hexadecimal_number)
Returns the decimal equivalent of the hexadecimal number */
PHP_FUNCTION(hexdec)
{
- zval *arg;
+ zend_string *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(arg)
+ Z_PARAM_STR(arg)
ZEND_PARSE_PARAMETERS_END();
- convert_to_string_ex(arg);
- if (_php_math_basetozval(arg, 16, return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(arg, 16, return_value);
}
/* }}} */
-/* {{{ proto int octdec(string octal_number)
+/* {{{ proto int|float octdec(string octal_number)
Returns the decimal equivalent of an octal string */
PHP_FUNCTION(octdec)
{
- zval *arg;
+ zend_string *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(arg)
+ Z_PARAM_STR(arg)
ZEND_PARSE_PARAMETERS_END();
- convert_to_string_ex(arg);
- if (_php_math_basetozval(arg, 8, return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(arg, 8, return_value);
}
/* }}} */
@@ -1096,7 +1082,7 @@ PHP_FUNCTION(dechex)
}
/* }}} */
-/* {{{ proto string base_convert(string number, int frombase, int tobase)
+/* {{{ proto string|false base_convert(string number, int frombase, int tobase)
Converts a number in a string from any base <= 36 to any base <= 36 */
PHP_FUNCTION(base_convert)
{
@@ -1123,9 +1109,7 @@ PHP_FUNCTION(base_convert)
RETURN_FALSE;
}
- if(_php_math_basetozval(number, (int)frombase, &temp) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(Z_STR_P(number), (int)frombase, &temp);
result = _php_math_zvaltobase(&temp, (int)tobase);
RETVAL_STR(result);
}
@@ -1316,6 +1300,25 @@ PHP_FUNCTION(fmod)
}
/* }}} */
+/* {{{ proto float fdiv(float dividend, float divisor)
+ Perform floating-point division of dividend / divisor
+ with IEEE-754 semantics for division by zero. */
+#ifdef __clang__
+__attribute__((no_sanitize("float-divide-by-zero")))
+#endif
+PHP_FUNCTION(fdiv)
+{
+ double dividend, divisor;
+
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_DOUBLE(dividend)
+ Z_PARAM_DOUBLE(divisor)
+ ZEND_PARSE_PARAMETERS_END();
+
+ RETURN_DOUBLE(dividend / divisor);
+}
+/* }}} */
+
/* {{{ proto int intdiv(int dividend, int divisor)
Returns the integer quotient of the division of dividend by divisor */
PHP_FUNCTION(intdiv)
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 463279a497..994ac1a1fe 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.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/ext/standard/md5.h b/ext/standard/md5.h
index 76bb08c5ac..a6aa4e7b0a 100644
--- a/ext/standard/md5.h
+++ b/ext/standard/md5.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/ext/standard/metaphone.c b/ext/standard/metaphone.c
index 16fd149571..aa6fa0e798 100644
--- a/ext/standard/metaphone.c
+++ b/ext/standard/metaphone.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, |
@@ -25,7 +23,7 @@
static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional);
-/* {{{ proto string metaphone(string text[, int phones])
+/* {{{ proto string|false metaphone(string text[, int phones])
Break english phrases down into their phonemes */
PHP_FUNCTION(metaphone)
{
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 9bd45e188d..8f7ac8b1ec 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.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, |
@@ -100,7 +98,7 @@ PHP_FUNCTION(gettimeofday)
/* }}} */
#ifdef HAVE_GETRUSAGE
-/* {{{ proto array getrusage([int who])
+/* {{{ proto array|false getrusage([int who])
Returns an array of usage statistics */
PHP_FUNCTION(getrusage)
{
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
index 59fb3e4aba..949d10e50c 100644
--- a/ext/standard/microtime.h
+++ b/ext/standard/microtime.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/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index a176b95231..d38b9cba8d 100644
--- a/ext/standard/mt_rand.c
+++ b/ext/standard/mt_rand.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/ext/standard/net.c b/ext/standard/net.c
index 600ef8d0e0..535ab13f00 100644
--- a/ext/standard/net.c
+++ b/ext/standard/net.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/ext/standard/pack.c b/ext/standard/pack.c
index 3c0dc009f1..8f47aac258 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.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, |
@@ -715,7 +713,7 @@ static zend_long php_unpack(char *data, size_t size, int issigned, int *map)
* Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, q, Q, J, P, f, d, x, X, @.
* Added g, G for little endian float and big endian float, added e, E for little endian double and big endian double.
*/
-/* {{{ proto array unpack(string format, string input)
+/* {{{ proto array|false unpack(string format, string input)
Unpack binary string into named array elements according to format argument */
PHP_FUNCTION(unpack)
{
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
index 3deeb1f270..ed58b9fcec 100644
--- a/ext/standard/pack.h
+++ b/ext/standard/pack.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/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index e0533efdd0..de1552c3eb 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.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/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
index db0924c8cd..76543194dc 100644
--- a/ext/standard/pageinfo.h
+++ b/ext/standard/pageinfo.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/ext/standard/password.c b/ext/standard/password.c
index a12590c0e0..ff3458275e 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.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, |
@@ -52,19 +50,6 @@ void php_password_algo_unregister(const char *ident) {
zend_hash_str_del(&php_password_algos, ident, strlen(ident));
}
-static int php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */
-{
- size_t i = 0;
-
- for (i = 0; i < len; i++) {
- if (!((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')) {
- return FAILURE;
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */
{
size_t pos = 0;
@@ -123,68 +108,11 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */
/* }}} */
static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) {
- zend_string *buffer;
- zval *option_buffer;
-
- if (!options || !(option_buffer = zend_hash_str_find(options, "salt", sizeof("salt") - 1))) {
- return php_password_make_salt(required_salt_len);
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated");
-
- switch (Z_TYPE_P(option_buffer)) {
- case IS_STRING:
- buffer = zend_string_copy(Z_STR_P(option_buffer));
- break;
- case IS_LONG:
- case IS_DOUBLE:
- case IS_OBJECT:
- buffer = zval_try_get_string(option_buffer);
- if (UNEXPECTED(!buffer)) {
- return NULL;
- }
- break;
- case IS_FALSE:
- case IS_TRUE:
- case IS_NULL:
- case IS_RESOURCE:
- case IS_ARRAY:
- default:
- php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied");
- return NULL;
- }
-
- /* XXX all the crypt related APIs work with int for string length.
- That should be revised for size_t and then we maybe don't require
- the > INT_MAX check. */
- if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) {
- php_error_docref(NULL, E_WARNING, "Supplied salt is too long");
- zend_string_release_ex(buffer, 0);
- return NULL;
- }
-
- if (ZSTR_LEN(buffer) < required_salt_len) {
- php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len);
- zend_string_release_ex(buffer, 0);
- return NULL;
+ if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) {
+ php_error_docref(NULL, E_WARNING, "The 'salt' option is no longer supported. The provided salt has been been ignored");
}
- if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) {
- zend_string *salt = zend_string_alloc(required_salt_len, 0);
- if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer));
- zend_string_release_ex(salt, 0);
- zend_string_release_ex(buffer, 0);
- return NULL;
- }
- zend_string_release_ex(buffer, 0);
- return salt;
- } else {
- zend_string *salt = zend_string_alloc(required_salt_len, 0);
- memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len);
- zend_string_release_ex(buffer, 0);
- return salt;
- }
+ return php_password_make_salt(required_salt_len);
}
/* bcrypt implementation */
@@ -632,7 +560,7 @@ const php_password_algo* php_password_algo_identify_ex(const zend_string* hash,
return (!algo || (algo->valid && !algo->valid(hash))) ? default_algo : algo;
}
-/* {{{ proto array password_get_info(string $hash)
+/* {{{ proto array|null password_get_info(string $hash)
Retrieves information about a given hash */
PHP_FUNCTION(password_get_info)
{
@@ -715,14 +643,14 @@ PHP_FUNCTION(password_verify)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(password)
Z_PARAM_STR(hash)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
algo = php_password_algo_identify(hash);
RETURN_BOOL(algo && (!algo->verify || algo->verify(password, hash)));
}
/* }}} */
-/* {{{ proto string password_hash(string password, mixed algo[, array options = array()])
+/* {{{ proto string|null password_hash(string password, mixed algo[, array options = array()])
Hash a password */
PHP_FUNCTION(password_hash)
{
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index e15b116802..c8bca740af 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.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/ext/standard/php_assert.h b/ext/standard/php_assert.h
index 0cc10f7aa6..1289cc9b30 100644
--- a/ext/standard/php_assert.h
+++ b/ext/standard/php_assert.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/ext/standard/php_browscap.h b/ext/standard/php_browscap.h
index a2add821dd..aa8eafb0a0 100644
--- a/ext/standard/php_browscap.h
+++ b/ext/standard/php_browscap.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/ext/standard/php_crypt.h b/ext/standard/php_crypt.h
index 38410c9d20..d3ee90ee84 100644
--- a/ext/standard/php_crypt.h
+++ b/ext/standard/php_crypt.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/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index 479b8c7965..96e5905e5a 100644
--- a/ext/standard/php_crypt_r.c
+++ b/ext/standard/php_crypt_r.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/ext/standard/php_crypt_r.h b/ext/standard/php_crypt_r.h
index e5985e12d2..20cf215dfd 100644
--- a/ext/standard/php_crypt_r.h
+++ b/ext/standard/php_crypt_r.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/ext/standard/php_dir.h b/ext/standard/php_dir.h
index b72ad7b957..9d91e50ef2 100644
--- a/ext/standard/php_dir.h
+++ b/ext/standard/php_dir.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/ext/standard/php_dns.h b/ext/standard/php_dns.h
index 47c1e3ab5d..3f4a61f6d5 100644
--- a/ext/standard/php_dns.h
+++ b/ext/standard/php_dns.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/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index 3ae078951a..100f4b3ab5 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.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/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index 2b2e1838ca..8e4ffcd7a0 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.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/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 295751f0db..f525f868e4 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.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/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
index 3c49ab4074..021a186448 100644
--- a/ext/standard/php_fopen_wrappers.h
+++ b/ext/standard/php_fopen_wrappers.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/ext/standard/php_ftok.h b/ext/standard/php_ftok.h
index 3f79fa58bc..3726c36bd1 100644
--- a/ext/standard/php_ftok.h
+++ b/ext/standard/php_ftok.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/ext/standard/php_http.h b/ext/standard/php_http.h
index b8ce4b1722..5a0dba0818 100644
--- a/ext/standard/php_http.h
+++ b/ext/standard/php_http.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/ext/standard/php_image.h b/ext/standard/php_image.h
index 5f9b07ddea..4bd972beac 100644
--- a/ext/standard/php_image.h
+++ b/ext/standard/php_image.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, |
@@ -58,7 +56,7 @@ typedef enum
PHP_MINIT_FUNCTION(imagetypes);
-PHPAPI int php_getimagetype(php_stream *stream, char *filetype);
+PHPAPI int php_getimagetype(php_stream *stream, char *input, char *filetype);
PHPAPI char * php_image_type_to_mime_type(int image_type);
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index d768f25bdb..03bd1daaca 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.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, |
@@ -27,7 +25,7 @@
#define PHP_SET_CLASS_ATTRIBUTES(struc) \
/* OBJECTS_FIXME: Fix for new object model */ \
if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
- class_name = php_lookup_class_name(struc); \
+ class_name = php_lookup_class_name(Z_OBJ_P(struc)); \
if (!class_name) { \
class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
} \
@@ -51,7 +49,7 @@ extern "C" {
#endif
PHPAPI zend_class_entry *php_create_incomplete_class(void);
-PHPAPI zend_string *php_lookup_class_name(zval *object);
+PHPAPI zend_string *php_lookup_class_name(zend_object *object);
PHPAPI void php_store_class_name(zval *object, const char *name, size_t len);
#ifdef __cplusplus
diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h
index 1636ceaf63..999912599a 100644
--- a/ext/standard/php_iptc.h
+++ b/ext/standard/php_iptc.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/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index f3d52f138e..4feddb5c9b 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.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/ext/standard/php_link.h b/ext/standard/php_link.h
index 4b20077d5a..fb7d76ba85 100644
--- a/ext/standard/php_link.h
+++ b/ext/standard/php_link.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/ext/standard/php_mail.h b/ext/standard/php_mail.h
index 90e1497e0e..12203830c6 100644
--- a/ext/standard/php_mail.h
+++ b/ext/standard/php_mail.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/ext/standard/php_math.h b/ext/standard/php_math.h
index 791a01c02d..e85fd120f2 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.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, |
@@ -25,7 +23,7 @@ PHPAPI zend_string *_php_math_number_format(double, int, char, char);
PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t);
PHPAPI zend_string * _php_math_longtobase(zval *arg, int base);
PHPAPI zend_long _php_math_basetolong(zval *arg, int base);
-PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret);
+PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret);
PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base);
PHP_FUNCTION(sin);
@@ -61,6 +59,7 @@ PHP_FUNCTION(octdec);
PHP_FUNCTION(base_convert);
PHP_FUNCTION(number_format);
PHP_FUNCTION(fmod);
+PHP_FUNCTION(fdiv);
PHP_FUNCTION(deg2rad);
PHP_FUNCTION(rad2deg);
PHP_FUNCTION(intdiv);
diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h
index 7543b4ef4c..c52bfe66a2 100644
--- a/ext/standard/php_metaphone.h
+++ b/ext/standard/php_metaphone.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/ext/standard/php_mt_rand.h b/ext/standard/php_mt_rand.h
index 9446421dbc..e3d9b652d3 100644
--- a/ext/standard/php_mt_rand.h
+++ b/ext/standard/php_mt_rand.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/ext/standard/php_net.h b/ext/standard/php_net.h
index c0a60eb060..5eb65491aa 100644
--- a/ext/standard/php_net.h
+++ b/ext/standard/php_net.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/ext/standard/php_password.h b/ext/standard/php_password.h
index 97a6bf63a2..d89f563f8f 100644
--- a/ext/standard/php_password.h
+++ b/ext/standard/php_password.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/ext/standard/php_rand.h b/ext/standard/php_rand.h
index 8cd47a5b5f..fdf2fc7d13 100644
--- a/ext/standard/php_rand.h
+++ b/ext/standard/php_rand.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/ext/standard/php_random.h b/ext/standard/php_random.h
index 3398ddb534..1cf471befe 100644
--- a/ext/standard/php_random.h
+++ b/ext/standard/php_random.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/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h
index b1042450ac..fbd1321e73 100644
--- a/ext/standard/php_smart_string.h
+++ b/ext/standard/php_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/ext/standard/php_smart_string_public.h b/ext/standard/php_smart_string_public.h
index 5bb0c6c0be..a022b44c9e 100644
--- a/ext/standard/php_smart_string_public.h
+++ b/ext/standard/php_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/ext/standard/php_standard.h b/ext/standard/php_standard.h
index 615264282e..54375c0739 100644
--- a/ext/standard/php_standard.h
+++ b/ext/standard/php_standard.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/ext/standard/php_string.h b/ext/standard/php_string.h
index 0bf88cb741..7e5f6566e4 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_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/ext/standard/php_type.h b/ext/standard/php_type.h
index 9cd4cb22fe..be056201db 100644
--- a/ext/standard/php_type.h
+++ b/ext/standard/php_type.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/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h
index 7c350b4f18..40a1a20b21 100644
--- a/ext/standard/php_uuencode.h
+++ b/ext/standard/php_uuencode.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/ext/standard/php_var.h b/ext/standard/php_var.h
index 1342ae2565..d9abae86d2 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.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/ext/standard/php_versioning.h b/ext/standard/php_versioning.h
index 5b1ac2ec64..1c5041e0dc 100644
--- a/ext/standard/php_versioning.h
+++ b/ext/standard/php_versioning.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/ext/standard/proc_open.c b/ext/standard/proc_open.c
index d99d008771..12e9820522 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.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, |
@@ -244,7 +242,7 @@ PHP_FUNCTION(proc_terminate)
Z_PARAM_RESOURCE(zproc)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sig_no)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -266,7 +264,7 @@ PHP_FUNCTION(proc_terminate)
}
/* }}} */
-/* {{{ proto int proc_close(resource process)
+/* {{{ proto int|false proc_close(resource process)
close a process opened by proc_open */
PHP_FUNCTION(proc_close)
{
@@ -275,7 +273,7 @@ PHP_FUNCTION(proc_close)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zproc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -288,7 +286,7 @@ PHP_FUNCTION(proc_close)
}
/* }}} */
-/* {{{ proto array proc_get_status(resource process)
+/* {{{ proto array|false proc_get_status(resource process)
get information about a process opened by proc_open */
PHP_FUNCTION(proc_get_status)
{
@@ -305,7 +303,7 @@ PHP_FUNCTION(proc_get_status)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zproc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
RETURN_FALSE;
@@ -470,7 +468,7 @@ static char *create_win_command_from_args(HashTable *args) {
}
#endif
-/* {{{ proto resource proc_open(string|array command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]])
+/* {{{ proto resource|false proc_open(string|array command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]])
Run a process with more control over it's file descriptors */
PHP_FUNCTION(proc_open)
{
@@ -523,7 +521,7 @@ PHP_FUNCTION(proc_open)
Z_PARAM_STRING_EX(cwd, cwd_len, 1, 0)
Z_PARAM_ARRAY_EX(environment, 1, 0)
Z_PARAM_ARRAY_EX(other_options, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
memset(&env, 0, sizeof(env));
diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h
index b7a29220d1..c637e7ba26 100644
--- a/ext/standard/proc_open.h
+++ b/ext/standard/proc_open.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/ext/standard/quot_print.c b/ext/standard/quot_print.c
index 336a4cc0bb..19dc2e652a 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.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/ext/standard/quot_print.h b/ext/standard/quot_print.h
index 2cdf403a4e..d27f6f1d2d 100644
--- a/ext/standard/quot_print.h
+++ b/ext/standard/quot_print.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/ext/standard/rand.c b/ext/standard/rand.c
index 8c47a89f4f..be4d55c6c0 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.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/ext/standard/random.c b/ext/standard/random.c
index 2ab0e8ed80..ecc9b61eee 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.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, |
@@ -202,7 +200,7 @@ PHP_FUNCTION(random_bytes)
zend_long size;
zend_string *bytes;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(size)
ZEND_PARSE_PARAMETERS_END();
@@ -276,7 +274,7 @@ PHP_FUNCTION(random_int)
zend_long max;
zend_long result;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 2, 2)
+ ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(min)
Z_PARAM_LONG(max)
ZEND_PARSE_PARAMETERS_END();
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index fc48315973..687d063111 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.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/ext/standard/scanf.h b/ext/standard/scanf.h
index 7b958e8b23..77086edf24 100644
--- a/ext/standard/scanf.h
+++ b/ext/standard/scanf.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/ext/standard/sha1.c b/ext/standard/sha1.c
index 148b2dbb24..269fe8a947 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.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/ext/standard/sha1.h b/ext/standard/sha1.h
index 594c4a3f3e..b1788a6739 100644
--- a/ext/standard/sha1.h
+++ b/ext/standard/sha1.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/ext/standard/soundex.c b/ext/standard/soundex.c
index 0f46fbfdfe..37cce07601 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.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/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 24d8357d7f..7c08083f5b 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.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, |
@@ -49,7 +47,7 @@ static php_stream_context *decode_context_param(zval *contextresource);
/* Streams based network functions */
#if HAVE_SOCKETPAIR
-/* {{{ proto array stream_socket_pair(int domain, int type, int protocol)
+/* {{{ proto array|false stream_socket_pair(int domain, int type, int protocol)
Creates a pair of connected, indistinguishable socket streams */
PHP_FUNCTION(stream_socket_pair)
{
@@ -61,7 +59,7 @@ PHP_FUNCTION(stream_socket_pair)
Z_PARAM_LONG(domain)
Z_PARAM_LONG(type)
Z_PARAM_LONG(protocol)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (0 != socketpair((int)domain, (int)type, (int)protocol, pair)) {
char errbuf[256];
@@ -86,7 +84,7 @@ PHP_FUNCTION(stream_socket_pair)
/* }}} */
#endif
-/* {{{ proto resource stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]])
+/* {{{ proto resource|false stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]])
Open a client connection to a remote address */
PHP_FUNCTION(stream_socket_client)
{
@@ -112,7 +110,7 @@ PHP_FUNCTION(stream_socket_client)
Z_PARAM_DOUBLE(timeout)
Z_PARAM_LONG(flags)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -175,7 +173,7 @@ PHP_FUNCTION(stream_socket_client)
}
/* }}} */
-/* {{{ proto resource stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]])
+/* {{{ proto resource|false stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]])
Create a server socket bound to localaddress */
PHP_FUNCTION(stream_socket_server)
{
@@ -197,7 +195,7 @@ PHP_FUNCTION(stream_socket_server)
Z_PARAM_ZVAL(zerrstr)
Z_PARAM_LONG(flags)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -240,7 +238,7 @@ PHP_FUNCTION(stream_socket_server)
}
/* }}} */
-/* {{{ proto resource stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])
+/* {{{ proto resource|false stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])
Accept a client connection from a server socket */
PHP_FUNCTION(stream_socket_accept)
{
@@ -258,7 +256,7 @@ PHP_FUNCTION(stream_socket_accept)
Z_PARAM_OPTIONAL
Z_PARAM_DOUBLE(timeout)
Z_PARAM_ZVAL(zpeername)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -293,7 +291,7 @@ PHP_FUNCTION(stream_socket_accept)
}
/* }}} */
-/* {{{ proto string stream_socket_get_name(resource stream, bool want_peer)
+/* {{{ proto string|false stream_socket_get_name(resource stream, bool want_peer)
Returns either the locally bound or remote name for a socket stream */
PHP_FUNCTION(stream_socket_get_name)
{
@@ -305,7 +303,7 @@ PHP_FUNCTION(stream_socket_get_name)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_BOOL(want_peer)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -325,7 +323,7 @@ PHP_FUNCTION(stream_socket_get_name)
}
/* }}} */
-/* {{{ proto int stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]])
+/* {{{ proto int|false stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]])
Send data to a socket stream. If target_addr is specified it must be in dotted quad (or [ipv6]) format */
PHP_FUNCTION(stream_socket_sendto)
{
@@ -343,7 +341,7 @@ PHP_FUNCTION(stream_socket_sendto)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
Z_PARAM_STRING(target_addr, target_addr_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
if (target_addr_len) {
@@ -358,7 +356,7 @@ PHP_FUNCTION(stream_socket_sendto)
}
/* }}} */
-/* {{{ proto string stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]])
+/* {{{ proto string|false stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]])
Receives data from a socket stream */
PHP_FUNCTION(stream_socket_recvfrom)
{
@@ -376,7 +374,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
Z_PARAM_ZVAL(zremote)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -409,7 +407,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
}
/* }}} */
-/* {{{ proto string stream_get_contents(resource source [, int maxlen [, int offset]])
+/* {{{ proto string|false stream_get_contents(resource source [, int maxlen [, int offset]])
Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */
PHP_FUNCTION(stream_get_contents)
{
@@ -424,7 +422,7 @@ PHP_FUNCTION(stream_get_contents)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
Z_PARAM_LONG(desiredpos)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -460,7 +458,7 @@ PHP_FUNCTION(stream_get_contents)
}
/* }}} */
-/* {{{ proto int stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]])
+/* {{{ proto int|false stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]])
Reads up to maxlen bytes from source stream and writes them to dest stream. */
PHP_FUNCTION(stream_copy_to_stream)
{
@@ -476,7 +474,7 @@ PHP_FUNCTION(stream_copy_to_stream)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
Z_PARAM_LONG(pos)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(src, zsrc);
php_stream_from_zval(dest, zdest);
@@ -495,7 +493,7 @@ PHP_FUNCTION(stream_copy_to_stream)
}
/* }}} */
-/* {{{ proto array stream_get_meta_data(resource fp)
+/* {{{ proto array|false stream_get_meta_data(resource fp)
Retrieves header/meta data from streams/file pointers */
PHP_FUNCTION(stream_get_meta_data)
{
@@ -552,7 +550,7 @@ PHP_FUNCTION(stream_get_meta_data)
}
/* }}} */
-/* {{{ proto array stream_get_transports()
+/* {{{ proto array|false stream_get_transports()
Retrieves list of registered socket transports */
PHP_FUNCTION(stream_get_transports)
{
@@ -574,7 +572,7 @@ PHP_FUNCTION(stream_get_transports)
}
/* }}} */
-/* {{{ proto array stream_get_wrappers()
+/* {{{ proto array|false stream_get_wrappers()
Retrieves list of registered stream wrappers */
PHP_FUNCTION(stream_get_wrappers)
{
@@ -738,7 +736,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array)
}
/* }}} */
-/* {{{ proto int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
+/* {{{ proto int|false stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */
PHP_FUNCTION(stream_select)
{
@@ -755,7 +753,7 @@ PHP_FUNCTION(stream_select)
Z_PARAM_ARRAY_EX2(r_array, 1, 1, 0)
Z_PARAM_ARRAY_EX2(w_array, 1, 1, 0)
Z_PARAM_ARRAY_EX2(e_array, 1, 1, 0)
- Z_PARAM_LONG_EX(sec, secnull, 1, 0)
+ Z_PARAM_LONG_OR_NULL(sec, secnull)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(usec)
ZEND_PARSE_PARAMETERS_END();
@@ -959,7 +957,7 @@ static php_stream_context *decode_context_param(zval *contextresource)
}
/* }}} */
-/* {{{ proto array stream_context_get_options(resource context|resource stream)
+/* {{{ proto array|false stream_context_get_options(resource context|resource stream)
Retrieve options for a stream/wrapper/context */
PHP_FUNCTION(stream_context_get_options)
{
@@ -968,7 +966,7 @@ PHP_FUNCTION(stream_context_get_options)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
@@ -993,7 +991,7 @@ PHP_FUNCTION(stream_context_set_option)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zcontext)
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* figure out where the context is coming from exactly */
if (!(context = decode_context_param(zcontext))) {
@@ -1012,7 +1010,7 @@ PHP_FUNCTION(stream_context_set_option)
Z_PARAM_STRING(wrappername, wrapperlen)
Z_PARAM_STRING(optionname, optionlen)
Z_PARAM_ZVAL(zvalue)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* figure out where the context is coming from exactly */
if (!(context = decode_context_param(zcontext))) {
@@ -1035,7 +1033,7 @@ PHP_FUNCTION(stream_context_set_params)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zcontext)
Z_PARAM_ARRAY(params)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
@@ -1047,7 +1045,7 @@ PHP_FUNCTION(stream_context_set_params)
}
/* }}} */
-/* {{{ proto array stream_context_get_params(resource context|resource stream)
+/* {{{ proto array|false stream_context_get_params(resource context|resource stream)
Get parameters of a file context */
PHP_FUNCTION(stream_context_get_params)
{
@@ -1056,7 +1054,7 @@ PHP_FUNCTION(stream_context_get_params)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
@@ -1084,7 +1082,7 @@ PHP_FUNCTION(stream_context_get_default)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(params)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
@@ -1132,7 +1130,7 @@ PHP_FUNCTION(stream_context_create)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_EX(options, 1, 0)
Z_PARAM_ARRAY_EX(params, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_alloc();
@@ -1166,7 +1164,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(read_write)
Z_PARAM_ZVAL(filterparams)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -1253,7 +1251,7 @@ PHP_FUNCTION(stream_filter_remove)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zfilter)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
filter = zend_fetch_resource(Z_RES_P(zfilter), NULL, php_file_le_stream_filter());
if (!filter) {
@@ -1292,7 +1290,7 @@ PHP_FUNCTION(stream_get_line)
Z_PARAM_LONG(max_length)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (max_length < 0) {
php_error_docref(NULL, E_WARNING, "The maximum allowed length must be greater than or equal to zero");
@@ -1399,7 +1397,7 @@ PHP_FUNCTION(stream_set_write_buffer)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_LONG(arg2)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -1428,7 +1426,7 @@ PHP_FUNCTION(stream_set_chunk_size)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_LONG(csize)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (csize <= 0) {
php_error_docref(NULL, E_WARNING, "The chunk size must be a positive integer, given " ZEND_LONG_FMT, csize);
@@ -1464,7 +1462,7 @@ PHP_FUNCTION(stream_set_read_buffer)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_LONG(arg2)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -1495,9 +1493,9 @@ PHP_FUNCTION(stream_socket_enable_crypto)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_BOOL(enable)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG_EX(cryptokind, cryptokindnull, 1, 0)
+ Z_PARAM_LONG_OR_NULL(cryptokind, cryptokindnull)
Z_PARAM_RESOURCE(zsessstream)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -1536,7 +1534,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
}
/* }}} */
-/* {{{ proto string stream_resolve_include_path(string filename)
+/* {{{ proto string|false stream_resolve_include_path(string filename)
Determine what file will be opened by calls to fopen() with a relative path */
PHP_FUNCTION(stream_resolve_include_path)
{
@@ -1567,7 +1565,7 @@ PHP_FUNCTION(stream_is_local)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(zstream)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(zstream) == IS_RESOURCE) {
php_stream_from_zval(stream, zstream);
@@ -1600,7 +1598,7 @@ PHP_FUNCTION(stream_supports_lock)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zsrc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1622,7 +1620,7 @@ PHP_FUNCTION(stream_isatty)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zsrc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1666,7 +1664,7 @@ PHP_FUNCTION(sapi_windows_vt100_support)
Z_PARAM_RESOURCE(zsrc)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(enable)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1677,8 +1675,7 @@ PHP_FUNCTION(sapi_windows_vt100_support)
php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0);
}
else {
- zend_internal_type_error(
- ZEND_ARG_USES_STRICT_TYPES(),
+ zend_type_error(
"%s() was not able to analyze the specified stream",
get_active_function_name()
);
@@ -1727,7 +1724,7 @@ PHP_FUNCTION(stream_socket_shutdown)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_LONG(how)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (how != STREAM_SHUT_RD &&
how != STREAM_SHUT_WR &&
diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h
index bcd2afdcc4..6a94169dc6 100644
--- a/ext/standard/streamsfuncs.h
+++ b/ext/standard/streamsfuncs.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/ext/standard/string.c b/ext/standard/string.c
index fc234aafad..639e443c06 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.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, |
@@ -236,15 +234,11 @@ PHP_FUNCTION(bin2hex)
result = php_bin2hex((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data));
- if (!result) {
- RETURN_FALSE;
- }
-
RETURN_STR(result);
}
/* }}} */
-/* {{{ proto string hex2bin(string data)
+/* {{{ proto string|false hex2bin(string data)
Converts the hex representation of data to binary */
PHP_FUNCTION(hex2bin)
{
@@ -328,7 +322,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
}
/* }}} */
-/* {{{ proto int strspn(string str, string mask [, int start [, int len]])
+/* {{{ proto int|false strspn(string str, string mask [, int start [, int len]])
Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */
PHP_FUNCTION(strspn)
{
@@ -336,7 +330,7 @@ PHP_FUNCTION(strspn)
}
/* }}} */
-/* {{{ proto int strcspn(string str, string mask [, int start [, int len]])
+/* {{{ proto int|false strcspn(string str, string mask [, int start [, int len]])
Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */
PHP_FUNCTION(strcspn)
{
@@ -514,7 +508,7 @@ PHP_MINIT_FUNCTION(nl_langinfo)
}
/* }}} */
-/* {{{ proto string nl_langinfo(int item)
+/* {{{ proto string|false nl_langinfo(int item)
Query language and locale information */
PHP_FUNCTION(nl_langinfo)
{
@@ -937,13 +931,13 @@ PHP_FUNCTION(wordwrap)
}
if (breakchar_len == 0) {
- php_error_docref(NULL, E_WARNING, "Break string cannot be empty");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Break string cannot be empty");
+ return;
}
if (linelength == 0 && docut) {
- php_error_docref(NULL, E_WARNING, "Can't force cut when width is zero");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Can't force cut when width is zero");
+ return;
}
/* Special case for a single-character break as it needs no
@@ -1149,14 +1143,14 @@ PHP_FUNCTION(explode)
ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(delim) == 0) {
- php_error_docref(NULL, E_WARNING, "Empty delimiter");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Empty delimiter");
+ return;
}
array_init(return_value);
if (ZSTR_LEN(str) == 0) {
- if (limit >= 0) {
+ if (limit >= 0) {
ZVAL_EMPTY_STRING(&tmp);
zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
}
@@ -1281,7 +1275,7 @@ PHP_FUNCTION(implode)
if (arg2 == NULL) {
if (Z_TYPE_P(arg1) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Argument must be an array");
+ zend_type_error("Argument must be an array");
return;
}
@@ -1298,7 +1292,7 @@ PHP_FUNCTION(implode)
glue = zval_get_tmp_string(arg1, &tmp_glue);
pieces = arg2;
} else {
- php_error_docref(NULL, E_WARNING, "Invalid arguments passed");
+ zend_type_error("Invalid arguments passed");
return;
}
}
@@ -1310,7 +1304,7 @@ PHP_FUNCTION(implode)
#define STRTOK_TABLE(p) BG(strtok_table)[(unsigned char) *p]
-/* {{{ proto string strtok([string str,] string token)
+/* {{{ proto string|false strtok([string str,] string token)
Tokenize a string */
PHP_FUNCTION(strtok)
{
@@ -1648,7 +1642,7 @@ PHP_FUNCTION(dirname)
ZSTR_LEN(ret) = zend_dirname(ZSTR_VAL(ret), str_len);
#endif
} else if (levels < 1) {
- php_error_docref(NULL, E_WARNING, "Invalid argument, levels must be >= 1");
+ zend_throw_error(NULL, "Invalid argument, levels must be >= 1");
zend_string_efree(ret);
return;
} else {
@@ -1666,7 +1660,7 @@ PHP_FUNCTION(dirname)
}
/* }}} */
-/* {{{ proto array pathinfo(string path[, int options])
+/* {{{ proto array|string pathinfo(string path[, int options])
Returns information about a certain string */
PHP_FUNCTION(pathinfo)
{
@@ -1798,76 +1792,28 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end)
}
/* }}} */
-/* {{{ php_needle_char
- */
-static int php_needle_char(zval *needle, char *target)
-{
- switch (Z_TYPE_P(needle)) {
- case IS_LONG:
- *target = (char)Z_LVAL_P(needle);
- return SUCCESS;
- case IS_NULL:
- case IS_FALSE:
- *target = '\0';
- return SUCCESS;
- case IS_TRUE:
- *target = '\1';
- return SUCCESS;
- case IS_DOUBLE:
- case IS_OBJECT:
- *target = (char) zval_get_long(needle);
- return SUCCESS;
- default:
- php_error_docref(NULL, E_WARNING, "needle is not a string or an integer");
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ proto string stristr(string haystack, string needle[, bool part])
+/* {{{ proto string|false stristr(string haystack, string needle[, bool part])
Finds first occurrence of a string within another, case insensitive */
PHP_FUNCTION(stristr)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
size_t found_offset;
char *haystack_dup;
- char needle_char[2];
+ char *orig_needle;
zend_bool part = 0;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(part)
ZEND_PARSE_PARAMETERS_END();
haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack));
-
- if (Z_TYPE_P(needle) == IS_STRING) {
- char *orig_needle;
- if (!Z_STRLEN_P(needle)) {
- php_error_docref(NULL, E_WARNING, "Empty needle");
- efree(haystack_dup);
- RETURN_FALSE;
- }
- orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
- found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle));
- efree(orig_needle);
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- efree(haystack_dup);
- RETURN_FALSE;
- }
- needle_char[1] = 0;
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1);
- }
+ orig_needle = estrndup(ZSTR_VAL(needle), ZSTR_LEN(needle));
+ found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), ZSTR_LEN(needle));
+ efree(orig_needle);
if (found) {
found_offset = found - haystack_dup;
@@ -1884,43 +1830,23 @@ PHP_FUNCTION(stristr)
}
/* }}} */
-/* {{{ proto string strstr(string haystack, string needle[, bool part])
+/* {{{ proto string|false strstr(string haystack, string needle[, bool part])
Finds first occurrence of a string within another */
PHP_FUNCTION(strstr)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
- char needle_char[2];
zend_long found_offset;
zend_bool part = 0;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(part)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(needle) == IS_STRING) {
- if (!Z_STRLEN_P(needle)) {
- php_error_docref(NULL, E_WARNING, "Empty needle");
- RETURN_FALSE;
- }
-
- found = php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- RETURN_FALSE;
- }
- needle_char[1] = 0;
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- }
+ found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
if (found) {
found_offset = found - ZSTR_VAL(haystack);
@@ -1938,19 +1864,17 @@ PHP_FUNCTION(strstr)
An alias for strstr */
/* }}} */
-/* {{{ proto int strpos(string haystack, string needle [, int offset])
+/* {{{ proto int|false strpos(string haystack, string needle [, int offset])
Finds position of first occurrence of a string within another */
PHP_FUNCTION(strpos)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
- char needle_char[2];
- zend_long offset = 0;
+ zend_long offset = 0;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END();
@@ -1963,31 +1887,9 @@ PHP_FUNCTION(strpos)
RETURN_FALSE;
}
- if (Z_TYPE_P(needle) == IS_STRING) {
- if (!Z_STRLEN_P(needle)) {
- php_error_docref(NULL, E_WARNING, "Empty needle");
- RETURN_FALSE;
- }
-
- found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
- Z_STRVAL_P(needle),
- Z_STRLEN_P(needle),
- ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- RETURN_FALSE;
- }
- needle_char[1] = 0;
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
- needle_char,
- 1,
- ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- }
+ found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
+ ZSTR_VAL(needle), ZSTR_LEN(needle),
+ ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
if (found) {
RETURN_LONG(found - ZSTR_VAL(haystack));
@@ -1997,20 +1899,18 @@ PHP_FUNCTION(strpos)
}
/* }}} */
-/* {{{ proto int stripos(string haystack, string needle [, int offset])
+/* {{{ proto int|false stripos(string haystack, string needle [, int offset])
Finds position of first occurrence of a string within another, case insensitive */
PHP_FUNCTION(stripos)
{
const char *found = NULL;
- zend_string *haystack;
+ zend_string *haystack, *needle;
zend_long offset = 0;
- char needle_char[2];
- zval *needle;
zend_string *needle_dup = NULL, *haystack_dup;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END();
@@ -2023,37 +1923,14 @@ PHP_FUNCTION(stripos)
RETURN_FALSE;
}
- if (ZSTR_LEN(haystack) == 0) {
+ if (ZSTR_LEN(needle) > ZSTR_LEN(haystack)) {
RETURN_FALSE;
}
- if (Z_TYPE_P(needle) == IS_STRING) {
- if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) {
- RETURN_FALSE;
- }
-
- haystack_dup = php_string_tolower(haystack);
- needle_dup = php_string_tolower(Z_STR_P(needle));
- found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
- ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- haystack_dup = php_string_tolower(haystack);
- needle_char[0] = tolower(needle_char[0]);
- needle_char[1] = '\0';
- found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
- needle_char,
- sizeof(needle_char) - 1,
- ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
- }
-
+ haystack_dup = php_string_tolower(haystack);
+ needle_dup = php_string_tolower(needle);
+ found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
+ ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
if (found) {
RETVAL_LONG(found - ZSTR_VAL(haystack_dup));
@@ -2062,72 +1939,48 @@ PHP_FUNCTION(stripos)
}
zend_string_release_ex(haystack_dup, 0);
- if (needle_dup) {
- zend_string_release_ex(needle_dup, 0);
- }
+ zend_string_release_ex(needle_dup, 0);
}
/* }}} */
-/* {{{ proto int strrpos(string haystack, string needle [, int offset])
+/* {{{ proto int|false strrpos(string haystack, string needle [, int offset])
Finds position of last occurrence of a string within another string */
PHP_FUNCTION(strrpos)
{
- zval *zneedle;
+ zend_string *needle;
zend_string *haystack;
- size_t needle_len;
zend_long offset = 0;
- char ord_needle[2];
- const char *p, *e, *found, *needle;
+ const char *p, *e, *found;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(zneedle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- if (Z_TYPE_P(zneedle) == IS_STRING) {
- needle = Z_STRVAL_P(zneedle);
- needle_len = Z_STRLEN_P(zneedle);
- } else {
- if (php_needle_char(zneedle, ord_needle) != SUCCESS) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- ord_needle[1] = '\0';
- needle = ord_needle;
- needle_len = 1;
- }
-
- if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_END();
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+ php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
p = ZSTR_VAL(haystack) + (size_t)offset;
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+ php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
+
p = ZSTR_VAL(haystack);
- if ((size_t)-offset < needle_len) {
+ if ((size_t)-offset < ZSTR_LEN(needle)) {
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
- e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + needle_len;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + ZSTR_LEN(needle);
}
}
- if ((found = zend_memnrstr(p, needle, needle_len, e))) {
+ if ((found = zend_memnrstr(p, ZSTR_VAL(needle), ZSTR_LEN(needle), e))) {
RETURN_LONG(found - ZSTR_VAL(haystack));
}
@@ -2135,54 +1988,30 @@ PHP_FUNCTION(strrpos)
}
/* }}} */
-/* {{{ proto int strripos(string haystack, string needle [, int offset])
+/* {{{ proto int|false strripos(string haystack, string needle [, int offset])
Finds position of last occurrence of a string within another string */
PHP_FUNCTION(strripos)
{
- zval *zneedle;
zend_string *needle;
zend_string *haystack;
zend_long offset = 0;
const char *p, *e, *found;
- zend_string *needle_dup, *haystack_dup, *ord_needle = NULL;
- ALLOCA_FLAG(use_heap);
+ zend_string *needle_dup, *haystack_dup;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(zneedle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap);
- if (Z_TYPE_P(zneedle) == IS_STRING) {
- needle = Z_STR_P(zneedle);
- } else {
- if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- ZSTR_VAL(ord_needle)[1] = '\0';
- needle = ord_needle;
- }
-
- if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(needle) == 1) {
/* Single character search can shortcut memcmps
Can also avoid tolower emallocs */
+ char lowered;
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+ php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
p = ZSTR_VAL(haystack) + (size_t)offset;
@@ -2190,22 +2019,19 @@ PHP_FUNCTION(strripos)
} else {
p = ZSTR_VAL(haystack);
if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+ php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
e = ZSTR_VAL(haystack) + (ZSTR_LEN(haystack) + (size_t)offset);
}
/* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */
- *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle));
+ lowered = tolower(*ZSTR_VAL(needle));
while (e >= p) {
- if (tolower(*e) == *ZSTR_VAL(ord_needle)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
+ if (tolower(*e) == lowered) {
RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
e--;
}
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
@@ -2213,8 +2039,7 @@ PHP_FUNCTION(strripos)
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+ php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
p = ZSTR_VAL(haystack_dup) + offset;
@@ -2222,10 +2047,10 @@ PHP_FUNCTION(strripos)
} else {
if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+ php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
+
p = ZSTR_VAL(haystack_dup);
if ((size_t)-offset < ZSTR_LEN(needle)) {
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
@@ -2239,45 +2064,28 @@ PHP_FUNCTION(strripos)
RETVAL_LONG(found - ZSTR_VAL(haystack_dup));
zend_string_release_ex(needle_dup, 0);
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
} else {
zend_string_release_ex(needle_dup, 0);
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto string strrchr(string haystack, string needle)
+/* {{{ proto string|false strrchr(string haystack, string needle)
Finds the last occurrence of a character in a string within another */
PHP_FUNCTION(strrchr)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
zend_long found_offset;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(needle) == IS_STRING) {
- found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack));
- } else {
- char needle_chr;
- if (php_needle_char(needle, &needle_chr) != SUCCESS) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack));
- }
-
+ found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack));
if (found) {
found_offset = found - ZSTR_VAL(haystack);
RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset);
@@ -2293,28 +2101,19 @@ static zend_string *php_chunk_split(const char *src, size_t srclen, const char *
{
char *q;
const char *p;
- size_t chunks; /* complete chunks! */
+ size_t chunks;
size_t restlen;
- size_t out_len;
zend_string *dest;
chunks = srclen / chunklen;
restlen = srclen - chunks * chunklen; /* srclen % chunklen */
-
- if (chunks > INT_MAX - 1) {
- return NULL;
- }
- out_len = chunks + 1;
- if (endlen !=0 && out_len > INT_MAX/endlen) {
- return NULL;
- }
- out_len *= endlen;
- if (out_len > INT_MAX - srclen - 1) {
- return NULL;
+ if (restlen) {
+ /* We want chunks to be rounded up rather than rounded down.
+ * Increment can't overflow because chunks <= SIZE_MAX/2 at this point. */
+ chunks++;
}
- out_len += srclen + 1;
- dest = zend_string_alloc(out_len * sizeof(char), 0);
+ dest = zend_string_safe_alloc(chunks, endlen, srclen, 0);
for (p = src, q = ZSTR_VAL(dest); p < (src + srclen - chunklen + 1); ) {
memcpy(q, p, chunklen);
@@ -2332,7 +2131,7 @@ static zend_string *php_chunk_split(const char *src, size_t srclen, const char *
}
*q = '\0';
- ZSTR_LEN(dest) = q - ZSTR_VAL(dest);
+ ZEND_ASSERT(q - ZSTR_VAL(dest) == ZSTR_LEN(dest));
return dest;
}
@@ -2356,8 +2155,8 @@ PHP_FUNCTION(chunk_split)
ZEND_PARSE_PARAMETERS_END();
if (chunklen <= 0) {
- php_error_docref(NULL, E_WARNING, "Chunk length should be greater than zero");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Chunk length should be greater than zero");
+ return;
}
if ((size_t)chunklen > ZSTR_LEN(str)) {
@@ -2375,27 +2174,23 @@ PHP_FUNCTION(chunk_split)
result = php_chunk_split(ZSTR_VAL(str), ZSTR_LEN(str), end, endlen, (size_t)chunklen);
- if (result) {
- RETURN_STR(result);
- } else {
- RETURN_FALSE;
- }
+ RETURN_STR(result);
}
/* }}} */
-/* {{{ proto string substr(string str, int start [, int length])
+/* {{{ proto string|false substr(string str, int start [, int length])
Returns part of a string */
PHP_FUNCTION(substr)
{
zend_string *str;
zend_long l = 0, f;
- int argc = ZEND_NUM_ARGS();
+ zend_bool len_is_null = 1;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(str)
Z_PARAM_LONG(f)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG(l)
+ Z_PARAM_LONG_OR_NULL(l, len_is_null)
ZEND_PARSE_PARAMETERS_END();
if (f > (zend_long)ZSTR_LEN(str)) {
@@ -2409,7 +2204,7 @@ PHP_FUNCTION(substr)
} else {
f = (zend_long)ZSTR_LEN(str) + f;
}
- if (argc > 2) {
+ if (!len_is_null) {
if (l < 0) {
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
@@ -2429,7 +2224,7 @@ PHP_FUNCTION(substr)
} else {
goto truncate_len;
}
- } else if (argc > 2) {
+ } else if (!len_is_null) {
if (l < 0) {
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
@@ -2459,7 +2254,7 @@ truncate_len:
}
/* }}} */
-/* {{{ proto mixed substr_replace(mixed str, mixed repl, mixed start [, mixed length])
+/* {{{ proto string|array|false substr_replace(mixed str, mixed repl, mixed start [, mixed length])
Replaces part of a string with another string */
PHP_FUNCTION(substr_replace)
{
@@ -2739,8 +2534,8 @@ PHP_FUNCTION(quotemeta)
old_end = ZSTR_VAL(old) + ZSTR_LEN(old);
- if (ZSTR_VAL(old) == old_end) {
- RETURN_FALSE;
+ if (ZSTR_LEN(old) == 0) {
+ RETURN_EMPTY_STRING();
}
str = zend_string_safe_alloc(2, ZSTR_LEN(old), 0, 0);
@@ -2796,7 +2591,7 @@ PHP_FUNCTION(chr)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(c)
- ZEND_PARSE_PARAMETERS_END_EX(c = 0);
+ ZEND_PARSE_PARAMETERS_END();
c &= 0xff;
ZVAL_INTERNED_STR(return_value, ZSTR_CHAR(c));
@@ -3455,7 +3250,7 @@ PHPAPI zend_string *php_str_to_str(const char *haystack, size_t length, const ch
}
/* }}} */
-/* {{{ proto string strtr(string str, string from[, string to])
+/* {{{ proto string|false strtr(string str, string from[, string to])
Translates characters in str using given translation tables */
PHP_FUNCTION(strtr)
{
@@ -3473,8 +3268,8 @@ PHP_FUNCTION(strtr)
ZEND_PARSE_PARAMETERS_END();
if (ac == 2 && Z_TYPE_P(from) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "The second argument is not an array");
- RETURN_FALSE;
+ zend_type_error("The second argument is not an array");
+ return;
}
/* shortcut for empty string */
@@ -4616,7 +4411,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
ZEND_PARSE_PARAMETERS_END();
if (str_len == 0) {
- RETURN_FALSE;
+ RETURN_EMPTY_STRING();
}
tmp = str;
@@ -4916,7 +4711,7 @@ PHP_FUNCTION(strip_tags)
}
/* }}} */
-/* {{{ proto string setlocale(mixed category, string locale [, string ...])
+/* {{{ proto string|false setlocale(int category, string locale [, string ...])
Set locale information */
PHP_FUNCTION(setlocale)
{
@@ -5029,7 +4824,7 @@ PHP_FUNCTION(setlocale)
}
/* }}} */
-/* {{{ proto void parse_str(string encoded_string [, array &result])
+/* {{{ proto void parse_str(string encoded_string, array &result)
Parses GET/POST/COOKIE data and sets global variables */
PHP_FUNCTION(parse_str)
{
@@ -5038,39 +4833,18 @@ PHP_FUNCTION(parse_str)
char *res = NULL;
size_t arglen;
- ZEND_PARSE_PARAMETERS_START(1, 2)
+ ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(arg, arglen)
- Z_PARAM_OPTIONAL
Z_PARAM_ZVAL(arrayArg)
ZEND_PARSE_PARAMETERS_END();
- res = estrndup(arg, arglen);
-
- if (arrayArg == NULL) {
- zval tmp;
- zend_array *symbol_table;
- if (zend_forbid_dynamic_call("parse_str() with a single argument") == FAILURE) {
- efree(res);
- return;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated");
-
- symbol_table = zend_rebuild_symbol_table();
- ZVAL_ARR(&tmp, symbol_table);
- sapi_module.treat_data(PARSE_STRING, res, &tmp);
- if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) {
- zend_throw_error(NULL, "Cannot re-assign $this");
- }
- } else {
- arrayArg = zend_try_array_init(arrayArg);
- if (!arrayArg) {
- efree(res);
- return;
- }
-
- sapi_module.treat_data(PARSE_STRING, res, arrayArg);
+ arrayArg = zend_try_array_init(arrayArg);
+ if (!arrayArg) {
+ return;
}
+
+ res = estrndup(arg, arglen);
+ sapi_module.treat_data(PARSE_STRING, res, arrayArg);
}
/* }}} */
@@ -5547,7 +5321,7 @@ PHP_FUNCTION(str_repeat)
ZEND_PARSE_PARAMETERS_END();
if (mult < 0) {
- php_error_docref(NULL, E_WARNING, "Second argument has to be greater than or equal to 0");
+ zend_throw_error(NULL, "Second argument has to be greater than or equal to 0");
return;
}
@@ -5585,7 +5359,7 @@ PHP_FUNCTION(str_repeat)
}
/* }}} */
-/* {{{ proto mixed count_chars(string input [, int mode])
+/* {{{ proto array|string count_chars(string input [, int mode])
Returns info about what characters are used in input */
PHP_FUNCTION(count_chars)
{
@@ -5605,8 +5379,8 @@ PHP_FUNCTION(count_chars)
ZEND_PARSE_PARAMETERS_END();
if (mymode < 0 || mymode > 4) {
- php_error_docref(NULL, E_WARNING, "Unknown mode");
- RETURN_FALSE;
+ zend_value_error("Unknown mode");
+ return;
}
buf = (const unsigned char *) ZSTR_VAL(input);
@@ -5773,13 +5547,13 @@ PHP_FUNCTION(strnatcasecmp)
}
/* }}} */
-/* {{{ proto int substr_count(string haystack, string needle [, int offset [, int length]])
+/* {{{ proto int|false substr_count(string haystack, string needle [, int offset [, int length]])
Returns the number of times a substring occurs in the string */
PHP_FUNCTION(substr_count)
{
char *haystack, *needle;
zend_long offset = 0, length = 0;
- int ac = ZEND_NUM_ARGS();
+ zend_bool length_is_null = 1;
zend_long count = 0;
size_t haystack_len, needle_len;
const char *p, *endp;
@@ -5790,12 +5564,12 @@ PHP_FUNCTION(substr_count)
Z_PARAM_STRING(needle, needle_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
- Z_PARAM_LONG(length)
+ Z_PARAM_LONG_OR_NULL(length, length_is_null)
ZEND_PARSE_PARAMETERS_END();
if (needle_len == 0) {
- php_error_docref(NULL, E_WARNING, "Empty substring");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Empty substring");
+ return;
}
p = haystack;
@@ -5810,7 +5584,7 @@ PHP_FUNCTION(substr_count)
}
p += offset;
- if (ac == 4) {
+ if (!length_is_null) {
if (length < 0) {
length += (haystack_len - offset);
@@ -5871,21 +5645,16 @@ PHP_FUNCTION(str_pad)
}
if (pad_str_len == 0) {
- php_error_docref(NULL, E_WARNING, "Padding string cannot be empty");
+ zend_throw_error(NULL, "Padding string cannot be empty");
return;
}
if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
- php_error_docref(NULL, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
+ zend_throw_error(NULL, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
return;
}
num_pad_chars = pad_length - ZSTR_LEN(input);
- if (num_pad_chars >= INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Padding length is too long");
- return;
- }
-
result = zend_string_safe_alloc(1, ZSTR_LEN(input), num_pad_chars, 0);
ZSTR_LEN(result) = 0;
@@ -5925,7 +5694,7 @@ PHP_FUNCTION(str_pad)
}
/* }}} */
-/* {{{ proto mixed sscanf(string str, string format [, string ...])
+/* {{{ proto array|int|null sscanf(string str, string format [, string ...])
Implements an ANSI C compatible sscanf */
PHP_FUNCTION(sscanf)
{
@@ -6083,7 +5852,7 @@ static void php_string_shuffle(char *str, zend_long len) /* {{{ */
}
/* }}} */
-/* {{{ proto void str_shuffle(string str)
+/* {{{ proto string str_shuffle(string str)
Shuffles string. One permutation of all possible is created */
PHP_FUNCTION(str_shuffle)
{
@@ -6100,13 +5869,13 @@ PHP_FUNCTION(str_shuffle)
}
/* }}} */
-/* {{{ proto mixed str_word_count(string str, [int format [, string charlist]])
+
+/* {{{ proto array|int str_word_count(string str, [int format [, string charlist]])
Counts the number of words inside a string. If format of 1 is specified,
then the function will return an array containing all the words
found inside the string. If format of 2 is specified, then the function
will return an associated array where the position of the word is the key
and the word itself is the value.
-
For the purpose of this function, 'word' is defined as a locale dependent
string containing alphabetic characters, which also may contain, but not start
with "'" and "-" characters.
@@ -6141,8 +5910,8 @@ PHP_FUNCTION(str_word_count)
/* nothing to be done */
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid format value " ZEND_LONG_FMT, type);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Invalid format value " ZEND_LONG_FMT, type);
+ return;
}
if (char_list) {
@@ -6191,7 +5960,7 @@ PHP_FUNCTION(str_word_count)
/* }}} */
#if HAVE_STRFMON
-/* {{{ proto string money_format(string format , float value)
+/* {{{ proto string|false money_format(string format , float value)
Convert monetary value(s) to string */
PHP_FUNCTION(money_format)
{
@@ -6258,8 +6027,8 @@ PHP_FUNCTION(str_split)
ZEND_PARSE_PARAMETERS_END();
if (split_length <= 0) {
- php_error_docref(NULL, E_WARNING, "The length of each segment must be greater than zero");
- RETURN_FALSE;
+ zend_throw_error(NULL, "The length of each segment must be greater than zero");
+ return;
}
@@ -6285,7 +6054,7 @@ PHP_FUNCTION(str_split)
}
/* }}} */
-/* {{{ proto array strpbrk(string haystack, string char_list)
+/* {{{ proto string|false strpbrk(string haystack, string char_list)
Search a string for any of a set of characters */
PHP_FUNCTION(strpbrk)
{
@@ -6295,7 +6064,7 @@ PHP_FUNCTION(strpbrk)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(haystack)
Z_PARAM_STR(char_list)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!ZSTR_LEN(char_list)) {
php_error_docref(NULL, E_WARNING, "The character list cannot be empty");
@@ -6314,7 +6083,7 @@ PHP_FUNCTION(strpbrk)
}
/* }}} */
-/* {{{ proto int substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]])
+/* {{{ proto int|false substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]])
Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters */
PHP_FUNCTION(substr_compare)
{
@@ -6329,16 +6098,16 @@ PHP_FUNCTION(substr_compare)
Z_PARAM_STR(s2)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG_EX(len, len_is_default, 1, 0)
+ Z_PARAM_LONG_OR_NULL(len, len_is_default)
Z_PARAM_BOOL(cs)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!len_is_default && len <= 0) {
if (len == 0) {
RETURN_LONG(0L);
} else {
- php_error_docref(NULL, E_WARNING, "The length must be greater than or equal to zero");
- RETURN_FALSE;
+ zend_throw_error(NULL, "The length must be greater than or equal to zero");
+ return;
}
}
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index 29967df34a..de4136ceb8 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.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/ext/standard/tests/array/002.phpt b/ext/standard/tests/array/002.phpt
index f6aa37b9fb..8d088f9129 100644
--- a/ext/standard/tests/array/002.phpt
+++ b/ext/standard/tests/array/002.phpt
@@ -130,17 +130,17 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[1000]=>
string(4) "test"
@@ -240,15 +240,15 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[16777216]=>
float(-0.33333333333333)
@@ -544,17 +544,17 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[0]=>
string(4) "test"
@@ -654,15 +654,15 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[0]=>
float(-0.33333333333333)
diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt
index c82f5f7fd0..c51e98a67b 100644
--- a/ext/standard/tests/array/005.phpt
+++ b/ext/standard/tests/array/005.phpt
@@ -33,18 +33,6 @@ $mixed_array = array(
/* Testing Error Conditions */
echo "\n*** Testing Error Conditions ***\n";
-/* Zero argument */
-var_dump( array_shift() );
-
-/* Scalar argument */
-var_dump( array_shift($number) );
-
-/* String argument */
-var_dump( array_shift($str) );
-
-/* Invalid Number of arguments */
-var_dump( array_shift($mixed_array[1],$mixed_array[2]) );
-
/* Empty Array as argument */
var_dump( array_shift($empty_array) );
@@ -83,18 +71,6 @@ echo"Done";
?>
--EXPECTF--
*** Testing Error Conditions ***
-
-Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
NULL
*** Testing with various array inputs ***
diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt
index 017456917e..c62be0d27c 100644
--- a/ext/standard/tests/array/009.phpt
+++ b/ext/standard/tests/array/009.phpt
@@ -69,51 +69,6 @@ foreach ($varient_arrays as $sub_array ) {
echo "\n";
}
-/*test these functions on array which is already unset */
-echo "\n-- Testing variation: when array is unset --\n";
-$unset_array = array (1);
-unset($unset_array);
-
-var_dump( current($unset_array) );
-var_dump( key($unset_array) );
-var_dump( next($unset_array) );
-var_dump( reset($unset_array) );
-
-
-echo "\n*** Testing error conditions ***\n";
-//Zero argument, expected 1 argument
-var_dump( key() );
-var_dump( current() );
-var_dump( reset() );
-var_dump( next() );
-
-// args more than expected, expected 1 argument
-$temp_array = array(1);
-var_dump( key($temp_array, $temp_array) );
-var_dump( current($temp_array, $temp_array) );
-var_dump( reset($temp_array, $temp_array) );
-var_dump( next($temp_array, $temp_array) );
-
-// invalid args type, valid argument: array
-$int_var = 1;
-$float_var = 1.5;
-$string = "string";
-var_dump( key($int_var) );
-var_dump( key($float_var) );
-var_dump( key($string) );
-
-var_dump( current($int_var) );
-var_dump( current($float_var) );
-var_dump( current($string) );
-
-var_dump( next($int_var) );
-var_dump( next($float_var) );
-var_dump( next($string) );
-
-var_dump( reset($int_var) );
-var_dump( reset($float_var) );
-var_dump( reset($string) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -456,84 +411,4 @@ array(5) {
string(4) "zero"
}
-
--- Testing variation: when array is unset --
-
-Notice: Undefined variable: unset_array in %s on line %d
-
-Warning: current() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-Notice: Undefined variable: unset_array in %s on line %d
-
-Warning: key() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-*** Testing error conditions ***
-
-Warning: key() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: current() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: next() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: key() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: current() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: next() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: key() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: key() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: key() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: current() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: current() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: current() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, string given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt
index 3f8d502ffe..f2b185523f 100644
--- a/ext/standard/tests/array/array_change_key_case_variation.phpt
+++ b/ext/standard/tests/array/array_change_key_case_variation.phpt
@@ -6,13 +6,16 @@ Test array_change_key_case() function - 2
$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
-var_dump(array_change_key_case($item, "CASE_UPPER"));
+try {
+ var_dump(array_change_key_case($item, "CASE_UPPER"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(array_change_key_case($item, 5));
/* when keys are different in terms of only case */
/* should return one value key pair with key being in lowercase */
var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
/* should return one value key pair with key being in uppercase */
var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
@@ -21,8 +24,7 @@ var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 )
echo "end\n";
?>
--EXPECTF--
-Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d
-NULL
+array_change_key_case() expects parameter 2 to be int, string given
array(4) {
["ONE"]=>
int(1)
@@ -37,9 +39,6 @@ array(1) {
["one"]=>
int(4)
}
-
-Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d
-NULL
array(1) {
["ONE"]=>
int(3)
diff --git a/ext/standard/tests/array/array_chunk.phpt b/ext/standard/tests/array/array_chunk.phpt
deleted file mode 100644
index 2ee77e129c..0000000000
--- a/ext/standard/tests/array/array_chunk.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-array_chunk()
---FILE--
-<?php
-$array = array ();
-var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
-}
-?>
---EXPECT--
-array(0) {
-}
-[0]
-NULL
-NULL
-NULL
diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt
index 6d8b74545e..c02194aa5b 100644
--- a/ext/standard/tests/array/array_chunk2.phpt
+++ b/ext/standard/tests/array/array_chunk2.phpt
@@ -3,8 +3,19 @@ basic array_chunk test
--FILE--
<?php
$input_array = array('a', 'b', 'c', 'd', 'e');
-var_dump(array_chunk($input_array, 0));
-var_dump(array_chunk($input_array, 0, true));
+
+try {
+ var_dump(array_chunk($input_array, 0));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(array_chunk($input_array, 0, true));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump(array_chunk($input_array, 1));
var_dump(array_chunk($input_array, 1, true));
var_dump(array_chunk($input_array, 2));
@@ -12,12 +23,9 @@ var_dump(array_chunk($input_array, 2, true));
var_dump(array_chunk($input_array, 10));
var_dump(array_chunk($input_array, 10, true));
?>
---EXPECTF--
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
+--EXPECT--
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
array(5) {
[0]=>
array(1) {
diff --git a/ext/standard/tests/array/array_chunk_variation10.phpt b/ext/standard/tests/array/array_chunk_variation10.phpt
index 7b4bee172b..be5fcdc7f3 100644
--- a/ext/standard/tests/array/array_chunk_variation10.phpt
+++ b/ext/standard/tests/array/array_chunk_variation10.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 10
<?php
$array = array (1 => 1, 2 => 2, 3 => 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -21,11 +21,6 @@ array(3) {
[3]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation11.phpt b/ext/standard/tests/array/array_chunk_variation11.phpt
index dca366652d..09ec255744 100644
--- a/ext/standard/tests/array/array_chunk_variation11.phpt
+++ b/ext/standard/tests/array/array_chunk_variation11.phpt
@@ -5,11 +5,11 @@ array_chunk() - variation 11
$array = array (0 => 0, 3 => 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -20,11 +20,6 @@ array(2) {
[3]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation12.phpt b/ext/standard/tests/array/array_chunk_variation12.phpt
index 3b87dbab95..f85f2a8c0d 100644
--- a/ext/standard/tests/array/array_chunk_variation12.phpt
+++ b/ext/standard/tests/array/array_chunk_variation12.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 12
<?php
$array = array (1 => 1, 5 => 2, 8 => 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -21,11 +21,6 @@ array(3) {
[8]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation13.phpt b/ext/standard/tests/array/array_chunk_variation13.phpt
index f6369df1c8..5cd6f0ea34 100644
--- a/ext/standard/tests/array/array_chunk_variation13.phpt
+++ b/ext/standard/tests/array/array_chunk_variation13.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 13
<?php
$array = array (1, 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -19,11 +19,6 @@ array(2) {
[1]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation14.phpt b/ext/standard/tests/array/array_chunk_variation14.phpt
index f8d1b11790..97fce1e722 100644
--- a/ext/standard/tests/array/array_chunk_variation14.phpt
+++ b/ext/standard/tests/array/array_chunk_variation14.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 14
<?php
$array = array (0, 1, 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -21,11 +21,6 @@ array(3) {
[2]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation15.phpt b/ext/standard/tests/array/array_chunk_variation15.phpt
index abec754a3d..c48af63f6c 100644
--- a/ext/standard/tests/array/array_chunk_variation15.phpt
+++ b/ext/standard/tests/array/array_chunk_variation15.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 15
<?php
$array = array (1, 2, 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -21,11 +21,6 @@ array(3) {
[2]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation16.phpt b/ext/standard/tests/array/array_chunk_variation16.phpt
index 18179c8b07..3426f9278b 100644
--- a/ext/standard/tests/array/array_chunk_variation16.phpt
+++ b/ext/standard/tests/array/array_chunk_variation16.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 16
<?php
$array = array (0, 1, 2, 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -23,11 +23,6 @@ array(4) {
[3]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation17.phpt b/ext/standard/tests/array/array_chunk_variation17.phpt
index 27507ea8cd..1a8bb5d340 100644
--- a/ext/standard/tests/array/array_chunk_variation17.phpt
+++ b/ext/standard/tests/array/array_chunk_variation17.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 17
<?php
$array = array (1, 2, 3, 4);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -23,11 +23,6 @@ array(4) {
[3]=>
int(4)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation18.phpt b/ext/standard/tests/array/array_chunk_variation18.phpt
index 7f0946f497..593c702ce9 100644
--- a/ext/standard/tests/array/array_chunk_variation18.phpt
+++ b/ext/standard/tests/array/array_chunk_variation18.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 18
<?php
$array = array (0, 1, 2, 3, 4);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -25,11 +25,6 @@ array(5) {
[4]=>
int(4)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(5) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation19.phpt b/ext/standard/tests/array/array_chunk_variation19.phpt
index d51389c9f3..f160cba263 100644
--- a/ext/standard/tests/array/array_chunk_variation19.phpt
+++ b/ext/standard/tests/array/array_chunk_variation19.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 19
<?php
$array = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -35,11 +35,6 @@ array(10) {
[9]=>
int(10)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(10) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation20.phpt b/ext/standard/tests/array/array_chunk_variation20.phpt
index cd5314ff04..d47279915c 100644
--- a/ext/standard/tests/array/array_chunk_variation20.phpt
+++ b/ext/standard/tests/array/array_chunk_variation20.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 20
<?php
$array = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -37,11 +37,6 @@ array(11) {
[10]=>
int(10)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(11) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation21.phpt b/ext/standard/tests/array/array_chunk_variation21.phpt
index 678bf16751..e8c7784325 100644
--- a/ext/standard/tests/array/array_chunk_variation21.phpt
+++ b/ext/standard/tests/array/array_chunk_variation21.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 21
<?php
$array = array ("a" => 1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
["a"]=>
int(1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation22.phpt b/ext/standard/tests/array/array_chunk_variation22.phpt
index 45c458ebf9..b0eeade3ab 100644
--- a/ext/standard/tests/array/array_chunk_variation22.phpt
+++ b/ext/standard/tests/array/array_chunk_variation22.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 22
<?php
$array = array ("b" => 1, "c" => 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -19,11 +19,6 @@ array(2) {
["c"]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation23.phpt b/ext/standard/tests/array/array_chunk_variation23.phpt
index 80b92985b1..87ced15132 100644
--- a/ext/standard/tests/array/array_chunk_variation23.phpt
+++ b/ext/standard/tests/array/array_chunk_variation23.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 23
<?php
$array = array ("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -27,11 +27,6 @@ array(6) {
["v"]=>
int(6)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(6) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation24.phpt b/ext/standard/tests/array/array_chunk_variation24.phpt
index e25f53f6b6..69dce7be17 100644
--- a/ext/standard/tests/array/array_chunk_variation24.phpt
+++ b/ext/standard/tests/array/array_chunk_variation24.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 24
<?php
$array = array ("a" => "A");
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
["a"]=>
string(1) "A"
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation25.phpt b/ext/standard/tests/array/array_chunk_variation25.phpt
index eae89e952b..09303c30ba 100644
--- a/ext/standard/tests/array/array_chunk_variation25.phpt
+++ b/ext/standard/tests/array/array_chunk_variation25.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 25
<?php
$array = array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F");
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -27,11 +27,6 @@ array(6) {
["v"]=>
string(1) "F"
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(6) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation26.phpt b/ext/standard/tests/array/array_chunk_variation26.phpt
index 487f6b4f67..ca6975a64e 100644
--- a/ext/standard/tests/array/array_chunk_variation26.phpt
+++ b/ext/standard/tests/array/array_chunk_variation26.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 26
<?php
$array =array (0);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
[0]=>
int(0)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation27.phpt b/ext/standard/tests/array/array_chunk_variation27.phpt
index a83a16b7fb..aa91036a52 100644
--- a/ext/standard/tests/array/array_chunk_variation27.phpt
+++ b/ext/standard/tests/array/array_chunk_variation27.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 27
<?php
$array = array (1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
[0]=>
int(1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation28.phpt b/ext/standard/tests/array/array_chunk_variation28.phpt
index bdbaf45cbd..5389049ce4 100644
--- a/ext/standard/tests/array/array_chunk_variation28.phpt
+++ b/ext/standard/tests/array/array_chunk_variation28.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 28
<?php
$array = array (-1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
[0]=>
int(-1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation29.phpt b/ext/standard/tests/array/array_chunk_variation29.phpt
index 12f50c1190..f18de5ea85 100644
--- a/ext/standard/tests/array/array_chunk_variation29.phpt
+++ b/ext/standard/tests/array/array_chunk_variation29.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 29
<?php
$array = array (0, 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -19,11 +19,6 @@ array(2) {
[1]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation30.phpt b/ext/standard/tests/array/array_chunk_variation30.phpt
index 281537a876..0dbd9b6368 100644
--- a/ext/standard/tests/array/array_chunk_variation30.phpt
+++ b/ext/standard/tests/array/array_chunk_variation30.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 30
<?php
$array = array (1, 2, 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -21,11 +21,6 @@ array(3) {
[2]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation31.phpt b/ext/standard/tests/array/array_chunk_variation31.phpt
index 1592679839..fd7f358ca0 100644
--- a/ext/standard/tests/array/array_chunk_variation31.phpt
+++ b/ext/standard/tests/array/array_chunk_variation31.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 31
<?php
$array = array (1 => 0);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
[1]=>
int(0)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation32.phpt b/ext/standard/tests/array/array_chunk_variation32.phpt
index cf65993c0b..09471a59aa 100644
--- a/ext/standard/tests/array/array_chunk_variation32.phpt
+++ b/ext/standard/tests/array/array_chunk_variation32.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 32
<?php
$array = array (2 => 1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
[2]=>
int(1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt
index 50050892e7..21f1a3dce2 100644
--- a/ext/standard/tests/array/array_chunk_variation5.phpt
+++ b/ext/standard/tests/array/array_chunk_variation5.phpt
@@ -26,26 +26,33 @@ $sizes = array(-1, count($input_array) + 1, 0, 1.5);
// loop through the array for size argument
foreach ($sizes as $size){
- echo "\n-- Testing array_chunk() when size = $size --\n";
- var_dump( array_chunk($input_array, $size) );
- var_dump( array_chunk($input_array, $size, true) );
- var_dump( array_chunk($input_array, $size, false) );
+ echo "\n-- Testing array_chunk() when size = $size --\n";
+ try {
+ var_dump( array_chunk($input_array, $size) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( array_chunk($input_array, $size, true) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( array_chunk($input_array, $size, false) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done";
?>
---EXPECTF--
+
+DONE
+--EXPECT--
*** Testing array_chunk() : usage variations ***
-- Testing array_chunk() when size = -1 --
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
-- Testing array_chunk() when size = 4 --
array(1) {
@@ -83,15 +90,9 @@ array(1) {
}
-- Testing array_chunk() when size = 0 --
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
-- Testing array_chunk() when size = 1.5 --
array(3) {
@@ -145,4 +146,5 @@ array(3) {
int(3)
}
}
-Done
+
+DONE
diff --git a/ext/standard/tests/array/array_chunk_variation8.phpt b/ext/standard/tests/array/array_chunk_variation8.phpt
index 6a6e752ecb..64b9bb2036 100644
--- a/ext/standard/tests/array/array_chunk_variation8.phpt
+++ b/ext/standard/tests/array/array_chunk_variation8.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 8
<?php
$array = array (3 => -1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -17,11 +17,6 @@ array(1) {
[3]=>
int(-1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation9.phpt b/ext/standard/tests/array/array_chunk_variation9.phpt
index ec57da4f88..a68240e6f6 100644
--- a/ext/standard/tests/array/array_chunk_variation9.phpt
+++ b/ext/standard/tests/array/array_chunk_variation9.phpt
@@ -4,11 +4,11 @@ array_chunk() - variation 9
<?php
$array = array (1 => 0, 2 => 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
echo "\n";
}
?>
@@ -19,11 +19,6 @@ array(2) {
[2]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt
index 26a09aff24..6fb5169d45 100644
--- a/ext/standard/tests/array/array_column_error.phpt
+++ b/ext/standard/tests/array/array_column_error.phpt
@@ -10,73 +10,51 @@ Test array_column() function: error conditions
*/
echo "*** Testing array_column() : error conditions ***\n";
-
-echo "\n-- Testing array_column() function with Zero arguments --\n";
-var_dump(array_column());
-
-echo "\n-- Testing array_column() function with One argument --\n";
-var_dump(array_column(array()));
-
-echo "\n-- Testing array_column() function with string as first parameter --\n";
-var_dump(array_column('foo', 0));
-
-echo "\n-- Testing array_column() function with int as first parameter --\n";
-var_dump(array_column(1, 'foo'));
-
echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n";
-var_dump(array_column(array(), true));
+try {
+ var_dump(array_column(array(), true));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n";
-var_dump(array_column(array(), array()));
+try {
+ var_dump(array_column(array(), array()));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n";
-var_dump(array_column(array(), 'foo', true));
+try {
+ var_dump(array_column(array(), 'foo', true));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n";
-var_dump(array_column(array(), 'foo', array()));
+try {
+ var_dump(array_column(array(), 'foo', array()));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done\n";
?>
---EXPECTF--
-*** Testing array_column() : error conditions ***
-
--- Testing array_column() function with Zero arguments --
-
-Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d
-NULL
--- Testing array_column() function with One argument --
-
-Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing array_column() function with string as first parameter --
-
-Warning: array_column() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Testing array_column() function with int as first parameter --
-
-Warning: array_column() expects parameter 1 to be array, int given in %s on line %d
-NULL
+DONE
+--EXPECT--
+*** Testing array_column() : error conditions ***
-- Testing array_column() column key parameter should be a string or an integer (testing bool) --
-
-Warning: array_column(): The column key should be either a string or an integer in %s on line %d
-bool(false)
+The column key should be either a string or an integer
-- Testing array_column() column key parameter should be a string or integer (testing array) --
-
-Warning: array_column(): The column key should be either a string or an integer in %s on line %d
-bool(false)
+The column key should be either a string or an integer
-- Testing array_column() index key parameter should be a string or an integer (testing bool) --
-
-Warning: array_column(): The index key should be either a string or an integer in %s on line %d
-bool(false)
+The index key should be either a string or an integer
-- Testing array_column() index key parameter should be a string or integer (testing array) --
+The index key should be either a string or an integer
-Warning: array_column(): The index key should be either a string or an integer in %s on line %d
-bool(false)
-Done
+DONE
diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt
index 2d820a0d21..463dc6dfe8 100644
--- a/ext/standard/tests/array/array_combine_error2.phpt
+++ b/ext/standard/tests/array/array_combine_error2.phpt
@@ -16,19 +16,32 @@ var_dump( array_combine(array(), array()) );
// Testing array_combine by passing empty array to $keys
echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
-var_dump( array_combine(array(), array(1, 2)) );
+try {
+ var_dump( array_combine(array(), array(1, 2)) );
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
// Testing array_combine by passing empty array to $values
echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
-var_dump( array_combine(array(1, 2), array()) );
+try {
+ var_dump( array_combine(array(1, 2), array()) );
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
// Testing array_combine with arrays having unequal number of elements
echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
-var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
+try {
+ var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
-echo "Done";
?>
---EXPECTF--
+
+DONE
+--EXPECT--
*** Testing array_combine() : error conditions specific to array_combine() ***
-- Testing array_combine() function with empty arrays --
@@ -36,17 +49,9 @@ array(0) {
}
-- Testing array_combine() function with empty array for $keys argument --
-
-Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
-bool(false)
-
+Both parameters should have an equal number of elements
-- Testing array_combine() function with empty array for $values argument --
-
-Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
-bool(false)
-
+Both parameters should have an equal number of elements
-- Testing array_combine() function by passing array with unequal number of elements --
-
-Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
-bool(false)
-Done
+Both parameters should have an equal number of elements
+DONE
diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt
index a7ea0a9dc4..5726eb73e6 100644
--- a/ext/standard/tests/array/array_combine_variation4.phpt
+++ b/ext/standard/tests/array/array_combine_variation4.phpt
@@ -60,10 +60,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
-/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+/*10*/ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed keys
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+/*11*/ array('hello' => 1, "fruit" => 2.2,
$fp => 'resource', 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
@@ -71,7 +71,7 @@ $arrays = array (
// array to be passsed to $arr2 argument
$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
"\tHello" => 111, 2.2, 'color', "Hello world" => "string",
- "pen\n" => 33, new classA() => 11, 133 => "int");
+ "pen\n" => 33, 133 => "int");
// loop through each sub-array within $arrays to check the behavior of array_combine()
// same arrays are passed to both $keys and $values
@@ -90,15 +90,9 @@ echo "Done";
--EXPECTF--
*** Testing array_combine() : assoc array with diff keys to both $keys and $values argument ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_count_values2.phpt b/ext/standard/tests/array/array_count_values2.phpt
index 8aaf445f93..cb0c330965 100644
--- a/ext/standard/tests/array/array_count_values2.phpt
+++ b/ext/standard/tests/array/array_count_values2.phpt
@@ -18,11 +18,11 @@ $array1 = array(1,
var_dump(array_count_values($array1));
?>
--EXPECTF--
-Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d
+Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d
-Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d
+Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d
-Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d
+Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d
array(8) {
[1]=>
int(2)
diff --git a/ext/standard/tests/array/array_diff_1.phpt b/ext/standard/tests/array/array_diff_1.phpt
index a7ee015346..2e2b135128 100644
--- a/ext/standard/tests/array/array_diff_1.phpt
+++ b/ext/standard/tests/array/array_diff_1.phpt
@@ -6,10 +6,14 @@ Test array_diff when non-array is passed
$a = array();
$b = 3;
$c = array(5);
-array_diff($a, $b, $c);
+try {
+ array_diff($a, $b, $c);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//-=-=-=-=-=-
echo "OK!";
?>
--EXPECTF--
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s
+Expected parameter 2 to be an array, int given
OK!
diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt
index fc8c70c67c..6aa7864ee9 100644
--- a/ext/standard/tests/array/array_diff_assoc_error.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_error.phpt
@@ -16,13 +16,20 @@ echo "*** Testing array_diff_assoc() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing array_diff_assoc() function with zero arguments --\n";
-var_dump( array_diff_assoc() );
+try {
+ var_dump( array_diff_assoc() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff_assoc with one less than the expected number of arguments
echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_diff_assoc($arr1) );
-
+try {
+ var_dump( array_diff_assoc($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -30,12 +37,8 @@ echo "Done";
*** Testing array_diff_assoc() : error conditions ***
-- Testing array_diff_assoc() function with zero arguments --
-
-Warning: array_diff_assoc(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_diff_assoc() function with less than expected no. of arguments --
-
-Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt
index 2172e695d3..270660a8cf 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt
@@ -91,143 +91,95 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff_assoc
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_diff_assoc($input, $array));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(array_diff_assoc($input, $array));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff_assoc() : usage variations ***
-- Iteration 1 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 2 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 3 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 4 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 5 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 6 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 7 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 8 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 9 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 10 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 11 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 12 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 13 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 14 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 15 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 16 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 17 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 18 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 19 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 20 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 21 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 22 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 23 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
-- Iteration 24 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 25 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 26 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
index a57f10fce0..9185b53439 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
@@ -91,143 +91,95 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff_assoc
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_diff_assoc($array, $input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(array_diff_assoc($array, $input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff_assoc() : usage variations ***
-- Iteration 1 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 2 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 3 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 4 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 5 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 6 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 7 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 8 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 9 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 10 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 11 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 12 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 13 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 14 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 15 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 16 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 17 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 18 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 19 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 20 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 21 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 22 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 23 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
-- Iteration 24 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 25 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 26 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt
index 25be6e1c55..d269f010b8 100644
--- a/ext/standard/tests/array/array_diff_error.phpt
+++ b/ext/standard/tests/array/array_diff_error.phpt
@@ -15,13 +15,21 @@ Test array_diff() function : error conditions - too few arguments passed to func
echo "*** Testing array_diff() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing array_diff() function with zero arguments --\n";
-var_dump( array_diff() );
+try {
+ var_dump( array_diff() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff with one less than the expected number of arguments
echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_diff($arr1) );
+try {
+ var_dump( array_diff($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -29,12 +37,8 @@ echo "Done";
*** Testing array_diff() : error conditions ***
-- Testing array_diff() function with zero arguments --
-
-Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_diff() function with less than expected no. of arguments --
-
-Warning: array_diff(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt
index 05d5cf3c27..ec5ef10ba8 100644
--- a/ext/standard/tests/array/array_diff_key_error.phpt
+++ b/ext/standard/tests/array/array_diff_key_error.phpt
@@ -14,23 +14,27 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
// Testing array_diff_key with one less than the expected number of arguments
echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n";
-var_dump( array_diff_key($array1) );
+try {
+ var_dump( array_diff_key($array1) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff_key with no arguments
echo "\n-- Testing array_diff_key() function with no arguments --\n";
-var_dump( array_diff_key() );
+try {
+ var_dump( array_diff_key() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
--EXPECTF--
*** Testing array_diff_key() : error conditions ***
-- Testing array_diff_key() function with less than expected no. of arguments --
-
-Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
-- Testing array_diff_key() function with no arguments --
-
-Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt
index 3e689a0e8f..f47042f009 100644
--- a/ext/standard/tests/array/array_diff_key_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation1.phpt
@@ -89,222 +89,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_key($value, $array2) );
- var_dump( array_diff_key($value, $array2, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_key($value, $array2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_key($value, $array2, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_key() : usage variation ***
--int 0--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt
index fb0bcd6796..24ddffb530 100644
--- a/ext/standard/tests/array/array_diff_key_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation2.phpt
@@ -90,222 +90,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_key($array1, $value) );
- var_dump( array_diff_key($array1, $value, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_key($array1, $value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_key($array1, $value, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_key() : usage variation ***
--int 0--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt
deleted file mode 100644
index 36741dba33..0000000000
--- a/ext/standard/tests/array/array_diff_key_variation3.phpt
+++ /dev/null
@@ -1,232 +0,0 @@
---TEST--
-Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument
---FILE--
-<?php
-/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
- * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_diff_key() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for arr1
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_key($array1, $array2, $value) );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_diff_key() : usage variation ***
-
---int 0--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt
index d90c80f20b..13881f6993 100644
--- a/ext/standard/tests/array/array_diff_uassoc_error.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt
@@ -27,36 +27,34 @@ function key_compare_func($a, $b)
//Test array_diff_uassoc with one more than the expected number of arguments
echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n";
-var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) );
-var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) );
+try {
+ var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff_uassoc with one less than the expected number of arguments
echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n";
-var_dump( array_diff_uassoc($array1, $array2) );
+try {
+ var_dump( array_diff_uassoc($array1, $array2) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-// Testing array_diff_uassoc with no arguments
-echo "\n-- Testing array_diff_uassoc() function with no arguments --\n";
-var_dump( array_diff_uassoc() );
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_uassoc() : error conditions ***
-- Testing array_diff_uassoc() function with more than expected no. of arguments --
-
-Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
-Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
+array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members
+array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members
-- Testing array_diff_uassoc() function with less than expected no. of arguments --
-
-Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d
-NULL
-
--- Testing array_diff_uassoc() function with no arguments --
-
-Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d
-NULL
+At least 3 parameters are required, 2 given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt
index aad42705db..03f3160a00 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt
@@ -102,143 +102,95 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_uassoc($value, $array2, "key_compare_func") );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_uassoc($value, $array2, "key_compare_func") );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt
index ae664f9812..7ca05b1fd0 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt
@@ -102,143 +102,95 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_uassoc($array1, $value, "key_compare_func") );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_uassoc($array1, $value, "key_compare_func") );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt b/ext/standard/tests/array/array_diff_uassoc_variation4.phpt
deleted file mode 100644
index 8ea51a4103..0000000000
--- a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt
+++ /dev/null
@@ -1,246 +0,0 @@
---TEST--
-Test array_diff_uassoc() function : usage variation -Passing unexpected values as third optional argument
---FILE--
-<?php
-/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
- * Description: Computes the difference of arrays with additional index check which is performed by a
- * user supplied callback function
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_diff_uassoc() : usage variation ***\n";
-
-//Initialize variables
-$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
-$array2 = array("a" => "green", "yellow", "red");
-
-
-function key_compare_func($a, $b)
-{
- if ($a === $b) {
- return 0;
- }
- return ($a > $b)? 1:-1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for arr2
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_uassoc($array1, $array2, $value, "key_compare_func") );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_diff_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt
index bbf349c4fd..3b591018bd 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt
@@ -97,222 +97,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_ukey($value, $array2, 'key_compare_func') );
- var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_ukey($value, $array2, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
--int 0--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
index 09b4a70237..e80f02629e 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
@@ -14,27 +14,23 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
//function name within double quotes
-var_dump( array_diff_ukey($array1, $array1, "unknown_function") );
+try {
+ var_dump( array_diff_ukey($array1, $array1, "unknown_function") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//function name within single quotes
-var_dump( array_diff_ukey($array1, $array1, 'unknown_function') );
-
-//function name without quotes
-var_dump( array_diff_ukey($array1, $array1, unknown_function) );
+try {
+ var_dump( array_diff_ukey($array1, $array1, 'unknown_function') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
-
-Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
+array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
+array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt
index 38141a430c..3638afcb53 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt
@@ -101,222 +101,126 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_ukey($array1, $value, 'key_compare_func') );
- var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_ukey($array1, $value, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
--int 0--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt
deleted file mode 100644
index 572061d697..0000000000
--- a/ext/standard/tests/array/array_diff_ukey_variation3.phpt
+++ /dev/null
@@ -1,240 +0,0 @@
---TEST--
-Test array_diff_ukey() function : usage variation - Passing unexpected values to third optional argument
---FILE--
-<?php
-/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
- * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_diff_ukey() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-
-function key_compare_func($key1, $key2)
-{
- if ($key1 == $key2) {
- return 0;
- }
- return ($key1 > $key2)? 1:-1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for key_comp_func
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_ukey($array1, $array2, $value, 'key_compare_func') );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_diff_ukey() : usage variation ***
-
---int 0--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt
index e162c523d6..5b92231642 100644
--- a/ext/standard/tests/array/array_diff_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_variation1.phpt
@@ -91,118 +91,70 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --";
- var_dump( array_diff($input, $array));
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+ try {
+ var_dump( array_diff($input, $array));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff() : usage variations ***
--- Iteration 1 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 1 to be an array, int given
--- Iteration 2 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 1 to be an array, int given
--- Iteration 3 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 1 to be an array, int given
--- Iteration 4 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 1 to be an array, int given
--- Iteration 5 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 1 to be an array, float given
--- Iteration 6 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 1 to be an array, float given
--- Iteration 7 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 1 to be an array, float given
--- Iteration 8 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 1 to be an array, float given
--- Iteration 9 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 1 to be an array, float given
--- Iteration 10 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 1 to be an array, null given
--- Iteration 11 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 1 to be an array, null given
--- Iteration 12 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 1 to be an array, bool given
--- Iteration 13 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 1 to be an array, bool given
--- Iteration 14 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 1 to be an array, bool given
--- Iteration 15 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 1 to be an array, bool given
--- Iteration 16 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 1 to be an array, string given
--- Iteration 17 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 1 to be an array, string given
--- Iteration 18 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 1 to be an array, string given
--- Iteration 19 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 1 to be an array, string given
--- Iteration 20 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 1 to be an array, string given
--- Iteration 21 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 1 to be an array, string given
--- Iteration 22 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 1 to be an array, string given
--- Iteration 23 --
-Warning: array_diff(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 1 to be an array, object given
--- Iteration 24 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 1 to be an array, null given
--- Iteration 25 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 25 --Expected parameter 1 to be an array, null given
--- Iteration 26 --
-Warning: array_diff(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 26 --Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt
index 5f8183b88d..a9ddb22b82 100644
--- a/ext/standard/tests/array/array_diff_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_variation2.phpt
@@ -91,117 +91,69 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --";
- var_dump( array_diff($array, $input));
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+ try {
+ var_dump( array_diff($array, $input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff() : usage variations ***
--- Iteration 1 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 2 to be an array, int given
--- Iteration 2 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 2 to be an array, int given
--- Iteration 3 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 2 to be an array, int given
--- Iteration 4 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 2 to be an array, int given
--- Iteration 5 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 2 to be an array, float given
--- Iteration 6 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 2 to be an array, float given
--- Iteration 7 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 2 to be an array, float given
--- Iteration 8 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 2 to be an array, float given
--- Iteration 9 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 2 to be an array, float given
--- Iteration 10 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 2 to be an array, null given
--- Iteration 11 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 2 to be an array, null given
--- Iteration 12 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 2 to be an array, bool given
--- Iteration 13 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 2 to be an array, bool given
--- Iteration 14 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 2 to be an array, bool given
--- Iteration 15 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 2 to be an array, bool given
--- Iteration 16 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 2 to be an array, string given
--- Iteration 17 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 2 to be an array, string given
--- Iteration 18 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 2 to be an array, string given
--- Iteration 19 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 2 to be an array, string given
--- Iteration 20 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 2 to be an array, string given
--- Iteration 21 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 2 to be an array, string given
--- Iteration 22 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 2 to be an array, string given
--- Iteration 23 --
-Warning: array_diff(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 2 to be an array, object given
--- Iteration 24 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 2 to be an array, null given
--- Iteration 25 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 25 --Expected parameter 2 to be an array, null given
--- Iteration 26 --
-Warning: array_diff(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 26 --Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_variation9.phpt b/ext/standard/tests/array/array_diff_variation9.phpt
index 05b6a1eb02..3d85bc1832 100644
--- a/ext/standard/tests/array/array_diff_variation9.phpt
+++ b/ext/standard/tests/array/array_diff_variation9.phpt
@@ -1,7 +1,5 @@
--TEST--
Test array_diff() function : usage variations - multidimensional arrays
---INI--
-error_reporting=E_ALL & ~E_NOTICE
--FILE--
<?php
/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
@@ -38,11 +36,27 @@ var_dump(array_diff($array1, $array2['sub_arraya']));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing array_diff() : usage variations ***
-- Compare two 2-D arrays --
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(0) {
}
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(0) {
}
@@ -71,6 +85,10 @@ array(3) {
}
-- Compare a subarray from one 2-D array and one 2-D array --
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(3) {
[0]=>
int(1)
@@ -79,6 +97,10 @@ array(3) {
[2]=>
int(3)
}
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(2) {
["sub_array1"]=>
array(3) {
diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt
index 2fbdb850c3..63af88bf28 100644
--- a/ext/standard/tests/array/array_fill_error.phpt
+++ b/ext/standard/tests/array/array_fill_error.phpt
@@ -10,45 +10,22 @@ Test array_fill() function : error conditions
echo "*** Testing array_fill() : error conditions ***\n";
-// Zero arguments
-echo "-- Testing array_fill() function with Zero arguments --\n";
-var_dump( array_fill() );
-
-// More than expected number of arguments
-echo "-- Testing array_fill() function with more than expected no. of arguments --\n";
+// calling array_fill with negative values for 'num' parameter
$start_key = 0;
-$num = 2;
+$num = -1;
$val = 1;
-$extra_arg = 10;
-var_dump( array_fill($start_key,$num,$val, $extra_arg) );
-// Less than the expected number of arguments
-echo "-- Testing array_fill() function with less than expected no. of arguments --\n";
-$start_key = 0;
-$num = 2;
-var_dump( array_fill($start_key,$num) );
-
-//calling array_fill with negative values for 'num' parameter
-$num = -1;
-var_dump( array_fill($start_key,$num,$val) );
+try {
+ var_dump( array_fill($start_key,$num,$val) );
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done";
?>
+
+DONE
--EXPECTF--
*** Testing array_fill() : error conditions ***
--- Testing array_fill() function with Zero arguments --
-
-Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
--- Testing array_fill() function with more than expected no. of arguments --
-
-Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
--- Testing array_fill() function with less than expected no. of arguments --
-
-Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
+Number of elements can't be negative
-Warning: array_fill(): Number of elements can't be negative in %s on line %d
-bool(false)
-Done
+DONE
diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt
index 12adde72e7..fb222a414b 100644
--- a/ext/standard/tests/array/array_fill_keys.phpt
+++ b/ext/standard/tests/array/array_fill_keys.phpt
@@ -4,15 +4,12 @@ basic array_fill_keys test
precision=14
--FILE--
<?php
- var_dump(array_fill_keys('test', 1));
var_dump(array_fill_keys(array(), 1));
var_dump(array_fill_keys(array('foo', 'bar'), NULL));
var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123));
var_dump(array_fill_keys(array('test', TRUE, 10, 100), ''));
?>
---EXPECTF--
-Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d
-NULL
+--EXPECT--
array(0) {
}
array(2) {
diff --git a/ext/standard/tests/array/array_fill_keys_variation1.phpt b/ext/standard/tests/array/array_fill_keys_variation1.phpt
index 0af38c7bde..1f394eec86 100644
--- a/ext/standard/tests/array/array_fill_keys_variation1.phpt
+++ b/ext/standard/tests/array/array_fill_keys_variation1.phpt
@@ -59,7 +59,7 @@ array(4) {
-- Testing array_fill_keys() function with mixed array --
-Notice: Array to string conversion in %sarray_fill_keys_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
array(7) {
["Resource id #%d"]=>
string(6) "simple"
diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt
index 84cc928cbc..b1abbcfe1b 100644
--- a/ext/standard/tests/array/array_fill_keys_variation3.phpt
+++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt
@@ -12,33 +12,18 @@ Test array_fill_keys() function : variation of parameter
echo "*** Testing array_fill_keys() : parameter variations ***\n";
-$simpleStr = "simple";
$fp = fopen(__FILE__, "r");
-$bool = false;
-$float = 2.4;
$array = array("one", "two");
-$nullVal = null;
-
-echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n";
-var_dump( array_fill_keys($bool, $float) );
echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n";
var_dump( array_fill_keys($array, $fp) );
-echo "\n-- Testing array_fill_keys() function with mixed array --\n";
-var_dump( array_fill_keys($nullVal, $simpleStr) );
-
fclose($fp);
echo "Done";
?>
--EXPECTF--
*** Testing array_fill_keys() : parameter variations ***
--- Testing array_fill_keys() function with both wrong arguments --
-
-Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d
-NULL
-
-- Testing array_fill_keys() function with unusual second arguments --
array(2) {
["one"]=>
@@ -46,9 +31,4 @@ array(2) {
["two"]=>
resource(%d) of type (stream)
}
-
--- Testing array_fill_keys() function with mixed array --
-
-Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d
-NULL
Done
diff --git a/ext/standard/tests/array/array_fill_keys_variation4.phpt b/ext/standard/tests/array/array_fill_keys_variation4.phpt
index bd89416d9d..9edc4e4a9c 100644
--- a/ext/standard/tests/array/array_fill_keys_variation4.phpt
+++ b/ext/standard/tests/array/array_fill_keys_variation4.phpt
@@ -83,7 +83,7 @@ array(1) {
-- Testing array_fill_keys() function with unset var --
-Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d
+Warning: Undefined variable: unset_var in %s on line %d
array(1) {
["one"]=>
NULL
diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt
index ba27a59c96..1488aedd09 100644
--- a/ext/standard/tests/array/array_filter.phpt
+++ b/ext/standard/tests/array/array_filter.phpt
@@ -26,9 +26,6 @@ var_dump(array_filter($array2, "even"));
var_dump(array_filter($array3, "even"));
var_dump(array_filter(array()));
-var_dump(array_filter(array(), array()));
-var_dump(array_filter("", null));
-var_dump(array_filter($array1, 1));
echo '== DONE ==';
?>
@@ -81,13 +78,4 @@ array(2) {
}
array(0) {
}
-
-Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
-Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
-NULL
== DONE ==
diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt
index 4749fe8e45..a32fdadc05 100644
--- a/ext/standard/tests/array/array_filter_variation10.phpt
+++ b/ext/standard/tests/array/array_filter_variation10.phpt
@@ -48,7 +48,11 @@ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY));
var_dump(array_filter($mixed, 'is_numeric', 0));
-var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH));
+try {
+ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -88,14 +92,5 @@ array(2) {
["b"]=>
int(2)
}
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-array(0) {
-}
+is_numeric() expects exactly 1 parameter, 2 given
Done
diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt
index a6f5789eae..240f5c10fa 100644
--- a/ext/standard/tests/array/array_filter_variation9.phpt
+++ b/ext/standard/tests/array/array_filter_variation9.phpt
@@ -13,7 +13,7 @@ Test array_filter() function : usage variations - built-in functions as 'callbac
echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
-$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
+$input = array(0, 1, -1, 10, 100, 1000, null);
// using built-in function 'is_int' as 'callback'
var_dump( array_filter($input, 'is_int') );
@@ -22,10 +22,18 @@ var_dump( array_filter($input, 'is_int') );
var_dump( array_filter($input, 'chr') );
// using language construct 'echo' as 'callback'
-var_dump( array_filter($input, 'echo') );
+try {
+ var_dump( array_filter($input, 'echo') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// using language construct 'exit' as 'callback'
-var_dump( array_filter($input, 'exit') );
+try {
+ var_dump( array_filter($input, 'exit') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -45,9 +53,7 @@ array(6) {
[5]=>
int(1000)
}
-
-Warning: chr() expects parameter 1 to be int, string given in %s on line %d
-array(8) {
+array(7) {
[0]=>
int(0)
[1]=>
@@ -61,14 +67,8 @@ array(8) {
[5]=>
int(1000)
[6]=>
- string(5) "Hello"
- [7]=>
NULL
}
-
-Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
-
-Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
+array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name
+array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_flip.phpt b/ext/standard/tests/array/array_flip.phpt
index ab8cf271b1..b03c65f034 100644
--- a/ext/standard/tests/array/array_flip.phpt
+++ b/ext/standard/tests/array/array_flip.phpt
@@ -16,11 +16,11 @@ $trans = array_flip($trans);
var_dump($trans);
?>
--EXPECTF--
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
array(6) {
[1]=>
string(1) "b"
diff --git a/ext/standard/tests/array/array_flip_variation4.phpt b/ext/standard/tests/array/array_flip_variation4.phpt
index b8badb0caa..0ad2367701 100644
--- a/ext/standard/tests/array/array_flip_variation4.phpt
+++ b/ext/standard/tests/array/array_flip_variation4.phpt
@@ -62,29 +62,29 @@ echo "Done"
--EXPECTF--
*** Testing array_flip() : different invalid values in 'input' array argument ***
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
array(0) {
}
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt
index a06dbddefe..fa815118ce 100644
--- a/ext/standard/tests/array/array_intersect_assoc_error.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_error.phpt
@@ -12,25 +12,29 @@ echo "*** Testing array_intersect_assoc() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing array_intersect_assoc() function with Zero arguments --\n";
-var_dump( array_intersect_assoc() );
+try {
+ var_dump( array_intersect_assoc() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_intersect_assoc with one less than the expected number of arguments
echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_intersect_assoc($arr1) );
+try {
+ var_dump( array_intersect_assoc($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_assoc() : error conditions ***
-- Testing array_intersect_assoc() function with Zero arguments --
-
-Warning: array_intersect_assoc(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_intersect_assoc() function with less than expected no. of arguments --
-
-Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
index ca11b7cc9b..3490c4f25c 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
@@ -93,14 +93,22 @@ $arrays = array(
// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iteration $iterator --";
-
- // Calling array_intersect_assoc() with default arguments
- var_dump( array_intersect_assoc($unexpected_value, $arr2) );
-
- // Calling array_intersect_assoc() with more arguments
- var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) );
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ try {
+ var_dump( array_intersect_assoc($unexpected_value, $arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect_assoc() with more arguments
+ try {
+ var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
}
// close the file resource used
@@ -108,174 +116,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_assoc() : Passing non-array values to $arr1 argument ***
--- Iteration 1 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iteration 14 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iteration 15 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iteration 16 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iteration 17 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iteration 18 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iteration 19 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iteration 20 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iteration 21 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iteration 22 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iteration 23 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iteration 24 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
index 274da6f7b2..12cf4d7307 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
@@ -93,15 +93,23 @@ $arrays = array(
// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iteration $iterator --";
-
- // Calling array_intersect_assoc() with default arguments
- var_dump( array_intersect_assoc($arr1,$unexpected_value) );
-
- // Calling array_intersect_assoc() with more arguments
- var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
-
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ try {
+ var_dump( array_intersect_assoc($arr1,$unexpected_value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect_assoc() with more arguments
+ try {
+ var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $iterator++;
}
// close the file resource used
@@ -109,174 +117,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_assoc() : Passing non-array values to $arr2 argument ***
--- Iteration 1 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iteration 14 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iteration 15 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iteration 16 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iteration 17 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iteration 18 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iteration 19 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iteration 20 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iteration 21 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iteration 22 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iteration 23 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iteration 24 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation9.phpt b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
index 26a491ad64..38b7605924 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
@@ -62,13 +62,13 @@ echo "Done";
-- Passing the entire 2-D array to $arr1 and $arr2 --
- With default arguments -
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(2) {
[0]=>
array(4) {
@@ -95,21 +95,21 @@ array(2) {
}
- With more arguments -
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(2) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt
index 373a0ddbe0..81be2634db 100644
--- a/ext/standard/tests/array/array_intersect_error.phpt
+++ b/ext/standard/tests/array/array_intersect_error.phpt
@@ -11,25 +11,29 @@ echo "*** Testing array_intersect() : error conditions ***\n";
// Testing array_intersect() with zero arguments
echo "\n-- Testing array_intersect() function with Zero arguments --\n";
-var_dump( array_intersect() );
+try {
+ var_dump( array_intersect() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_intersect() with one less than the expected number of arguments
echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_intersect($arr1) );
+try {
+ var_dump( array_intersect($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect() : error conditions ***
-- Testing array_intersect() function with Zero arguments --
-
-Warning: array_intersect(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_intersect() function with less than expected no. of arguments --
-
-Warning: array_intersect(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_intersect_key_error.phpt b/ext/standard/tests/array/array_intersect_key_error.phpt
index 10ad8ad342..7db4b7415f 100644
--- a/ext/standard/tests/array/array_intersect_key_error.phpt
+++ b/ext/standard/tests/array/array_intersect_key_error.phpt
@@ -14,23 +14,27 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
// Testing array_intersect_key with one less than the expected number of arguments
echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n";
-var_dump( array_intersect_key($array1) );
+try {
+ var_dump( array_intersect_key($array1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_intersect_key with one less than the expected number of arguments
echo "\n-- Testing array_intersect_key() function with no arguments --\n";
-var_dump( array_intersect_key() );
+try {
+ var_dump( array_intersect_key() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_key() : error conditions ***
-- Testing array_intersect_key() function with less than expected no. of arguments --
-
-Warning: array_intersect_key(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
-- Testing array_intersect_key() function with no arguments --
-
-Warning: array_intersect_key(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt
index fb9dd2c7aa..0987205b7e 100644
--- a/ext/standard/tests/array/array_intersect_key_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt
@@ -93,222 +93,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_key($value, $array2) );
- var_dump( array_intersect_key($value, $array2, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_key($value, $array2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_key($value, $array2, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_key() : usage variation ***
--int 0--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource var--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt
index 5d2147b99f..8d46b6efae 100644
--- a/ext/standard/tests/array/array_intersect_key_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt
@@ -94,222 +94,126 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_key($array1, $value) );
- var_dump( array_intersect_key($array1, $value, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_key($array1, $value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_key($array1, $value, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_key() : usage variation ***
--int 0--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource var--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt
deleted file mode 100644
index dca52bafc2..0000000000
--- a/ext/standard/tests/array/array_intersect_key_variation3.phpt
+++ /dev/null
@@ -1,235 +0,0 @@
---TEST--
-Test array_intersect_key() function : usage variation - Passing unexpected values to optional argument
---FILE--
-<?php
-/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
- * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_intersect_key() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource var' => $fp,
-);
-
-// loop through each element of the array for arr2
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_key($array1, $array2, $value) );
-}
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_intersect_key() : usage variation ***
-
---int 0--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource var--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
index 887ad12d9a..4c4a69250c 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
@@ -101,222 +101,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') );
- var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
index d482e9ffcc..0daa424314 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
@@ -101,222 +101,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') );
- var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt
deleted file mode 100644
index 42e53101dc..0000000000
--- a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt
+++ /dev/null
@@ -1,243 +0,0 @@
---TEST--
-Test array_intersect_uassoc() function : usage variation - Passing unexpected values to optional third argument
---FILE--
-<?php
-/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
- * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
-
-// Initialise function arguments
-$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
-$array2 = array("a" => "green", "yellow", "red");
-
-//Callback function
-function key_compare_func($a, $b) {
- if ($a === $b) {
- return 0;
- }
- return ($a > $b) ? 1 : -1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for arr1
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_uassoc($array1, $array2, $value, 'key_compare_func') );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_intersect_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt
index 86850094b8..cf1525a519 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt
@@ -99,222 +99,126 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') );
- var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
--int 0--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource var--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt
index 82b43628e3..f4df546f8e 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt
@@ -99,222 +99,126 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') );
- var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
--int 0--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource var--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt b/ext/standard/tests/array/array_intersect_ukey_variation4.phpt
deleted file mode 100644
index 35c0d4a2e6..0000000000
--- a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt
+++ /dev/null
@@ -1,321 +0,0 @@
---TEST--
-Test array_intersect_ukey() function : usage variation - Passing unexpected values to optional third argument
---FILE--
-<?php
-/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
- * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_intersect_ukey() : usage variation ***\n";
-
-//Initialise arguments
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-$array4 = array('green' => 5, 'cyan' => 8);
-
-//Call back function
-function key_compare_func($key1, $key2)
-{
- if ($key1 == $key2)
- return 0;
- else
- return ($key1 > $key2)? 1:-1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource var' => $fp,
-);
-
-// loop through each element of the array for arr2
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_ukey($array1, $array2, $value, 'key_compare_func') );
- var_dump( array_intersect_ukey($array1, $array2, $value, $array4, 'key_compare_func') );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_intersect_ukey() : usage variation ***
-
---int 0--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource var--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
index 122d1e4767..f4b91503bc 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
@@ -14,26 +14,23 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
//function name within double quotes
-var_dump( array_intersect_ukey($array1, $array2, "unknown_function") );
+try {
+ var_dump( array_intersect_ukey($array1, $array2, "unknown_function") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//function name within single quotes
-var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') );
+try {
+ var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-//function name without quotes
-var_dump( array_intersect_ukey($array1, $array2, unknown_function) );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_ukey() : usage variation ***
-
-Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
+array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
+array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
===DONE===
diff --git a/ext/standard/tests/array/array_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt
index 9536dd8c2a..d38a284496 100644
--- a/ext/standard/tests/array/array_intersect_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_variation1.phpt
@@ -92,14 +92,22 @@ $arrays = array(
// loop through each sub-array within $arrrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iterator $iterator --";
-
- // Calling array_intersect() with default arguments
- var_dump( array_intersect($unexpected_value,$arr2) );
-
- // Calling array_intersect() with more arguments
- var_dump( array_intersect($unexpected_value, $arr2, $arr3) );
- $iterator++;
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ try {
+ var_dump( array_intersect($unexpected_value,$arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect() with more arguments
+ try {
+ var_dump( array_intersect($unexpected_value, $arr2, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
}
// close the file resource used
@@ -107,174 +115,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect() : Passing non-array values to $arr1 argument ***
--- Iterator 1 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 2 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 3 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 4 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 5 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 6 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 7 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 8 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 9 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 10 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 11 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 12 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iterator 13 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 1 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 2 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iterator 14 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 3 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 4 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iterator 15 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 5 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 6 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iterator 16 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 7 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 8 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iterator 17 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 9 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 10 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iterator 18 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 11 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 12 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iterator 19 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 13 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 14 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iterator 20 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 15 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 16 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iterator 21 --
-Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iterator 17 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iterator 18 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iterator 22 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 19 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 20 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iterator 23 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 21 --Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 22 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iterator 24 --
-Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 23 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 24 --Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt
index 1db37b8467..08f6c9bb48 100644
--- a/ext/standard/tests/array/array_intersect_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_variation2.phpt
@@ -92,15 +92,23 @@ $arrays = array(
// loop through each sub-array within $arrrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iterator $iterator --";
-
- // Calling array_intersect() with default arguments
- var_dump( array_intersect($arr1,$unexpected_value) );
-
- // Calling array_intersect() with more arguments
- var_dump( array_intersect($arr1, $unexpected_value, $arr3) );
-
- $iterator++;
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ try {
+ var_dump( array_intersect($arr1,$unexpected_value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect() with more arguments
+ try {
+ var_dump( array_intersect($arr1, $unexpected_value, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $iterator++;
}
// close the file resource used
@@ -108,174 +116,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect() : Passing non-array values to $arr2 argument ***
--- Iterator 1 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 2 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 3 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 4 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 5 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 6 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 7 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 8 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 9 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 10 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 11 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 12 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
--- Iterator 13 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 1 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 2 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iterator 14 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 3 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 4 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iterator 15 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 5 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 6 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iterator 16 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 7 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 8 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iterator 17 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 9 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 10 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iterator 18 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 11 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 12 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iterator 19 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 13 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 14 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iterator 20 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 15 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 16 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iterator 21 --
-Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iterator 17 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iterator 18 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iterator 22 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 19 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 20 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iterator 23 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 21 --Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 22 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iterator 24 --
-Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 23 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 24 --Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_variation9.phpt b/ext/standard/tests/array/array_intersect_variation9.phpt
index 6c7c956ea7..d66d9c682b 100644
--- a/ext/standard/tests/array/array_intersect_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_variation9.phpt
@@ -61,37 +61,37 @@ echo "Done";
-- Passing the entire 2-D array to $arr1 and $arr2 --
- With default arguments -
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(4) {
[0]=>
array(4) {
@@ -136,53 +136,53 @@ array(4) {
}
- With more arguments -
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(4) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt
index 78a144f829..f66648f17d 100644
--- a/ext/standard/tests/array/array_key_exists.phpt
+++ b/ext/standard/tests/array/array_key_exists.phpt
@@ -69,24 +69,8 @@ foreach ($search_arrays_v as $search_array) {
}
echo "\n*** Testing error conditions ***\n";
-//Zeor args
-var_dump( array_key_exists() );
// first args as array
var_dump( array_key_exists(array(), array()) );
-// second args as string
-var_dump( array_key_exists("", "") );
-// second args a integer
-var_dump( array_key_exists(1, 1) );
-// second args as NULL
-var_dump( array_key_exists(1, NULL) );
-// second args as boolean
-var_dump( array_key_exists(1, true) );
-// first args as boolean
-var_dump( array_key_exists(false, true) );
-// second args as float
-var_dump( array_key_exists(false, 17.5) );
-// args more than expected
-var_dump( array_key_exists(1, array(), array()) );
// first argument as floating point value
var_dump( array_key_exists(17.5, array(1,23) ) ) ;
@@ -249,33 +233,9 @@ bool(true)
*** Testing error conditions ***
-Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
-Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt
deleted file mode 100644
index 46a989b839..0000000000
--- a/ext/standard/tests/array/array_keys_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Test array_keys() function (error conditions)
---FILE--
-<?php
-
-echo "\n*** Testing error conditions ***";
-var_dump(array_keys(100));
-var_dump(array_keys("string"));
-var_dump(array_keys(new stdclass)); // object
-var_dump(array_keys()); // Zero arguments
-var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
-var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing error conditions ***
-Warning: array_keys() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d
-NULL
-
-Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: Illegal offset type in %s on line %d
-array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
-}
-Done
diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt
index 56dd033521..d15f28425e 100644
--- a/ext/standard/tests/array/array_map_error.phpt
+++ b/ext/standard/tests/array/array_map_error.phpt
@@ -9,10 +9,6 @@ Test array_map() function : error conditions
echo "*** Testing array_map() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing array_map() function with Zero arguments --\n";
-var_dump( array_map() );
-
// Testing array_map with one less than the expected number of arguments
echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n";
function callback1() {
@@ -45,15 +41,8 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : error conditions ***
--- Testing array_map() function with Zero arguments --
-
-Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d
-NULL
-
-- Testing array_map() function with one less than expected no. of arguments --
-
-Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d
-NULL
+Exception: array_map() expects at least 2 parameters, 1 given
-- Testing array_map() function with less no. of arrays than callback function arguments --
Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected
diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt
index b808381048..43cc4484e6 100644
--- a/ext/standard/tests/array/array_map_object1.phpt
+++ b/ext/standard/tests/array/array_map_object1.phpt
@@ -22,13 +22,17 @@ echo "-- simple class with public variable and method --\n";
class SimpleClass
{
public $var1 = 1;
- public function square($n) {
+ public static function square($n) {
return $n * $n;
}
}
function test($cb, $args) {
echo join('::', $cb) . "\n";
- var_dump(array_map($cb, $args));
+ try {
+ var_dump(array_map($cb, $args));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
test(array('SimpleClass', 'square'), array(1, 2));
@@ -36,7 +40,7 @@ echo "\n-- simple class with private variable and method --\n";
class SimpleClassPri
{
private $var1 = 10;
- private function add($n) {
+ private static function add($n) {
return $var + $n;
}
}
@@ -46,7 +50,7 @@ echo "\n-- simple class with protected variable and method --\n";
class SimpleClassPro
{
protected $var1 = 5;
- protected function mul($n) {
+ protected static function mul($n) {
return $var1 * $n;
}
}
@@ -62,14 +66,14 @@ echo "\n-- abstract class --\n";
abstract class AbstractClass
{
protected $var2 = 5;
- abstract function emptyFunction();
+ abstract static function emptyFunction();
}
// class deriving the above abstract class
class ChildClass extends AbstractClass
{
private $var3;
- public function emptyFunction() {
+ public static function emptyFunction() {
echo "defined in child\n";
}
}
@@ -79,7 +83,7 @@ echo "\n-- class with final method --\n";
class FinalClass
{
private $var4;
- final function finalMethod() {
+ final static function finalMethod() {
echo "This function can't be overloaded\n";
}
}
@@ -126,8 +130,6 @@ test(array('InterClass', 'square'), array(1, 2));
*** Testing array_map() : object functionality ***
-- simple class with public variable and method --
SimpleClass::square
-
-Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d
array(2) {
[0]=>
int(1)
@@ -137,26 +139,18 @@ array(2) {
-- simple class with private variable and method --
SimpleClassPri::add
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add()
-- simple class with protected variable and method --
SimpleClassPro::mul
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul()
-- class without members --
EmptyClass
-
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, array must have exactly two members
-- abstract class --
ChildClass::emptyFunction
-
-Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d
defined in child
defined in child
array(2) {
@@ -168,8 +162,6 @@ array(2) {
-- class with final method --
FinalClass::finalMethod
-
-Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d
This function can't be overloaded
This function can't be overloaded
array(2) {
@@ -188,13 +180,9 @@ array(2) {
int(4)
}
StaticClass::cube
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube()
StaticClass::retVal
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal()
-- class implementing an interface --
InterClass::square
array(2) {
diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt
index 7cfb528bf2..e5218ccbe4 100644
--- a/ext/standard/tests/array/array_map_object2.phpt
+++ b/ext/standard/tests/array/array_map_object2.phpt
@@ -26,21 +26,25 @@ class SimpleClass
}
echo "-- with non-existent class --\n";
-var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
+try {
+ var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- with existent class and non-existent method --\n";
-var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
+try {
+ var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
--EXPECTF--
*** Testing array_map() : with non-existent class and method ***
-- with non-existent class --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found
-- with existent class and non-existent method --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent'
Done
diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt
index 114d1d3134..2f1536df5c 100644
--- a/ext/standard/tests/array/array_map_object3.phpt
+++ b/ext/standard/tests/array/array_map_object3.phpt
@@ -51,13 +51,21 @@ echo "-- accessing parent method from child class --\n";
var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) );
echo "-- accessing child method from parent class --\n";
-var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) );
+try {
+ var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- accessing parent method using child class object --\n";
var_dump( array_map(array($childobj, 'staticParent1'), $arr1) );
echo "-- accessing child method using parent class object --\n";
-var_dump( array_map(array($parentobj, 'staticChild'), $arr1) );
+try {
+ var_dump( array_map(array($parentobj, 'staticChild'), $arr1) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -73,9 +81,7 @@ array(3) {
int(7)
}
-- accessing child method from parent class --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild'
-- accessing parent method using child class object --
array(3) {
[0]=>
@@ -86,7 +92,5 @@ array(3) {
int(7)
}
-- accessing child method using parent class object --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild'
Done
diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt
index 5b80126966..df071a414b 100644
--- a/ext/standard/tests/array/array_map_variation10.phpt
+++ b/ext/standard/tests/array/array_map_variation10.phpt
@@ -33,11 +33,15 @@ echo "-- anonymous function with NULL body --\n";
var_dump( array_map( function($a) { }, $array1));
echo "-- passing NULL as 'arr1' --\n";
-var_dump( array_map( function($a) { return array($a); }, NULL));
+try {
+ var_dump( array_map( function($a) { return array($a); }, NULL));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_map() : anonymous callback function ***
-- anonymous function with all parameters and body --
array(3) {
@@ -84,7 +88,5 @@ array(3) {
NULL
}
-- passing NULL as 'arr1' --
-
-Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
Done
diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt
index b258c2d31b..67abde0108 100644
--- a/ext/standard/tests/array/array_map_variation12.phpt
+++ b/ext/standard/tests/array/array_map_variation12.phpt
@@ -20,10 +20,18 @@ echo "-- with built-in function 'pow' and two parameters --\n";
var_dump( array_map('pow', $array1, $array2));
echo "-- with built-in function 'pow' and one parameter --\n";
-var_dump( array_map('pow', $array1));
+try {
+ var_dump( array_map('pow', $array1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- with language construct --\n";
-var_dump( array_map('echo', $array1));
+try {
+ var_dump( array_map('echo', $array1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -39,22 +47,7 @@ array(3) {
int(243)
}
-- with built-in function 'pow' and one parameter --
-
-Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
-array(3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
-}
+pow() expects exactly 2 parameters, 1 given
-- with language construct --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt
index 771d3f949e..2764cb7374 100644
--- a/ext/standard/tests/array/array_map_variation14.phpt
+++ b/ext/standard/tests/array/array_map_variation14.phpt
@@ -36,10 +36,18 @@ echo "-- with undefined variable --\n";
var_dump( array_map(@$undefined_var, $arr1) );
echo "-- with empty string --\n";
-var_dump( array_map("", $arr1, $arr2) );
+try {
+ var_dump( array_map("", $arr1, $arr2) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- with empty array --\n";
-var_dump( array_map(array(), $arr1, $arr2) );
+try {
+ var_dump( array_map(array(), $arr1, $arr2) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -115,11 +123,7 @@ array(2) {
int(2)
}
-- with empty string --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name
-- with empty array --
-
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, array must have exactly two members
Done
diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt
index b29af47713..f36d55bd5f 100644
--- a/ext/standard/tests/array/array_map_variation15.phpt
+++ b/ext/standard/tests/array/array_map_variation15.phpt
@@ -18,13 +18,15 @@ $arr1 = array(1, 2);
$arr2 = array("one", "two");
$arr3 = array(1.1, 2.2);
-var_dump( array_map('non_existent', $arr1, $arr2, $arr3) );
+try {
+ var_dump( array_map('non_existent', $arr1, $arr2, $arr3) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_map() : non existent 'callback' function ***
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt
index c4987cb385..0c80337c76 100644
--- a/ext/standard/tests/array/array_map_variation16.phpt
+++ b/ext/standard/tests/array/array_map_variation16.phpt
@@ -30,8 +30,12 @@ $callback_names = array(
);
for($count = 0; $count < count($callback_names); $count++)
{
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( array_map($callback_names[$count], $arr1) );
+ echo "-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( array_map($callback_names[$count], $arr1) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
echo "Done";
@@ -39,35 +43,19 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : non-permmited built-in functions ***
-- Iteration 1 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name
-- Iteration 2 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name
-- Iteration 3 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name
-- Iteration 4 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name
-- Iteration 5 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name
-- Iteration 6 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name
-- Iteration 7 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name
-- Iteration 8 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt
index 1cfbdd7beb..4558dc999f 100644
--- a/ext/standard/tests/array/array_map_variation17.phpt
+++ b/ext/standard/tests/array/array_map_variation17.phpt
@@ -66,93 +66,77 @@ $unexpected_callbacks = array(
// loop through each element of $inputs to check the behavior of array_map
for($count = 0; $count < count($unexpected_callbacks); $count++) {
- echo "\n-- Iteration ".($count + 1)." --";
- var_dump( array_map($unexpected_callbacks[$count], $arr1));
+ echo "\n-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( array_map($unexpected_callbacks[$count], $arr1));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_map() : unexpected values for 'callback' argument ***
-- Iteration 1 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 2 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 3 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 4 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 5 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 6 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 7 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 8 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 9 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 10 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 11 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 12 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 13 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 14 --
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name
-- Iteration 15 --
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name
-- Iteration 16 --
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, array must have exactly two members
-- Iteration 17 --
-Warning: array_map() 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
+array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
-- Iteration 18 --
-Warning: array_map() 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
+array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
-- Iteration 19 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 20 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
Done
diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt
index e5b4c062c1..8e75b91ff4 100644
--- a/ext/standard/tests/array/array_map_variation4.phpt
+++ b/ext/standard/tests/array/array_map_variation4.phpt
@@ -58,10 +58,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
- array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed values
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+/*11*/ array('hello' => 1, "fruit" => 2.2,
$fp => 'resource', 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
@@ -79,13 +79,9 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-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
-- Iteration 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt
index 0afc2084af..08ecbf7147 100644
--- a/ext/standard/tests/array/array_merge.phpt
+++ b/ext/standard/tests/array/array_merge.phpt
@@ -78,12 +78,6 @@ var_dump(array_merge($begin_array[6]));
echo "\n*** Testing array_merge() with typecasting non-array to array ***\n";
var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34));
-echo "\n*** Testing error conditions ***";
-/* Invalid arguments */
-var_dump(array_merge(100, 200));
-var_dump(array_merge($begin_array[0], $begin_array[1], 100));
-var_dump(array_merge($begin_array[0], $begin_array[1], $arr4));
-
echo "\n*** Testing array_merge without any arguments ***\n";
var_dump(array_merge());
@@ -747,18 +741,6 @@ array(7) {
float(12.34)
}
-*** Testing error conditions ***
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_merge(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Notice: Undefined variable: arr4 in %s on line %d
-
-Warning: array_merge(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
*** Testing array_merge without any arguments ***
array(0) {
}
diff --git a/ext/standard/tests/array/array_merge_recursive_variation1.phpt b/ext/standard/tests/array/array_merge_recursive_variation1.phpt
index 071e9eadb5..3d15d56b81 100644
--- a/ext/standard/tests/array/array_merge_recursive_variation1.phpt
+++ b/ext/standard/tests/array/array_merge_recursive_variation1.phpt
@@ -88,17 +88,25 @@ $arr2 = array(1, array("hello", 'world'));
// loop through each element of $arrays and check the behavior of array_merge_recursive()
$iterator = 1;
foreach($arrays as $arr1) {
- echo "\n-- Iteration $iterator --";
-
- // with default argument
- echo "\n-- With default argument --";
- var_dump( array_merge_recursive($arr1) );
-
- // with more arguments
- echo "-- With more arguments --";
- var_dump( array_merge_recursive($arr1, $arr2) );
-
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+
+ // with default argument
+ echo "\n-- With default argument --";
+ try {
+ var_dump( array_merge_recursive($arr1) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // with more arguments
+ echo "-- With more arguments --";
+ try {
+ var_dump( array_merge_recursive($arr1, $arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $iterator++;
}
// close the file resource used
@@ -106,198 +114,102 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_merge_recursive() : Passing non array values to $arr1 argument ***
-- Iteration 1 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 2 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 3 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 4 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 5 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 6 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 7 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 8 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 9 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 10 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 11 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 12 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 13 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 14 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 15 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 16 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 17 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 18 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 19 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 20 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 21 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 22 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 23 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, resource given
+-- With more arguments --Expected parameter 1 to be an array, resource given
-- Iteration 24 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, object given
+-- With more arguments --Expected parameter 1 to be an array, object given
Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
index f14d5d9bb3..eec9634630 100644
--- a/ext/standard/tests/array/array_merge_recursive_variation2.phpt
+++ b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
@@ -88,9 +88,13 @@ $arrays = array (
// loop through each element of $arrays and check the behavior of array_merge_recursive()
$iterator = 1;
foreach($arrays as $arr2) {
- echo "\n-- Iteration $iterator --";
- var_dump( array_merge_recursive($arr1, $arr2) );
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+ try {
+ var_dump( array_merge_recursive($arr1, $arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
}
// close the file resource used
@@ -98,102 +102,54 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_merge_recursive() : Passing non array values to $arr2 argument ***
--- Iteration 1 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 2 to be an array, int given
--- Iteration 2 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 2 to be an array, int given
--- Iteration 3 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 2 to be an array, int given
--- Iteration 4 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 2 to be an array, int given
--- Iteration 5 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 2 to be an array, float given
--- Iteration 6 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 2 to be an array, float given
--- Iteration 7 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 2 to be an array, float given
--- Iteration 8 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 2 to be an array, float given
--- Iteration 9 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 2 to be an array, float given
--- Iteration 10 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 2 to be an array, null given
--- Iteration 11 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 2 to be an array, null given
--- Iteration 12 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 2 to be an array, bool given
--- Iteration 13 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 2 to be an array, bool given
--- Iteration 14 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 2 to be an array, bool given
--- Iteration 15 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 2 to be an array, bool given
--- Iteration 16 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 2 to be an array, string given
--- Iteration 17 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 2 to be an array, string given
--- Iteration 18 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 2 to be an array, string given
--- Iteration 19 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 2 to be an array, string given
--- Iteration 20 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 2 to be an array, string given
--- Iteration 21 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 2 to be an array, null given
--- Iteration 22 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 2 to be an array, null given
--- Iteration 23 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 2 to be an array, resource given
--- Iteration 24 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 2 to be an array, object given
Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
index f2c1e82a0c..dc5651adfb 100644
--- a/ext/standard/tests/array/array_merge_recursive_variation4.phpt
+++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
@@ -50,7 +50,7 @@ $arrays = array (
array("hello", $heredoc => array("heredoc", 'string'), "string"),
// array with object, unset variable and resource variable
-/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello")
+/*8*/ array(@$unset_var => array("unset"), $fp => 'resource', 11, "hello")
);
// initialise the second array
@@ -80,9 +80,7 @@ echo "Done";
--EXPECTF--
*** Testing array_merge_recursive() : assoc. array with diff. keys to $arr1 argument ***
-Warning: Illegal offset type in %s on line %d
-
-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
-- Iteration 1 --
-- With default argument --
array(2) {
diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt
index 0335fe473b..16e702e8a1 100644
--- a/ext/standard/tests/array/array_merge_variation1.phpt
+++ b/ext/standard/tests/array/array_merge_variation1.phpt
@@ -102,129 +102,8 @@ echo "Done";
-- Iteration 1 --
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
-}
-
--- Iteration 19 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
--- Iteration 23 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-Done
+Fatal error: Uncaught TypeError: Expected parameter 1 to be an array, int given in %s:%d
+Stack trace:
+#0 %s(%d): array_merge(0, Array)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt
index fd7e9ccfc8..57715d484b 100644
--- a/ext/standard/tests/array/array_merge_variation2.phpt
+++ b/ext/standard/tests/array/array_merge_variation2.phpt
@@ -88,102 +88,72 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_merge()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_merge($arr1, $input) );
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump( array_merge($arr1, $input) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_merge() : usage variations ***
-- Iteration 1 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 2 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 3 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 4 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 5 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 6 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 7 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 8 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 9 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 10 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 11 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 12 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 13 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 14 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 15 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 16 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 17 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 18 --
array(2) {
@@ -194,37 +164,23 @@ array(2) {
}
-- Iteration 19 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 20 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 21 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 22 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
-- Iteration 23 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 24 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 25 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt
index 3e78b78ac0..5d3bab456a 100644
--- a/ext/standard/tests/array/array_multisort_error.phpt
+++ b/ext/standard/tests/array/array_multisort_error.phpt
@@ -10,35 +10,30 @@ Test array_multisort() function : error conditions
echo "*** Testing array_multisort() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing array_multisort() function with Zero arguments --\n";
-var_dump( array_multisort() );
-
echo "\n-- Testing array_multisort() function with repeated flags --\n";
$ar1 = array(1);
-var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) );
+try {
+ var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) );
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing array_multisort() function with repeated flags --\n";
$ar1 = array(1);
-var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) );
+try {
+ var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) );
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : error conditions ***
--- Testing array_multisort() function with Zero arguments --
-
-Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d
-NULL
-
-- Testing array_multisort() function with repeated flags --
-
-Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
-- Testing array_multisort() function with repeated flags --
-
-Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt
index 9a33a270f1..763944054a 100644
--- a/ext/standard/tests/array/array_multisort_variation1.phpt
+++ b/ext/standard/tests/array/array_multisort_variation1.phpt
@@ -11,8 +11,8 @@ Test array_multisort() function : usage variation
echo "*** Testing array_multisort() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
@@ -97,111 +97,90 @@ $inputs = array(
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( array_multisort($value));
+ try {
+ var_dump( array_multisort($value));
+ } catch (Error $e) {
+ echo $e->getMessage() . "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : usage variation ***
--int 0--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or sorting flag that has not already been specified
--int 1--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or sorting flag that has not already been specified
--int 12345--
-Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is an unknown sort flag
--int -12345--
-Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is an unknown sort flag
--float 10.5--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float -10.5--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float 12.3456789000e10--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float -12.3456789000e10--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float .5--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--uppercase NULL--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--lowercase null--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--lowercase true--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--lowercase false--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--uppercase TRUE--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--uppercase FALSE--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--empty string DQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--empty string SQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--string DQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--string SQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--mixed case string--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--heredoc--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--instance of classWithToString--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--instance of classWithoutToString--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--undefined var--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--unset var--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt
index 8c26a8347b..b23d8b19fa 100644
--- a/ext/standard/tests/array/array_multisort_variation2.phpt
+++ b/ext/standard/tests/array/array_multisort_variation2.phpt
@@ -11,8 +11,8 @@ Test array_multisort() function : usage variation
echo "*** Testing array_multisort() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
@@ -104,13 +104,17 @@ $inputs = array(
// loop through each element of the array for SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]]
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_multisort($ar1, $value) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_multisort($ar1, $value) );
+ } catch (Error $e) {
+ echo $e->getMessage() . "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : usage variation ***
--int 0--
@@ -120,109 +124,83 @@ bool(true)
bool(true)
--int 12345--
-Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is an unknown sort flag
--int -12345--
-Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is an unknown sort flag
--float 10.5--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float -10.5--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float 12.3456789000e10--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float -12.3456789000e10--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float .5--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--empty array--
-Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d)
-bool(false)
+Array sizes are inconsistent
--int indexed array--
-Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d)
-bool(false)
+Array sizes are inconsistent
--associative array--
bool(true)
--nested arrays--
-Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d)
-bool(false)
+Array sizes are inconsistent
--uppercase NULL--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--lowercase null--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--lowercase true--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--lowercase false--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--uppercase TRUE--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--uppercase FALSE--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--empty string DQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--empty string SQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--string DQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--string SQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--mixed case string--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--heredoc--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--instance of classWithToString--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--instance of classWithoutToString--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--undefined var--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--unset var--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt
index 28130e31fd..42b1d9fbe5 100644
--- a/ext/standard/tests/array/array_multisort_variation3.phpt
+++ b/ext/standard/tests/array/array_multisort_variation3.phpt
@@ -11,8 +11,8 @@ Test array_multisort() function : usage variation
echo "*** Testing array_multisort() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
@@ -95,114 +95,92 @@ $inputs = array(
);
// loop through each element of the array for ar2
-
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_multisort($ar1, SORT_REGULAR, $value) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_multisort($ar1, SORT_REGULAR, $value) );
+ } catch (Error $e) {
+ echo $e->getMessage() . "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : usage variation ***
--int 0--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
--int 1--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
--int 12345--
-Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is an unknown sort flag
--int -12345--
-Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is an unknown sort flag
--float 10.5--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float -10.5--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float 12.3456789000e10--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float -12.3456789000e10--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float .5--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--uppercase NULL--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--lowercase null--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--lowercase true--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--lowercase false--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--uppercase TRUE--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--uppercase FALSE--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--empty string DQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--empty string SQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--string DQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--string SQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--mixed case string--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--heredoc--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--instance of classWithToString--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--instance of classWithoutToString--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--undefined var--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--unset var--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt
index 00b0ccb012..d681ef92c5 100644
--- a/ext/standard/tests/array/array_multisort_variation8.phpt
+++ b/ext/standard/tests/array/array_multisort_variation8.phpt
@@ -11,7 +11,7 @@ Test array_multisort() function : usage variation - test sort order of all types
echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
// We're testing sort order not errors so ignore.
}
set_error_handler('test_error_handler');
diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt
index c267516730..ce6e1b2b04 100644
--- a/ext/standard/tests/array/array_pad.phpt
+++ b/ext/standard/tests/array/array_pad.phpt
@@ -3,9 +3,6 @@ array_pad() tests
--FILE--
<?php
-var_dump(array_pad());
-var_dump(array_pad(array()));
-var_dump(array_pad(array(), 1));
var_dump(array_pad(array(), 1, 0));
var_dump(array_pad(array(), 0, 0));
@@ -15,20 +12,17 @@ var_dump(array_pad(array("", -1, 2.0), 5, array()));
var_dump(array_pad(array("", -1, 2.0), 2, array()));
var_dump(array_pad(array("", -1, 2.0), -3, array()));
var_dump(array_pad(array("", -1, 2.0), -4, array()));
-var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
-var_dump(array_pad("", 2000000, 0));
-echo "Done\n";
-?>
---EXPECTF--
-Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
+try {
+ var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
+?>
-Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
+DONE
+--EXPECT--
array(1) {
[0]=>
int(0)
@@ -92,10 +86,6 @@ array(4) {
[3]=>
float(2)
}
+You may only pad up to 1048576 elements at a time
-Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
-bool(false)
-
-Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d
-NULL
-Done
+DONE
diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt
index 52e754f94d..227a520ac1 100644
--- a/ext/standard/tests/array/array_push.phpt
+++ b/ext/standard/tests/array/array_push.phpt
@@ -31,16 +31,7 @@ $mixed_array = array(
);
/* Error Conditions */
-echo "\n*** Testing Error Conditions ***\n";
-
-/* Zero argument */
-var_dump( array_push() );
-
-/* Scalar argument */
-var_dump( array_push($number, 22) );
-
-/* String argument */
-var_dump( array_push($str, 22) );
+echo "\n*** Testing Edge Conditions ***\n";
/* Invalid Number of arguments */
var_dump( array_push($mixed_array[1],1,2) );
@@ -70,16 +61,7 @@ var_dump( $mixed_array[2] );
echo"\nDone";
?>
--EXPECTF--
-*** Testing Error Conditions ***
-
-Warning: array_push() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: array_push() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_push() expects parameter 1 to be array, string given in %s on line %d
-NULL
+*** Testing Edge Conditions ***
int(11)
int(1)
diff --git a/ext/standard/tests/array/array_push_error2.phpt b/ext/standard/tests/array/array_push_error2.phpt
index 3ab60136be..2d19dbc246 100644
--- a/ext/standard/tests/array/array_push_error2.phpt
+++ b/ext/standard/tests/array/array_push_error2.phpt
@@ -15,17 +15,18 @@ Test array_push() function : error conditions - max int value as key
echo "*** Testing array_push() : error conditions ***\n";
$array = array(PHP_INT_MAX => 'max');
-
-var_dump(array_push($array, 'new'));
+try {
+ var_dump(array_push($array, 'new'));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
var_dump($array);
echo "Done";
?>
--EXPECTF--
*** Testing array_push() : error conditions ***
-
-Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d
-bool(false)
+Cannot add element to the array as the next element is already occupied
array(1) {
[%d]=>
string(3) "max"
diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt
index db432dc9b4..5895727548 100644
--- a/ext/standard/tests/array/array_rand.phpt
+++ b/ext/standard/tests/array/array_rand.phpt
@@ -3,39 +3,47 @@ array_rand() tests
--FILE--
<?php
-var_dump(array_rand());
-var_dump(array_rand(array()));
-var_dump(array_rand(array(), 0));
-var_dump(array_rand(0, 0));
-var_dump(array_rand(array(1,2,3), 0));
-var_dump(array_rand(array(1,2,3), -1));
-var_dump(array_rand(array(1,2,3), 10));
-var_dump(array_rand(array(1,2,3), 3));
-var_dump(array_rand(array(1,2,3), 2));
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array()));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Array is empty in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(), 0));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Array is empty in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(1,2,3), 0));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(1,2,3), -1));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(1,2,3), 10));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+var_dump(array_rand(array(1,2,3), 3));
+var_dump(array_rand(array(1,2,3), 2));
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+echo "Done\n";
+?>
+--EXPECTF--
+Array is empty
+Array is empty
+Second argument has to be between 1 and the number of elements in the array
+Second argument has to be between 1 and the number of elements in the array
+Second argument has to be between 1 and the number of elements in the array
array(3) {
[0]=>
int(%d)
diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt
index 30eb7d7801..03e20d6e07 100644
--- a/ext/standard/tests/array/array_rand_variation5.phpt
+++ b/ext/standard/tests/array/array_rand_variation5.phpt
@@ -32,17 +32,36 @@ var_dump( array_rand($input, 1) ); // with valid $num_req value
// with invalid num_req value
echo"\n-- With num_req = 0 --\n";
-var_dump( array_rand($input, 0) ); // with $num_req=0
+try {
+ var_dump( array_rand($input, 0) ); // with $num_req=0
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo"\n-- With num_req = -1 --\n";
-var_dump( array_rand($input, -1) ); // with $num_req=-1
+try {
+ var_dump( array_rand($input, -1) ); // with $num_req=-1
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo"\n-- With num_req = -2 --\n";
-var_dump( array_rand($input, -2) ); // with $num_req=-2
-echo"\n-- With num_req more than number of members in 'input' array --\n";
-var_dump( array_rand($input, 13) ); // with $num_req=13
+try {
+ var_dump( array_rand($input, -2) ); // with $num_req=-2
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+echo"\n-- With num_req more than number of members in 'input' array --\n";
+try {
+ var_dump( array_rand($input, 13) ); // with $num_req=13
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done";
?>
+
+DONE
--EXPECTF--
*** Testing array_rand() : with invalid values for 'req_num' ***
@@ -53,22 +72,15 @@ int(%d)
int(%d)
-- With num_req = 0 --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+Second argument has to be between 1 and the number of elements in the array
-- With num_req = -1 --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+Second argument has to be between 1 and the number of elements in the array
-- With num_req = -2 --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+Second argument has to be between 1 and the number of elements in the array
-- With num_req more than number of members in 'input' array --
+Second argument has to be between 1 and the number of elements in the array
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
-Done
+DONE
diff --git a/ext/standard/tests/array/array_replace.phpt b/ext/standard/tests/array/array_replace.phpt
index 6ba9e43fd7..48b616ab04 100644
--- a/ext/standard/tests/array/array_replace.phpt
+++ b/ext/standard/tests/array/array_replace.phpt
@@ -42,11 +42,15 @@ $data = array_replace_recursive($array1, $array2);
var_dump($data);
echo " -- Testing array_replace_recursive() w/ endless recusrsion --\n";
-$data = array_replace_recursive($array3, $array4);
+try {
+ $data = array_replace_recursive($array3, $array4);
+ var_dump($data);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-var_dump($data);
?>
---EXPECTF--
+--EXPECT--
-- Testing array_replace() --
array(5) {
[0]=>
@@ -107,16 +111,4 @@ array(5) {
}
}
-- Testing array_replace_recursive() w/ endless recusrsion --
-
-Warning: array_replace_recursive(): recursion detected in %s on line %d
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(0) {
- }
- }
- }
-}
+Recursion detected
diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt
index 09b2eb4bee..21cced1703 100644
--- a/ext/standard/tests/array/array_reverse_variation4.phpt
+++ b/ext/standard/tests/array/array_reverse_variation4.phpt
@@ -54,10 +54,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
- array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed values
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc")
+/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc")
);
// loop through the various elements of $arrays to test array_reverse()
@@ -83,13 +83,9 @@ echo "Done";
--EXPECTF--
*** Testing array_reverse() : usage variations ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-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
-- Iteration 1 --
- default argument -
array(0) {
diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt
index 49563f9712..10c1672e54 100644
--- a/ext/standard/tests/array/array_search1.phpt
+++ b/ext/standard/tests/array/array_search1.phpt
@@ -5,8 +5,6 @@ array_search() tests
$a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d");
-var_dump(array_search(1));
-var_dump(array_search(1,1));
var_dump(array_search("a",$a));
var_dump(array_search("0",$a, true));
var_dump(array_search("0",$a));
@@ -18,12 +16,7 @@ var_dump(array_search(-1,$a, true));
echo "Done\n";
?>
---EXPECTF--
-Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: array_search() expects parameter 2 to be array, int given in %s on line %d
-NULL
+--EXPECT--
int(1)
bool(false)
int(1)
diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt
index 41b0b5bb20..596c36f805 100644
--- a/ext/standard/tests/array/array_search_variation3.phpt
+++ b/ext/standard/tests/array/array_search_variation3.phpt
@@ -33,9 +33,17 @@ class array_search_check {
$array_search_obj = new array_search_check(); //creating new object
//error: as wrong datatype for second argument
-var_dump( array_search("array_var", $array_search_obj) );
+try {
+ var_dump( array_search("array_var", $array_search_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//error: as wrong datatype for second argument
-var_dump( array_search("foo", $array_search_obj) );
+try {
+ var_dump( array_search("foo", $array_search_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//element found as "one" exists in array $array_var
var_dump( array_search("one", $array_search_obj->array_var) );
@@ -48,11 +56,7 @@ string(5) "three"
int(5)
*** Testing objects with array_search() ***
-
-Warning: array_search() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_search() expects parameter 2 to be array, object given in %s on line %d
-NULL
+array_search() expects parameter 2 to be array, object given
+array_search() expects parameter 2 to be array, object given
int(1)
Done
diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt
index 59d804350b..d19f5195d6 100644
--- a/ext/standard/tests/array/array_slice.phpt
+++ b/ext/standard/tests/array/array_slice.phpt
@@ -20,26 +20,6 @@ $var_array = array(
$num = 4;
$str = "john";
-/* Zero args */
-echo"\n*** Output for Zero Argument ***\n";
-array_slice();
-
-/* Single args */
-echo"\n*** Output for Single array Argument ***\n";
-array_slice($var_array);
-
-/* More than valid no. of args (ie. >4 ) */
-echo"\n*** Output for invalid number of Arguments ***\n";
-array_slice($var_array, 2, 4, true, 3);
-
-/* Scalar arg */
-echo"\n*** Output for scalar Argument ***\n";
-array_slice($num, 2);
-
-/* String arg */
-echo"\n*** Output for string Argument ***\n";
-array_slice($str, 2);
-
$counter = 1;
foreach ($var_array as $sub_array)
{
@@ -89,26 +69,6 @@ foreach ($var_array as $sub_array)
?>
--EXPECTF--
-*** Output for Zero Argument ***
-
-Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d
-
-*** Output for Single array Argument ***
-
-Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d
-
-*** Output for invalid number of Arguments ***
-
-Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d
-
-*** Output for scalar Argument ***
-
-Warning: array_slice() expects parameter 1 to be array, int given in %s on line %d
-
-*** Output for string Argument ***
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-
*** Iteration 1 ***
*** Variation with first two Arguments ***
diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt
index 7b6d712a1f..46f33b9503 100644
--- a/ext/standard/tests/array/array_slice_variation1.phpt
+++ b/ext/standard/tests/array/array_slice_variation1.phpt
@@ -15,12 +15,20 @@ var_dump(array_slice(range(1, 3), -1, NULL, 1));
$a = 'foo';
-var_dump(array_slice(range(1, 3), 0, $a));
-var_dump(array_slice(range(1, 3), 0, $a));
+try {
+ var_dump(array_slice(range(1, 3), 0, $a));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(array_slice(range(1, 3), 0, $a));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($a);
?>
---EXPECT--
+--EXPECTF--
array(3) {
[0]=>
int(1)
@@ -53,8 +61,6 @@ array(1) {
[2]=>
int(3)
}
-array(0) {
-}
-array(0) {
-}
+array_slice() expects parameter 3 to be int, string given
+array_slice() expects parameter 3 to be int, string given
string(3) "foo"
diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt
deleted file mode 100644
index a76d68e6e0..0000000000
--- a/ext/standard/tests/array/array_slice_variation2.phpt
+++ /dev/null
@@ -1,303 +0,0 @@
---TEST--
-Test array_slice() function : usage variations - Pass different data types as $offset arg
---SKIPIF--
-<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?>
---FILE--
-<?php
-/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
- * Description: Returns elements specified by offset and length
- * Source code: ext/standard/array.c
- */
-
-/*
- * Pass different data types as $offset argument to array_slice() to test behaviour
- */
-
-echo "*** Testing array_slice() : usage variations ***\n";
-
-// Initialise function arguments not being substituted
-$input_array = array('one' => 1, 2, 'three' => 3, 4);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $offset argument
-$inputs = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
- array(),
-
- // string data
-/*19*/ "string",
- 'string',
- $heredoc,
-
- // undefined data
-/*22*/ @$undefined_var,
-
- // unset data
-/*23*/ @$unset_var,
-);
-
-// loop through each element of $inputs to check the behavior of array_slice()
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_slice($input_array, $input) );
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing array_slice() : usage variations ***
-
--- Iteration 1 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 2 --
-array(3) {
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 3 --
-array(0) {
-}
-
--- Iteration 4 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 5 --
-array(0) {
-}
-
--- Iteration 6 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 7 --
-
-Warning: array_slice() expects parameter 2 to be int, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 9 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 10 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 11 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 12 --
-array(3) {
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 13 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 14 --
-array(3) {
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 15 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 16 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-
-Warning: array_slice() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
--- Iteration 19 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 23 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-Done
diff --git a/ext/standard/tests/array/array_splice_basic.phpt b/ext/standard/tests/array/array_splice_basic.phpt
index 9a96ccb362..cf6fcd1db2 100644
--- a/ext/standard/tests/array/array_splice_basic.phpt
+++ b/ext/standard/tests/array/array_splice_basic.phpt
@@ -14,6 +14,12 @@ var_dump (array_splice($input, 2));
var_dump ($input);
// $input is now array("red", "green")
+echo "test truncation with null length \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 2, null));
+var_dump ($input);
+// $input is now array("red", "green")
+
echo "test removing entries from the middle \n";
$input = array("red", "green", "blue", "yellow");
var_dump (array_splice($input, 1, -1));
@@ -56,6 +62,19 @@ array(2) {
[1]=>
string(5) "green"
}
+test truncation with null length
+array(2) {
+ [0]=>
+ string(4) "blue"
+ [1]=>
+ string(6) "yellow"
+}
+array(2) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+}
test removing entries from the middle
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
index 2cbc9572d2..9f320c04ad 100644
--- a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_assoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
index 1a2c1ed978..e0eaaf63ce 100644
--- a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_assoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt
deleted file mode 100644
index 20a5afa202..0000000000
--- a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_udiff_assoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
- * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_udiff_assoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$key_comp_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_assoc($arr1, $arr2, $value, $key_comp_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_udiff_assoc() : usage variation ***
-
---int 0--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
index 4496194b62..bbc213aee4 100644
--- a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
@@ -92,137 +92,91 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
index 2324c5a47b..9466dc952b 100644
--- a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
@@ -92,137 +92,91 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt
deleted file mode 100644
index 820f0466ad..0000000000
--- a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt
+++ /dev/null
@@ -1,229 +0,0 @@
---TEST--
-Test array_udiff_uassoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
- * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_comp_func = 'compare_function';
-$key_comp_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_udiff_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---int 1--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float .5--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---unset var--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt
index 5eb84146a1..f462be78c0 100644
--- a/ext/standard/tests/array/array_udiff_variation1.phpt
+++ b/ext/standard/tests/array/array_udiff_variation1.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff($value, $arr2, $data_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff($value, $arr2, $data_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff() : usage variation ***
--int 0--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt
index 61aa1f0c9a..ee478837cd 100644
--- a/ext/standard/tests/array/array_udiff_variation2.phpt
+++ b/ext/standard/tests/array/array_udiff_variation2.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff($arr1, $value, $data_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff($arr1, $value, $data_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff() : usage variation ***
--int 0--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt
deleted file mode 100644
index a92c5ddfdf..0000000000
--- a/ext/standard/tests/array/array_udiff_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_udiff() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
- * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_udiff() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_comp_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff($arr1, $arr2, $value, $data_comp_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_udiff() : usage variation ***
-
---int 0--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
index a2babcdb02..8a3ffe909d 100644
--- a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_assoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
index 8723157506..3c04bd5a36 100644
--- a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_assoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt
deleted file mode 100644
index 3024246a3d..0000000000
--- a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_uintersect_assoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
- * Description: U
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_compare_function = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_uintersect_assoc() : usage variation ***
-
---int 0--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
index 84d4e634cf..385fffed96 100644
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
@@ -92,137 +92,91 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
index 8692026fc4..74eeddf4ff 100644
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
@@ -92,137 +92,91 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt
deleted file mode 100644
index d1db008416..0000000000
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt
+++ /dev/null
@@ -1,229 +0,0 @@
---TEST--
-Test array_uintersect_uassoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
- * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_compare_func = 'compare_function';
-$key_compare_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_uintersect_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---int 1--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float .5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---unset var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt
index c88177018b..32e2177758 100644
--- a/ext/standard/tests/array/array_uintersect_variation1.phpt
+++ b/ext/standard/tests/array/array_uintersect_variation1.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect($value, $arr2, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect($value, $arr2, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect() : usage variation ***
--int 0--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt
index ee52e21c72..bf914e9bc6 100644
--- a/ext/standard/tests/array/array_uintersect_variation2.phpt
+++ b/ext/standard/tests/array/array_uintersect_variation2.phpt
@@ -91,137 +91,91 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect($arr1, $value, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect($arr1, $value, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect() : usage variation ***
--int 0--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt
deleted file mode 100644
index abc33e591b..0000000000
--- a/ext/standard/tests/array/array_uintersect_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_uintersect() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
- * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_uintersect() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_compare_function = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect($arr1, $arr2, $value, $data_compare_function) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_uintersect() : usage variation ***
-
---int 0--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt
index 205bc3a576..0227449233 100644
--- a/ext/standard/tests/array/array_unique_variation3.phpt
+++ b/ext/standard/tests/array/array_unique_variation3.phpt
@@ -50,7 +50,7 @@ $inputs = array (
array("hello", $heredoc => "string", "string"),
// array with object, unset variable and resource variable
-/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"),
+/*8*/ array(@$unset_var => "hello", $fp => 'resource', 11, "hello"),
);
// loop through each sub-array of $inputs to check the behavior of array_unique()
@@ -68,9 +68,7 @@ echo "Done";
--EXPECTF--
*** Testing array_unique() : assoc. array with diff. keys passed to $input argument ***
-Warning: Illegal offset type in %s on line %d
-
-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
-- Iteration 1 --
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt
index d8a318dd93..0ac6f91687 100644
--- a/ext/standard/tests/array/array_unique_variation8.phpt
+++ b/ext/standard/tests/array/array_unique_variation8.phpt
@@ -29,13 +29,13 @@ echo "Done";
--EXPECTF--
*** Testing array_unique() : two dimensional array for $input argument ***
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt
index 9b474277a9..9ebe83391e 100644
--- a/ext/standard/tests/array/array_unshift.phpt
+++ b/ext/standard/tests/array/array_unshift.phpt
@@ -7,8 +7,6 @@ $a = array();
$s = "";
var_dump(array_unshift($a, $s));
var_dump($a);
-var_dump(array_unshift($s, $a));
-var_dump($a);
var_dump(array_unshift($a, $a));
var_dump($a);
@@ -20,13 +18,6 @@ array(1) {
[0]=>
string(0) ""
}
-
-Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d
-NULL
-array(1) {
- [0]=>
- string(0) ""
-}
int(2)
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt
index 7f507c98d0..e468bfcf46 100644
--- a/ext/standard/tests/array/array_unshift_variation4.phpt
+++ b/ext/standard/tests/array/array_unshift_variation4.phpt
@@ -63,10 +63,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
- array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed keys
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+/*11*/ array('hello' => 1, "fruit" => 2.2,
$fp => 'resource', 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
@@ -101,13 +101,9 @@ echo "Done";
--EXPECTF--
*** Testing array_unshift() : associative array with different keys ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-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
-- Iteration 1 --
int(1)
array(1) {
diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt
index 7cd8a8cf7a..cf792bfa19 100644
--- a/ext/standard/tests/array/array_walk.phpt
+++ b/ext/standard/tests/array/array_walk.phpt
@@ -3,12 +3,6 @@ array_walk() tests
--FILE--
<?php
-var_dump(array_walk());
-$var = 1;
-var_dump(array_walk($var,1));
-$var = array();
-var_dump(array_walk($var,""));
-
function foo($v1, $v2, $v3) {
var_dump($v1);
var_dump($v2);
@@ -31,14 +25,6 @@ try {
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
int(1)
int(0)
string(4) "data"
diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt
index 0a5d854582..7ac62d7484 100644
--- a/ext/standard/tests/array/array_walk_closure.phpt
+++ b/ext/standard/tests/array/array_walk_closure.phpt
@@ -3,14 +3,6 @@ array_walk() closure tests
--FILE--
<?php
-var_dump(array_walk());
-
-$ar = false;
-var_dump(array_walk($ar, $ar));
-
-$ar = NULL;
-var_dump(array_walk($ar, $ar));
-
$ar = ["one" => 1, "two"=>2, "three" => 3];
var_dump(array_walk($ar, function(){ var_dump(func_get_args());}));
@@ -94,14 +86,6 @@ try {
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d
-NULL
array(2) {
[0]=>
int(1)
diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt
index a4026180fb..73445892a6 100644
--- a/ext/standard/tests/array/array_walk_error2.phpt
+++ b/ext/standard/tests/array/array_walk_error2.phpt
@@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp
Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected
Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected
-- Testing array_walk() function with too many callback parameters --
-
-Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
-NULL
+Exception: array_walk() expects at most 3 parameters, 4 given
Done
diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt
index fc04304fc5..9f3ac8c1cd 100644
--- a/ext/standard/tests/array/array_walk_objects.phpt
+++ b/ext/standard/tests/array/array_walk_objects.phpt
@@ -24,7 +24,11 @@ array_walk($t, "walk");
$var = array();
array_walk($var, "walk");
$var = "";
-array_walk($var, "walk");
+try {
+ array_walk($var, "walk");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro"
string(14) "test_protected"
string(7) "var_pub"
string(11) "test_public"
-
-Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d
+array_walk() expects parameter 1 to be array, string given
Done
diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt
index a83c227a3b..097143e8ec 100644
--- a/ext/standard/tests/array/array_walk_rec_objects.phpt
+++ b/ext/standard/tests/array/array_walk_rec_objects.phpt
@@ -24,7 +24,11 @@ array_walk_recursive($t, "walk");
$var = array();
array_walk_recursive($var, "walk");
$var = "";
-array_walk_recursive($var, "walk");
+try {
+ array_walk_recursive($var, "walk");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro"
string(14) "test_protected"
string(7) "var_pub"
string(11) "test_public"
-
-Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d
+array_walk_recursive() expects parameter 1 to be array, string given
Done
diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt
index 962f133e4c..f952b4410b 100644
--- a/ext/standard/tests/array/array_walk_recursive1.phpt
+++ b/ext/standard/tests/array/array_walk_recursive1.phpt
@@ -3,12 +3,6 @@ array_walk_recursive() tests
--FILE--
<?php
-var_dump(array_walk_recursive());
-$var = 1;
-var_dump(array_walk_recursive($var,1));
-$var = array();
-var_dump(array_walk_recursive($var,""));
-
function foo($v1, $v2, $v3) {
var_dump($v1);
var_dump($v2);
@@ -31,14 +25,6 @@ try {
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
int(1)
int(0)
string(4) "data"
diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt
index b162a1c9dc..e9bd7ea175 100644
--- a/ext/standard/tests/array/array_walk_recursive_error2.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt
@@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp
Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected
Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected
-- Testing array_walk_recursive() function with too many callback parameters --
-
-Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
-NULL
+Exception: array_walk_recursive() expects at most 3 parameters, 4 given
Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
index 06dc1aaa09..a0c159d71d 100644
--- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
@@ -29,9 +29,6 @@ var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key);
echo "-- Anonymous function with three arguments --\n";
var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10));
-echo "-- Anonymous function with one more argument --\n";
-var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30));
-
echo "-- Anonymous function with null argument --\n";
var_dump( array_walk_recursive( $input, function() { echo "1\n"; }));
echo "Done"
@@ -80,10 +77,6 @@ int(0)
int(10)
bool(true)
--- Anonymous function with one more argument --
-
-Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-- Anonymous function with null argument --
1
1
diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
index 2db8067fe0..51eba1e0e0 100644
--- a/ext/standard/tests/array/array_walk_recursive_variation8.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
@@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n";
var_dump( array_walk_recursive($input, "min"));
echo "-- With 'echo' language construct --\n";
-var_dump( array_walk_recursive($input, "echo"));
+try {
+ var_dump( array_walk_recursive($input, "echo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -36,7 +40,5 @@ bool(true)
-- With 'min' built-in function --
bool(true)
-- With 'echo' language construct --
-
-Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt
index 671ad44309..0354782eda 100644
--- a/ext/standard/tests/array/array_walk_variation7.phpt
+++ b/ext/standard/tests/array/array_walk_variation7.phpt
@@ -29,9 +29,6 @@ var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($
echo "-- Anonymous function with three arguments --\n";
var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10));
-echo "-- Anonymous function with one more argument --\n";
-var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30));
-
echo "-- Anonymous function with null argument --\n";
var_dump( array_walk( $input, function() { echo "1\n"; }));
echo "Done"
@@ -80,10 +77,6 @@ int(0)
int(10)
bool(true)
--- Anonymous function with one more argument --
-
-Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-- Anonymous function with null argument --
1
1
diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt
index 829baf1add..baa5f3914b 100644
--- a/ext/standard/tests/array/array_walk_variation8.phpt
+++ b/ext/standard/tests/array/array_walk_variation8.phpt
@@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n";
var_dump( array_walk($input, "min"));
echo "-- With 'echo' language construct --\n";
-var_dump( array_walk($input, "echo"));
+try {
+ var_dump( array_walk($input, "echo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -36,7 +40,5 @@ bool(true)
-- With 'min' built-in function --
bool(true)
-- With 'echo' language construct --
-
-Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/bug30074.phpt b/ext/standard/tests/array/bug30074.phpt
index 289e802c00..e0309bac1f 100644
--- a/ext/standard/tests/array/bug30074.phpt
+++ b/ext/standard/tests/array/bug30074.phpt
@@ -2,12 +2,12 @@
Bug #30074 (EG(uninitialized_zval_ptr) gets set to reference using EXTR_REFS, affecting later values)
--FILE--
<?php
-error_reporting(E_ALL & ~E_NOTICE); // We don't want the notice for $undefined
$result = extract(array('a'=>$undefined), EXTR_REFS);
var_dump(array($a));
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
+Warning: Undefined variable: undefined in %s on line %d
array(1) {
[0]=>
NULL
diff --git a/ext/standard/tests/array/bug31158.phpt b/ext/standard/tests/array/bug31158.phpt
index 62ba1cfaa3..d4f5210760 100644
--- a/ext/standard/tests/array/bug31158.phpt
+++ b/ext/standard/tests/array/bug31158.phpt
@@ -14,7 +14,7 @@ __();
echo "ok\n";
?>
--EXPECTF--
-Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6
+Warning: Undefined variable: GLOBALS in %s on line %d
-Notice: Trying to access array offset on value of type null in %sbug31158.php on line 6
+Warning: Trying to access array offset on value of type null in %s on line %d
ok
diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt
index f858bf107b..b674590fd6 100644
--- a/ext/standard/tests/array/bug35014.phpt
+++ b/ext/standard/tests/array/bug35014.phpt
@@ -7,7 +7,6 @@ precision=14
--FILE--
<?php
$tests = array(
- 'foo',
array(),
array(0),
array(3),
@@ -22,9 +21,7 @@ foreach ($tests as $v) {
var_dump(array_product($v));
}
?>
---EXPECTF--
-Warning: array_product() expects parameter 1 to be array, string given in %s on line %d
-NULL
+--EXPECT--
int(1)
int(0)
int(3)
diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt
index 5caf48c6ee..3b3d29b5be 100644
--- a/ext/standard/tests/array/bug35014_64bit.phpt
+++ b/ext/standard/tests/array/bug35014_64bit.phpt
@@ -7,7 +7,6 @@ precision=14
--FILE--
<?php
$tests = array(
- 'foo',
array(),
array(0),
array(3),
@@ -22,9 +21,7 @@ foreach ($tests as $v) {
var_dump(array_product($v));
}
?>
---EXPECTF--
-Warning: array_product() expects parameter 1 to be array, string given in %s on line %d
-NULL
+--EXPECT--
int(1)
int(0)
int(3)
diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt
index f5e439821d..b94e709364 100644
--- a/ext/standard/tests/array/bug40191.phpt
+++ b/ext/standard/tests/array/bug40191.phpt
@@ -8,12 +8,14 @@ $arrObj->append('foo');
$arrObj->append('bar');
$arrObj->append('foo');
-$arr = array_unique($arrObj);
-var_dump($arr);
+try {
+ $arr = array_unique($arrObj);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d
-NULL
+--EXPECT--
+array_unique() expects parameter 1 to be array, object given
Done
diff --git a/ext/standard/tests/array/bug42177.phpt b/ext/standard/tests/array/bug42177.phpt
index 5678ca3cac..dc5297b302 100644
--- a/ext/standard/tests/array/bug42177.phpt
+++ b/ext/standard/tests/array/bug42177.phpt
@@ -18,7 +18,11 @@ unset( $a1, $a2 );
$a1 = array();
$a2 = array( 'key1' => &$a1 );
$a1 = array_merge_recursive( $a1, $a2 );
-$a1 = array_merge_recursive( $a1, $a2 );
+try {
+ $a1 = array_merge_recursive( $a1, $a2 );
+} catch (\Error $e) {
+ echo $e->getMessage() . " on line " . $e->getLine() . "\n";
+}
unset( $a1, $a2 );
$x = 'foo';
@@ -30,5 +34,5 @@ $a1 = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
?>
---EXPECTF--
-Warning: array_merge_recursive(): recursion detected in %s on line 18
+--EXPECT--
+Recursion detected on line 19
diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt
index 522ff1903b..cb011d3d44 100644
--- a/ext/standard/tests/array/bug43495.phpt
+++ b/ext/standard/tests/array/bug43495.phpt
@@ -8,14 +8,21 @@ $a["key1"]["key2"]["key3"]=&$a;
$b=array("key1"=>array("key2"=>array()));
$b["key1"]["key2"]["key3"]=&$b;
-array_merge_recursive($a,$b);
+
+try {
+ array_merge_recursive($a,$b);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
/* Break recursion */
$a["key1"]["key2"]["key3"] = null;
$b["key1"]["key2"]["key3"] = null;
-echo "Done.\n";
?>
---EXPECTF--
-Warning: array_merge_recursive(): recursion detected in %sbug43495.php on line %d
-Done.
+
+DONE
+--EXPECT--
+Recursion detected
+
+DONE
diff --git a/ext/standard/tests/array/bug61058.phpt b/ext/standard/tests/array/bug61058.phpt
index f5e06a4a02..6e78b35711 100644
--- a/ext/standard/tests/array/bug61058.phpt
+++ b/ext/standard/tests/array/bug61058.phpt
@@ -2,7 +2,12 @@
Bug #61058 (array_fill leaks if start index is PHP_INT_MAX)
--FILE--
<?php
-array_fill(PHP_INT_MAX, 2, '*');
+
+try {
+ array_fill(PHP_INT_MAX, 2, '*');
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: array_fill(): Cannot add element to the array as the next element is already occupied in %sbug61058.php on line %d
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt
index 014517794c..3e0f3a1e27 100644
--- a/ext/standard/tests/array/bug65251.phpt
+++ b/ext/standard/tests/array/bug65251.phpt
@@ -3,8 +3,12 @@ Bug #65251: array_merge_recursive() recursion detection broken
--FILE--
<?php
-array_merge_recursive($GLOBALS, $GLOBALS)
+try {
+ array_merge_recursive($GLOBALS, $GLOBALS);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: array_merge_recursive(): recursion detected in %s on line %d
+--EXPECT--
+Recursion detected
diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt
index 516436c511..c9aa2d86fa 100644
--- a/ext/standard/tests/array/bug67693.phpt
+++ b/ext/standard/tests/array/bug67693.phpt
@@ -16,9 +16,9 @@ echo"\nDone";
?>
--EXPECT--
array(2) {
- [0]=>
+ [-1]=>
int(0)
- [1]=>
+ [0]=>
int(0)
}
diff --git a/ext/standard/tests/array/bug70713.phpt b/ext/standard/tests/array/bug70713.phpt
index 7cd0a0f113..f24720607d 100644
--- a/ext/standard/tests/array/bug70713.phpt
+++ b/ext/standard/tests/array/bug70713.phpt
@@ -19,8 +19,13 @@ class obj
}
$arr = array('string' => new obj);
-array_walk_recursive($arr, 'settype');
+
+try {
+ array_walk_recursive($arr, 'settype');
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: array_walk_recursive(): Iterated value is no longer an array or object in %s on line %d
+--EXPECT--
+Iterated value is no longer an array or object
diff --git a/ext/standard/tests/array/bug71220.phpt b/ext/standard/tests/array/bug71220.phpt
index 49e5bb7719..ed46b25e18 100644
--- a/ext/standard/tests/array/bug71220.phpt
+++ b/ext/standard/tests/array/bug71220.phpt
@@ -3,8 +3,14 @@ Bug #71220 (Null pointer deref (segfault) in compact via ob_start)
--FILE--
<?php
ob_start("compact");
-ob_end_clean();
+try {
+ ob_end_clean();
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
?>
-okey
+
+OKAY
--EXPECT--
-okey
+Cannot call compact() dynamically
+OKAY
diff --git a/ext/standard/tests/array/bug77395.phpt b/ext/standard/tests/array/bug77395.phpt
index 7910e36982..b90e9dd976 100644
--- a/ext/standard/tests/array/bug77395.phpt
+++ b/ext/standard/tests/array/bug77395.phpt
@@ -10,7 +10,12 @@ function error_handle($level, $message, $file = '', $line = 0){
}
set_error_handler('error_handle');
$data = [['aa'=> 'bb',], ['aa'=> 'bb',],];
-array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
+
+try {
+ array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
--EXPECT--
-array_multisort(): Array sizes are inconsistent
+Array sizes are inconsistent
diff --git a/ext/standard/tests/array/bug77931.phpt b/ext/standard/tests/array/bug77931.phpt
index 98a2eb91cf..45a241f27f 100644
--- a/ext/standard/tests/array/bug77931.phpt
+++ b/ext/standard/tests/array/bug77931.phpt
@@ -3,14 +3,24 @@ Bug #77931: Warning for array_map mentions wrong type
--FILE--
<?php
-array_map('trim', array(), 1);
-array_map('trim', array(), array(), true);
-array_map('trim', array(), array(), array(), null);
+try {
+ array_map('trim', array(), 1);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map('trim', array(), array(), true);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map('trim', array(), array(), array(), null);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: array_map(): Expected parameter 3 to be an array, int given in %s on line %d
-
-Warning: array_map(): Expected parameter 4 to be an array, bool given in %s on line %d
-
-Warning: array_map(): Expected parameter 5 to be an array, null given in %s on line %d
+--EXPECT--
+Expected parameter 3 to be an array, int given
+Expected parameter 4 to be an array, bool given
+Expected parameter 5 to be an array, null given
diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt
index d2b9fc45df..9201bc5aa1 100644
--- a/ext/standard/tests/array/compact_variation1.phpt
+++ b/ext/standard/tests/array/compact_variation1.phpt
@@ -10,7 +10,7 @@ Test compact() function : usage variations - arrays containing references.
/*
* compact variations - arrays with references
*/
-echo "*** Testing compact() : usage variations - arrays containg references ***\n";
+echo "*** Testing compact() : usage variations - arrays containing references ***\n";
$a = 1;
$b = 2;
$c = 3;
@@ -20,31 +20,34 @@ $arr2 = array("a", array(array(array("b"))));
$arr2[1][0][0][] = &$arr2;
$arr2[1][0][0][] = &$arr2[1];
$arr3 = array(&$string);
-var_dump(compact($arr1));
-var_dump(compact($arr2));
-var_dump(compact($arr3));
-echo "Done";
-?>
---EXPECTF--
-*** Testing compact() : usage variations - arrays containg references ***
-Warning: compact(): recursion detected in %s on line %d
-array(1) {
- ["a"]=>
- int(1)
+try {
+ var_dump(compact($arr1));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
}
-Warning: compact(): recursion detected in %s on line %d
+try {
+ var_dump(compact($arr2));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: compact(): recursion detected in %s on line %d
-array(2) {
- ["a"]=>
- int(1)
- ["b"]=>
- int(2)
+try {
+ var_dump(compact($arr3));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
}
+?>
+
+DONE
+--EXPECT--
+*** Testing compact() : usage variations - arrays containing references ***
+Recursion detected
+Recursion detected
array(1) {
["c"]=>
int(3)
}
-Done
+
+DONE
diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt
index 175cfe7118..1fd2e8e6ca 100644
--- a/ext/standard/tests/array/count_recursive.phpt
+++ b/ext/standard/tests/array/count_recursive.phpt
@@ -111,16 +111,6 @@ for( $i =0; $i < count( $mode_arr ); $i++) {
var_dump(count($arr, $mode_arr[$i]));
}
-
-echo "\n-- Testing error conditions --";
-var_dump( count() ); // No. of args = 0
-var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected
-
-/* Testing Invalid type arguments */
-var_dump( count("string", ABCD) );
-var_dump( count(100, "string") );
-var_dump( count(array(), "") );
-
echo "\nDone";
/* closing the resource handles */
@@ -230,22 +220,4 @@ For mode '1' count is => int(9)
For mode '' count is => int(3)
For mode '' count is => int(3)
--- Testing error conditions --
-Warning: count() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: count() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Warning: count() expects parameter 2 to be int, %s given in %s on line %d
-NULL
-
-Warning: count() expects parameter 2 to be int, %s given in %s on line %d
-NULL
-
-Warning: count() expects parameter 2 to be int, %s given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt
deleted file mode 100644
index 4af2097a7d..0000000000
--- a/ext/standard/tests/array/each.phpt
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
deleted file mode 100644
index cd38682dc7..0000000000
--- a/ext/standard/tests/array/each_basic.phpt
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-Test each() function : basic functionality
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test basic functionality of each()
- */
-
-echo "*** Testing each() : basic functionality ***\n";
-
-$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty');
-echo "\n-- Passed array: --\n";
-var_dump($arr);
-
-echo "\n-- Initial position: --\n";
-var_dump(each($arr));
-
-echo "\n-- End position: --\n";
-end($arr);
-var_dump(each($arr));
-
-echo "\n-- Passed the end of array: --\n";
-var_dump(each($arr));
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : basic functionality ***
-
--- Passed array: --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- string(4) "zero"
- ["two"]=>
- string(4) "deux"
- [20]=>
- string(6) "twenty"
-}
-
--- Initial position: --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- string(3) "one"
- ["key"]=>
- string(3) "one"
-}
-
--- End position: --
-array(4) {
- [1]=>
- string(6) "twenty"
- ["value"]=>
- string(6) "twenty"
- [0]=>
- int(20)
- ["key"]=>
- int(20)
-}
-
--- Passed the end of array: --
-bool(false)
-Done
diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt
deleted file mode 100644
index e7ee4976ed..0000000000
--- a/ext/standard/tests/array/each_error.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Test each() function : error conditions - pass incorrect number of args
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass an incorrect number of arguments to each() to test behaviour
- */
-
-echo "*** Testing each() : error conditions ***\n";
-
-// Zero arguments
-echo "\n-- Testing each() function with Zero arguments --\n";
-var_dump( each() );
-
-//Test each with one more than the expected number of arguments
-echo "\n-- Testing each() function with more than expected no. of arguments --\n";
-$arr = array(1, 2);
-$extra_arg = 10;
-var_dump( each($arr, $extra_arg) );
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : error conditions ***
-
--- Testing each() function with Zero arguments --
-
-Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing each() function with more than expected no. of arguments --
-
-Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt
deleted file mode 100644
index 6b75d5e15c..0000000000
--- a/ext/standard/tests/array/each_variation1.phpt
+++ /dev/null
@@ -1,223 +0,0 @@
---TEST--
-Test each() function : usage variations - Pass different data types as $arr arg
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass different data types as $arr arg to each() to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $arr argument
-$inputs = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
- array(),
-
- // string data
-/*19*/ "string",
- 'string',
- $heredoc,
-
- // object data
-/*22*/ new classA(),
-
- // undefined data
-/*23*/ @$undefined_var,
-
- // unset data
-/*24*/ @$unset_var,
-
- // resource variable
-/*25*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( each($input) );
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1 --
-
-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
-
--- Iteration 2 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 18 --
-bool(false)
-
--- Iteration 19 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 22 --
-bool(false)
-
--- Iteration 23 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
deleted file mode 100644
index 34eeedc9a8..0000000000
--- a/ext/standard/tests/array/each_variation2.phpt
+++ /dev/null
@@ -1,249 +0,0 @@
---TEST--
-Test each() function : usage variations - arrays of different data types
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass arrays of different data types as $arr argument to each() to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// arrays of different data types to be passed as $arr
-$inputs = array(
-
- // int data
-/*1*/ 'int' => array(
- 0,
- 1,
- 12345,
- -2345,
- ),
-
- // float data
-/*2*/ 'float' => array(
- 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
- ),
-
- // null data
-/*3*/ 'null' => array(
- NULL,
- null,
- ),
-
- // boolean data
-/*4*/ 'bool' => array(
- true,
- false,
- TRUE,
- FALSE,
- ),
-
- // empty data
-/*5*/ 'empty string' => array(
- "",
- '',
- ),
-
-/*6*/ 'empty array' => array(
- ),
-
- // string data
-/*7*/ 'string' => array(
- "string",
- 'string',
- $heredoc,
- ),
-
- // object data
-/*8*/ 'object' => array(
- new classA(),
- ),
-
- // undefined data
-/*9*/ 'undefined' => array(
- @$undefined_var,
- ),
-
- // unset data
-/*10*/ 'unset' => array(
- @$unset_var,
- ),
-
- // resource variable
-/*11*/ 'resource' => array(
- $fp
- ),
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator: $key data --\n";
- var_dump( each($input) );
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1: int data --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- int(0)
- ["value"]=>
- int(0)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 2: float data --
-array(4) {
- [1]=>
- float(10.5)
- ["value"]=>
- float(10.5)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 3: null data --
-array(4) {
- [1]=>
- NULL
- ["value"]=>
- NULL
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 4: bool data --
-array(4) {
- [1]=>
- bool(true)
- ["value"]=>
- bool(true)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 5: empty string data --
-array(4) {
- [1]=>
- string(0) ""
- ["value"]=>
- string(0) ""
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 6: empty array data --
-bool(false)
-
--- Iteration 7: string data --
-array(4) {
- [1]=>
- string(6) "string"
- ["value"]=>
- string(6) "string"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 8: object data --
-array(4) {
- [1]=>
- object(classA)#%d (0) {
- }
- ["value"]=>
- object(classA)#%d (0) {
- }
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 9: undefined data --
-array(4) {
- [1]=>
- NULL
- ["value"]=>
- NULL
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 10: unset data --
-array(4) {
- [1]=>
- NULL
- ["value"]=>
- NULL
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 11: resource data --
-array(4) {
- [1]=>
- resource(%d) of type (stream)
- ["value"]=>
- resource(%d) of type (stream)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-Done
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
deleted file mode 100644
index 32342d6d78..0000000000
--- a/ext/standard/tests/array/each_variation3.phpt
+++ /dev/null
@@ -1,254 +0,0 @@
---TEST--
-Test each() function : usage variations - keys of different data types
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass each() arrays where the keys are different data types to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// unexpected values to be passed as $arr
-$inputs = array(
-
- // int data
-/*1*/ 'int' => array(
- 0 => 'zero',
- 1 => 'one',
- 12345 => 'positive',
- -2345 => 'negative',
- ),
-
- // float data
-/*2*/ 'float' => array(
- 10.5 => 'positive',
- -10.5 => 'negative',
- .5 => 'half',
- ),
-
-/*3*/ 'extreme floats' => array(
- 12.3456789000e6 => 'large',
- 12.3456789000E-10 => 'small',
- ),
-
- // null data
-/*4*/ 'null uppercase' => array(
- NULL => 'null 1',
- ),
-
-/*5*/ 'null lowercase' => array(
- null => 'null 2',
- ),
-
- // boolean data
-/*6*/ 'bool lowercase' => array(
- true => 'lowert',
- false => 'lowerf',
- ),
-
-/*7*/ 'bool uppercase' => array(
- TRUE => 'uppert',
- FALSE => 'upperf',
- ),
-
- // empty data
-/*8*/ 'empty double quotes' => array(
- "" => 'emptyd',
- ),
-
-/*9*/ 'empty single quotes' => array(
- '' => 'emptys',
- ),
-
- // string data
-/*10*/ 'string' => array(
- "stringd" => 'stringd',
- 'strings' => 'strings',
- $heredoc => 'stringh',
- ),
-
- // undefined data
-/*11*/ 'undefined' => array(
- @$undefined_var => 'undefined',
- ),
-
- // unset data
-/*12*/ 'unset' => array(
- @$unset_var => 'unset',
- ),
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator: $key data --\n";
- var_dump( each($input) );
- $iterator++;
-};
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1: int data --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(4) "zero"
- ["value"]=>
- string(4) "zero"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 2: float data --
-array(4) {
- [1]=>
- string(8) "positive"
- ["value"]=>
- string(8) "positive"
- [0]=>
- int(10)
- ["key"]=>
- int(10)
-}
-
--- Iteration 3: extreme floats data --
-array(4) {
- [1]=>
- string(5) "large"
- ["value"]=>
- string(5) "large"
- [0]=>
- int(12345678)
- ["key"]=>
- int(12345678)
-}
-
--- Iteration 4: null uppercase data --
-array(4) {
- [1]=>
- string(6) "null 1"
- ["value"]=>
- string(6) "null 1"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 5: null lowercase data --
-array(4) {
- [1]=>
- string(6) "null 2"
- ["value"]=>
- string(6) "null 2"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 6: bool lowercase data --
-array(4) {
- [1]=>
- string(6) "lowert"
- ["value"]=>
- string(6) "lowert"
- [0]=>
- int(1)
- ["key"]=>
- int(1)
-}
-
--- Iteration 7: bool uppercase data --
-array(4) {
- [1]=>
- string(6) "uppert"
- ["value"]=>
- string(6) "uppert"
- [0]=>
- int(1)
- ["key"]=>
- int(1)
-}
-
--- Iteration 8: empty double quotes data --
-array(4) {
- [1]=>
- string(6) "emptyd"
- ["value"]=>
- string(6) "emptyd"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 9: empty single quotes data --
-array(4) {
- [1]=>
- string(6) "emptys"
- ["value"]=>
- string(6) "emptys"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 10: string data --
-array(4) {
- [1]=>
- string(7) "stringd"
- ["value"]=>
- string(7) "stringd"
- [0]=>
- string(7) "stringd"
- ["key"]=>
- string(7) "stringd"
-}
-
--- Iteration 11: undefined data --
-array(4) {
- [1]=>
- string(9) "undefined"
- ["value"]=>
- string(9) "undefined"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 12: unset data --
-array(4) {
- [1]=>
- string(5) "unset"
- ["value"]=>
- string(5) "unset"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-Done
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
deleted file mode 100644
index 64fbb4a8d0..0000000000
--- a/ext/standard/tests/array/each_variation4.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-Test each() function : usage variations - Referenced variables
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test behaviour of each() when:
- * 1. Passed an array made up of referenced variables
- * 2. Passed an array as $arr argument by reference
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-echo "\n-- Array made up of referenced variables: --\n";
-$val1 = 'foo';
-$val2 = 'bar';
-
-$arr1 = array('one' => &$val1, &$val2);
-
-echo "-- Call each until at the end of the array: --\n";
-var_dump( each($arr1) );
-var_dump( each($arr1) );
-var_dump( each($arr1) );
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Array made up of referenced variables: --
--- Call each until at the end of the array: --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(3) "foo"
- ["value"]=>
- string(3) "foo"
- [0]=>
- string(3) "one"
- ["key"]=>
- string(3) "one"
-}
-array(4) {
- [1]=>
- string(3) "bar"
- ["value"]=>
- string(3) "bar"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-bool(false)
-Done
diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt
deleted file mode 100644
index 441882f962..0000000000
--- a/ext/standard/tests/array/each_variation5.phpt
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-Test each() function : usage variations - Multi-dimensional arrays
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test behaviour of each() when passed:
- * 1. a two-dimensional array
- * 2. a sub-array
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-$arr = array ('zero',
- array(1, 2, 3),
- 'one' => 'un',
- array('a', 'b', 'c')
- );
-
-echo "\n-- Pass each() a two-dimensional array --\n";
-for ($i = 1; $i < count($arr); $i++) {
- var_dump( each($arr) );
-}
-
-echo "\n-- Pass each() a sub-array --\n";
-var_dump( each($arr[2]));
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Pass each() a two-dimensional array --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(4) "zero"
- ["value"]=>
- string(4) "zero"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-array(4) {
- [1]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["value"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [0]=>
- int(1)
- ["key"]=>
- int(1)
-}
-array(4) {
- [1]=>
- string(2) "un"
- ["value"]=>
- string(2) "un"
- [0]=>
- string(3) "one"
- ["key"]=>
- string(3) "one"
-}
-
--- Pass each() a sub-array --
-array(4) {
- [1]=>
- string(1) "a"
- ["value"]=>
- string(1) "a"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-Done
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
deleted file mode 100644
index de52ba5965..0000000000
--- a/ext/standard/tests/array/each_variation6.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-Test each() function : usage variations - Internal array pointer
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test the position of the internal array pointer after a call to each()
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-$arr = array('zero', 'one', 'two', 'abc', 'xyz');
-
-echo "\n-- Current position: --\n";
-echo key($arr) . " => " . current($arr) . "\n";
-
-echo "\n-- Call to each(): --\n";
-var_dump( each($arr) );
-
-echo "\n-- New position: --\n";
-echo key($arr) . " => " . current($arr) . "\n";
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Current position: --
-0 => zero
-
--- Call to each(): --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(4) "zero"
- ["value"]=>
- string(4) "zero"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- New position: --
-1 => one
-Done
diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt
index 724f2e612f..a7474a7e73 100644
--- a/ext/standard/tests/array/end.phpt
+++ b/ext/standard/tests/array/end.phpt
@@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle);
var_dump( end($resources) );
var_dump( current($resources) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for unexpected number of arguments */
-var_dump( end() );
-var_dump( end($array[0], $array[0]) );
-
-/* checking for unexpected type of arguments */
-$var=1;
-$var1="string";
-var_dump( end($var) );
-var_dump( end($var1) );
-
-/* checking null array */
-$null_array = array();
-var_dump( end($null_array) );
-
echo "Done\n";
@@ -219,19 +204,4 @@ array(2) {
*** Testing end() on resource type ***
resource(%d) of type (stream)
resource(%d) of type (stream)
-
-*** Testing error conditions ***
-
-Warning: end() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: end() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, string given in %s on line %d
-NULL
-bool(false)
Done
diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt
index 0049041848..ba20693d0f 100644
--- a/ext/standard/tests/array/end_64bit.phpt
+++ b/ext/standard/tests/array/end_64bit.phpt
@@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle);
var_dump( end($resources) );
var_dump( current($resources) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for unexpected number of arguments */
-var_dump( end() );
-var_dump( end($array[0], $array[0]) );
-
-/* checking for unexpected type of arguments */
-$var=1;
-$var1="string";
-var_dump( end($var) );
-var_dump( end($var1) );
-
-/* checking null array */
-$null_array = array();
-var_dump( end($null_array) );
-
echo "Done\n";
?>
@@ -218,19 +203,4 @@ array(2) {
*** Testing end() on resource type ***
resource(%d) of type (stream)
resource(%d) of type (stream)
-
-*** Testing error conditions ***
-
-Warning: end() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: end() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, string given in %s on line %d
-NULL
-bool(false)
Done
diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt
index e8bcf8f5d8..2103a1b9a4 100644
--- a/ext/standard/tests/array/extract_error.phpt
+++ b/ext/standard/tests/array/extract_error.phpt
@@ -6,53 +6,35 @@ Test extract() function (error conditions)
/* Testing Error Conditions */
echo "*** Testing Error Conditions ***\n";
-/* Zero Arguments */
-var_dump( extract() );
-
/* Invalid second argument ( only 0-6 is valid) */
$arr = array(1);
-var_dump( extract($arr, -1 . "wddr") );
-var_dump( extract($arr, 7 , "wddr") );
-
-/* scalar argument */
-$val = 1;
-var_dump( extract($val) );
-/* string argument */
-$str = "test";
-var_dump( extract($str) );
+try {
+ var_dump( extract($arr, -1 . "wddr") );
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-/* More than valid number of arguments i.e. 3 args */
-var_dump( extract($arr, EXTR_SKIP, "aa", "ee") );
+try {
+ var_dump( extract($arr, 7 , "wddr") );
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
/* Two Arguments, second as prefix but without prefix string as third argument */
-var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
+try {
+ var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "Done\n";
?>
--EXPECTF--
*** Testing Error Conditions ***
-Warning: extract() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Notice: A non well formed numeric value encountered in %s on line %d
-
-Warning: extract(): Invalid extract type in %s on line %d
-NULL
-
-Warning: extract(): Invalid extract type in %s on line %d
-NULL
-
-Warning: extract() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: extract() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: extract() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: extract(): specified extract type requires the prefix parameter in %s on line %d
-NULL
+Invalid extract type
+Invalid extract type
+Specified extract type requires the prefix parameter
Done
diff --git a/ext/standard/tests/array/extract_error_variation1.phpt b/ext/standard/tests/array/extract_error_variation1.phpt
new file mode 100644
index 0000000000..ec3078a0b9
--- /dev/null
+++ b/ext/standard/tests/array/extract_error_variation1.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test extract() function - error condition - Invalid prefix.
+--FILE--
+<?php
+$a = ["1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"];
+
+try {
+ extract($a, EXTR_PREFIX_ALL, '85bogus');
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Prefix is not a valid identifier
diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt
index f07d1dea89..0b58990041 100644
--- a/ext/standard/tests/array/in_array_variation3.phpt
+++ b/ext/standard/tests/array/in_array_variation3.phpt
@@ -36,9 +36,17 @@ class in_array_check {
$in_array_obj = new in_array_check(); //creating new object
//error: as wrong datatype for second argument
-var_dump( in_array("array_var", $in_array_obj) );
+try {
+ var_dump( in_array("array_var", $in_array_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//error: as wrong datatype for second argument
-var_dump( in_array("foo", $in_array_obj) );
+try {
+ var_dump( in_array("foo", $in_array_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//element found as "one" exists in array $array_var
var_dump( in_array("one", $in_array_obj->array_var) );
@@ -51,11 +59,7 @@ bool(true)
bool(true)
*** Testing objects with in_array() ***
-
-Warning: in_array() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: in_array() expects parameter 2 to be array, object given in %s on line %d
-NULL
+in_array() expects parameter 2 to be array, object given
+in_array() expects parameter 2 to be array, object given
bool(true)
Done
diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt
index ae4f304eae..9e6448cd52 100644
--- a/ext/standard/tests/array/max.phpt
+++ b/ext/standard/tests/array/max.phpt
@@ -5,10 +5,24 @@ precision=14
--FILE--
<?php
-var_dump(max());
-var_dump(max(1));
-var_dump(max(array()));
-var_dump(max(new stdclass));
+try {
+ var_dump(max(1));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(max(array()));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(max(new stdclass));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump(max(2,1,2));
var_dump(max(2.1,2.11,2.09));
var_dump(max("", "t", "b"));
@@ -19,18 +33,10 @@ var_dump(max(0, true, false, true));
echo "Done\n";
?>
---EXPECTF--
-Warning: max() expects at least 1 parameter, 0 given in %s on line 3
-NULL
-
-Warning: max(): When only one parameter is given, it must be an array in %s on line 4
-NULL
-
-Warning: max(): Array must contain at least one element in %s on line 5
-bool(false)
-
-Warning: max(): When only one parameter is given, it must be an array in %s on line 6
-NULL
+--EXPECT--
+When only one parameter is given, it must be an array
+Array must contain at least one element
+When only one parameter is given, it must be an array
int(2)
float(2.11)
string(1) "t"
diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt
index cb8c7cfdca..85defa6e85 100644
--- a/ext/standard/tests/array/min.phpt
+++ b/ext/standard/tests/array/min.phpt
@@ -5,10 +5,24 @@ precision=14
--FILE--
<?php
-var_dump(min());
-var_dump(min(1));
-var_dump(min(array()));
-var_dump(min(new stdclass));
+try {
+ var_dump(min(1));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(min(array()));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(min(new stdclass));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump(min(2,1,2));
var_dump(min(2.1,2.11,2.09));
var_dump(min("", "t", "b"));
@@ -19,18 +33,10 @@ var_dump(min(0, true, false, true));
echo "Done\n";
?>
---EXPECTF--
-Warning: min() expects at least 1 parameter, 0 given in %s on line 3
-NULL
-
-Warning: min(): When only one parameter is given, it must be an array in %s on line 4
-NULL
-
-Warning: min(): Array must contain at least one element in %s on line 5
-bool(false)
-
-Warning: min(): When only one parameter is given, it must be an array in %s on line 6
-NULL
+--EXPECT--
+When only one parameter is given, it must be an array
+Array must contain at least one element
+When only one parameter is given, it must be an array
int(1)
float(2.09)
string(0) ""
diff --git a/ext/standard/tests/array/negative_index.phpt b/ext/standard/tests/array/negative_index.phpt
new file mode 100644
index 0000000000..a9f442acbd
--- /dev/null
+++ b/ext/standard/tests/array/negative_index.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test arrays starting with negative indices
+--FILE--
+<?php
+
+$a = array_fill(-2, 3, true);
+$b = [-2 => true, true, true];
+$c = ["string" => true, -2 => true, true, true];
+unset($c["string"]);
+$d[-2] = true;
+$d[] = true;
+$d[] = true;
+$e = [-2 => false];
+array_pop($e);
+$e[] = true;
+$e[] = true;
+$e[] = true;
+
+var_dump($a === $b && $b === $c && $c === $d && $d == $e);
+var_dump($a);
+?>
+--EXPECT--
+bool(true)
+array(3) {
+ [-2]=>
+ bool(true)
+ [-1]=>
+ bool(true)
+ [0]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/array/range_bug70239_0.phpt b/ext/standard/tests/array/range_bug70239_0.phpt
index edfdd05fbc..c902a168b2 100644
--- a/ext/standard/tests/array/range_bug70239_0.phpt
+++ b/ext/standard/tests/array/range_bug70239_0.phpt
@@ -2,9 +2,13 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 1
--FILE--
<?php
-range(0, pow(2.0, 100000000));
+try {
+ range(0, pow(2.0, 100000000));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
---EXPECTF--
-Warning: range(): Invalid range supplied: start=0 end=inf in %srange_bug70239_0.php on line %d
+--EXPECT--
+Invalid range supplied: start=0 end=inf
===DONE===
diff --git a/ext/standard/tests/array/range_bug70239_1.phpt b/ext/standard/tests/array/range_bug70239_1.phpt
index 75419cf829..6d12348f67 100644
--- a/ext/standard/tests/array/range_bug70239_1.phpt
+++ b/ext/standard/tests/array/range_bug70239_1.phpt
@@ -2,9 +2,13 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 2
--FILE--
<?php
-range(pow(2.0, 100000000), pow(2.0, 100000000) + 1);
+try {
+ range(pow(2.0, 100000000), pow(2.0, 100000000) + 1);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
---EXPECTF--
-Warning: range(): Invalid range supplied: start=inf end=inf in %srange_bug70239_1.php on line %d
+--EXPECT--
+Invalid range supplied: start=inf end=inf
===DONE===
diff --git a/ext/standard/tests/array/range_bug70239_2.phpt b/ext/standard/tests/array/range_bug70239_2.phpt
index 76ed638669..c9396b3cb4 100644
--- a/ext/standard/tests/array/range_bug70239_2.phpt
+++ b/ext/standard/tests/array/range_bug70239_2.phpt
@@ -2,10 +2,13 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 3
--FILE--
<?php
-var_dump(range(0, PHP_INT_MAX));
+try {
+ var_dump(range(0, PHP_INT_MAX));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
--EXPECTF--
-Warning: range(): The supplied range exceeds the maximum array size: start=0 end=%d in %srange_bug70239_2.php on line %d
-bool(false)
+The supplied range exceeds the maximum array size: start=0 end=%d
===DONE===
diff --git a/ext/standard/tests/array/range_bug70239_3.phpt b/ext/standard/tests/array/range_bug70239_3.phpt
index 8402870c82..e49267bfe3 100644
--- a/ext/standard/tests/array/range_bug70239_3.phpt
+++ b/ext/standard/tests/array/range_bug70239_3.phpt
@@ -2,10 +2,13 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 4
--FILE--
<?php
-var_dump(range(PHP_INT_MIN, 0));
+try {
+ var_dump(range(PHP_INT_MIN, 0));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
--EXPECTF--
-Warning: range(): The supplied range exceeds the maximum array size: start=-%d end=0 in %srange_bug70239_3.php on line %d
-bool(false)
+The supplied range exceeds the maximum array size: start=-%d end=0
===DONE===
diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt
index b63e9874bf..971eade4be 100644
--- a/ext/standard/tests/array/range_errors.phpt
+++ b/ext/standard/tests/array/range_errors.phpt
@@ -7,34 +7,84 @@ precision=14
echo "\n*** Testing error conditions ***\n";
-echo "\n-- Testing ( (low < high) && (step = 0) ) --";
-var_dump( range(1, 2, 0) );
-var_dump( range("a", "b", 0) );
-
-echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
-var_dump( range(2, 1, 0) );
-var_dump( range("b", "a", 0) );
-
-echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
-var_dump( range(1.0, 7.0, 6.5) );
-
-echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
-var_dump( range(7.0, 1.0, 6.5) );
-
-echo "\n-- Testing Invalid number of arguments --";
-var_dump( range() ); // No.of args = 0
-var_dump( range(1) ); // No.of args < expected
-var_dump( range(1,2,3,4) ); // No.of args > expected
-var_dump( range(-1, -2, 2) );
-var_dump( range("a", "j", "z") );
-var_dump( range(0, 1, "140962482048819216326.24") );
-var_dump( range(0, 1, "140962482048819216326.24.") );
-
-echo "\n-- Testing Invalid steps --";
+echo "\n-- Testing ( (low < high) && (step = 0) ) --\n";
+try {
+ var_dump( range(1, 2, 0) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump( range("a", "b", 0) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --\n";
+try {
+ var_dump( range(2, 1, 0) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump( range("b", "a", 0) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --\n";
+try {
+ var_dump( range(1.0, 7.0, 6.5) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --\n";
+try {
+ var_dump( range(7.0, 1.0, 6.5) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n-- Testing other conditions --\n";
+try {
+ var_dump( range(-1, -2, 2) );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump( range("a", "j", "z") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump( range(0, 1, "140962482048819216326.24") );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump( range(0, 1, "140962482048819216326.24.") );
+} catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n-- Testing Invalid steps --\n";
$step_arr = array( "string", NULL, FALSE, "", "\0" );
foreach( $step_arr as $step ) {
- var_dump( range( 1, 5, $step ) );
+ try {
+ var_dump( range( 1, 5, $step ) );
+ } catch (\TypeError $e) {
+ echo $e->getMessage(), "\n";
+ } catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+ }
}
echo "Done\n";
@@ -43,65 +93,34 @@ echo "Done\n";
*** Testing error conditions ***
-- Testing ( (low < high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+step exceeds the specified range
+step exceeds the specified range
-- Testing ( (low > high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+step exceeds the specified range
+step exceeds the specified range
-- Testing ( (low < high) && (high-low < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+step exceeds the specified range
-- Testing ( (low > high) && (low-high < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
--- Testing Invalid number of arguments --
-Warning: range() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: range() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
+step exceeds the specified range
-Warning: range() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
+-- Testing other conditions --
+step exceeds the specified range
+range() expects parameter 3 to be int or float, string given
+step exceeds the specified range
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
+Notice: A non well formed numeric value encountered in %s on line %d
+step exceeds the specified range
-- Testing Invalid steps --
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
-
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
+range() expects parameter 3 to be int or float, string given
+step exceeds the specified range
+step exceeds the specified range
+range() expects parameter 3 to be int or float, string given
+range() expects parameter 3 to be int or float, string given
Done
diff --git a/ext/standard/tests/array/range_variation.phpt b/ext/standard/tests/array/range_variation.phpt
index f7fc9e0815..3de5f6188f 100644
--- a/ext/standard/tests/array/range_variation.phpt
+++ b/ext/standard/tests/array/range_variation.phpt
@@ -18,7 +18,11 @@ for( $i = 0; $i < count($low_arr); $i++) {
echo "\n*** Possible variatins with steps ***\n";
var_dump( range( 1, 5, TRUE ) );
-var_dump( range( 1, 5, array(1, 2) ) );
+try {
+ var_dump( range( 1, 5, array(1, 2) ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -611,16 +615,5 @@ array(5) {
[4]=>
int(5)
}
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
+range() expects parameter 3 to be int or float, array given
Done
diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt
index 465b818174..2fc98396b1 100644
--- a/ext/standard/tests/array/sizeof_variation4.phpt
+++ b/ext/standard/tests/array/sizeof_variation4.phpt
@@ -89,380 +89,380 @@ echo "Done";
--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes ---
-- Iteration 1 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 2 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 3 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 4 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 5 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 6 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 7 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 8 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 9 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 10 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 11 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 12 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 13 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 14 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 15 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 16 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 17 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 18 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 19 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 20 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt
index 2bb2b46512..d27cd569c0 100644
--- a/ext/standard/tests/array/uasort_variation8.phpt
+++ b/ext/standard/tests/array/uasort_variation8.phpt
@@ -10,7 +10,6 @@ Test uasort() function : usage variations - built-in function as 'cmp_function'
/*
* Passing different built-in library functions in place of 'cmp_function'
* valid comparison functions: strcmp() & strcasecmp()
-* language constructs: echo & exit
*/
echo "*** Testing uasort() : built in function as 'cmp_function' ***\n";
@@ -28,13 +27,6 @@ echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n";
var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true)
var_dump($array_arg);
-// Testing with language construct as comparison function
-echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
-var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false)
-
-echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
-var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false)
-
echo "Done"
?>
--EXPECTF--
@@ -67,12 +59,4 @@ array(5) {
["o"]=>
string(6) "orange"
}
--- Testing uasort() with language construct as 'cmp_function' --
-
-Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
--- Testing uasort() with language construct as 'cmp_function' --
-
-Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt
index 3296c4a36a..98c303e083 100644
--- a/ext/standard/tests/array/usort_variation8.phpt
+++ b/ext/standard/tests/array/usort_variation8.phpt
@@ -30,14 +30,6 @@ $temp_array2 = $array_arg;
var_dump( usort($temp_array2, 'strcmp') );
var_dump($temp_array2);
-// Testing with language construct as comparison function
-echo "\n-- Testing usort() with language construct as 'cmp_function' --\n";
-$temp_array3 = $array_arg;
-var_dump( usort($temp_array3, 'echo') );
-
-echo "\n-- Testing usort() with language construct as 'cmp_function' --\n";
-$temp_array4 = $array_arg;
-var_dump( usort($temp_array4, 'exit') );
?>
===DONE===
--EXPECTF--
@@ -72,14 +64,4 @@ array(5) {
[4]=>
string(6) "orange"
}
-
--- Testing usort() with language construct as 'cmp_function' --
-
-Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
-
--- Testing usort() with language construct as 'cmp_function' --
-
-Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
===DONE===
diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt
index 08e1188d60..71b0649141 100644
--- a/ext/standard/tests/assert/assert.phpt
+++ b/ext/standard/tests/assert/assert.phpt
@@ -1,44 +1,41 @@
--TEST--
assert()
--INI--
-error_reporting = 2039
assert.active = 0
assert.warning = 1
assert.callback =
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
-function a($file,$line,$myev)
+function a($file, $line, $unused, $desc)
{
- echo "assertion failed $line,\"$myev\"\n";
+ echo "assertion failed $line,\"$desc\"\n";
}
class a
{
- function assert($file,$line,$myev)
+ static function assert($file, $line, $unused, $desc)
{
- echo "class assertion failed $line,\"$myev\"\n";
+ echo "class assertion failed $line,\"$desc\"\n";
}
}
assert_options(ASSERT_ACTIVE,1);
-assert_options(ASSERT_QUIET_EVAL,1);
assert_options(ASSERT_WARNING,0);
$a = 0;
assert_options(ASSERT_CALLBACK,"a");
-assert('$a != 0');
+assert($a != 0);
assert_options(ASSERT_CALLBACK,array("a","assert"));
-assert('$a != 0');
+assert($a != 0);
$obj = new a();
assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
-assert('$a != 0');
+assert($a != 0);
?>
--EXPECT--
-assertion failed 22,"$a != 0"
-class assertion failed 25,"$a != 0"
-class assertion failed 29,"$a != 0"
+assertion failed 21,"assert($a != 0)"
+class assertion failed 24,"assert($a != 0)"
+class assertion failed 28,"assert($a != 0)"
diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt
deleted file mode 100644
index 85b72369cb..0000000000
--- a/ext/standard/tests/assert/assert02.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-catch assert() errors
---INI--
-assert.active=1
-assert.warning=1
-assert.callback=
-assert.bail=0
-assert.quiet_eval=0
---FILE--
-<?php
-
-assert(1);
-assert('1');
-assert('$a');
-
-try {
- assert('aa=sd+as+safsafasfasafsaf');
-} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
-}
-
-assert('0');
-
-assert_options(ASSERT_BAIL, 1);
-
-try {
- assert('aa=sd+as+safsafasfasafsaf');
-} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
-}
-
-echo "done\n";
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1
-
-Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Failure evaluating code:
-aa=sd+as+safsafasfasafsaf
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Warning: assert(): Assertion "0" failed in %sassert02.php on line %d
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1
-Stack trace:
-#0 %s(%d): assert('aa=sd+as+safsaf...')
-#1 {main}
-
-Next Error: Failure evaluating code:
-aa=sd+as+safsafasfasafsaf in %s:%d
-Stack trace:
-#0 %s(%d): assert('aa=sd+as+safsaf...')
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt
index 80c42df473..3b231405f6 100644
--- a/ext/standard/tests/assert/assert03.phpt
+++ b/ext/standard/tests/assert/assert03.phpt
@@ -5,38 +5,33 @@ assert.active = 1
assert.warning = 0
assert.callback =
assert.bail = 0
-assert.quiet_eval = 1
--FILE--
<?php
-function a($file,$line,$myev)
+function a($file, $line, $unused, $desc)
{
- echo "assertion failed - a - $line,\"$myev\"\n";
+ echo "assertion failed - a - $line,\"$desc\"\n";
}
-function b($file,$line,$myev)
+function b($file, $line, $unused, $desc)
{
- echo "assertion failed - b - $line,\"$myev\"\n";
+ echo "assertion failed - b - $line,\"$desc\"\n";
}
assert_options(ASSERT_ACTIVE,1);
-assert_options(ASSERT_QUIET_EVAL,1);
assert_options(ASSERT_WARNING,0);
$a = 0;
-assert_options(ASSERT_CALLBACK,"a");
-assert('$a != 0');
+assert_options(ASSERT_CALLBACK, "a");
+assert($a != 0);
/* Modify call back using ini_set() */
ini_set("assert.callback", "b");
-assert('$a != 0');
+assert($a != 0);
?>
==DONE==
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-assertion failed - a - %d,"$a != 0"
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-assertion failed - b - %d,"$a != 0"
+--EXPECT--
+assertion failed - a - 18,"assert($a != 0)"
+assertion failed - b - 22,"assert($a != 0)"
==DONE==
diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt
index 0100229958..35f7668ce1 100644
--- a/ext/standard/tests/assert/assert04.phpt
+++ b/ext/standard/tests/assert/assert04.phpt
@@ -5,24 +5,14 @@ assert.active = 1
assert.warning = 1
assert.callback =
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
/* Assert not active */
assert_options(ASSERT_ACTIVE, 0);
assert(1);
-
/* Wrong parameter count in assert */
assert_options(ASSERT_ACTIVE, 1);
-assert(2, "failure", 3);
-
-/* Wrong parameter count in assert_options */
-assert_options(ASSERT_ACTIVE, 0, 2);
-
-/* Wrong parameter name in assert_options */
-$test="ASSERT_FRED";
-assert_options($test, 1);
/* Assert false */
assert(0);
@@ -36,12 +26,6 @@ echo "not reached\n";
?>
--EXPECTF--
-Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d
-
Warning: assert(): assert(0) failed in %s on line %d
Warning: assert(): assert(0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt
index 73b3e73206..ce53a17a61 100644
--- a/ext/standard/tests/assert/assert_basic.phpt
+++ b/ext/standard/tests/assert/assert_basic.phpt
@@ -5,29 +5,16 @@ assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
{
echo "f1 called\n";
}
-//String assert
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
-$sa = "0 == 0";
-var_dump($r2=assert($sa));
-//Non string assert
-var_dump($r2=assert(0));
-var_dump($r2=assert(1));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-f1 called
-bool(false)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-bool(true)
+var_dump($r2 = assert(0));
+var_dump($r2 = assert(1));
+--EXPECT--
f1 called
bool(false)
bool(true)
diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt
index a5bcda3316..cd4a5601ab 100644
--- a/ext/standard/tests/assert/assert_basic1.phpt
+++ b/ext/standard/tests/assert/assert_basic1.phpt
@@ -5,7 +5,6 @@ assert.active = 0
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
@@ -13,17 +12,9 @@ function f1()
echo "f1 called\n";
}
-//String assert
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
-$sa = "0 == 0";
-var_dump($r2=assert($sa));
-
-//Non string assert
var_dump($r2=assert(0));
var_dump($r2=assert(1));
+?>
--EXPECT--
bool(true)
bool(true)
-bool(true)
-bool(true)
diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt
index d6c150d0d0..052e7d4e89 100644
--- a/ext/standard/tests/assert/assert_basic2.phpt
+++ b/ext/standard/tests/assert/assert_basic2.phpt
@@ -5,7 +5,6 @@ assert.active = 1
assert.warning = 1
assert.callback=f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f2()
diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt
index a7fd990cbe..87103cbfbb 100644
--- a/ext/standard/tests/assert/assert_basic3.phpt
+++ b/ext/standard/tests/assert/assert_basic3.phpt
@@ -4,7 +4,6 @@ assert() - basic - Test that bailout works
assert.active = 1
assert.warning = 1
assert.callback = f1
-assert.quiet_eval = 1
assert.bail = 0
--FILE--
<?php
@@ -15,13 +14,10 @@ function f1()
//bail out on error
var_dump($rao=assert_options(ASSERT_BAIL, 1));
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
-Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
+Warning: assert(): assert(0 != 0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_basic4.phpt b/ext/standard/tests/assert/assert_basic4.phpt
index 4e78cf9ec1..289c51860e 100644
--- a/ext/standard/tests/assert/assert_basic4.phpt
+++ b/ext/standard/tests/assert/assert_basic4.phpt
@@ -4,7 +4,6 @@ assert() - basic - test initial values using ini.get and assert_options
assert.active = 0
assert.warning = 0
assert.bail = 0
-assert.quiet_eval = 0
assert.callback = f1
--FILE--
<?php
@@ -14,23 +13,19 @@ assert.callback = f1
echo "Initial values: assert_options(ASSERT_ACTIVE) => [".assert_options(ASSERT_ACTIVE)."]\n";
echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n";
echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n";
-echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n";
echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
//Using ini.get;
echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n";
echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n";
echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n";
-echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n";
echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
--EXPECT--
Initial values: assert_options(ASSERT_ACTIVE) => [0]
Initial values: assert_options(ASSERT_WARNING) => [0]
Initial values: assert_options(ASSERT_BAIL) => [0]
-Initial values: assert_options(ASSERT_QUIET_EVAL) => [0]
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
Initial values: ini.get("assert.active") => [0]
Initial values: ini.get("assert.warning") => [0]
Initial values: ini.get("assert.bail") => [0]
-Initial values: ini.get("assert.quiet_eval") => [0]
Initial values: ini.get("assert.callback") => [f1]
diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt
index f4943cdf16..cf2ed6ded3 100644
--- a/ext/standard/tests/assert/assert_basic5.phpt
+++ b/ext/standard/tests/assert/assert_basic5.phpt
@@ -5,7 +5,6 @@ assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
@@ -15,22 +14,16 @@ function f1()
//switch warning on and test return value
var_dump($rao=assert_options(ASSERT_WARNING, 1));
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
-$sa = "0 == 0";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
+var_dump($r2=assert(0 == 0));
//switch warning on and test return value
var_dump($rao=assert_options(ASSERT_WARNING, 0));
--EXPECTF--
int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
-Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
+Warning: assert(): assert(0 != 0) failed in %s on line %d
bool(false)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(true)
int(1)
diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt
deleted file mode 100644
index 216c85c94b..0000000000
--- a/ext/standard/tests/assert/assert_basic6.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-assert() - basic - Test that bailout works
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.quiet_eval = 1
-assert.bail = 0
---FILE--
-<?php
-function f1($message)
-{
- echo "f1 called\n";
-}
-
-//bail out on error
-var_dump($rao = assert_options(ASSERT_BAIL, 1));
-$sa = "0 != 0";
-var_dump($r2 = assert($sa, "0 is 0"));
-echo "If this is printed BAIL hasn't worked";
---EXPECTF--
-int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-f1 called
-
-Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10
diff --git a/ext/standard/tests/assert/assert_closures.phpt b/ext/standard/tests/assert/assert_closures.phpt
index 4a013283a8..13a7e5415e 100644
--- a/ext/standard/tests/assert/assert_closures.phpt
+++ b/ext/standard/tests/assert/assert_closures.phpt
@@ -4,7 +4,6 @@ assert() - basic - accept closures as callback.
assert.active = 1
assert.warning = 1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; });
diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt
deleted file mode 100644
index 6e04060765..0000000000
--- a/ext/standard/tests/assert/assert_error.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-assert() - error - give assert nonsense string with quiet_eval on then off
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.bail = 0
-assert.quiet_eval = 0
---FILE--
-<?php
-function f1()
-{
- echo "f1 called\n";
-}
-
-$sa = "threemeninaboat";
-
-var_dump($r2=assert($sa));
-
-var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1));
-
-var_dump($r2=assert($sa));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1
-bool(true)
-int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-bool(true)
diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt
index d1b6f1745f..de00743b1b 100644
--- a/ext/standard/tests/assert/assert_error2.phpt
+++ b/ext/standard/tests/assert/assert_error2.phpt
@@ -4,7 +4,6 @@ assert() - basic - Test that bailout works
assert.active = 1
assert.warning = 1
assert.callback = f1
-assert.quiet_eval = 1
assert.bail = 0
error_reporting = -1
display_errors = 1
@@ -17,18 +16,10 @@ function f1($script, $line, $message, $user_message)
//bail out on error
var_dump($rao = assert_options(ASSERT_BAIL, 1));
-var_dump($r2 = assert("0 != 0"));
+var_dump($r2 = assert(0 != 0));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
+f1 called
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Warning: assert(): Assertion "0 != 0" failed in %s on line 9
-
-Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2
-Stack trace:
-#0 [internal function]: f1('%s', 9, '0 != 0')
-#1 %sassert_error2.php(9): assert('0 != 0')
-#2 {main}
- thrown in %sassert_error2.php on line 2
+Warning: assert(): assert(0 != 0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
deleted file mode 100644
index 24538f4b04..0000000000
--- a/ext/standard/tests/assert/assert_error3.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-assert() - basic - Test recoverable error
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.quiet_eval = 0
-assert.bail = 0
-error_reporting = -1
-display_errors = 1
---FILE--
-<?php
-var_dump($r2 = assert("0 $ 0"));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
-Stack trace:
-#0 %s(%d): assert('0 $ 0')
-#1 {main}
-
-Next Error: Failure evaluating code:
-0 $ 0 in %s:%d
-Stack trace:
-#0 %s(%d): assert('0 $ 0')
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
deleted file mode 100644
index 59b4df6935..0000000000
--- a/ext/standard/tests/assert/assert_error4.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-assert() - basic - Test recoverable error
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.quiet_eval = 0
-assert.bail = 0
-error_reporting = -1
-display_errors = 1
---FILE--
-<?php
-$sa = "0 $ 0";
-var_dump($r2 = assert($sa, "Describing what was asserted"));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
-Stack trace:
-#0 %s(%d): assert('0 $ 0', 'Describing what...')
-#1 {main}
-
-Next Error: Failure evaluating code:
-Describing what was asserted:"0 $ 0" in %s:%d
-Stack trace:
-#0 %s(%d): assert('0 $ 0', 'Describing what...')
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert_options_error.phpt b/ext/standard/tests/assert/assert_options_error.phpt
new file mode 100644
index 0000000000..0b50370b6c
--- /dev/null
+++ b/ext/standard/tests/assert/assert_options_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+assert_options() - unknown assert option.
+
+--FILE--
+<?php
+try {
+ assert_options(1000);
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Unknown value 1000 \ No newline at end of file
diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt
index 023f6690c5..d0cb90ff66 100644
--- a/ext/standard/tests/assert/assert_variation.phpt
+++ b/ext/standard/tests/assert/assert_variation.phpt
@@ -5,7 +5,6 @@ assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
@@ -22,29 +21,28 @@ function f3()
}
class c1
{
- function assert($file, $line, $myev)
+ static function assert($file, $line, $unused, $desc)
{
- echo "Class assertion failed $line, \"$myev\"\n";
+ echo "Class assertion failed $line, \"$desc\"\n";
}
}
echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Change callback function using ini.set and test return value \n";
var_dump($rv = ini_set("assert.callback","f2"));
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Change callback function using assert_options and test return value \n";
var_dump($rv=assert_options(ASSERT_CALLBACK, "f3"));
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
@@ -52,14 +50,14 @@ echo "Reset the name of the callback routine to a class method and check that it
var_dump($rc=assert_options(ASSERT_CALLBACK, "c1"));
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Reset callback options to use a class method \n";
var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert")));
var_dump($rao=assert_options(ASSERT_CALLBACK));
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Reset callback options to use an object method \n";
@@ -67,13 +65,11 @@ $o = new c1();
var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert")));
var_dump($rao=assert_options(ASSERT_CALLBACK));
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
--EXPECTF--
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
Initial values: ini.get("assert.callback") => [f1]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
bool(false)
@@ -81,8 +77,6 @@ Change callback function using ini.set and test return value
string(2) "f1"
assert_options(ASSERT_CALLBACK) => [f2]
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f2 called
bool(false)
@@ -90,8 +84,6 @@ Change callback function using assert_options and test return value
string(2) "f2"
assert_options(ASSERT_CALLBACK) => [f3]
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f3 called
bool(false)
@@ -99,8 +91,6 @@ Reset the name of the callback routine to a class method and check that it works
string(2) "f3"
assert_options(ASSERT_CALLBACK) => [c1]
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(false)
Reset callback options to use a class method
@@ -113,11 +103,7 @@ array(2) {
}
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53
-Class assertion failed 53, "0 != 0"
+Class assertion failed 52, "assert(0 != 0)"
bool(false)
Reset callback options to use an object method
@@ -136,7 +122,5 @@ array(2) {
}
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Class assertion failed 61, "0 != 0"
+Class assertion failed 60, "assert(0 != 0)"
bool(false)
diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt
deleted file mode 100644
index 7264f5a322..0000000000
--- a/ext/standard/tests/assert/bug73303.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #73303: Scope not inherited by eval in assert()
---FILE--
-<?php
-
-class Test {
- public $prop;
-
- public function main(){
- assert('self::checkCacheKey(get_object_vars($this))');
- echo 'Success';
- }
- private static function checkCacheKey($obj_properties){
- return count($obj_properties) == 1;
- }
-}
-
-$obj = new Test();
-$obj->main();
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Success
diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
index dd852ef61f..2e2e1657af 100644
--- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
+++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
@@ -9,8 +9,8 @@ Test get_class_methods() function : usage variations - unexpected types
*/
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -81,10 +81,10 @@ foreach($values as $value) {
};
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing get_class_methods() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(67)
-Error: 8 - Undefined variable: unset_var, %s(70)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
NULL
@@ -112,23 +112,23 @@ NULL
Arg value 0.5
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt
index b142f8ace9..87a9eac6c3 100644
--- a/ext/standard/tests/class_object/get_class_variation_001.phpt
+++ b/ext/standard/tests/class_object/get_class_variation_001.phpt
@@ -67,8 +67,12 @@ $values = array(
// loop through each element of the array for object
foreach($values as $value) {
- echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
- var_dump( get_class($value) );
+ echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
+ try {
+ var_dump( get_class($value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
echo "Done";
@@ -76,137 +80,85 @@ echo "Done";
--EXPECTF--
*** Testing get_class() : usage variations ***
-Notice: Undefined variable: undefined_var in %sget_class_variation_001.php on line 58
+Warning: Undefined variable: undefined_var in %s on line %d
-Notice: Undefined variable: unset_var in %sget_class_variation_001.php on line 61
+Warning: Undefined variable: unset_var in %s on line %d
Arg value: 0 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: 1 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: 12345 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: -2345 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: 10.5 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: -10.5 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: 101234567000 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: 1.07654321E-9 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: 0.5 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: (type: NULL)
-
-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
Arg value: (type: NULL)
-
-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
Arg value: 1 (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: 1 (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: string (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: string (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: (type: NULL)
-
-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
Arg value: (type: NULL)
-
-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/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
index 0ad5756837..2aaa93fa8a 100644
--- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
+++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
@@ -12,8 +12,8 @@ spl_autoload_register(function ($className) {
echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -83,10 +83,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing get_parent_class() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(68)
-Error: 8 - Undefined variable: unset_var, %s(71)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -114,23 +114,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/is_a_variation_001.phpt b/ext/standard/tests/class_object/is_a_variation_001.phpt
index 563195cd0c..e9dfe0db6d 100644
--- a/ext/standard/tests/class_object/is_a_variation_001.phpt
+++ b/ext/standard/tests/class_object/is_a_variation_001.phpt
@@ -77,9 +77,9 @@ echo "Done";
--EXPECTF--
*** Testing is_a() : usage variations ***
-Notice: Undefined variable: undefined_var in %s on line 59
+Warning: Undefined variable: undefined_var in %s on line %d
-Notice: Undefined variable: unset_var in %s on line 62
+Warning: Undefined variable: unset_var in %s on line %d
Arg value 0
bool(false)
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
index d65bfcbc26..961ae96287 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
@@ -12,8 +12,8 @@ spl_autoload_register(function ($className) {
echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -84,10 +84,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing is_subclass_of() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(69)
-Error: 8 - Undefined variable: unset_var, %s(72)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -115,23 +115,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
index 0a4c575258..dba37cc3f4 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
@@ -12,8 +12,8 @@ spl_autoload_register(function ($className) {
echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -84,10 +84,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing is_subclass_of() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(69)
-Error: 8 - Undefined variable: unset_var, %s(72)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -115,23 +115,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt
index 4accebe20a..b975f81958 100644
--- a/ext/standard/tests/class_object/method_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt
@@ -12,8 +12,8 @@ spl_autoload_register(function ($className) {
echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -83,10 +83,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing method_exists() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(68)
-Error: 8 - Undefined variable: unset_var, %s(71)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -114,23 +114,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt
index 217a5c61f9..7a2f4712da 100644
--- a/ext/standard/tests/class_object/property_exists_error.phpt
+++ b/ext/standard/tests/class_object/property_exists_error.phpt
@@ -10,19 +10,8 @@ Test property_exists() function : error conditions
echo "*** Testing property_exists() : error conditions ***\n";
-$object_or_class = "obj";
-$property_name = 'string_val';
-$extra_arg = 10;
-
-
-echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n";
-var_dump( property_exists($object_or_class, $property_name, $extra_arg) );
-
-
-echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n";
-var_dump( property_exists($object_or_class) );
-
echo "\n-- Testing property_exists() function with incorrect arguments --\n";
+$property_name = 'string_val';
var_dump( property_exists(10, $property_name) );
?>
@@ -30,16 +19,6 @@ var_dump( property_exists(10, $property_name) );
--EXPECTF--
*** Testing property_exists() : error conditions ***
--- Testing property_exists() function with more than expected no. of arguments --
-
-Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d
-NULL
-
--- Testing property_exists() function with less than expected no. of arguments --
-
-Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d
-NULL
-
-- Testing property_exists() function with incorrect arguments --
Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d
diff --git a/ext/standard/tests/dir/bug41693.phpt b/ext/standard/tests/dir/bug41693.phpt
new file mode 100644
index 0000000000..c42ca2faea
--- /dev/null
+++ b/ext/standard/tests/dir/bug41693.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #41693 (scandir() allows empty directory names)
+--FILE--
+<?php
+
+try {
+ var_dump(scandir(''));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+Directory name cannot be empty
diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt
deleted file mode 100644
index e0a399c688..0000000000
--- a/ext/standard/tests/dir/closedir_error-win32-mb.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-Test closedir() function : error conditions - Pass incorrect number of arguments
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die("skip Valid only on Windows");
-}
-?>
---FILE--
-<?php
-/* Prototype : void closedir([resource $dir_handle])
- * Description: Close directory connection identified by the dir_handle
- * Source code: ext/standard/dir.c
- * Alias to functions: close
- */
-
-/*
- * Pass incorrect number of arguments to closedir() to test behaviour
- */
-
-echo "*** Testing closedir() : error conditions ***\n";
-
-
-//Test closedir with one more than the expected number of arguments
-echo "\n-- Testing closedir() function with more than expected no. of arguments --\n";
-
-$dir_path = __DIR__ . '\ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™closedir_error';
-mkdir($dir_path);
-$dir_handle = opendir($dir_path);
-
-$extra_arg = 10;
-var_dump( closedir($dir_handle, $extra_arg) );
-
-//successfully close the directory handle so can delete in CLEAN section
-closedir($dir_handle);
-?>
-===DONE===
---CLEAN--
-<?php
-$base_dir = __DIR__;
-$dir_path = $base_dir . '\ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™closedir_error';
-rmdir($dir_path);
-?>
---EXPECTF--
-*** Testing closedir() : error conditions ***
-
--- Testing closedir() function with more than expected no. of arguments --
-
-Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt
index 07b9ab869a..26d410f4bd 100644
--- a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt
+++ b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt
@@ -32,7 +32,11 @@ echo "Directory Handle: ";
var_dump($dh);
echo "\n-- Close directory handle second time: --\n";
-var_dump(closedir($dh));
+try {
+ var_dump(closedir($dh));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Directory Handle: ";
var_dump($dh);
?>
@@ -50,8 +54,6 @@ NULL
Directory Handle: resource(%d) of type (Unknown)
-- Close directory handle second time: --
-
-Warning: closedir(): %s is not a valid Directory resource in %s on line %d
-bool(false)
+closedir(): %s is not a valid Directory resource
Directory Handle: resource(%d) of type (Unknown)
===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation2.phpt b/ext/standard/tests/dir/closedir_variation2.phpt
index cb85750e71..7c814a4926 100644
--- a/ext/standard/tests/dir/closedir_variation2.phpt
+++ b/ext/standard/tests/dir/closedir_variation2.phpt
@@ -26,7 +26,11 @@ echo "Directory Handle: ";
var_dump($dh);
echo "\n-- Close directory handle second time: --\n";
-var_dump(closedir($dh));
+try {
+ var_dump(closedir($dh));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Directory Handle: ";
var_dump($dh);
?>
@@ -44,8 +48,6 @@ NULL
Directory Handle: resource(%d) of type (Unknown)
-- Close directory handle second time: --
-
-Warning: closedir(): supplied resource is not a valid Directory resource in %s on line %d
-bool(false)
+closedir(): supplied resource is not a valid Directory resource
Directory Handle: resource(%d) of type (Unknown)
===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt
index 7d7fdcbf0e..7c65f5f877 100644
--- a/ext/standard/tests/dir/closedir_variation3.phpt
+++ b/ext/standard/tests/dir/closedir_variation3.phpt
@@ -18,8 +18,11 @@ echo "\n-- Open a file using fopen() --\n";
var_dump($fp = fopen(__FILE__, 'r'));
echo "\n-- Try to close the file pointer using closedir() --\n";
-var_dump(closedir($fp));
-
+try {
+ var_dump(closedir($fp));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Check file pointer: --\n";
var_dump($fp);
@@ -35,9 +38,7 @@ if(is_resource($fp)) {
resource(%d) of type (stream)
-- Try to close the file pointer using closedir() --
-
-Warning: closedir(): %d is not a valid Directory resource in %s on line %d
-bool(false)
+%d is not a valid Directory resource
-- Check file pointer: --
resource(%d) of type (stream)
diff --git a/ext/standard/tests/dir/dir_basic-win32-mb.phpt b/ext/standard/tests/dir/dir_basic-win32-mb.phpt
index d643846852..2106bc37d6 100644
--- a/ext/standard/tests/dir/dir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/dir_basic-win32-mb.phpt
@@ -44,8 +44,12 @@ echo "\nClose directory:\n";
var_dump( $d->close() );
var_dump( $d );
-echo "\nTest read after closing the dir:";
-var_dump( $d->read() );
+echo "\nTest read after closing the dir:\n";
+try {
+ var_dump( $d->read() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// delete temp files
delete_files($dir_path, 3, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™dir_basic", 1, ".tmp");
@@ -87,6 +91,5 @@ object(Directory)#%d (2) {
}
Test read after closing the dir:
-Warning: Directory::read(): %s is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): %s is not a valid Directory resource
Done
diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt
index 4360a749c7..15f8061b7b 100644
--- a/ext/standard/tests/dir/dir_basic.phpt
+++ b/ext/standard/tests/dir/dir_basic.phpt
@@ -38,8 +38,12 @@ echo "\nClose directory:\n";
var_dump( $d->close() );
var_dump( $d );
-echo "\nTest read after closing the dir:";
-var_dump( $d->read() );
+echo "\nTest read after closing the dir:\n";
+try {
+ var_dump( $d->read() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// delete temp files
delete_files($dir_path, 3, "dir_basic", 1, ".tmp");
@@ -81,6 +85,5 @@ object(Directory)#%d (2) {
}
Test read after closing the dir:
-Warning: Directory::read(): supplied resource is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): supplied resource is not a valid Directory resource
Done
diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt
index 2cd23b8bfc..7950d58823 100644
--- a/ext/standard/tests/dir/readdir_variation7.phpt
+++ b/ext/standard/tests/dir/readdir_variation7.phpt
@@ -15,14 +15,16 @@ echo "*** Testing readdir() : usage variations ***\n";
// get a resource variable
var_dump($fp = fopen(__FILE__, "r"));
-var_dump( readdir($fp) );
+try {
+ var_dump( readdir($fp) );
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
===DONE===
--EXPECTF--
*** Testing readdir() : usage variations ***
resource(%d) of type (stream)
-
-Warning: readdir(): %d is not a valid Directory resource in %s on line %d
-bool(false)
+%d is not a valid Directory resource
===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
index e46640c41e..d38571c88a 100644
--- a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
@@ -29,7 +29,11 @@ var_dump(readdir($dir_handle));
closedir($dir_handle);
echo "\n-- Call to rewinddir() --\n";
-var_dump(rewinddir($dir_handle));
+try {
+ var_dump(rewinddir($dir_handle));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
--CLEAN--
@@ -45,7 +49,5 @@ resource(%d) of type (stream)
string(%d) "%s"
-- Call to rewinddir() --
-
-Warning: rewinddir(): %s is not a valid Directory resource in %s on line %d
-bool(false)
+rewinddir(): %s is not a valid Directory resource
===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation2.phpt b/ext/standard/tests/dir/rewinddir_variation2.phpt
index 02654aa80c..ca646f2002 100644
--- a/ext/standard/tests/dir/rewinddir_variation2.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation2.phpt
@@ -23,7 +23,11 @@ var_dump(readdir($dir_handle));
closedir($dir_handle);
echo "\n-- Call to rewinddir() --\n";
-var_dump(rewinddir($dir_handle));
+try {
+ var_dump(rewinddir($dir_handle));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
--CLEAN--
@@ -39,7 +43,5 @@ resource(%d) of type (stream)
string(%d) "%s"
-- Call to rewinddir() --
-
-Warning: rewinddir(): supplied resource is not a valid Directory resource in %s on line %d
-bool(false)
+rewinddir(): supplied resource is not a valid Directory resource
===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt
index a1ec7f80d4..920e493c07 100644
--- a/ext/standard/tests/dir/rewinddir_variation3.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation3.phpt
@@ -18,7 +18,12 @@ echo "\n-- Open a file using fopen --\n";
var_dump($fp = fopen(__FILE__, 'r'));
$result1 = fread($fp, 5);
-var_dump(rewinddir($fp));
+
+try {
+ var_dump(rewinddir($fp));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
$result2 = fread($fp, 5);
echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
@@ -34,9 +39,7 @@ if ($result1 === $result2) {
-- Open a file using fopen --
resource(%d) of type (stream)
-
-Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
-bool(false)
+%d is not a valid Directory resource
-- Check if rewinddir() has repositioned the file pointer --
rewinddir() does not work on file pointers
diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt
deleted file mode 100644
index 5505b3db6d..0000000000
--- a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt
+++ /dev/null
@@ -1,244 +0,0 @@
---TEST--
-Test scandir() function : usage variations - diff data types as $context arg
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die("skip Valid only on Windows");
-}
-?>
---FILE--
-<?php
-/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
- * Description: List files & directories inside the specified path
- * Source code: ext/standard/dir.c
- */
-
-/*
- * Pass different data types as $context argument to test how scandir() behaves
- */
-
-echo "*** Testing scandir() : usage variations ***\n";
-
-// Initialise function arguments not being substituted
-$dir = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation3';
-mkdir($dir);
-$sorting_order = SCANDIR_SORT_ASCENDING;
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $context argument
-$inputs = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
- array(),
-
- // string data
-/*19*/ "string",
- 'string',
- $heredoc,
-
- // object data
-/*22*/ new classA(),
-
- // undefined data
-/*23*/ @$undefined_var,
-
- // unset data
-/*24*/ @$unset_var,
-
- // resource variable
-/*25*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of scandir()
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( scandir($dir, $sorting_order, $input) );
- $iterator++;
-};
-
-fclose($fp);
-?>
-===DONE===
---CLEAN--
-<?php
-$dir = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation3';
-rmdir($dir);
-?>
---EXPECTF--
-*** Testing scandir() : usage variations ***
-
--- Iteration 1 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-
-Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d
-NULL
-
--- Iteration 19 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-
-Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d
-NULL
-
--- Iteration 23 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d
-array(2) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
-}
-===DONE===
diff --git a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt
index 73aac5b43c..5594207812 100644
--- a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt
@@ -15,7 +15,12 @@ echo $rc;
echo "Cannot instantiate a valid Directory directly:\n";
$d = new Directory(getcwd());
var_dump($d);
-var_dump($d->read());
+
+try {
+ var_dump($d->read());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
--EXPECTF--
@@ -60,6 +65,4 @@ Class [ <internal%s> class Directory ] {
Cannot instantiate a valid Directory directly:
object(Directory)#%d (0) {
}
-
-Warning: Directory::read(): Unable to find my handle property in %s on line 15
-bool(false)
+Unable to find my handle property
diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
index cba61d3fbf..2949bd3381 100644
--- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
@@ -10,22 +10,41 @@ mkdir($d);
echo "\n--> Try all methods with bad handle:\n";
$d = new Directory($d);
$d->handle = "Havoc!";
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
+try {
+ var_dump($d->read());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->close());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n--> Try all methods with no handle:\n";
$d = new Directory($d);
unset($d->handle);
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
-echo "\n--> Try all methods with wrong number of args:\n";
-$d = new Directory($d);
-var_dump($d->read(1,2));
-var_dump($d->rewind(1,2));
-var_dump($d->close(1,2));
+try {
+ var_dump($d->read());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->close());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
--CLEAN--
@@ -34,36 +53,14 @@ $d = getcwd().PATH_SEPARATOR."ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™";
rmdir($d);
?>
---EXPECTF--
+--EXPECT--
--> Try all methods with bad handle:
-
-Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): supplied argument is not a valid Directory resource
+Directory::rewind(): supplied argument is not a valid Directory resource
+Directory::close(): supplied argument is not a valid Directory resource
--> Try all methods with no handle:
+Unable to find my handle property
+Unable to find my handle property
+Unable to find my handle property
-Warning: Directory::read(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::close(): Unable to find my handle property in %s on line %d
-bool(false)
-
---> Try all methods with wrong number of args:
-
-Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt
index 5b2771eef6..1a8bbf3c1d 100644
--- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt
@@ -6,54 +6,50 @@ Directory class behaviour.
echo "\n--> Try all methods with bad handle:\n";
$d = new Directory(getcwd());
$d->handle = "Havoc!";
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
+try {
+ var_dump($d->read());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->close());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n--> Try all methods with no handle:\n";
$d = new Directory(getcwd());
unset($d->handle);
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
-echo "\n--> Try all methods with wrong number of args:\n";
-$d = new Directory(getcwd());
-var_dump($d->read(1,2));
-var_dump($d->rewind(1,2));
-var_dump($d->close(1,2));
+try {
+ var_dump($d->read());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->close());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
+--EXPECT--
--> Try all methods with bad handle:
-
-Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): supplied argument is not a valid Directory resource
+Directory::rewind(): supplied argument is not a valid Directory resource
+Directory::close(): supplied argument is not a valid Directory resource
--> Try all methods with no handle:
-
-Warning: Directory::read(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::close(): Unable to find my handle property in %s on line %d
-bool(false)
-
---> Try all methods with wrong number of args:
-
-Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d
-NULL
+Unable to find my handle property
+Unable to find my handle property
+Unable to find my handle property
diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt
index e3ce551b3d..bc2bf3f978 100644
--- a/ext/standard/tests/file/005_error.phpt
+++ b/ext/standard/tests/file/005_error.phpt
@@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") );
var_dump( filectime("/no/such/file/or/dir") );
var_dump( touch("/no/such/file/or/dir", 10) );
-/* Only one invalid argument */
-var_dump( fileatime(__FILE__, "string") );
-var_dump( filemtime(__FILE__, 100) );
-var_dump( filectime(__FILE__, TRUE) );
-var_dump( touch(__FILE__, 10, 100, 123) );
-
-echo "\n-- Testing No.of arguments less than expected --";
-var_dump( fileatime() );
-var_dump( filemtime() );
-var_dump( filectime() );
-var_dump( touch() );
-
-echo "\n-- Testing No.of arguments greater than expected --";
-/* Both invalid arguments */
-var_dump( fileatime("/no/such/file/or/dir", "string") );
-var_dump( filemtime("/no/such/file/or/dir", 100) );
-var_dump( filectime("/no/such/file/or/dir", TRUE) );
-var_dump( touch("/no/such/file/or/dir", 10, 100, 123) );
-
-/* Only one invalid argument */
-var_dump( fileatime(__FILE__, "string") );
-var_dump( filemtime(__FILE__, 100) );
-var_dump( filectime(__FILE__, TRUE) );
-var_dump( touch(__FILE__, 10, 100, 123) );
-
echo "\nDone";
?>
--EXPECTF--
@@ -72,54 +47,4 @@ bool(false)
Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d
bool(false)
-Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
--- Testing No.of arguments less than expected --
-Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing No.of arguments greater than expected --
-Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt
index 9451a3e18b..9234922790 100644
--- a/ext/standard/tests/file/006_error.phpt
+++ b/ext/standard/tests/file/006_error.phpt
@@ -36,19 +36,6 @@ var_dump( chmod("/no/such/file/dir", 0777) );
var_dump( fileperms("/no/such/file/dir") );
echo "\n";
-/* With args less than expected */
-$fp = fopen(__DIR__."/006_error.tmp", "w");
-fclose($fp);
-var_dump( chmod(__DIR__."/006_error.tmp") );
-var_dump( chmod("nofile") );
-var_dump( chmod() );
-var_dump( fileperms() );
-
-/* With args greater than expected */
-var_dump( chmod(__DIR__."/006_error.tmp", 0755, TRUE) );
-var_dump( fileperms(__DIR__."/006_error.tmp", 0777) );
-var_dump( fileperms("nofile", 0777) );
-
echo "\n*** Done ***\n";
?>
--CLEAN--
@@ -73,25 +60,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d
bool(false)
-Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt
index 6e87d24675..a5c95ab1da 100644
--- a/ext/standard/tests/file/006_variation2.phpt
+++ b/ext/standard/tests/file/006_variation2.phpt
@@ -58,15 +58,23 @@ $perms_array = array(
$count = 1;
foreach($perms_array as $permission) {
echo "-- Iteration $count --\n";
- var_dump( chmod($file_name, $permission) );
- printf("%o", fileperms($file_name) );
- echo "\n";
- clearstatcache();
-
- var_dump( chmod($dir_name, $permission) );
- printf("%o", fileperms($dir_name) );
- echo "\n";
- clearstatcache();
+ try {
+ var_dump( chmod($file_name, $permission) );
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+ clearstatcache();
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ try {
+ var_dump( chmod($dir_name, $permission) );
+ printf("%o", fileperms($dir_name) );
+ echo "\n";
+ clearstatcache();
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
echo "*** Done ***\n";
@@ -138,39 +146,15 @@ bool(true)
bool(true)
43567
-- Iteration 12 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
-- Iteration 13 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
-- Iteration 14 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
-- Iteration 15 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
*** Done ***
diff --git a/ext/standard/tests/file/007_basic.phpt b/ext/standard/tests/file/007_basic.phpt
index fd2e5575a9..fa25431580 100644
--- a/ext/standard/tests/file/007_basic.phpt
+++ b/ext/standard/tests/file/007_basic.phpt
@@ -51,9 +51,17 @@ for( $i=0; $i<count($modes); $i++ ) {
// check fclose()
var_dump( fclose($handle) );
var_dump( $handle );
- // confirm the closure, using ftell() and feof(), expect, false
- var_dump( ftell($handle) );
- var_dump( feof($handle) );
+ // confirm the closure, using ftell() and feof()
+ try {
+ var_dump( ftell($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( feof($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
// remove the temp file
@@ -78,9 +86,17 @@ for( $i=0; $i<count($x_modes); $i++ ) {
// check fclose()
var_dump( fclose($handle) );
var_dump( $handle );
- // confirm the closure, using ftell() and feof(), expect, false
- var_dump( ftell($handle) );
- var_dump( feof($handle) );
+ // confirm the closure, using ftell() and feof()
+ try {
+ var_dump( ftell($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( feof($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump( $handle );
// remove the file
@@ -97,12 +113,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'wb' --
resource(%d) of type (stream)
@@ -110,12 +122,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'wt' --
resource(%d) of type (stream)
@@ -123,12 +131,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'w+' --
resource(%d) of type (stream)
@@ -136,12 +140,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'w+b' --
resource(%d) of type (stream)
@@ -149,12 +149,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'w+t' --
resource(%d) of type (stream)
@@ -162,12 +158,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r' --
resource(%d) of type (stream)
@@ -175,12 +167,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'rb' --
resource(%d) of type (stream)
@@ -188,12 +176,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'rt' --
resource(%d) of type (stream)
@@ -201,12 +185,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r+' --
resource(%d) of type (stream)
@@ -214,12 +194,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r+b' --
resource(%d) of type (stream)
@@ -227,12 +203,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r+t' --
resource(%d) of type (stream)
@@ -240,12 +212,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a' --
resource(%d) of type (stream)
@@ -253,12 +221,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'ab' --
resource(%d) of type (stream)
@@ -266,12 +230,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'at' --
resource(%d) of type (stream)
@@ -279,12 +239,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a+' --
resource(%d) of type (stream)
@@ -292,12 +248,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a+t' --
resource(%d) of type (stream)
@@ -305,12 +257,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a+b' --
resource(%d) of type (stream)
@@ -318,12 +266,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'x' --
resource(%d) of type (stream)
@@ -331,12 +275,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'xb' --
@@ -345,12 +285,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'xt' --
@@ -359,12 +295,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'x+' --
@@ -373,12 +305,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'x+b' --
@@ -387,12 +315,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'x+t' --
@@ -401,12 +325,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
*** Done ***
diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt
deleted file mode 100644
index 93a6a23e5f..0000000000
--- a/ext/standard/tests/file/007_error.phpt
+++ /dev/null
@@ -1,185 +0,0 @@
---TEST--
-Test fopen, fclose() & feof() functions: error conditions
---CREDITS--
-Dave Kelsey <d_kelsey@uk.ibm.com>
---FILE--
-<?php
-/*
- Prototype: resource fopen(string $filename, string $mode
- [, bool $use_include_path [, resource $context]] );
- Description: Opens file or URL.
-
- Prototype: bool fclose ( resource $handle );
- Description: Closes an open file pointer
-
- Prototype: bool feof ( resource $handle )
- Description: Returns TRUE if the file pointer is at EOF or an error occurs
- (including socket timeout); otherwise returns FALSE.
-*/
-
-echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n";
-/* Arguments less than minimum no.of args */
-
-// fopen ()
-var_dump(fopen(__FILE__)); // one valid argument
-var_dump(fopen()); // zero argument
-
-// fclose()
-$fp = fopen(__FILE__, "r");
-fclose($fp);
-var_dump( fclose($fp) ); // closed handle
-var_dump( fclose(__FILE__) ); // invalid handle
-var_dump( fclose() ); // zero argument
-
-//feof()
-var_dump( feof($fp) ); // closed handle
-var_dump( feof(__FILE__) ); // invalid handle
-var_dump( feof() ); //zero argument
-
-/* Arguments greater than maximum no.of ags */
-var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100));
-
-$fp = fopen(__FILE__, "r");
-var_dump( fclose($fp, "handle") );
-
-var_dump( feof($fp, "handle"));
-fclose($fp);
-
-/* test invalid arguments : non-resources */
-echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
- NULL,
- ""
-);
-
-/* loop to test fclose with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fopen($invalid_args[$loop_counter - 1], "r") );
- var_dump( fclose($invalid_args[$loop_counter - 1]) );
- var_dump( feof($invalid_args[$loop_counter - 1]) );
-}
-
-?>
---EXPECTF--
-*** Testing error conditions for fopen(), fclsoe() & feof() ***
-
-Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: fclose(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-
-Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
--- Testing fopen(), fclose() & feof() with invalid arguments --
--- Iteration 1 --
-
-Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Iteration 7 --
-
-Warning: fopen(): Filename cannot be empty in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
--- Iteration 8 --
-
-Warning: fopen(): Filename cannot be empty in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt
index 996b060cea..703861dec7 100644
--- a/ext/standard/tests/file/basename-win32.phpt
+++ b/ext/standard/tests/file/basename-win32.phpt
@@ -115,23 +115,6 @@ check_basename( $file_paths );
echo "\n*** Testing possible variations in path and suffix ***\n";
check_basename( $file_path_variations );
-echo "\n*** Testing error conditions ***\n";
-// zero arguments
-var_dump( basename() );
-
-// more than expected no. of arguments
-var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") );
-
-// passing invalid type arguments
-$object = new stdclass;
-var_dump( basename( array("string\\bar") ) );
-var_dump( basename( array("string\\bar"), "bar" ) );
-var_dump( basename( "bar", array("string\\bar") ) );
-var_dump( basename( $object, "bar" ) );
-var_dump( basename( $object ) );
-var_dump( basename( $object, $object ) );
-var_dump( basename( "bar", $object ) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -309,33 +292,4 @@ string(0) ""
--Iteration 32--
string(0) ""
-
-*** Testing error conditions ***
-
-Warning: basename() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: basename() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 2 to be string, object given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt
index a9b4389b5a..8352f4da4b 100644
--- a/ext/standard/tests/file/basename.phpt
+++ b/ext/standard/tests/file/basename.phpt
Binary files differ
diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt
index 5460203e05..174e349b15 100644
--- a/ext/standard/tests/file/bug39863.phpt
+++ b/ext/standard/tests/file/bug39863.phpt
@@ -7,16 +7,11 @@ Andrew van der Stock, vanderaj @ owasp.org
$filename = __FILE__ . chr(0). ".ridiculous";
-if (file_exists($filename)) {
- echo "FAIL\n";
-}
-else {
- echo "PASS\n";
+try {
+ var_dump(file_exists($filename));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d
-PASS
-===DONE===
+--EXPECT--
+file_exists() expects parameter 1 to be a valid path, string given
diff --git a/ext/standard/tests/file/bug41693.phpt b/ext/standard/tests/file/bug41693.phpt
deleted file mode 100644
index ea074fa4fd..0000000000
--- a/ext/standard/tests/file/bug41693.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #41693 (scandir() allows empty directory names)
---FILE--
-<?php
-
-var_dump(scandir(''));
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: scandir(): Directory name cannot be empty in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/file/bug52820.phpt b/ext/standard/tests/file/bug52820.phpt
index e51c27e457..b5690484a2 100644
--- a/ext/standard/tests/file/bug52820.phpt
+++ b/ext/standard/tests/file/bug52820.phpt
@@ -10,7 +10,7 @@ if (!extension_loaded("curl")) exit("skip curl extension not loaded");
$handle=curl_init('http://127.0.0.1:37349/');
curl_setopt($handle, CURLOPT_VERBOSE, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
-if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
+if (!@curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
die("skip fopencookie not supported on this platform");
--FILE--
<?php
diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt
index 704d746efc..57feddbb09 100644
--- a/ext/standard/tests/file/bug72035.phpt
+++ b/ext/standard/tests/file/bug72035.phpt
@@ -3,7 +3,6 @@ Bug #72035 php-cgi.exe fails to run scripts relative to drive root
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test');
-if(php_sapi_name() != "cli") die('skip CLI only test');
$cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe";
if (!file_exists($cgi)) die('skip CGI binary not found');
diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt
index 3b234c741f..b7999aa03d 100644
--- a/ext/standard/tests/file/chmod_error.phpt
+++ b/ext/standard/tests/file/chmod_error.phpt
@@ -10,19 +10,6 @@ Test chmod() function : error conditions
echo "*** Testing chmod() : error conditions ***\n";
-
-//Test chmod with one more than the expected number of arguments
-echo "\n-- Testing chmod() function with more than expected no. of arguments --\n";
-$filename = 'string_val';
-$mode = 10;
-$extra_arg = 10;
-var_dump( chmod($filename, $mode, $extra_arg) );
-
-// Testing chmod with one less than the expected number of arguments
-echo "\n-- Testing chmod() function with less than expected no. of arguments --\n";
-$filename = 'string_val';
-var_dump( chmod($filename) );
-
// testing chmod with a non-existing file
$filename = "___nonExisitingFile___";
var_dump(chmod($filename, 0777));
@@ -32,16 +19,6 @@ var_dump(chmod($filename, 0777));
--EXPECTF--
*** Testing chmod() : error conditions ***
--- Testing chmod() function with more than expected no. of arguments --
-
-Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
--- Testing chmod() function with less than expected no. of arguments --
-
-Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: chmod(): No such file or directory in %s on line %d
bool(false)
===DONE===
diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt
index 2d6395167b..36eb58fc2a 100644
--- a/ext/standard/tests/file/copy_error.phpt
+++ b/ext/standard/tests/file/copy_error.phpt
@@ -11,13 +11,6 @@ echo "*** Testing copy() function: error conditions --\n";
/* Invalid args */
var_dump( copy("/no/file", "file") );
-/* No.of args less than expected */
-var_dump( copy() );
-var_dump( copy(__FILE__) );
-
-/* No.of args less than expected */
-var_dump( copy(__FILE__, "file1", "file1") );
-
echo "*** Done ***\n";
?>
--EXPECTF--
@@ -25,13 +18,4 @@ echo "*** Done ***\n";
Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d
bool(false)
-
-Warning: copy() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: copy() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: copy() expects parameter 3 to be resource, string given in %s on line %d
-NULL
*** Done ***
diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt
index b082c082b5..01385cb893 100644
--- a/ext/standard/tests/file/copy_variation4.phpt
+++ b/ext/standard/tests/file/copy_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt
index a048af6ccb..fe415535ba 100644
--- a/ext/standard/tests/file/disk.phpt
+++ b/ext/standard/tests/file/disk.phpt
@@ -11,9 +11,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
--FILE--
<?php
-var_dump(disk_free_space());
-var_dump(disk_total_space());
-
var_dump(disk_free_space(-1));
var_dump(disk_total_space(-1));
@@ -26,12 +23,6 @@ var_dump(disk_total_space("/some/path/here"));
echo "Done\n";
?>
--EXPECTF--
-Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: disk_free_space(): No such file or directory in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt
index 43e71719c0..e7439d3f34 100644
--- a/ext/standard/tests/file/disk_free_space_error-win32.phpt
+++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt
@@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' )
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_free_space() ); // Zero Arguments
-var_dump( diskfreespace() );
-
-var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
-var_dump( diskfreespace( $file_path, "extra argument") );
-
var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
var_dump( diskfreespace( $file_path."/dir1" ));
@@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_free_space(): The system cannot find the path specified.
in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt
index aca17b2331..ea8d84aa36 100644
--- a/ext/standard/tests/file/disk_free_space_error.phpt
+++ b/ext/standard/tests/file/disk_free_space_error.phpt
@@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN')
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_free_space() ); // Zero Arguments
-var_dump( diskfreespace() );
-
-var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
-var_dump( diskfreespace( $file_path, "extra argument") );
-
var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
var_dump( diskfreespace( $file_path."/dir1" ));
@@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_free_space(): No such file or directory in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt
index 25eeadf800..d47850d898 100644
--- a/ext/standard/tests/file/disk_free_space_variation.phpt
+++ b/ext/standard/tests/file/disk_free_space_variation.phpt
@@ -48,8 +48,16 @@ $count = 1;
/* loop through to test each element the above array */
foreach($dirs_arr as $dir1) {
echo "\n-- Iteration $count --\n";
- var_dump( disk_free_space( $dir1 ) );
- var_dump( diskfreespace( $dir1 ) );
+ try {
+ var_dump( disk_free_space( $dir1 ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( diskfreespace( $dir1 ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
@@ -102,35 +110,19 @@ float(%d)
float(%d)
-- Iteration 9 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
-- Iteration 11 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
-- Iteration 12 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
--- Done ---
diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt
index c3a2854eff..5896ad213b 100644
--- a/ext/standard/tests/file/disk_total_space_error-win32.phpt
+++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt
@@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' )
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_total_space() ); // Zero Arguments
-
-var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
-
var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
@@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_total_space(): The system cannot find the path specified.
in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt
index 125d093ccd..6c2c3bf833 100644
--- a/ext/standard/tests/file/disk_total_space_error.phpt
+++ b/ext/standard/tests/file/disk_total_space_error.phpt
@@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN')
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_total_space() ); // Zero Arguments
-
-var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
-
var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
@@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_total_space(): No such file or directory in %s on line %d
bool(false)
float(%d)
diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt
index 3ba3771aac..326fd9ea25 100644
--- a/ext/standard/tests/file/disk_total_space_variation.phpt
+++ b/ext/standard/tests/file/disk_total_space_variation.phpt
@@ -49,7 +49,11 @@ $count = 1;
/* loop through to test each element the above array */
foreach($dirs_arr as $dir1) {
echo "\n-- Iteration $count --\n";
- var_dump( disk_total_space( $dir1 ) );
+ try {
+ var_dump( disk_total_space( $dir1 ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
@@ -96,25 +100,17 @@ float(%d)
float(%d)
-- Iteration 9 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
-- Iteration 11 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
-- Iteration 12 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
*** Testing with Binary Input ***
-float(%d)
+float(%s)
--- Done ---
diff --git a/ext/standard/tests/file/fclose_variation1.phpt b/ext/standard/tests/file/fclose_variation1.phpt
index ba3631e50d..8d3e1a1805 100644
--- a/ext/standard/tests/file/fclose_variation1.phpt
+++ b/ext/standard/tests/file/fclose_variation1.phpt
@@ -7,9 +7,13 @@ function separate_zval(&$var) { }
$s2 = $s;
separate_zval($s2);
fclose($s);
-echo fread($s2, strlen("<?php"));
+try {
+ echo fread($s2, strlen("<?php"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\nDone.\n";
---EXPECTF--
-Warning: fread(): supplied resource is not a valid stream resource in %s on line %d
+--EXPECT--
+fread(): supplied resource is not a valid stream resource
Done.
diff --git a/ext/standard/tests/file/feof_basic.phpt b/ext/standard/tests/file/feof_basic.phpt
index 2fc2e4b855..0711a3468d 100644
--- a/ext/standard/tests/file/feof_basic.phpt
+++ b/ext/standard/tests/file/feof_basic.phpt
@@ -64,13 +64,17 @@ var_dump(feof($h));
echo "*** closing file, testing eof ***\n";
fclose($h);
-feof($h);
+try {
+ feof($h);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
unlink($tmpFile1);
unlink($tmpFile2);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing feof() : basic functionality ***
*** testing reading complete file using feof to stop ***
@@ -96,6 +100,5 @@ bool(false)
*** testing feof after a seek passed the end ***
bool(false)
*** closing file, testing eof ***
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
+feof(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt
index d444209af4..d67e56e56a 100644
--- a/ext/standard/tests/file/fgetc_variation2.phpt
+++ b/ext/standard/tests/file/fgetc_variation2.phpt
@@ -24,29 +24,16 @@ $file_handle = fopen(__FILE__, "r");
fclose($file_handle);
// read from closed file
-var_dump( fgetc($file_handle) );
-
-echo "-- Testing fgetc() with unset handle --\n";
-// open the file for reading
-$file_handle = fopen(__FILE__, "r");
-// unset the file handle
-unset($file_handle);
-
-//fgetc using unset handle
-var_dump( fgetc($file_handle) );
+try {
+ var_dump( fgetc($file_handle) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing fgetc() : usage variations ***
-- Testing fgetc() with closed handle --
-
-Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
--- Testing fgetc() with unset handle --
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fgetc(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt
index 919343aa87..eed35b3001 100644
--- a/ext/standard/tests/file/fgets_error.phpt
+++ b/ext/standard/tests/file/fgets_error.phpt
@@ -8,14 +8,8 @@ Test fgets() function : error conditions
*/
echo "*** Testing error conditions ***\n";
-// zero argument
-echo "-- Testing fgets() with zero argument --\n";
-var_dump( fgets() );
-// more than expected no. of args
-echo "-- Testing fgets() with more than expected number of arguments --\n";
$fp = fopen(__FILE__, "r");
-var_dump( fgets($fp, 10, $fp) );
// invalid length argument
echo "-- Testing fgets() with invalid length arguments --\n";
@@ -26,45 +20,10 @@ var_dump( fgets($fp, $len) );
$len = 1;
var_dump( fgets($fp, $len) ); // return length - 1 always, expect false
-
-// test invalid arguments : non-resources
-echo "-- Testing fgets() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fgets() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fgets($invalid_args[$loop_counter - 1], 10) );
-}
-
-// fgets() on a file handle which is already closed
-echo "-- Testing fgets() with closed/unset file handle --";
-fclose($fp);
-var_dump(fgets($fp,10));
-
-// fgets() on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( fgets(@$file_handle,10));
-
echo "Done\n";
?>
--EXPECTF--
*** Testing error conditions ***
--- Testing fgets() with zero argument --
-
-Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing fgets() with more than expected number of arguments --
-
-Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-- Testing fgets() with invalid length arguments --
Warning: fgets(): Length parameter must be greater than 0 in %s on line %d
@@ -73,35 +32,4 @@ bool(false)
Warning: fgets(): Length parameter must be greater than 0 in %s on line %d
bool(false)
bool(false)
--- Testing fgets() with invalid arguments --
--- Iteration 1 --
-
-Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fgets() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fgets() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fgets() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Testing fgets() with closed/unset file handle --
-Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt
index 0bbcf22039..2626139dcb 100644
--- a/ext/standard/tests/file/fgets_variation2.phpt
+++ b/ext/standard/tests/file/fgets_variation2.phpt
@@ -24,39 +24,22 @@ $file_handle = fopen(__FILE__, "r");
fclose($file_handle);
// read from closed file
-var_dump( fgets($file_handle) ); // default length
-var_dump( fgets($file_handle, 10) ); // with specific length
-
-echo "-- Testing fgets() with unset handle --\n";
-// open the file for reading
-$file_handle = fopen(__FILE__, "r");
-// unset the file handle
-unset($file_handle);
-
-//fgets using unset handle
-var_dump( fgets($file_handle) ); // default length
-var_dump( fgets($file_handle, 10) ); // with specific length
+try {
+ var_dump( fgets($file_handle) ); // default length
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( fgets($file_handle, 10) ); // with specific length
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing fgets() : usage variations ***
-- Testing fgets() with closed handle --
-
-Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
--- Testing fgets() with unset handle --
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fgets(): supplied resource is not a valid stream resource
+fgets(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt
deleted file mode 100644
index 7ca6169762..0000000000
--- a/ext/standard/tests/file/fgetss.phpt
+++ /dev/null
@@ -1,144 +0,0 @@
---TEST--
-fgetss() tests
---FILE--
-<?php
-
-$filename = __DIR__."/fgetss.html";
-
-$array = array(
- "askasdfasdf<b>aaaaaa\n</b>dddddd",
- "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
- "aaa<script>function foo() {}</script>qqq",
- "asdasd<a\n asdjeje",
- "",
- "some text \n<b>blah</i>",
- "some another text <> hoho </>"
- );
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp));
- var_dump(fgetss($fp));
-}
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp, 10));
- var_dump(fgetss($fp, 10));
-}
-
-var_dump(fgetss($fp, -10));
-var_dump(fgetss($fp, 0));
-fclose($fp);
-var_dump(fgetss($fp, 0));
-
-@unlink($filename);
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(18) "askasdfasdfaaaaaa
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "dddddd"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "asdqw
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(8) "aaaaqqqq"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(23) "aaafunction foo() {}qqq"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "asdasd"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(0) ""
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(11) "some text
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(4) "blah"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(24) "some another text hoho "
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "askasdfas"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "dfaaaa"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(5) "asdqw"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(0) ""
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(3) "aaa"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(7) "functio"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "asdasd"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(0) ""
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "some text"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(2) "
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "some anot"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "her text "
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-
-Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt
deleted file mode 100644
index 55b6adbe6b..0000000000
--- a/ext/standard/tests/file/fgetss1.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
---TEST--
-more fgetss() tests
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-$filename = __DIR__."/fgetss1.html";
-
-$array = array(
- "askasdfasdf<b>aaaaaa\n</b>dddddd",
- "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
- "aaa<script>function foo() {}</script>qqq",
- "asdasd<a\n asdjeje",
- "",
- "some text \n<b>blah</i>",
- "some another text <> hoho </>"
- );
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp, 1000, "<i>,<b>,<a>"));
- var_dump(fgetss($fp));
-}
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp, 10));
- var_dump(fgetss($fp, 10, "<script>,<a>"));
-}
-
-echo "Done\n";
-?>
---CLEAN--
-<?php
-$filename = __DIR__."/fgetss1.html";
-unlink($filename);
-?>
---EXPECT--
-string(21) "askasdfasdf<b>aaaaaa
-"
-string(6) "dddddd"
-string(28) "asdqw<i onClick="hello();">
-"
-string(8) "aaaaqqqq"
-string(23) "aaafunction foo() {}qqq"
-bool(false)
-string(6) "asdasd"
-string(0) ""
-bool(false)
-bool(false)
-string(11) "some text
-"
-string(4) "blah"
-string(24) "some another text hoho "
-bool(false)
-string(9) "askasdfas"
-string(6) "dfaaaa"
-string(5) "asdqw"
-string(0) ""
-string(3) "aaa"
-string(9) "t>functio"
-string(6) "asdasd"
-string(0) ""
-bool(false)
-bool(false)
-string(9) "some text"
-string(2) "
-"
-string(9) "some anot"
-string(9) "her text "
-Done
diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt
deleted file mode 100644
index 80d1b74f3c..0000000000
--- a/ext/standard/tests/file/fgetss_basic1.phpt
+++ /dev/null
@@ -1,137 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read modes only
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* test fgetss with all read modes */
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : Basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-/* try reading the file opened in different modes of reading */
-$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $filename = __DIR__."/fgetss_basic1.tmp";
- create_file ($filename); //create an empty file
- file_put_contents($filename, $string_with_tags);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- rewind($file_handle);
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : Basic operations ***
-
--- Testing fgetss() with file opened using r mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using rb mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using rt mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using r+ mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using r+b mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using r+t mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt
deleted file mode 100644
index 68fd7059d0..0000000000
--- a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt
+++ /dev/null
@@ -1,218 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only on Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-$filename = __DIR__."/fgetss_basic2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : basic operations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt
deleted file mode 100644
index 9e9ab50788..0000000000
--- a/ext/standard/tests/file/fgetss_basic2-win32.phpt
+++ /dev/null
@@ -1,218 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only on Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-$filename = __DIR__."/fgetss_basic2.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : basic operations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt
deleted file mode 100644
index 887a752435..0000000000
--- a/ext/standard/tests/file/fgetss_basic2.phpt
+++ /dev/null
@@ -1,216 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-
-$filename = __DIR__."/fgetss_basic2.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : basic operations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+t mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+t mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+t mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt
deleted file mode 100644
index 13a5399406..0000000000
--- a/ext/standard/tests/file/fgetss_error.phpt
+++ /dev/null
@@ -1,108 +0,0 @@
---TEST--
-Test fgetss() function : error conditions
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-echo "*** Testing error conditions ***\n";
-// zero argument
-echo "-- Testing fgetss() with zero argument --\n";
-var_dump( fgetss() );
-
-// more than expected no. of args
-echo "-- Testing fgetss() with more than expected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( fgetss($fp, 100, '<p><a>', $fp) );
-
-// invalid length argument
-echo "-- Testing fgetss() with invalid length arguments --\n";
-$len = 0;
-$allowable_tags = '<p><a>';
-var_dump( fgetss($fp, $len, $allowable_tags) );
-$len = -10;
-var_dump( fgetss($fp, $len, $allowable_tags) );
-$len = 1;
-var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false
-
-// test invalid arguments : non-resources
-echo "-- Testing fgetss() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fgetss() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) );
-}
-// fgetss() on a file handle which is already closed
-echo "-- Testing fgetss() with closed/unset file handle --";
-fclose($fp);
-var_dump(fgetss($fp,10,$allowable_tags));
-
-// fgetss() on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( fgetss(@$file_handle,10));
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing error conditions ***
--- Testing fgetss() with zero argument --
-
-Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing fgetss() with more than expected number of arguments --
-
-Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
--- Testing fgetss() with invalid length arguments --
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-bool(false)
--- Testing fgetss() with invalid arguments --
--- Iteration 1 --
-
-Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fgetss() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fgetss() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fgetss() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Testing fgetss() with closed/unset file handle --
-Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt
deleted file mode 100644
index 72e19c293f..0000000000
--- a/ext/standard/tests/file/fgetss_variation1-win32.phpt
+++ /dev/null
@@ -1,192 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - write only modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only on Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgets on files which are opened in non readable modes
- w, wb, wt,
- a, ab, at,
- x, xb, xt
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-
-$filename = __DIR__."/fgetss_variation1.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n";
- var_dump( fgetss($file_handle) ); // expected : no character should be read
- var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed
- var_dump( feof($file_handle) ); // check if end of file pointer is set
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wt mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using a mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using ab mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using at mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using x mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xt mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt
deleted file mode 100644
index e1a202388c..0000000000
--- a/ext/standard/tests/file/fgetss_variation1.phpt
+++ /dev/null
@@ -1,188 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - write only modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgets on files which are opened in non readable modes
- w, wb, wt,
- a, ab, at,
- x, xb, xt
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation1.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n";
- var_dump( fgetss($file_handle) ); // expected : no character should be read
- var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed
- var_dump( feof($file_handle) ); // check if end of file pointer is set
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wt mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using a mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using ab mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using at mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using x mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xt mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt
deleted file mode 100644
index 7c581793c2..0000000000
--- a/ext/standard/tests/file/fgetss_variation2.phpt
+++ /dev/null
@@ -1,436 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read modes
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this is the text containing \r character
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation2.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- create_file ($filename); //create an empty file
- file_put_contents($filename, $string_with_tags);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* rewind the file and read the file line by line with allowable tags */
- echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
- rewind($file_handle);
- $line = 1;
- while( !feof($file_handle) ) {
- echo "-- Line $line --\n"; $line++;
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // check the file pointer position
- var_dump( feof($file_handle) ); // check if eof reached
- }
-
- // close the file
- fclose($file_handle);
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using r mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rb mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rt mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+ mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+b mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+t mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt
deleted file mode 100644
index f53d76ce27..0000000000
--- a/ext/standard/tests/file/fgetss_variation3-win32.phpt
+++ /dev/null
@@ -1,573 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
- reading line by line with allowable tags: <test>, <html>, <?>
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-
-$filename = __DIR__."/fgetss_variation3.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- rewind($file_handle);
- var_dump( ftell($file_handle) );
- var_dump( filesize($filename) );
- var_dump( feof($file_handle) );
-
- /* rewind the file and read the file line by line with allowable tags */
- echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
- $line = 1;
- while( !feof($file_handle) ) {
- echo "-- Line $line --\n"; $line++;
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // check the file pointer position
- var_dump( feof($file_handle) ); // check if eof reached
- }
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(0)
-int(453)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(0)
-int(453)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(0)
-int(453)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt
deleted file mode 100644
index d4120f7fc9..0000000000
--- a/ext/standard/tests/file/fgetss_variation3.phpt
+++ /dev/null
@@ -1,569 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
- reading line by line with allowable tags: <test>, <html>, <?>
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation3.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- rewind($file_handle);
- var_dump( ftell($file_handle) );
- var_dump( filesize($filename) );
- var_dump( feof($file_handle) );
-
- /* rewind the file and read the file line by line with allowable tags */
- echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
- $line = 1;
- while( !feof($file_handle) ) {
- echo "-- Line $line --\n"; $line++;
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // check the file pointer position
- var_dump( feof($file_handle) ); // check if eof reached
- }
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt
deleted file mode 100644
index 585f277e72..0000000000
--- a/ext/standard/tests/file/fgetss_variation4.phpt
+++ /dev/null
@@ -1,170 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read modes, file pointer at EOF
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip not for Windows");
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this is the text containing \r character
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation4.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- create_file ($filename); //create an empty file
- file_put_contents($filename, $string_with_tags);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- echo "-- Reading when file pointer points to EOF --\n";
- var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
- var_dump( ftell($file_handle) ); //ensure file pointer at end
- var_dump( fgetss($file_handle) ); // try to read
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // now file is at the end try reading with length and allowable tags,expecting false
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // close the file
- fclose($file_handle);
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using r mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rb mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rt mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+ mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+b mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+t mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt
deleted file mode 100644
index 035186fd09..0000000000
--- a/ext/standard/tests/file/fgetss_variation5-win32.phpt
+++ /dev/null
@@ -1,222 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes, file pointer at EOF
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-
-$filename = __DIR__."/fgetss_variation5.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- echo "-- Reading when file pointer points to EOF --\n";
- var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
- var_dump( ftell($file_handle) ); //ensure file pointer at end
- var_dump( fgetss($file_handle) ); // try to read
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // now file is at the end try reading with length and allowable tags,expecting false
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(453)
-bool(false)
-int(453)
-bool(true)
-bool(false)
-int(453)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(453)
-bool(false)
-int(453)
-bool(true)
-bool(false)
-int(453)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(453)
-bool(false)
-int(453)
-bool(true)
-bool(false)
-int(453)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt
deleted file mode 100644
index 928fdeadf5..0000000000
--- a/ext/standard/tests/file/fgetss_variation5.phpt
+++ /dev/null
@@ -1,219 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes, file pointer at EOF
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation5.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- echo "-- Reading when file pointer points to EOF --\n";
- var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
- var_dump( ftell($file_handle) ); //ensure file pointer at end
- var_dump( fgetss($file_handle) ); // try to read
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // now file is at the end try reading with length and allowable tags,expecting false
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt
index d932966ee5..cd714cca0b 100644
--- a/ext/standard/tests/file/file_error.phpt
+++ b/ext/standard/tests/file/file_error.phpt
@@ -8,14 +8,10 @@ Test file() function : error conditions
Returns the file in an array
*/
$file_path = __DIR__;
-echo "\n*** Testing error conditions ***";
+echo "\n*** Testing error conditions ***\n";
$file_handle = fopen($file_path."/file.tmp", "w");
-var_dump( file() ); // Zero No. of args
$filename = $file_path."/file.tmp";
-var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments
-
-var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag
var_dump( file($filename, 10, NULL) ); // Incorrect flag
var_dump( file("temp.tmp") ); // non existing filename
@@ -30,14 +26,6 @@ unlink($file_path."/file.tmp");
?>
--EXPECTF--
*** Testing error conditions ***
-Warning: file() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: file() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: file() expects parameter 2 to be int, string given in %s on line %d
-NULL
array(0) {
}
diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt
index d4c6f16529..9757b3be2a 100644
--- a/ext/standard/tests/file/file_get_contents_error.phpt
+++ b/ext/standard/tests/file/file_get_contents_error.phpt
@@ -17,14 +17,8 @@ include($file_path."/file.inc");
echo "\n-- Testing with Non-existing file --\n";
print( file_get_contents("/no/such/file/or/dir") );
-echo "\n-- Testing No.of arguments less than expected --\n";
-print( file_get_contents() );
-
-echo "\n-- Testing No.of arguments greater than expected --\n";
-
create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte");
$file_handle = fopen($file_path."/file_put_contents_error.tmp", "w");
-print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") );
echo "\n-- Testing for invalid negative maxlen values --";
var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) );
@@ -52,14 +46,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) {
Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
--- Testing No.of arguments less than expected --
-
-Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d
-
--- Testing No.of arguments greater than expected --
-
-Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d
-
-- Testing for invalid negative maxlen values --
Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
index f34e6ef418..a50317e8db 100644
--- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
+++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
@@ -18,15 +18,7 @@ $file_path = __DIR__;
echo "\n-- Testing with Non-existing file --\n";
print( file_get_contents("/no/such/file/or/dir") );
-echo "\n-- Testing No.of arguments less than expected --\n";
-print( file_get_contents() );
-print( file_put_contents() );
-print( file_put_contents($file_path."/".__FILE__) );
-
$file_handle = fopen($file_path."/file_put_contents.tmp", "w");
-echo "\n-- Testing No.of arguments greater than expected --\n";
-print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") );
-print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") );
echo "\n-- Testing for invalid negative maxlen values --";
file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file");
@@ -50,20 +42,6 @@ unlink($file_path."/file_put_contents1.tmp");
Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
--- Testing No.of arguments less than expected --
-
-Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d
-
-Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d
-
--- Testing No.of arguments greater than expected --
-
-Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d
-
-Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d
-
-- Testing for invalid negative maxlen values --
Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
index 4928404098..25060ea0cf 100644
--- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
@@ -38,7 +38,11 @@ $names_arr = array(
foreach($names_arr as $key =>$value) {
echo "\n-- Filename: $key --\n";
- var_dump(file_get_contents($value));
+ try {
+ var_dump(file_get_contents($value));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
@@ -77,14 +81,10 @@ Warning: file_get_contents( ): failed to open stream: Permission denied in %s on
bool(false)
-- Filename: \0 --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, string given
-- Filename: array() --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, array given
-- Filename: /no/such/file/dir --
diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt
index 97a3495d54..f826ad60c2 100644
--- a/ext/standard/tests/file/file_get_contents_variation8.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation8.phpt
@@ -37,7 +37,11 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- var_dump(file_get_contents($names_arr[$i]));
+ try {
+ var_dump(file_get_contents($names_arr[$i]));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
echo "\n*** Done ***\n";
@@ -69,13 +73,9 @@ bool(false)
Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, array given
-- Iteration 8 --
Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt
index be2a6ca0ac..f9dc6d1b8e 100644
--- a/ext/standard/tests/file/file_put_contents.phpt
+++ b/ext/standard/tests/file/file_put_contents.phpt
@@ -11,22 +11,27 @@ $file = __DIR__."/file_put_contents.txt";
$context = stream_context_create();
-var_dump(file_put_contents($file, $context));
+try {
+ var_dump(file_put_contents($file, $context));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(file_put_contents($file, new stdClass));
var_dump(file_put_contents($file, new foo));
$fp = fopen($file, "r");
-var_dump(file_put_contents($file, "string", 0, $fp));
+try {
+ var_dump(file_put_contents($file, "string", 0, $fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
@unlink($file);
echo "Done\n";
?>
---EXPECTF--
-Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+--EXPECT--
+file_put_contents(): supplied resource is not a valid stream resource
bool(false)
int(15)
-
-Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
-int(6)
+file_put_contents(): supplied resource is not a valid Stream-Context resource
Done
diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt
index ae56486d5f..1f86ba1074 100644
--- a/ext/standard/tests/file/file_put_contents_variation2.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation2.phpt
@@ -13,10 +13,10 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
echo "*** Testing file_put_contents() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ echo "Error: $err_no - $err_msg\n";
}
}
set_error_handler('test_error_handler');
@@ -110,7 +110,7 @@ unlink($filename);
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing file_put_contents() : usage variation ***
--int 0--
@@ -138,8 +138,8 @@ unlink($filename);
--associative array--
12
--nested arrays--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 8 - Array to string conversion, %s(%d)
+Error: 2 - Array to string conversion
+Error: 2 - Array to string conversion
fooArrayArray
--uppercase NULL--
diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
index 095980b536..4c03581c48 100644
--- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
@@ -35,14 +35,18 @@ $names_arr = array(
);
foreach($names_arr as $key =>$value) {
- echo "\n-- Filename: $key --\n";
- $res = file_put_contents($value, "Some data");
- if ($res !== false && $res != null) {
- echo "$res bytes written to: $value\n";
- unlink($value);
- } else {
- echo "Failed to write data to: $key\n";
- }
+ echo "\n-- Filename: $key --\n";
+ try {
+ $res = file_put_contents($value, "Some data");
+ if ($res !== false && $res != null) {
+ echo "$res bytes written to: $value\n";
+ unlink($value);
+ } else {
+ echo "Failed to write data to: $key\n";
+ }
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
@@ -77,14 +81,10 @@ Warning: file_put_contents( ): failed to open stream: Permission denied in %s on
Failed to write data to: " "
-- Filename: \0 --
-
-Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d
-Failed to write data to: \0
+file_put_contents() expects parameter 1 to be a valid path, string given
-- Filename: array() --
-
-Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d
-Failed to write data to: array()
+file_put_contents() expects parameter 1 to be a valid path, array given
-- Filename: /no/such/file/dir --
diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt
index f0161dca57..8d2c148598 100644
--- a/ext/standard/tests/file/file_put_contents_variation8.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt
index e32711cd5b..e602f3441f 100644
--- a/ext/standard/tests/file/filegroup_error.phpt
+++ b/ext/standard/tests/file/filegroup_error.phpt
@@ -15,10 +15,6 @@ var_dump( filegroup("/no/such/file/dir") );
var_dump( filegroup("string") );
var_dump( filegroup(100) );
-/* Invalid no.of arguments */
-var_dump( filegroup() ); // args < expected
-var_dump( filegroup("/no/such/file", "root") ); // args > expected
-
echo "\n*** Done ***\n";
?>
--EXPECTF--
@@ -33,10 +29,4 @@ bool(false)
Warning: filegroup(): stat failed for 100 in %s on line %d
bool(false)
-Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt
index 71def66e29..ee232e4214 100644
--- a/ext/standard/tests/file/filegroup_variation2.phpt
+++ b/ext/standard/tests/file/filegroup_variation2.phpt
@@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
/* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -22,7 +21,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -34,7 +32,6 @@ foreach( $filenames as $filename ) {
var_dump( filegroup($filename) );
clearstatcache();
}
-fclose($file_handle);
echo "\n*** Done ***";
?>
@@ -58,9 +55,6 @@ bool(false)
bool(false)
bool(false)
-Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: filegroup(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt
index a43a54da0d..274f12bb70 100644
--- a/ext/standard/tests/file/filegroup_variation3.phpt
+++ b/ext/standard/tests/file/filegroup_variation3.phpt
@@ -39,7 +39,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( filegroup( $file_path."/".$file ) );
+ try {
+ var_dump( filegroup( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -74,12 +78,8 @@ bool(false)
Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+filegroup() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+filegroup() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt
index 462ab62367..d080467f04 100644
--- a/ext/standard/tests/file/fileinode_error.phpt
+++ b/ext/standard/tests/file/fileinode_error.phpt
@@ -16,12 +16,6 @@ var_dump( fileinode("/no/such/file/dir") );
var_dump( fileinode("string") );
var_dump( fileinode(100) );
-/* No.of arguments less than expected */
-var_dump( fileinode() );
-
-/* No.of arguments greater than expected */
-var_dump( fileinode(__FILE__, "string") );
-
echo "\n*** Done ***";
--EXPECTF--
*** Testing error conditions of fileinode() ***
@@ -34,10 +28,4 @@ bool(false)
Warning: fileinode(): stat failed for 100 in %s on line 14
bool(false)
-Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17
-NULL
-
-Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt
index 3ccfc76476..f86a0b89a6 100644
--- a/ext/standard/tests/file/fileinode_variation2.phpt
+++ b/ext/standard/tests/file/fileinode_variation2.phpt
@@ -12,7 +12,6 @@ Description: Returns the inode number of the file, or FALSE in case of an error.
/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -23,7 +22,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -35,7 +33,6 @@ foreach( $filenames as $filename ) {
var_dump( fileinode($filename) );
clearstatcache();
}
-fclose($file_handle);
echo "\n*** Done ***";
?>
@@ -59,9 +56,6 @@ bool(false)
bool(false)
bool(false)
-Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: fileinode(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt
index 72dfcbdc55..16f67b0676 100644
--- a/ext/standard/tests/file/fileinode_variation3.phpt
+++ b/ext/standard/tests/file/fileinode_variation3.phpt
@@ -40,7 +40,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( fileinode( $file_path."/".$file ) );
+ try {
+ var_dump( fileinode( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -75,12 +79,8 @@ bool(false)
Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileinode() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileinode() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt
index 967a541cc0..807c09f0f0 100644
--- a/ext/standard/tests/file/fileowner_error.phpt
+++ b/ext/standard/tests/file/fileowner_error.phpt
@@ -15,10 +15,6 @@ var_dump( fileowner("/no/such/file/dir") );
var_dump( fileowner("string") );
var_dump( fileowner(100) );
-/* Invalid no.of arguments */
-var_dump( fileowner() ); // args < expected
-var_dump( fileowner("/no/such/file", "root") ); // args > expected
-
echo "\n*** Done ***\n";
?>
--EXPECTF--
@@ -33,10 +29,4 @@ bool(false)
Warning: fileowner(): stat failed for 100 in %s on line %d
bool(false)
-Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt
index 8a943e549e..b6d5afaee8 100644
--- a/ext/standard/tests/file/fileowner_variation2.phpt
+++ b/ext/standard/tests/file/fileowner_variation2.phpt
@@ -12,7 +12,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
/* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -23,7 +22,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -35,7 +33,6 @@ foreach( $filenames as $filename ) {
var_dump( fileowner($filename) );
clearstatcache();
}
-fclose($file_handle);
echo "\n*** Done ***";
?>
@@ -59,9 +56,6 @@ bool(false)
bool(false)
bool(false)
-Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: fileowner(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt
index e5d8852776..01d2da2445 100644
--- a/ext/standard/tests/file/fileowner_variation3.phpt
+++ b/ext/standard/tests/file/fileowner_variation3.phpt
@@ -40,7 +40,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( fileowner( $file_path."/".$file ) );
+ try {
+ var_dump( fileowner( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -75,12 +79,8 @@ bool(false)
Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileowner() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileowner() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt
index c8d62fd5bd..e626eab361 100644
--- a/ext/standard/tests/file/fileperms_variation2.phpt
+++ b/ext/standard/tests/file/fileperms_variation2.phpt
@@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
/* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -22,7 +21,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -34,7 +32,6 @@ foreach( $filenames as $filename ) {
var_dump( fileperms($filename) );
clearstatcache();
}
-fclose($file_handle);
echo "\n*** Done ***";
?>
@@ -58,9 +55,6 @@ bool(false)
bool(false)
bool(false)
-Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: fileperms(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt
index 6a4aacdc6d..1588ee67fe 100644
--- a/ext/standard/tests/file/fileperms_variation3.phpt
+++ b/ext/standard/tests/file/fileperms_variation3.phpt
@@ -39,7 +39,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( fileperms( $file_path."/".$file ) );
+ try {
+ var_dump( fileperms( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -74,12 +78,8 @@ bool(false)
Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileperms() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileperms() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt
index 9f721ff921..5ad8ee99ca 100644
--- a/ext/standard/tests/file/filesize_error.phpt
+++ b/ext/standard/tests/file/filesize_error.phpt
@@ -14,13 +14,6 @@ echo "*** Testing filesize(): error conditions ***";
var_dump( filesize("/no/such/file") );
var_dump( filesize("/no/such/dir") );
-/* No.of arguments less than expected */
-var_dump( filesize() );
-
-/* No.of arguments greater than expected */
-var_dump( filesize(__FILE__, 2000) );
-echo "\n";
-
echo "*** Done ***\n";
?>
--EXPECTF--
@@ -30,11 +23,4 @@ bool(false)
Warning: filesize(): stat failed for /no/such/dir in %s on line %d
bool(false)
-
-Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt
index b49a5286c6..a34671d9b0 100644
--- a/ext/standard/tests/file/filetype_error.phpt
+++ b/ext/standard/tests/file/filetype_error.phpt
@@ -16,12 +16,6 @@ print( filetype("/no/such/file/dir") );
print( filetype("string") );
print( filetype(100) );
-/* No.of args less than expected */
-print( filetype() );
-
-/* No.of args greater than expected */
-print( filetype("file", "file") );
-
echo "\n*** Done ***\n";
?>
--EXPECTF--
@@ -32,8 +26,4 @@ Warning: filetype(): Lstat failed for string in %s on line %d
Warning: filetype(): Lstat failed for 100 in %s on line %d
-Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d
-
*** Done ***
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
index 43f9112887..48cba22729 100644
--- a/ext/standard/tests/file/flock.phpt
+++ b/ext/standard/tests/file/flock.phpt
@@ -5,13 +5,14 @@ flock() tests
$file = __DIR__."/flock.dat";
-var_dump(flock());
-var_dump(flock("", "", $var));
-
$fp = fopen($file, "w");
fclose($fp);
-var_dump(flock($fp, LOCK_SH|LOCK_NB));
+try {
+ var_dump(flock($fp, LOCK_SH|LOCK_NB));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$fp = fopen($file, "w");
@@ -41,14 +42,7 @@ $file = __DIR__."/flock.dat";
unlink($file);
?>
--EXPECTF--
-Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: flock(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+flock(): supplied resource is not a valid stream resource
bool(true)
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt
index 26a8b3d01f..470c6a536f 100644
--- a/ext/standard/tests/file/flock_error.phpt
+++ b/ext/standard/tests/file/flock_error.phpt
@@ -29,7 +29,11 @@ $operations = array(
$i = 0;
foreach($operations as $operation) {
echo "\n--- Iteration $i ---";
- var_dump(flock($fp, $operation));
+ try {
+ var_dump(flock($fp, $operation));
+ } catch (TypeError $e) {
+ echo "\n", $e->getMessage(), "\n";
+ }
$i++;
}
@@ -37,16 +41,11 @@ foreach($operations as $operation) {
/* Invalid arguments */
$fp = fopen($file, "w");
fclose($fp);
-var_dump(flock($fp, LOCK_SH|LOCK_NB));
-
-var_dump(flock("", "", $var));
-
-/* No.of args leass than expected */
-var_dump(flock());
-var_dump(flock($fp));
-
-/* No.of args greater than expected */
-var_dump(flock($fp, "", $var, ""));
+try {
+ var_dump(flock($fp, LOCK_SH|LOCK_NB));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n*** Done ***\n";
?>
@@ -75,38 +74,19 @@ Warning: flock(): Illegal operation argument in %s on line %d
bool(false)
--- Iteration 4 ---
-Warning: flock() expects parameter 2 to be int, array given in %s on line %d
-NULL
+flock() expects parameter 2 to be int, array given
--- Iteration 5 ---
-Warning: flock() expects parameter 2 to be int, array given in %s on line %d
-NULL
+flock() expects parameter 2 to be int, array given
--- Iteration 6 ---
-Warning: flock() expects parameter 2 to be int, string given in %s on line %d
-NULL
+flock() expects parameter 2 to be int, string given
--- Iteration 7 ---
-Warning: flock() expects parameter 2 to be int, string given in %s on line %d
-NULL
+flock() expects parameter 2 to be int, string given
--- Iteration 8 ---
-Warning: flock() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
-Warning: flock(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: flock() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: flock() expects at most 3 parameters, 4 given in %s on line %d
-NULL
+flock() expects parameter 2 to be int, string given
+flock(): supplied resource is not a valid stream resource
*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt
index 919e80eec0..4318a844e8 100644
--- a/ext/standard/tests/file/fnmatch_variation.phpt
+++ b/ext/standard/tests/file/fnmatch_variation.phpt
@@ -66,7 +66,11 @@ $pattern_arr = array(
for( $i = 0; $i<count($pattern_arr); $i++ ) {
echo "-- Iteration $i --\n";
- var_dump( fnmatch($pattern_arr[$i], $file_name) );
+ try {
+ var_dump( fnmatch($pattern_arr[$i], $file_name) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
unlink($file_name);
@@ -78,7 +82,11 @@ function match( $pattern, $string ) {
for( $i = 0; $i<count($pattern); $i++ ) {
echo "-- Iteration $i --\n";
for( $j = 0; $j<count($string); $j++ ) {
- var_dump( fnmatch($pattern[$i], $string[$j]) );
+ try {
+ var_dump( fnmatch($pattern[$i], $string[$j]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
}
}
@@ -134,7 +142,7 @@ match($null_arr, $null_arr);
echo "\n*** Done ***\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fnmatch() with file and various patterns ***
-- Iteration 0 --
bool(true)
@@ -183,13 +191,9 @@ bool(false)
-- Iteration 22 --
bool(false)
-- Iteration 23 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 24 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 25 --
bool(false)
-- Iteration 26 --
@@ -263,84 +267,44 @@ bool(true)
--- With Strings ---
-- Iteration 0 --
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
-- Iteration 1 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 2 --
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
-- Iteration 3 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 4 --
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
bool(false)
-- Iteration 5 --
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
@@ -441,64 +405,42 @@ bool(true)
bool(true)
bool(true)
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)
-- Iteration 1 --
bool(true)
bool(true)
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)
-- Iteration 2 --
bool(true)
bool(true)
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)
-- Iteration 3 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 4 --
bool(false)
bool(false)
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
bool(false)
-- Iteration 5 --
bool(false)
bool(false)
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
diff --git a/ext/standard/tests/file/fputcsv_002.phpt b/ext/standard/tests/file/fputcsv_002.phpt
index db565d5223..90999a9e70 100644
--- a/ext/standard/tests/file/fputcsv_002.phpt
+++ b/ext/standard/tests/file/fputcsv_002.phpt
@@ -20,7 +20,7 @@ $file = __DIR__ .'/fgetcsv-test.csv';
unlink($file);
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(7) {
[0]=>
int(1)
diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt
index 1c4068cd97..f51f24c754 100644
--- a/ext/standard/tests/file/fread_error.phpt
+++ b/ext/standard/tests/file/fread_error.phpt
@@ -14,14 +14,6 @@ echo "*** Testing error conditions ***\n";
$filename = __FILE__;
$file_handle = fopen($filename, "r");
-// zero argument
-echo "-- Testing fread() with zero argument --\n";
-var_dump( fread() );
-
-// more than expected no. of args
-echo "-- Testing fread() with more than expected number of arguments --\n";
-var_dump( fread($file_handle, 10, $file_handle) );
-
// invalid length argument
echo "-- Testing fread() with invalid length arguments --\n";
$len = 0;
@@ -29,44 +21,9 @@ var_dump( fread($file_handle, $len) );
$len = -10;
var_dump( fread($file_handle, $len) );
-// test invalid arguments : non-resources
-echo "-- Testing fread() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fread() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fread($invalid_args[$loop_counter - 1], 10) );
-}
-
-// fwrite() on a file handle which is already closed
-echo "-- Testing fwrite() with closed/unset file handle --\n";
-fclose($file_handle);
-var_dump( fread($file_handle,$file_content_type) );
-
-// fwrite on a file handle which is unset
-$fp = fopen($filename, "r");
-unset($fp); //unset file handle
-var_dump( fread(@$fp,10) );
-var_dump( fclose(@$fp) );
-
echo "Done\n";
--EXPECTF--
*** Testing error conditions ***
--- Testing fread() with zero argument --
-
-Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
--- Testing fread() with more than expected number of arguments --
-
-Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-- Testing fread() with invalid length arguments --
Warning: fread(): Length parameter must be greater than 0 in %s on line %d
@@ -74,41 +31,4 @@ bool(false)
Warning: fread(): Length parameter must be greater than 0 in %s on line %d
bool(false)
--- Testing fread() with invalid arguments --
--- Iteration 1 --
-
-Warning: fread() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fread() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fread() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fread() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fread() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fread() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Testing fwrite() with closed/unset file handle --
-
-Notice: Undefined variable: file_content_type in %s on line %d
-
-Warning: fread(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fread() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt
index 7a5a70070e..343138d002 100644
--- a/ext/standard/tests/file/fscanf.phpt
+++ b/ext/standard/tests/file/fscanf.phpt
@@ -5,10 +5,6 @@ fscanf() tests
$filename = __DIR__."/fscanf.dat";
-var_dump(fscanf());
-var_dump(fscanf(array()));
-var_dump(fscanf(array(), array()));
-
file_put_contents($filename, "data");
$fp = fopen($filename, "rt");
@@ -64,14 +60,6 @@ $filename = __DIR__."/fscanf.dat";
unlink($filename);
?>
--EXPECTF--
-Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d
-NULL
int(0)
NULL
int(1)
diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt
index ea6a91e33d..5666689574 100644
--- a/ext/standard/tests/file/fscanf_error.phpt
+++ b/ext/standard/tests/file/fscanf_error.phpt
@@ -17,18 +17,12 @@ if ($file_handle == false)
fwrite($file_handle, "hello world");
fclose($file_handle);
-// zero argument
-var_dump( fscanf() );
-
-// single argument
-$file_handle = fopen($filename, 'r');
-if ($file_handle == false)
- exit("Error:failed to open file $filename");
-var_dump( fscanf($file_handle) );
-fclose($file_handle);
-
// invalid file handle
-var_dump( fscanf($file_handle, "%s") );
+try {
+ var_dump( fscanf($file_handle, "%s") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// number of formats in format strings not matching the no of variables
$file_handle = fopen($filename, 'r');
@@ -38,7 +32,7 @@ var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) );
fclose($file_handle);
// different invalid format strings
-$invalid_formats = array( $undefined_var, undefined_constant,
+$invalid_formats = array( $undefined_var,
"%", "%h", "%.", "%d%m"
);
@@ -62,24 +56,12 @@ unlink($filename);
?>
--EXPECTF--
*** Testing fscanf() for error conditions ***
-
-Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d
-bool(false)
+fscanf(): supplied resource is not a valid File-Handle resource
Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
int(-1)
-Notice: Undefined variable: undefined_var in %s on line %d
-
-Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d
-array(0) {
-}
+Warning: Undefined variable: undefined_var in %s on line %d
array(0) {
}
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
index 9c1b3a822d..cd58c30f20 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
@@ -14,86 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek()
*/
echo "*** Testing fseek() : error conditions ***\n";
-// zero argument
-echo "-- Testing fseek() with zero argument --\n";
-var_dump( fseek() );
-
-// unexpected no. of args
-echo "-- Testing fseek() with unexpected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( fseek($fp) );
-var_dump( fseek($fp, 10, $fp,10) );
-
-// test invalid arguments : non-resources
-echo "-- Testing fseek() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass
-);
-/* loop to test fseek() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fseek($invalid_args[$loop_counter - 1], 10) );
-}
// fseek() on a file handle which is already closed
-echo "-- Testing fseek() with closed/unset file handle --";
+echo "-- Testing fseek() with closed/unset file handle --\n";
+$fp = fopen(__FILE__, "r");
fclose($fp);
-var_dump(fseek($fp,10));
-
-// fseek() on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( fseek(@$file_handle,10));
+try {
+ var_dump(fseek($fp,10));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fseek() : error conditions ***
--- Testing fseek() with zero argument --
-
-Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
--- Testing fseek() with unexpected number of arguments --
-
-Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
--- Testing fseek() with invalid arguments --
--- Iteration 1 --
-
-Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fseek() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fseek() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fseek() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing fseek() with closed/unset file handle --
-Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fseek(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
index 8835046f6c..45f1298951 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
@@ -14,82 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell()
*/
echo "*** Testing ftell() : error conditions ***\n";
-// zero argument
-echo "-- Testing ftell() with zero argument --\n";
-var_dump( ftell() );
-
-// more than expected no. of args
-echo "-- Testing ftell() with more than expected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( ftell($fp, 10) );
-
-// test invalid arguments : non-resources
-echo "-- Testing ftell() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test ftell with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( ftell($invalid_args[$loop_counter - 1]) );
-}
// ftell on a file handle which is already closed
-echo "-- Testing ftell with closed/unset file handle --";
+echo "-- Testing ftell with closed/unset file handle --\n";
+$fp = fopen(__FILE__, "r");
fclose($fp);
-var_dump(ftell($fp));
-
-// ftell on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( ftell(@$file_handle) );
+try {
+ var_dump(ftell($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing ftell() : error conditions ***
--- Testing ftell() with zero argument --
-
-Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing ftell() with more than expected number of arguments --
-
-Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
--- Testing ftell() with invalid arguments --
--- Iteration 1 --
-
-Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: ftell() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: ftell() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: ftell() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing ftell with closed/unset file handle --
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
index 0b94bcffc7..e698bca463 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
@@ -14,82 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind()
*/
echo "*** Testing rewind() : error conditions ***\n";
-// zero argument
-echo "-- Testing rewind() with zero argument --\n";
-var_dump( rewind() );
-
-// more than expected no. of args
-echo "-- Testing rewind() with more than expected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( rewind($fp, 10) );
-
-// test invalid arguments : non-resources
-echo "-- Testing rewind() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test rewind with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( rewind($invalid_args[$loop_counter - 1]) );
-}
// rewind on a file handle which is already closed
-echo "-- Testing rewind() with closed/unset file handle --";
+echo "-- Testing rewind() with closed/unset file handle --\n";
+$fp = fopen(__FILE__, "r");
fclose($fp);
-var_dump(rewind($fp));
-
-// rewind on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( rewind(@$file_handle) );
+try {
+ var_dump(rewind($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing rewind() : error conditions ***
--- Testing rewind() with zero argument --
-
-Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing rewind() with more than expected number of arguments --
-
-Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
--- Testing rewind() with invalid arguments --
--- Iteration 1 --
-
-Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: rewind() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: rewind() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: rewind() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing rewind() with closed/unset file handle --
-Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+rewind(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fstat.phpt b/ext/standard/tests/file/fstat.phpt
index 415124046e..b48b06cfe5 100644
--- a/ext/standard/tests/file/fstat.phpt
+++ b/ext/standard/tests/file/fstat.phpt
@@ -8,7 +8,11 @@ $filename = __DIR__."/fstat.dat";
$fp = fopen($filename, "w");
var_dump(fstat($fp));
fclose($fp);
-var_dump(fstat($fp));
+try {
+ var_dump(fstat($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
@unlink($filename);
echo "Done\n";
@@ -68,7 +72,5 @@ array(26) {
["blocks"]=>
int(%i)
}
-
-Warning: fstat(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+fstat(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt
index 61ba1fc509..83569c47d8 100644
--- a/ext/standard/tests/file/ftruncate_error.phpt
+++ b/ext/standard/tests/file/ftruncate_error.phpt
@@ -15,51 +15,16 @@ fwrite($file_handle, "Testing ftruncate error conditions \n");
fflush($file_handle);
echo "\n Initial file size = ".filesize($filename)."\n";
-echo "-- Testing ftruncate() with less than expected number of arguments --\n";
-
-// zero arguments
-var_dump( ftruncate() );
-
-// arguments less than expected numbers
-var_dump( ftruncate( $file_handle ) );
-// check the first size
-var_dump( filesize($filename) );
-
-echo "-- Testing ftruncate() with more than expected number of arguments --\n";
-// more than expected number of arguments
-var_dump( ftruncate($file_handle, 10, 20) );
-// check the first size
-var_dump( filesize($filename) );
-
-// test invalid arguments : non-resources
-echo "-- Testing ftruncate() with invalid file pointer --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test ftruncate() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) );
-}
-
// ftruncate() on a file handle which is already closed/unset
echo "-- Testing ftruncate() with closed/unset file handle --\n";
// ftruncate on close file handle
fclose($file_handle);
-var_dump( ftruncate($file_handle,10) );
-// check the first size
-var_dump( filesize($filename) );
-
-// ftruncate on a file handle which is unset
-$fp = fopen($filename, "w");
-unset($fp); //unset file handle
-var_dump( ftruncate(@$fp,10));
+try {
+ var_dump( ftruncate($file_handle,10) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// check the first size
var_dump( filesize($filename) );
@@ -70,55 +35,11 @@ echo "Done\n";
$filename = __DIR__."/ftruncate_error.tmp";
unlink( $filename );
?>
---EXPECTF--
+--EXPECT--
*** Testing ftruncate() : error conditions ***
Initial file size = 36
--- Testing ftruncate() with less than expected number of arguments --
-
-Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-int(36)
--- Testing ftruncate() with more than expected number of arguments --
-
-Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-int(36)
--- Testing ftruncate() with invalid file pointer --
--- Iteration 1 --
-
-Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: ftruncate() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: ftruncate() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: ftruncate() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing ftruncate() with closed/unset file handle --
-
-Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-int(36)
-
-Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+ftruncate(): supplied resource is not a valid stream resource
int(36)
Done
diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt
index 7cdb270ae3..f2005d7e68 100644
--- a/ext/standard/tests/file/fwrite.phpt
+++ b/ext/standard/tests/file/fwrite.phpt
@@ -6,8 +6,7 @@ fwrite() tests
$filename = __DIR__."/fwrite.dat";
$fp = fopen($filename, "w");
-var_dump(fwrite($fp));
-var_dump(fwrite($fp, array()));
+var_dump(fwrite($fp, ""));
fclose($fp);
$fp = fopen($filename, "r");
@@ -20,35 +19,18 @@ fclose($fp);
var_dump(fwrite($fp, "data", -1));
-var_dump(fwrite(array(), "data", -1));
-var_dump(fwrite(array(), "data"));
-var_dump(fwrite(array()));
-
var_dump(file_get_contents($filename));
@unlink($filename);
echo "Done\n";
?>
--EXPECTF--
-Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
+int(0)
Notice: fwrite(): write of 4 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
int(4)
int(0)
-
-Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
string(4) "data"
Done
diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt
index a54550a6c8..236c4601b0 100644
--- a/ext/standard/tests/file/fwrite_error.phpt
+++ b/ext/standard/tests/file/fwrite_error.phpt
@@ -16,18 +16,8 @@ include ("file.inc");
echo "*** Testing fwrite() : error conditions ***\n";
$filename = __DIR__."/fwrite_error.tmp";
-
-echo "-- Testing fwrite() with less than expected number of arguments --\n";
-// zero argument
-var_dump( fwrite() );
-// less than expected, 1 arg
$file_handle = fopen ( $filename, "w");
-var_dump( fwrite($file_handle) );
-
-// more than expected no. of args
-echo "-- Testing fwrite() with more than expected number of arguments --\n";
$data = "data";
-var_dump( fwrite($file_handle, $data, strlen($data), 10) );
// invalid length argument
echo "-- Testing fwrite() with invalid length arguments --\n";
@@ -36,31 +26,14 @@ var_dump( fwrite($file_handle, $data, $len) );
$len = -10;
var_dump( fwrite($file_handle, $data, $len) );
-// test invalid arguments : non-resources
-echo "-- Testing fwrite() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fwrite() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fwrite($invalid_args[$loop_counter - 1], 10) );
-}
-
// fwrite() on a file handle which is already closed
echo "-- Testing fwrite() with closed/unset file handle --\n";
fclose($file_handle);
-var_dump(fwrite($file_handle,"data"));
-
-// fwrite on a file handle which is unset
-$fp = fopen($filename, "w");
-unset($fp); //unset file handle
-var_dump( fwrite(@$fp,"data"));
+try {
+ var_dump(fwrite($file_handle,"data"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -69,52 +42,11 @@ echo "Done\n";
$filename = __DIR__."/fwrite_error.tmp";
unlink( $filename );
?>
---EXPECTF--
+--EXPECT--
*** Testing fwrite() : error conditions ***
--- Testing fwrite() with less than expected number of arguments --
-
-Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
--- Testing fwrite() with more than expected number of arguments --
-
-Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-- Testing fwrite() with invalid length arguments --
int(0)
int(0)
--- Testing fwrite() with invalid arguments --
--- Iteration 1 --
-
-Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fwrite() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fwrite() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing fwrite() with closed/unset file handle --
-
-Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fwrite(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt
index f23d2fabef..04938e3d6b 100644
--- a/ext/standard/tests/file/get_current_user.phpt
+++ b/ext/standard/tests/file/get_current_user.phpt
@@ -3,13 +3,10 @@ get_current_user() tests
--FILE--
<?php
-var_dump(get_current_user("blah"));
var_dump(get_current_user());
echo "Done\n";
?>
--EXPECTF--
-Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
string(%d) %s
Done
diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt
index fd068b01ad..2ced6fd355 100644
--- a/ext/standard/tests/file/glob_variation-win32-mb.phpt
+++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt
@@ -46,12 +46,16 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "\n-- Iteration $counter --\n";
- var_dump( glob($pattern) ); // default arguments
- var_dump( glob($pattern, GLOB_MARK) );
- var_dump( glob($pattern, GLOB_NOSORT) );
- var_dump( glob($pattern, GLOB_NOCHECK) );
- var_dump( glob($pattern, GLOB_NOESCAPE) );
- var_dump( glob($pattern, GLOB_ERR) );
+ try {
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -73,7 +77,11 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "-- Iteration $counter --\n";
- var_dump( glob($pattern, GLOB_ONLYDIR) );
+ try {
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -326,24 +334,7 @@ array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
@@ -446,9 +437,7 @@ array(1) {
array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
}
diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt
index 9a1528bb1f..32d56e8762 100644
--- a/ext/standard/tests/file/glob_variation-win32.phpt
+++ b/ext/standard/tests/file/glob_variation-win32.phpt
@@ -45,12 +45,16 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "\n-- Iteration $counter --\n";
- var_dump( glob($pattern) ); // default arguments
- var_dump( glob($pattern, GLOB_MARK) );
- var_dump( glob($pattern, GLOB_NOSORT) );
- var_dump( glob($pattern, GLOB_NOCHECK) );
- var_dump( glob($pattern, GLOB_NOESCAPE) );
- var_dump( glob($pattern, GLOB_ERR) );
+ try {
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -72,7 +76,11 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "-- Iteration $counter --\n";
- var_dump( glob($pattern, GLOB_ONLYDIR) );
+ try {
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -325,24 +333,7 @@ array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
@@ -445,9 +436,7 @@ array(1) {
array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
}
diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt
index 056cf62bec..eb5aff0cf4 100644
--- a/ext/standard/tests/file/glob_variation.phpt
+++ b/ext/standard/tests/file/glob_variation.phpt
@@ -48,12 +48,16 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "\n-- Iteration $counter --\n";
- var_dump( glob($pattern) ); // default arguments
- var_dump( glob($pattern, GLOB_MARK) );
- var_dump( glob($pattern, GLOB_NOSORT) );
- var_dump( glob($pattern, GLOB_NOCHECK) );
- var_dump( glob($pattern, GLOB_NOESCAPE) );
- var_dump( glob($pattern, GLOB_ERR) );
+ try {
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -75,7 +79,11 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "-- Iteration $counter --\n";
- var_dump( glob($pattern, GLOB_ONLYDIR) );
+ try {
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -328,24 +336,7 @@ array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
@@ -448,9 +439,7 @@ array(1) {
array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
}
diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt
index 86c40da0eb..060739ff3d 100644
--- a/ext/standard/tests/file/is_dir_variation3.phpt
+++ b/ext/standard/tests/file/is_dir_variation3.phpt
@@ -9,8 +9,6 @@ Test is_dir() function: usage variations - invalid arguments
/* Passing invalid arguments to is_dir() */
-$dir_handle = opendir( __DIR__ );
-
echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n";
$dirnames = array(
/* Invalid dirnames */
@@ -19,7 +17,6 @@ $dirnames = array(
FALSE,
NULL,
" ",
- $dir_handle,
/* scalars */
0,
@@ -30,7 +27,6 @@ $dirnames = array(
foreach($dirnames as $dirname) {
var_dump( is_dir($dirname) );
}
-closedir($dir_handle);
echo "\n*** Done ***";
?>
@@ -41,9 +37,6 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt
index 543533f8ed..8d4838524e 100644
--- a/ext/standard/tests/file/is_dir_variation4.phpt
+++ b/ext/standard/tests/file/is_dir_variation4.phpt
@@ -38,7 +38,11 @@ $count = 1;
/* loop through to test each element the above array */
foreach($dirs_arr as $dir) {
echo "\n-- Iteration $count --\n";
- var_dump( is_dir($file_path."/".$dir ) );
+ try {
+ var_dump( is_dir($file_path."/".$dir ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
@@ -77,13 +81,9 @@ bool(true)
bool(false)
-- Iteration 9 --
-
-Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_dir() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
-
-Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_dir() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt
index 99c218b514..ad90d64435 100644
--- a/ext/standard/tests/file/is_executable_error.phpt
+++ b/ext/standard/tests/file/is_executable_error.phpt
@@ -6,24 +6,11 @@ Test is_executable() function: error conditions
Description: Tells whether the filename is executable
*/
-echo "*** Testing is_executable(): error conditions ***\n";
-var_dump( is_executable() ); // args < expected no of arguments
-
-var_dump( is_executable(1, 2) ); // args > expected no. of arguments
-
echo "\n*** Testing is_exceutable() on non-existent directory ***\n";
var_dump( is_executable(__DIR__."/is_executable") );
echo "Done\n";
--EXPECTF--
-*** Testing is_executable(): error conditions ***
-
-Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing is_exceutable() on non-existent directory ***
bool(false)
Done
diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt
index 1e8d8f5faf..5c8193b44d 100644
--- a/ext/standard/tests/file/is_executable_variation1.phpt
+++ b/ext/standard/tests/file/is_executable_variation1.phpt
@@ -51,7 +51,11 @@ $counter = 1;
is an executable file */
foreach($files_arr as $file) {
echo "-- Iteration $counter --\n";
- var_dump( is_executable($file) );
+ try {
+ var_dump( is_executable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
clearstatcache();
}
@@ -76,13 +80,9 @@ bool(false)
-- Iteration 5 --
bool(false)
-- Iteration 6 --
-
-Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_executable() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_executable() expects parameter 1 to be a valid path, string given
-- Iteration 8 --
bool(false)
-- Iteration 9 --
diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt
index 1a71a5a005..92ad3320d3 100644
--- a/ext/standard/tests/file/is_executable_variation3.phpt
+++ b/ext/standard/tests/file/is_executable_variation3.phpt
@@ -29,7 +29,6 @@ $invalid_files = array(
FALSE,
NULL,
" ",
- @array(),
@$file_handle
);
/* loop through to test each element in the above array
@@ -52,8 +51,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
bool(false)
Done
diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt
index 0a06ad5015..884f292b26 100644
--- a/ext/standard/tests/file/is_file_variation3.phpt
+++ b/ext/standard/tests/file/is_file_variation3.phpt
@@ -7,7 +7,7 @@ Test is_file() function: usage variations - invalid filenames
Returns TRUE if the filename exists and is a regular file
*/
-/* Testing is_file() with invalid arguments -int, float, bool, NULL, resource */
+/* Testing is_file() with invalid arguments -int, float, bool, NULL */
function flatten($variable) {
\ob_start();
@@ -29,10 +29,7 @@ foreach([
/* scalars */
1234,
- 0,
-
- /* resource */
- fopen(__FILE__, "r")
+ 0
] as $filename ) {
printf(
"%s: %d\n",
@@ -49,4 +46,3 @@ bool(false): 0
NULL: 0
int(1234): 0
int(0): 0
-resource(%d) of type (stream): 0
diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt
index 39a640e7eb..e67180c086 100644
--- a/ext/standard/tests/file/is_file_variation4.phpt
+++ b/ext/standard/tests/file/is_file_variation4.phpt
@@ -38,7 +38,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( is_file( $file_path."/".$file ) );
+ try {
+ var_dump( is_file( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -67,12 +71,8 @@ bool(false)
- Iteration 6 -
bool(false)
- Iteration 7 -
-
-Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_file() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_file() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt
index ad6c2b8c62..1520eb4d20 100644
--- a/ext/standard/tests/file/is_readable_error.phpt
+++ b/ext/standard/tests/file/is_readable_error.phpt
@@ -6,24 +6,12 @@ Test is_readable() function: error conditions
Description: Tells whether the filename is readable
*/
-echo "*** Testing is_readable(): error conditions ***\n";
-var_dump( is_readable() ); // args < expected
-var_dump( is_readable(1, 2) ); // args > expected
-
echo "\n*** Testing is_readable() on non-existent file ***\n";
var_dump( is_readable(__DIR__."/is_readable.tmp") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing is_readable(): error conditions ***
-
-Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing is_readable() on non-existent file ***
bool(false)
Done
diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt
index 60729b5ac2..ab2e591ad5 100644
--- a/ext/standard/tests/file/is_readable_variation1.phpt
+++ b/ext/standard/tests/file/is_readable_variation1.phpt
@@ -50,7 +50,11 @@ $counter = 1;
is a writable file */
foreach($files_arr as $file) {
echo "-- Iteration $counter --\n";
- var_dump( is_readable($file) );
+ try {
+ var_dump( is_readable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
clearstatcache();
}
@@ -77,17 +81,11 @@ bool(false)
-- Iteration 6 --
bool(false)
-- Iteration 7 --
-
-Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_readable() expects parameter 1 to be a valid path, string given
-- Iteration 8 --
-
-Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_readable() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
-
-Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_readable() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
bool(true)
-- Iteration 11 --
diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt
index c73a28520f..9a80792c00 100644
--- a/ext/standard/tests/file/is_readable_variation3.phpt
+++ b/ext/standard/tests/file/is_readable_variation3.phpt
@@ -26,7 +26,6 @@ $misc_files = array(
FALSE,
NULL,
" ",
- @array(),
@$file_handle
);
/* loop through to test each element in the above array
@@ -49,8 +48,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
bool(false)
Done
diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt
index 1721935549..d053244a79 100644
--- a/ext/standard/tests/file/is_uploaded_file_basic.phpt
+++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt
@@ -29,19 +29,9 @@ var_dump(is_uploaded_file('random_filename.txt'));
// not an uploaded file
var_dump(is_uploaded_file('__FILE__'));
-// Error cases
-var_dump(is_uploaded_file());
-var_dump(is_uploaded_file('a', 'b'));
-
?>
--EXPECTF--
bool(true)
bool(false)
bool(false)
bool(false)
-
-Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt
index a9633f2284..e2a38412cd 100644
--- a/ext/standard/tests/file/is_writable_error.phpt
+++ b/ext/standard/tests/file/is_writable_error.phpt
@@ -8,14 +8,6 @@ Test is_writable() and its alias is_writeable() function: error conditions
is_writeable() is an alias of is_writable()
*/
-echo "*** Testing is_writable(): error conditions ***\n";
-var_dump( is_writable() ); // args < expected
-var_dump( is_writeable() );
-
-echo "\n*** Testing is_writeable(): error conditions ***\n";
-var_dump( is_writable(1, 2) ); // args > expected
-var_dump( is_writeable(1, 2) );
-
echo "\n*** Testing is_writable() on non-existent file ***\n";
var_dump( is_writable(__DIR__."/is_writable") );
var_dump( is_writeable(__DIR__."/is_writable") );
@@ -23,22 +15,6 @@ var_dump( is_writeable(__DIR__."/is_writable") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing is_writable(): error conditions ***
-
-Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-*** Testing is_writeable(): error conditions ***
-
-Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing is_writable() on non-existent file ***
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt
index 6ce05f172e..45ef1524b6 100644
--- a/ext/standard/tests/file/is_writable_variation1.phpt
+++ b/ext/standard/tests/file/is_writable_variation1.phpt
@@ -50,8 +50,16 @@ $counter = 1;
is a writable file */
foreach($files_arr as $file) {
echo "-- Iteration $counter --\n";
- var_dump( is_writable($file) );
- var_dump( is_writeable($file) );
+ try {
+ var_dump( is_writable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( is_writeable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
clearstatcache();
}
@@ -84,26 +92,14 @@ bool(false)
bool(false)
bool(false)
-- Iteration 7 --
-
-Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_writable() expects parameter 1 to be a valid path, string given
+is_writeable() expects parameter 1 to be a valid path, string given
-- Iteration 8 --
-
-Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_writable() expects parameter 1 to be a valid path, string given
+is_writeable() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
-
-Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_writable() expects parameter 1 to be a valid path, string given
+is_writeable() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt
index 305bebef8f..b55a193fce 100644
--- a/ext/standard/tests/file/is_writable_variation3.phpt
+++ b/ext/standard/tests/file/is_writable_variation3.phpt
@@ -25,7 +25,6 @@ $misc_files = array(
FALSE,
NULL,
" ",
- @array(),
@$file_handle
);
/* loop through to test each element in the above array
@@ -56,12 +55,6 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
bool(false)
bool(false)
Done
diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt
index dbd9a7bbe8..5f9e8dbe69 100644
--- a/ext/standard/tests/file/lchown_error.phpt
+++ b/ext/standard/tests/file/lchown_error.phpt
@@ -21,20 +21,9 @@ $filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown.txt';
touch( $filename );
$uid = posix_getuid();
-
-// Less than expected arguments
-var_dump( lchown( $filename ) );
-
-// More than expected arguments
-var_dump( lchown( $filename, $uid, 'foobar' ) );
-
// Non-existent filename
var_dump( lchown( 'foobar_lchown.txt', $uid ) );
-// Wrong argument types
-var_dump( lchown( new StdClass(), $uid ) );
-var_dump( lchown( array(), $uid ) );
-
// Bad user
var_dump( lchown( $filename, -5 ) );
@@ -50,21 +39,9 @@ unlink($filename);
--EXPECTF--
*** Testing lchown() : error functionality ***
-Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d
-bool(true)
-
-Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d
-bool(true)
-
Warning: lchown(): No such file or directory in %s on line %d
bool(false)
-Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d
-bool(true)
-
-Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d
-bool(true)
-
Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d
bool(false)
===DONE===
diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt
index 543e296ec2..06926df2a2 100644
--- a/ext/standard/tests/file/lstat_stat_error.phpt
+++ b/ext/standard/tests/file/lstat_stat_error.phpt
@@ -17,54 +17,28 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
echo "*** Testing lstat() for error conditions ***\n";
$file_path = __DIR__;
-var_dump( lstat() ); // args < expected
-var_dump( lstat(__FILE__, 2) ); // args > expected
var_dump( lstat("$file_path/temp.tmp") ); // non existing file
var_dump( lstat(22) ); // scalar argument
-$arr = array(__FILE__);
-var_dump( lstat($arr) ); // array argument
echo "\n*** Testing stat() for error conditions ***\n";
-var_dump( stat() ); // args < expected
-var_dump( stat(__FILE__, 2) ); // file, args > expected
-var_dump( stat(__DIR__, 2) ); //dir, args > expected
var_dump( stat("$file_path/temp.tmp") ); // non existing file
var_dump( stat("$file_path/temp/") ); // non existing dir
var_dump( stat(22) ); // scalar argument
-var_dump( stat($arr) ); // array argument
echo "Done\n";
?>
--EXPECTF--
*** Testing lstat() for error conditions ***
-Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: lstat(): Lstat failed for %s in %s on line %d
bool(false)
Warning: lstat(): Lstat failed for 22 in %s on line %d
bool(false)
-Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
-
*** Testing stat() for error conditions ***
-Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: stat(): stat failed for %s in %s on line %d
bool(false)
@@ -73,7 +47,4 @@ bool(false)
Warning: stat(): stat failed for 22 in %s on line %d
bool(false)
-
-Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt
index 17f908c3f6..be0b434c2c 100644
--- a/ext/standard/tests/file/mkdir_rmdir_error.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt
@@ -9,48 +9,12 @@ Test mkdir() and rmdir() functions : error conditions
Description: Removes directory
*/
-echo "*** Testing mkdir(): error conditions ***\n";
-var_dump( mkdir() ); // args < expected
-var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected
-var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected
-
-echo "\n*** Testing rmdir(): error conditions ***\n";
-var_dump( rmdir() ); // args < expected
-var_dump( rmdir(1, 2, 3) ); // args > expected
-var_dump( rmdir("testdir", $context, "test") ); // args > expected
-
echo "\n*** Testing rmdir() on non-existent directory ***\n";
var_dump( rmdir("temp") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing mkdir(): error conditions ***
-
-Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: context in %s on line %d
-
-Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-
-*** Testing rmdir(): error conditions ***
-
-Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: context in %s on line %d
-
-Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
*** Testing rmdir() on non-existent directory ***
Warning: rmdir(temp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
index 22c055ddb5..8712d52604 100644
--- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
@@ -26,8 +26,16 @@ var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) );
var_dump( rmdir("$file_path/mkdir_variation2/") );
echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
-var_dump( mkdir("$file_path/temp".chr(0)."/") );
-var_dump( rmdir("$file_path/temp".chr(0)."/") );
+try {
+ var_dump( mkdir("$file_path/temp".chr(0)."/") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( rmdir("$file_path/temp".chr(0)."/") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n*** Testing mkdir() with miscelleneous input ***\n";
/* changing mode of mkdir to prevent creating sub-directory under it */
@@ -55,12 +63,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d
bool(false)
*** Testing mkdir() and rmdir() for binary safe functionality ***
-
-Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d
-bool(false)
-
-Warning: rmdir() expects parameter 1 to be a valid path, string given in %s on line %d
-bool(false)
+mkdir() expects parameter 1 to be a valid path, string given
+rmdir() expects parameter 1 to be a valid path, string given
*** Testing mkdir() with miscelleneous input ***
bool(true)
diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt
index c6cfdd3203..7af8748fe2 100644
--- a/ext/standard/tests/file/move_uploaded_file_basic.phpt
+++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt
@@ -49,11 +49,6 @@ fclose($fd);
var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4));
unlink($destination4);
-echo "Wrong parameters\n";
-var_dump(move_uploaded_file());
-var_dump(move_uploaded_file(1, 2, 3));
-
-
?>
--EXPECTF--
Valid move
@@ -66,10 +61,3 @@ Non-uploaded source file
bool(false)
Valid move to existing file
bool(true)
-Wrong parameters
-
-Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt
index 29e022fb13..5c812d7b9a 100644
--- a/ext/standard/tests/file/parse_ini_file_error.phpt
+++ b/ext/standard/tests/file/parse_ini_file_error.phpt
@@ -10,10 +10,6 @@ Test parse_ini_file() function : error conditions
echo "*** Testing parse_ini_file() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing parse_ini_file() function with Zero arguments --\n";
-var_dump( parse_ini_file() );
-
//Test parse_ini_file with one more than the expected number of arguments
echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n";
$filename = 'string_val';
@@ -30,11 +26,6 @@ echo "Done";
--EXPECTF--
*** Testing parse_ini_file() : error conditions ***
--- Testing parse_ini_file() function with Zero arguments --
-
-Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-- Testing parse_ini_file() function with more than expected no. of arguments --
Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt
index 96d44433f7..acdb4d83eb 100644
--- a/ext/standard/tests/file/parse_ini_file_variation3.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt
@@ -43,7 +43,6 @@ log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
-track_errors = Off
docref_root = "/phpmanual/"
docref_ext = .html
@@ -77,7 +76,7 @@ foreach($newdirs as $newdir) {
--EXPECTF--
*** Testing parse_ini_file() : variation ***
New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
-array(11) {
+array(10) {
["error_reporting"]=>
string(5) "32767"
["display_errors"]=>
@@ -94,8 +93,6 @@ array(11) {
string(0) ""
["report_memleaks"]=>
string(1) "1"
- ["track_errors"]=>
- string(0) ""
["docref_root"]=>
string(11) "/phpmanual/"
["docref_ext"]=>
diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt
index 421f378e01..a671c22fda 100644
--- a/ext/standard/tests/file/pathinfo_variaton.phpt
+++ b/ext/standard/tests/file/pathinfo_variaton.phpt
@@ -43,9 +43,6 @@ $paths = array (
"./array(1, 2)",
"array( array(), null)",
- /* pathname as object */
- $obj,
-
/* pathname as spaces */
" ",
' ',
@@ -93,7 +90,7 @@ echo "Done\n";
--EXPECTF--
*** Testing pathinfo() with miscelleneous input arguments ***
-Notice: Undefined variable: fp in %s on line %d
+Warning: Undefined variable: fp in %s on line %d
-- Iteration 1 --
array(3) {
["dirname"]=>
@@ -199,22 +196,6 @@ string(21) "array( array(), null)"
string(0) ""
string(21) "array( array(), null)"
-- Iteration 9 --
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
--- Iteration 10 --
array(3) {
["dirname"]=>
string(1) "."
@@ -227,7 +208,7 @@ string(1) "."
string(1) " "
string(0) ""
string(1) " "
--- Iteration 11 --
+-- Iteration 10 --
array(3) {
["dirname"]=>
string(1) "."
@@ -240,7 +221,7 @@ string(1) "."
string(1) " "
string(0) ""
string(1) " "
--- Iteration 12 --
+-- Iteration 11 --
array(2) {
["basename"]=>
string(0) ""
@@ -251,7 +232,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 13 --
+-- Iteration 12 --
array(2) {
["basename"]=>
string(0) ""
@@ -262,7 +243,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 14 --
+-- Iteration 13 --
array(2) {
["basename"]=>
string(0) ""
@@ -273,7 +254,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 15 --
+-- Iteration 14 --
array(2) {
["basename"]=>
string(0) ""
@@ -284,7 +265,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 16 --
+-- Iteration 15 --
array(2) {
["basename"]=>
string(0) ""
@@ -295,7 +276,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 17 --
+-- Iteration 16 --
array(4) {
["dirname"]=>
string(1) "."
@@ -310,7 +291,7 @@ string(1) "."
string(11) "www.foo.com"
string(3) "com"
string(7) "www.foo"
--- Iteration 18 --
+-- Iteration 17 --
array(4) {
["dirname"]=>
string(17) "/var/html/testdir"
@@ -325,7 +306,7 @@ string(17) "/var/html/testdir"
string(12) "example.html"
string(4) "html"
string(7) "example"
--- Iteration 19 --
+-- Iteration 18 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
@@ -338,7 +319,7 @@ string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 20 --
+-- Iteration 19 --
array(4) {
["dirname"]=>
string(4) "/foo"
@@ -353,7 +334,7 @@ string(4) "/foo"
string(12) "symlink.link"
string(4) "link"
string(7) "symlink"
--- Iteration 21 --
+-- Iteration 20 --
array(3) {
["dirname"]=>
string(1) "."
@@ -366,7 +347,7 @@ string(1) "."
string(5) "12345"
string(0) ""
string(5) "12345"
--- Iteration 22 --
+-- Iteration 21 --
array(4) {
["dirname"]=>
string(1) "."
@@ -381,7 +362,7 @@ string(1) "."
string(15) "www.example.com"
string(3) "com"
string(11) "www.example"
--- Iteration 23 --
+-- Iteration 22 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
@@ -394,7 +375,7 @@ string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 24 --
+-- Iteration 23 --
array(4) {
["dirname"]=>
string(6) "../foo"
@@ -409,7 +390,7 @@ string(6) "../foo"
string(9) "test.link"
string(4) "link"
string(4) "test"
--- Iteration 25 --
+-- Iteration 24 --
array(4) {
["dirname"]=>
string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6"
@@ -424,7 +405,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes
string(8) "test.tmp"
string(3) "tmp"
string(4) "test"
--- Iteration 26 --
+-- Iteration 25 --
array(4) {
["dirname"]=>
string(1) "."
diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt
index b0e86be65c..eebe6a7a00 100644
--- a/ext/standard/tests/file/popen_pclose_error.phpt
+++ b/ext/standard/tests/file/popen_pclose_error.phpt
@@ -16,14 +16,9 @@ if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN')
*/
$file_path = __DIR__;
echo "*** Testing for error conditions ***\n";
-var_dump( popen() ); // Zero Arguments
-var_dump( popen("abc.txt") ); // Single Argument
var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument
-var_dump( pclose() );
$file_handle = fopen($file_path."/popen.tmp", "w");
-var_dump( pclose($file_handle, $file_handle) );
fclose($file_handle);
-var_dump( pclose(1) );
echo "\n--- Done ---";
?>
--CLEAN--
@@ -34,22 +29,7 @@ unlink($file_path."/popen.tmp");
--EXPECTF--
*** Testing for error conditions ***
-Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: popen(abc.txt,rw): %s on line %d
bool(false)
-Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
-
--- Done ---
diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt
index 0dc1f7b82f..9e5c6e5702 100644
--- a/ext/standard/tests/file/readfile_error.phpt
+++ b/ext/standard/tests/file/readfile_error.phpt
@@ -9,17 +9,12 @@ Test readfile() function: error conditions
$context = stream_context_create();
echo "*** Test readfile(): error conditions ***\n";
-echo "-- Testing readfile() with unexpected no. of arguments --\n";
-var_dump( readfile() ); // args < expected
-var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected
echo "\n-- Testing readfile() with invalid arguments --\n";
// invalid arguments
var_dump( readfile(NULL) ); // NULL as $filename
var_dump( readfile('') ); // empty string as $filename
var_dump( readfile(false) ); // boolean false as $filename
-var_dump( readfile(__FILE__, false, '') ); // empty string as $context
-var_dump( readfile(__FILE__, true, false) ); // boolean false as $context
echo "\n-- Testing readfile() with non-existent file --\n";
$non_existent_file = __DIR__."/non_existent_file.tmp";
@@ -29,13 +24,6 @@ echo "Done\n";
?>
--EXPECTF--
*** Test readfile(): error conditions ***
--- Testing readfile() with unexpected no. of arguments --
-
-Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-- Testing readfile() with invalid arguments --
@@ -48,12 +36,6 @@ bool(false)
Warning: readfile(): Filename cannot be empty in %s on line %d
bool(false)
-Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: readfile() expects parameter 3 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing readfile() with non-existent file --
Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d
diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt
index a240a826b9..04fdafca79 100644
--- a/ext/standard/tests/file/readfile_variation10-win32.phpt
+++ b/ext/standard/tests/file/readfile_variation10-win32.phpt
@@ -36,8 +36,12 @@ $names_arr = array(
);
foreach($names_arr as $key => $value) {
- echo "\n-- Filename: $key --\n";
- readfile($value);
+ echo "\n-- Filename: $key --\n";
+ try {
+ readfile($value);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
@@ -70,12 +74,10 @@ Warning: readfile(): Filename cannot be empty in %s on line %d
Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
-- Filename: \0 --
-
-Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d
+readfile() expects parameter 1 to be a valid path, string given
-- Filename: array() --
-
-Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d
+readfile() expects parameter 1 to be a valid path, array given
-- Filename: /no/such/file/dir --
diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt
index 59b92ad365..5a0070c04f 100644
--- a/ext/standard/tests/file/readfile_variation10.phpt
+++ b/ext/standard/tests/file/readfile_variation10.phpt
Binary files differ
diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt
index e2afb8bb36..07880d1007 100644
--- a/ext/standard/tests/file/readlink_realpath_error.phpt
+++ b/ext/standard/tests/file/readlink_realpath_error.phpt
@@ -15,10 +15,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
Description: Returns canonicalized absolute pathname
*/
-echo "*** Testing readlink(): error conditions ***\n";
-var_dump( readlink() ); // args < expected
-var_dump( readlink(__FILE__, 2) ); // args > expected
-
echo "\n*** Testing readlink() on a non-existent link ***\n";
var_dump( readlink(__DIR__."/readlink_error.tmp") );
@@ -28,24 +24,12 @@ var_dump( readlink(__FILE__) );
echo "\n*** Testing readlink() on existing directory ***\n";
var_dump( readlink(__DIR__) );
-echo "*** Testing realpath(): error conditions ***\n";
-var_dump( realpath() ); // args < expected
-var_dump( realpath(1, 2) ); // args > expected
-
echo "\n*** Testing realpath() on a non-existent file ***\n";
var_dump( realpath(__DIR__."/realpath_error.tmp") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing readlink(): error conditions ***
-
-Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing readlink() on a non-existent link ***
Warning: readlink(): No such file or directory in %s on line %d
@@ -60,13 +44,6 @@ bool(false)
Warning: readlink(): Invalid argument in %s on line %d
bool(false)
-*** Testing realpath(): error conditions ***
-
-Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
*** Testing realpath() on a non-existent file ***
%s
diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt
index a54a246dc3..2971c1e146 100644
--- a/ext/standard/tests/file/readlink_variation1.phpt
+++ b/ext/standard/tests/file/readlink_variation1.phpt
@@ -10,7 +10,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
/* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/readlink_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -20,7 +19,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -32,7 +30,6 @@ foreach( $filenames as $filename ) {
var_dump( readlink($filename) );
clearstatcache();
}
-fclose($file_handle);
echo "\n*** Done ***";
?>
@@ -59,9 +56,6 @@ bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
-Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: readlink(): %s in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt
deleted file mode 100644
index 2fd221e45a..0000000000
--- a/ext/standard/tests/file/realpath_error-win32.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Test realpath() function: error conditions
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only on Windows');
-}
-?>
---FILE--
-<?php
-/* Prototype: string realpath ( string $path );
- Description: Returns canonicalized absolute pathname
-*/
-
-echo "*** Testing realpath() for error conditions ***\n";
-var_dump( realpath() ); // args < expected
-var_dump( realpath(1, 2) ); // args > expected
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing realpath() for error conditions ***
-
-Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt
index d8db734e38..c0299c27ab 100644
--- a/ext/standard/tests/file/rename_variation13-win32.phpt
+++ b/ext/standard/tests/file/rename_variation13-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt
index 1cadd8a438..209c950170 100644
--- a/ext/standard/tests/file/rename_variation13.phpt
+++ b/ext/standard/tests/file/rename_variation13.phpt
@@ -30,8 +30,6 @@ $names_arr = array(
NULL,
"",
" ",
- "\0",
- array(),
/* prefix with path separator of a non existing directory*/
"/no/such/file/dir",
@@ -97,24 +95,6 @@ bool(true)
Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d
bool(false)
--- testing '%s' --
-
-Warning: rename() %s in %s on line %d
-bool(false)
-
-Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d
-
-Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d
-bool(false)
--- testing 'Array' --
-
-Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d
-bool(false)
-
-Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d
-
-Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d
-bool(false)
-- testing '/no/such/file/dir' --
Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt
index 735a17cb26..3d4e367739 100644
--- a/ext/standard/tests/file/stat_error-win32.phpt
+++ b/ext/standard/tests/file/stat_error-win32.phpt
@@ -17,29 +17,16 @@ $file_path = __DIR__;
$arr = array(__FILE__);
echo "\n*** Testing stat() for error conditions ***\n";
-var_dump( stat() ); // args < expected
-var_dump( stat(__FILE__, 2) ); // file, args > expected
-var_dump( stat(__DIR__, 2) ); //dir, args > expected
var_dump( stat("$file_path/temp.tmp") ); // non existing file
var_dump( stat("$file_path/temp/") ); // non existing dir
var_dump( stat(22) ); // scalar argument
-var_dump( stat($arr) ); // array argument
echo "Done\n";
?>
--EXPECTF--
*** Testing stat() for error conditions ***
-Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: stat(): stat failed for %s in %s on line %d
bool(false)
@@ -48,7 +35,4 @@ bool(false)
Warning: stat(): stat failed for 22 in %s on line %d
bool(false)
-
-Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt
index b18dd85b31..84f3b78f06 100644
--- a/ext/standard/tests/file/stream_002.phpt
+++ b/ext/standard/tests/file/stream_002.phpt
@@ -15,8 +15,6 @@ var_dump(stream_socket_client(".", $a, $b));
var_dump($a, $b);
var_dump(stream_socket_client(1, $a, $b));
var_dump($a, $b);
-var_dump(stream_socket_client(array(), $a, $b));
-var_dump($a, $b);
echo "Done\n";
?>
@@ -45,9 +43,4 @@ Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address
bool(false)
int(0)
string(27) "Failed to parse address "1""
-
-Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-int(0)
-string(27) "Failed to parse address "1""
Done
diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt
index 1dce5adf6c..6c58d0d7ad 100644
--- a/ext/standard/tests/file/stream_rfc2397_002.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_002.phpt
@@ -24,9 +24,11 @@ $streams = array(
foreach($streams as $stream)
{
$stream = fopen($stream, 'r');
- $meta = @stream_get_meta_data($stream);
- var_dump($meta);
- var_dump(isset($meta['foo']) ? $meta['foo'] : null);
+ if ($stream) {
+ $meta = stream_get_meta_data($stream);
+ var_dump($meta);
+ var_dump(isset($meta['foo']) ? $meta['foo'] : null);
+ }
}
?>
@@ -52,8 +54,6 @@ array(7) {
NULL
Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
array(7) {
["base64"]=>
bool(true)
@@ -73,16 +73,10 @@ array(7) {
NULL
Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
array(8) {
["mediatype"]=>
string(10) "text/plain"
@@ -104,8 +98,6 @@ array(8) {
NULL
Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
array(9) {
["mediatype"]=>
string(10) "text/plain"
@@ -129,8 +121,6 @@ array(9) {
string(3) "bar"
Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
array(9) {
["mediatype"]=>
string(10) "text/plain"
@@ -154,8 +144,6 @@ array(9) {
string(3) "bar"
Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
array(10) {
["mediatype"]=>
string(10) "text/plain"
diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt
index f6616a0c88..18d1c1b280 100644
--- a/ext/standard/tests/file/stream_rfc2397_006.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_006.phpt
@@ -14,18 +14,19 @@ $streams = array(
foreach($streams as $stream)
{
- var_dump(file_get_contents($stream));
+ try {
+ var_dump(file_get_contents($stream));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
-NULL
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, string given
+file_get_contents() expects parameter 1 to be a valid path, string given
Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
bool(false)
diff --git a/ext/standard/tests/file/stream_supports_lock.phpt b/ext/standard/tests/file/stream_supports_lock.phpt
index 38a84dd7c2..0d2f04b72d 100644
--- a/ext/standard/tests/file/stream_supports_lock.phpt
+++ b/ext/standard/tests/file/stream_supports_lock.phpt
@@ -26,7 +26,11 @@ fclose($fp);
$sock = stream_context_create();
var_dump($sock);
-var_dump(stream_supports_lock($sock));
+try {
+ var_dump(stream_supports_lock($sock));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -40,7 +44,5 @@ bool(false)
resource(%d) of type (stream)
bool(false)
resource(%d) of type (stream-context)
-
-Warning: stream_supports_lock(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+stream_supports_lock(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
index ddee40ecdd..6ee0f8aca7 100644
--- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
@@ -33,11 +33,6 @@ fclose($fp);
$linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error1.tmp";
echo "*** Testing symlink() for error conditions ***\n";
-//zero arguments
-var_dump( symlink() );
-
-//more than expected
-var_dump( symlink($filename, $linkname, true) );
//invalid arguments
var_dump( symlink(NULL, $linkname) ); // NULL as filename
@@ -48,11 +43,6 @@ var_dump( symlink($filename, '') ); // '' as linkname
var_dump( symlink($filename, false) ); // false as linkname
echo "\n*** Testing linkinfo() for error conditions ***\n";
-//zero arguments
-var_dump( linkinfo() );
-
-//more than expected
-var_dump( linkinfo($linkname, true) );
//invalid arguments
var_dump( linkinfo(NULL) ); // NULL as linkname
@@ -69,12 +59,6 @@ unlink(__DIR__."/symlink_link_linkinfo_is_link_error1.tmp");
--EXPECTF--
*** Testing symlink() for error conditions ***
-Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: symlink(): %s in %s on line %d
bool(false)
@@ -95,12 +79,6 @@ bool(false)
*** Testing linkinfo() for error conditions ***
-Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: linkinfo(): %s in %s on line %d
int(-1)
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
index 7e22741aa8..287ac4eb5f 100644
--- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
@@ -30,11 +30,6 @@ fclose($fp);
$linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error2.tmp";
echo "*** Testing link() for error conditions ***\n";
-//zero arguments
-var_dump( link() );
-
-//more than expected
-var_dump( link($filename, $linkname, false) );
//invalid arguments
var_dump( link(NULL, $linkname) ); // NULL as filename
@@ -46,11 +41,6 @@ var_dump( link($filename, '') ); // '' as linkname
var_dump( link($filename, false) ); // false as linkname
echo "\n*** Testing is_link() for error conditions ***\n";
-//zero arguments
-var_dump( is_link() );
-
-//more than expected
-var_dump( is_link($linkname, "/") );
//invalid arguments
var_dump( is_link(NULL) ); // NULL as linkname
@@ -68,12 +58,6 @@ unlink(__DIR__."/symlink_link_linkinfo_is_link_error2.tmp");
--EXPECTF--
*** Testing link() for error conditions ***
-Warning: link() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: link() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: link(): No such file or directory in %s on line %d
bool(false)
@@ -96,12 +80,6 @@ Warning: link(): No such file or directory in %s on line %d
bool(false)
*** Testing is_link() for error conditions ***
-
-Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt
index c79aabfb62..ac22017a65 100644
--- a/ext/standard/tests/file/tempnam_variation3-win32.phpt
+++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt
@@ -59,7 +59,12 @@ $res_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- $file_name = tempnam($file_path, $names_arr[$i]);
+ try {
+ $file_name = tempnam($file_path, $names_arr[$i]);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
/* creating the files in existing dir */
if (file_exists($file_name) && !$res_arr[$i]) {
@@ -104,14 +109,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam
Failed, not created in the correct directory %s vs %s
0
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line 54
-Failed, not created in the correct directory %s vs %sext\standard\tests\file\tempnamVar3
-0
+tempnam() expects parameter 2 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d
-OK
+tempnam() expects parameter 2 to be a valid path, array given
-- Iteration 8 --
OK
-- Iteration 9 --
diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt
index 856667fa49..0a267c509e 100644
--- a/ext/standard/tests/file/tempnam_variation3.phpt
+++ b/ext/standard/tests/file/tempnam_variation3.phpt
@@ -37,7 +37,12 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- $file_name = tempnam("$file_path", $names_arr[$i]);
+ try {
+ $file_name = tempnam("$file_path", $names_arr[$i]);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
/* creating the files in existing dir */
if( file_exists($file_name) ) {
@@ -100,17 +105,9 @@ File name is => %s/%s
File permissions are => 100600
File created in => directory specified
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, string given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 2 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, array given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 2 to be a valid path, array given
-- Iteration 8 --
File name is => %s/dir%s
File permissions are => 100600
diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt
index 5bacb5e876..f4b3cf016c 100644
--- a/ext/standard/tests/file/tempnam_variation7-win32.phpt
+++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt
@@ -34,7 +34,12 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ try {
+ $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
if( file_exists($file_name) ){
@@ -95,17 +100,9 @@ File name is => %s%et%s
File permissions are => 100666
File created in => temp dir
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d
--- File is not created --
-
-Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
+tempnam() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
+tempnam() expects parameter 1 to be a valid path, array given
-- Iteration 8 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d
diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt
index 9ed84f974a..680e207718 100644
--- a/ext/standard/tests/file/tempnam_variation7.phpt
+++ b/ext/standard/tests/file/tempnam_variation7.phpt
@@ -35,7 +35,12 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ try {
+ $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
if( file_exists($file_name) ){
@@ -100,17 +105,9 @@ File name is => %s%etempnam_variation3.tmp%s
File permissions are => 100600
File created in => temp dir
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 1 to be a valid path, array given
-- Iteration 8 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d
diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt
index e0b06d3960..0474b34af2 100644
--- a/ext/standard/tests/file/touch.phpt
+++ b/ext/standard/tests/file/touch.phpt
@@ -13,7 +13,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
// output to linux. This could be a php.net bug on windows or a windows querk.
$filename = __DIR__."/touch.dat";
-var_dump(touch());
var_dump(touch($filename));
var_dump(filemtime($filename));
@unlink($filename);
@@ -39,8 +38,6 @@ var_dump(touch("/no/such/file/or/directory"));
echo "Done\n";
?>
--EXPECTF--
-Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
-NULL
bool(true)
int(%d)
bool(true)
diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt
index 0520055a90..9a4bd01e13 100644
--- a/ext/standard/tests/file/touch_error.phpt
+++ b/ext/standard/tests/file/touch_error.phpt
@@ -5,17 +5,9 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
--FILE--
<?php
-var_dump(touch());
-var_dump(touch(1, 2, 3, 4));
var_dump(touch("/no/such/file/or/directory"));
?>
--EXPECTF--
-Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt
index a208e5675b..833c083b19 100644
--- a/ext/standard/tests/file/unlink_error-win32-mb.phpt
+++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt
@@ -25,13 +25,6 @@ $context = stream_context_create();
echo "*** Testing unlink() : error conditions ***\n";
-echo "-- Testing unlink() on unexpected no. of arguments --\n";
-// arg < expected
-var_dump( unlink() );
-// args > expected
-var_dump( unlink($filename, $context, true) );
-var_dump( file_exists($filename) ); // expected: true
-
echo "\n-- Testing unlink() on invalid arguments --\n";
// invalid arguments
var_dump( unlink('') ); // $filename as empty string
@@ -43,9 +36,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist
var_dump( unlink(false) ); // $filename as boolean false
var_dump( file_exists(false) ); // confirm file doesnt exist
-var_dump( unlink($filename, '') ); // $context as empty string
-var_dump( unlink($filename, false) ); // $context as boolean false
-
echo "\n-- Testing unlink() on non-existent file --\n";
var_dump( unlink(__DIR__."/non_existent_file.tmp") );
@@ -68,14 +58,6 @@ rmdir(__DIR__."/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™");
?>
--EXPECTF--
*** Testing unlink() : error conditions ***
--- Testing unlink() on unexpected no. of arguments --
-
-Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-bool(true)
-- Testing unlink() on invalid arguments --
@@ -91,12 +73,6 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing unlink() on non-existent file --
Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt
index d62c715a94..535b3d0adf 100644
--- a/ext/standard/tests/file/unlink_error-win32.phpt
+++ b/ext/standard/tests/file/unlink_error-win32.phpt
@@ -23,13 +23,6 @@ $context = stream_context_create();
echo "*** Testing unlink() : error conditions ***\n";
-echo "-- Testing unlink() on unexpected no. of arguments --\n";
-// arg < expected
-var_dump( unlink() );
-// args > expected
-var_dump( unlink($filename, $context, true) );
-var_dump( file_exists($filename) ); // expected: true
-
echo "\n-- Testing unlink() on invalid arguments --\n";
// invalid arguments
var_dump( unlink('') ); // $filename as empty string
@@ -41,9 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist
var_dump( unlink(false) ); // $filename as boolean false
var_dump( file_exists(false) ); // confirm file doesnt exist
-var_dump( unlink($filename, '') ); // $context as empty string
-var_dump( unlink($filename, false) ); // $context as boolean false
-
echo "\n-- Testing unlink() on non-existent file --\n";
var_dump( unlink(__DIR__."/non_existent_file.tmp") );
@@ -65,14 +55,6 @@ rmdir(__DIR__."/unlink_error");
?>
--EXPECTF--
*** Testing unlink() : error conditions ***
--- Testing unlink() on unexpected no. of arguments --
-
-Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-bool(true)
-- Testing unlink() on invalid arguments --
@@ -88,12 +70,6 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing unlink() on non-existent file --
Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt
index 61aac03dd3..df5b5b9755 100644
--- a/ext/standard/tests/file/unlink_error.phpt
+++ b/ext/standard/tests/file/unlink_error.phpt
@@ -23,13 +23,6 @@ $context = stream_context_create();
echo "*** Testing unlink() : error conditions ***\n";
-echo "-- Testing unlink() on unexpected no. of arguments --\n";
-// arg < expected
-var_dump( unlink() );
-// args > expected
-var_dump( unlink($filename, $context, true) );
-var_dump( file_exists($filename) ); // expected true
-
echo "\n-- Testing unlink() on invalid arguments --\n";
// invalid arguments
var_dump( unlink('') ); // $filename as empty string
@@ -41,10 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist
var_dump( unlink(false) ); // $filename as boolean false
var_dump( file_exists(false) ); // confirm file doesnt exist
-var_dump( unlink($filename, '') ); // $context as empty string
-var_dump( unlink($filename, false) ); // $context as boolean false
-
-
echo "\n-- Testing unlink() on non-existent file --\n";
var_dump( unlink(__DIR__."/non_existent_file.tmp") );
@@ -65,14 +54,6 @@ rmdir(__DIR__."/unlink_error");
?>
--EXPECTF--
*** Testing unlink() : error conditions ***
--- Testing unlink() on unexpected no. of arguments --
-
-Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-bool(true)
-- Testing unlink() on invalid arguments --
@@ -88,12 +69,6 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing unlink() on non-existent file --
Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/userstreams_002.phpt b/ext/standard/tests/file/userstreams_002.phpt
index 81f463ddd2..3068c93b46 100644
--- a/ext/standard/tests/file/userstreams_002.phpt
+++ b/ext/standard/tests/file/userstreams_002.phpt
@@ -22,7 +22,11 @@ function test($name, $fd, $return_value) {
$data['wrapper_data']->return_value = $return_value;
$r = array($fd);
$w = $e = null;
- var_dump(stream_select($r, $w, $e, 0) !== false);
+ try {
+ var_dump(stream_select($r, $w, $e, 0) !== false);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
@@ -64,14 +68,12 @@ bool(false)
------ return value not a stream resource: -------
-Warning: stream_select(): supplied argument is not a valid stream resource in %s
-
Warning: stream_select(): test_wrapper::stream_cast must return a stream resource in %s
Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
Warning: stream_select(): No stream arrays were passed in %s
-bool(false)
+stream_select(): supplied argument is not a valid stream resource
------ return value is stream itself: -------
diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt
index fbfdda2385..53d9fc2b50 100644
--- a/ext/standard/tests/filters/001.phpt
+++ b/ext/standard/tests/filters/001.phpt
@@ -7,8 +7,6 @@ var_dump(stream_filter_register("", ""));
var_dump(stream_filter_register("test", ""));
var_dump(stream_filter_register("", "test"));
var_dump(stream_filter_register("------", "nonexistentclass"));
-var_dump(stream_filter_register(array(), "aa"));
-var_dump(stream_filter_register("", array()));
echo "Done\n";
?>
@@ -22,10 +20,4 @@ bool(false)
Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d
bool(false)
bool(true)
-
-Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/filters/php_user_filter_01.phpt b/ext/standard/tests/filters/php_user_filter_01.phpt
index ff5a51f5be..fb47177f4c 100644
--- a/ext/standard/tests/filters/php_user_filter_01.phpt
+++ b/ext/standard/tests/filters/php_user_filter_01.phpt
@@ -14,4 +14,4 @@ class bar extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of bar::filter($in, $out, &$consumed) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
+Fatal error: Declaration of bar::filter($in, $out, &$consumed) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_02.phpt b/ext/standard/tests/filters/php_user_filter_02.phpt
index bdd73c01a8..fd0822153b 100644
--- a/ext/standard/tests/filters/php_user_filter_02.phpt
+++ b/ext/standard/tests/filters/php_user_filter_02.phpt
@@ -9,4 +9,4 @@ class foo extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of foo::filter($in, $out, $consumed, $closing) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
+Fatal error: Declaration of foo::filter($in, $out, $consumed, $closing) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_03.phpt b/ext/standard/tests/filters/php_user_filter_03.phpt
index 867b74eb89..a89637d4cc 100644
--- a/ext/standard/tests/filters/php_user_filter_03.phpt
+++ b/ext/standard/tests/filters/php_user_filter_03.phpt
@@ -9,4 +9,4 @@ class foo extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of foo::onCreate($var) should be compatible with php_user_filter::onCreate() in %s on line %d
+Fatal error: Declaration of foo::onCreate($var) must be compatible with php_user_filter::onCreate() in %s on line %d
diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt
index 9513319f57..07de5acf0c 100644
--- a/ext/standard/tests/filters/stream_filter_remove_error.phpt
+++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt
@@ -20,16 +20,6 @@ $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE );
echo "*** Testing stream_filter_remove() : error conditions ***\n";
-echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n";
-var_dump( stream_filter_remove() );
-
-echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n";
-$arg = 'bogus arg';
-var_dump( stream_filter_remove( $filter, $arg ) );
-
-echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n";
-var_dump( stream_filter_remove( "fakefilter" ) );
-
echo "\n-- Testing stream_filter_remove() function with bad resource --\n";
var_dump( stream_filter_remove( $fp ) );
@@ -52,21 +42,6 @@ unlink( $file );
--EXPECTF--
*** Testing stream_filter_remove() : error conditions ***
--- Testing stream_filter_remove() function with Zero arguments --
-
-Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing stream_filter_remove() function with more than expected no. of arguments --
-
-Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
--- Testing stream_filter_remove() function with unexisting stream filter --
-
-Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-- Testing stream_filter_remove() function with bad resource --
Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d
diff --git a/ext/standard/tests/filters/strip_tags_filter.phpt b/ext/standard/tests/filters/strip_tags_filter.phpt
deleted file mode 100644
index f353e79a9a..0000000000
--- a/ext/standard/tests/filters/strip_tags_filter.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-string.strip_tags filter
---FILE--
-<?php
-$fp = fopen('php://output', 'w');
-stream_filter_append($fp, 'string.strip_tags');
-fwrite($fp, "test <b>bold</b> <i>italic</i> test\n");
-fclose($fp);
-
-$fp = fopen('php://output', 'w');
-stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, "<b>");
-fwrite($fp, "test <b>bold</b> <i>italic</i> test\n");
-fclose($fp);
-
-$fp = fopen('php://output', 'w');
-stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, ["b"]);
-fwrite($fp, "test <b>bold</b> <i>italic</i> test\n");
-fclose($fp);
-
-?>
---EXPECTF--
-Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d
-test bold italic test
-
-Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d
-test <b>bold</b> italic test
-
-Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d
-test <b>bold</b> italic test
diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt
index 51132c6a15..99971616d2 100644
--- a/ext/standard/tests/general_functions/010.phpt
+++ b/ext/standard/tests/general_functions/010.phpt
@@ -3,24 +3,19 @@ register_shutdown_function() & __call
--FILE--
<?php
class test {
- function _foo() {
- throw new Exception('test');
- }
- function __call($name=null, $args=null) {
- return test::_foo();
- }
+ function _foo() {
+ throw new Exception('test');
+ }
+ function __call($name=null, $args=null) {
+ return test::_foo();
+ }
}
-try {
- var_dump(register_shutdown_function(array("test","__call")));
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
-}
+var_dump(register_shutdown_function(array("test","__call")));
echo "Done\n";
?>
--EXPECTF--
-Exception: Non-static method test::__call() cannot be called statically
+Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d
+bool(false)
Done
-
-Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d
diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt
index c6ff94833d..92fa547820 100644
--- a/ext/standard/tests/general_functions/bug32647.phpt
+++ b/ext/standard/tests/general_functions/bug32647.phpt
@@ -30,11 +30,11 @@ register_shutdown_function(array($obj,'barfoo')); // Valid
?>
--EXPECTF--
-Notice: Undefined variable: obj in %s on line %d
+Warning: Undefined variable: obj in %s on line %d
Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
-Notice: Undefined variable: obj in %s on line %d
+Warning: Undefined variable: obj in %s on line %d
Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
@@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed
Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d
-Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d
Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
foo!
-
-Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
-
-Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
-bar!
bar!
diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt
index 6f05137afc..f43bf64380 100644
--- a/ext/standard/tests/general_functions/bug41970.phpt
+++ b/ext/standard/tests/general_functions/bug41970.phpt
@@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure)
$a = array(4,3,2);
var_dump(call_user_func_array("sort", array($a)));
-var_dump(call_user_func_array("strlen", array($a)));
+try {
+ var_dump(call_user_func_array("strlen", array($a)));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(call_user_func("sort", $a));
-var_dump(call_user_func("strlen", $a));
+try {
+ var_dump(call_user_func("strlen", $a));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECTF--
-Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d
bool(true)
+strlen() expects parameter 1 to be string, array given
-Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6
-NULL
-
-Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d
bool(true)
-
-Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8
-NULL
+strlen() expects parameter 1 to be string, array given
Done
diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt
index d19eca7248..c06673bc34 100644
--- a/ext/standard/tests/general_functions/bug47857.phpt
+++ b/ext/standard/tests/general_functions/bug47857.phpt
@@ -8,18 +8,20 @@ class foo {
}
}
var_dump(is_callable(array('foo','bar')));
-foo::bar();
+try {
+ foo::bar();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(is_callable(array('Exception','getMessage')));
-Exception::getMessage();
+try {
+ Exception::getMessage();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-bool(true)
-
-Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d
-ok
+--EXPECT--
+bool(false)
+Non-static method foo::bar() cannot be called statically
bool(false)
-
-Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d
-Stack trace:
-#0 {main}
- thrown in %sbug47857.php on line %d
+Non-static method Exception::getMessage() cannot be called statically
diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt
index 504de7afbf..93381d246c 100644
--- a/ext/standard/tests/general_functions/bug60723.phpt
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -14,6 +14,6 @@ readfile($log);
unlink($log);
?>
--EXPECTF--
-Notice: Undefined variable: aa in %sbug60723.php on line %d
-[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d
+Warning: Undefined variable: aa in %s on line %d
+[%s ASIA/Chongqing] PHP Warning: Undefined variable: aa in %s on line %d
[%s ASIA/Chongqing] dummy
diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt
index f7aefcc03f..77df0417a6 100644
--- a/ext/standard/tests/general_functions/bug70018.phpt
+++ b/ext/standard/tests/general_functions/bug70018.phpt
@@ -1,11 +1,5 @@
--TEST--
Bug #70018 (exec does not strip all whitespace)
---SKIPIF--
-<?php
-if ("cli" != php_sapi_name()) {
- die("skip.. CLI only test");
-}
-?>
--FILE--
<?php
$output = array();
diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt
index a58f19d932..76d0e94c82 100644
--- a/ext/standard/tests/general_functions/callbacks_001.phpt
+++ b/ext/standard/tests/general_functions/callbacks_001.phpt
@@ -69,7 +69,11 @@ class P extends O {
$this->call(array('parent', 'who'));
$this->call(array('P', 'parent::who'));
$this->call(array($this, 'O::who'));
- $this->call(array($this, 'B::who'));
+ try {
+ $this->call(array($this, 'B::who'));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
}
@@ -103,6 +107,5 @@ O
$this|O::who
O
$this|B::who
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B'
===DONE===
diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt
index 22130c524a..0d44035e0e 100644
--- a/ext/standard/tests/general_functions/callbacks_002.phpt
+++ b/ext/standard/tests/general_functions/callbacks_002.phpt
@@ -3,14 +3,24 @@ call_user_func(): Wrong parameters
--FILE--
<?php
-call_user_func(array('Foo', 'bar'));
-call_user_func(array(NULL, 'bar'));
-call_user_func(array('stdclass', NULL));
+try {
+ call_user_func(array('Foo', 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array(NULL, 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array('stdclass', NULL));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found 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: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d
+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, first array member is not a valid class name or object
+call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
index 6cb413dc26..d622089cff 100644
--- a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
+++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
@@ -147,7 +147,7 @@ int(10)
-- Value of $ref_first_var --
-Notice: Undefined variable: ref_first_var in %s on line %d
+Warning: Undefined variable: ref_first_var in %s on line %d
NULL
-- Value of $first_var --
@@ -166,7 +166,7 @@ int(10)
-- Value of $var_3: (after unsetting var_3) --
-Notice: Undefined variable: var_3 in %s on line %d
+Warning: Undefined variable: var_3 in %s on line %d
NULL
-- Value of $var_2: --
@@ -177,7 +177,7 @@ int(10)
-- Value of $var_1: (after unsetting variable_1) --
-Notice: Undefined variable: var_1 in %s on line %d
+Warning: Undefined variable: var_1 in %s on line %d
NULL
-- Value of $var_2: --
diff --git a/ext/standard/tests/general_functions/error_clear_last.phpt b/ext/standard/tests/general_functions/error_clear_last.phpt
index 675affb625..2cfd17793a 100644
--- a/ext/standard/tests/general_functions/error_clear_last.phpt
+++ b/ext/standard/tests/general_functions/error_clear_last.phpt
@@ -20,7 +20,7 @@ NULL
NULL
array(4) {
["type"]=>
- int(8)
+ int(2)
["message"]=>
string(21) "Undefined variable: b"
["file"]=>
diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt
index 71f068f104..a4cae412b5 100644
--- a/ext/standard/tests/general_functions/error_get_last.phpt
+++ b/ext/standard/tests/general_functions/error_get_last.phpt
@@ -4,7 +4,11 @@ error_get_last() tests
<?php
var_dump(error_get_last());
-var_dump(error_get_last(true));
+try {
+ var_dump(error_get_last(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(error_get_last());
$a = $b;
@@ -15,29 +19,18 @@ echo "Done\n";
?>
--EXPECTF--
NULL
-
-Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d
+error_get_last() expects exactly 0 parameters, 1 given
NULL
-array(4) {
- ["type"]=>
- int(2)
- ["message"]=>
- string(54) "error_get_last() expects exactly 0 parameters, 1 given"
- ["file"]=>
- string(%i) "%s"
- ["line"]=>
- int(4)
-}
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
array(4) {
["type"]=>
- int(8)
+ int(2)
["message"]=>
string(21) "Undefined variable: b"
["file"]=>
- string(%i) "%s"
+ string(%d) "%s"
["line"]=>
- int(7)
+ int(11)
}
Done
diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
index cbb3f6fcc4..b6bc828a87 100644
--- a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
+++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
@@ -7,4 +7,8 @@ escapeshellarg("hello\0world");
?>
===DONE===
--EXPECTF--
-Fatal error: escapeshellarg(): Input string contains NULL bytes in %s on line %d
+Fatal error: Uncaught TypeError: Input string contains NULL bytes in %s:%d
+Stack trace:
+#0 %s(%d): escapeshellarg('hello\x00world')
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
index 0a4d7eacff..7ce31fb8dd 100644
--- a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
+++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
@@ -7,4 +7,8 @@ escapeshellcmd("hello\0world");
?>
===DONE===
--EXPECTF--
-Fatal error: escapeshellcmd(): Input string contains NULL bytes in %s on line %d
+Fatal error: Uncaught TypeError: Input string contains NULL bytes in %s:%d
+Stack trace:
+#0 %s(%d): escapeshellcmd('hello\x00world')
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt
index a01e01dbf1..f6f354509a 100644
--- a/ext/standard/tests/general_functions/floatval.phpt
+++ b/ext/standard/tests/general_functions/floatval.phpt
@@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) {
var_dump( doubleval($type) );
}
-
-
-
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( floatval() );
-var_dump( doubleval() );
-
-//arguments more than expected
-var_dump( floatval(TRUE, FALSE) );
-var_dump( doubleval(TRUE, FALSE) );
-
echo "\nDone\n";
@@ -194,18 +182,4 @@ float(1)
float(0)
float(0)
-*** Testing error conditions ***
-
-Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
index 33d4af03d2..c74e4f71fe 100644
--- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
+++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
@@ -14,10 +14,14 @@ $result = get_extension_funcs("standard");
var_dump(gettype($result));
var_dump(in_array("cos", $result));
+// Unknown extension
+var_dump(get_extension_funcs("foo"));
+
?>
===DONE===
--EXPECT--
Simple testcase for get_extension_funcs() function
string(5) "array"
bool(true)
+bool(false)
===DONE===
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
deleted file mode 100644
index 44bd822d12..0000000000
--- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Test get_extension_funcs() function : error conditions
---FILE--
-<?php
-/* Prototype : array get_extension_funcs ( string $module_name )
- * Description: Returns an array with the names of the functions of a module.
- * Source code: Zend/zend_builtin_functions.c
- * Alias to functions:
- */
-
-echo "*** Testing get_extension_funcs() : error conditions ***\n";
-
-echo "\n-- Too few arguments --\n";
-var_dump(get_extension_funcs());
-
-$extra_arg = 1;
-echo "\n-- Too many arguments --\n";
-var_dump(get_extension_funcs("standard", $extra_arg));
-
-echo "\n-- Invalid extension name --\n";
-var_dump(get_extension_funcs("foo"));
-
-?>
-===DONE===
---EXPECTF--
-*** Testing get_extension_funcs() : error conditions ***
-
--- Too few arguments --
-
-Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Too many arguments --
-
-Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Invalid extension name --
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt
index 2017bf697a..5b45c86449 100644
--- a/ext/standard/tests/general_functions/get_include_path_basic.phpt
+++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt
@@ -19,19 +19,10 @@ if (ini_get("include_path") == get_include_path()) {
echo "FAILED\n";
}
-echo "\nError cases:\n";
-var_dump(get_include_path(TRUE));
-
-
?>
===DONE===
--EXPECTF--
*** Testing get_include_path()
string(1) "."
PASSED
-
-Error cases:
-
-Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
===DONE===
diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt
index df41ec8513..36719fa933 100644
--- a/ext/standard/tests/general_functions/get_included_files.phpt
+++ b/ext/standard/tests/general_functions/get_included_files.phpt
@@ -22,9 +22,6 @@ include(__DIR__."/get_included_files_inc2.inc");
echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n";
var_dump(get_included_files());
-echo "\n-- Error cases --\n";
-var_dump(get_included_files(true));
-
?>
===DONE===
--EXPECTF--
@@ -55,9 +52,4 @@ array(4) {
[3]=>
string(%d) "%sget_included_files_inc3.inc"
}
-
--- Error cases --
-
-Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
===DONE===
diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt
index 4caca88e1b..8ec131809f 100644
--- a/ext/standard/tests/general_functions/getrusage.phpt
+++ b/ext/standard/tests/general_functions/getrusage.phpt
@@ -8,16 +8,12 @@ getrusage() tests
var_dump(gettype(getrusage()));
var_dump(gettype(getrusage(1)));
var_dump(gettype(getrusage(-1)));
-var_dump(getrusage(array()));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(5) "array"
string(5) "array"
string(5) "array"
-
-Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
index a876ac1fea..f387161bf4 100644
--- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt
+++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
@@ -12,29 +12,13 @@ Simone Gentili (sensorario@gmail.com)
var_dump(getservbyport( -1, "tcp" ));
var_dump(getservbyport( 80, "ppp" ));
var_dump(getservbyport( null, null));
- var_dump(getservbyport( array(), array()));
- var_dump(getservbyport( array(80), array("tcp")));
- var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2)));
var_dump(getservbyport( 2, 2));
var_dump(getservbyport( "80", "tcp"));
- var_dump(getservbyport( new stdClass(), new stdClass()));
?>
--EXPECTF--
bool(false)
bool(false)
bool(false)
-
-Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d
-NULL
-
-Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d
-NULL
-
-Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d
-NULL
bool(false)
string(%d) "%s"
-
-Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d
-NULL
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
index f8ff6c4460..fac0327ad5 100644
--- a/ext/standard/tests/general_functions/gettype_settype_basic.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -846,7 +846,7 @@ string(6) "object"
-- Setting type of data to string --
-- Iteration 1 --
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
@@ -855,7 +855,7 @@ bool(true)
string(14) "another string"
string(6) "string"
-- Iteration 3 --
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt
index 325e91e47f..e204c64d4c 100644
--- a/ext/standard/tests/general_functions/gettype_settype_error.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt
@@ -13,19 +13,7 @@ Test gettype() & settype() functions : error conditions
echo "**** Testing gettype() and settype() functions ****\n";
-echo "\n*** Testing gettype(): error conditions ***\n";
-//Zero arguments
-var_dump( gettype() );
-// args more than expected
-var_dump( gettype( "1", "2" ) );
-
echo "\n*** Testing settype(): error conditions ***\n";
-//Zero arguments
-var_dump( settype() );
-
-// args more than expected
-$var = 10.5;
-var_dump( settype( $var, $var, "int" ) );
// passing an invalid type to set
var_dump( settype( $var, "unknown" ) );
@@ -35,22 +23,8 @@ echo "Done\n";
--EXPECTF--
**** Testing gettype() and settype() functions ****
-*** Testing gettype(): error conditions ***
-
-Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing settype(): error conditions ***
-Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: settype(): Invalid type in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
index 7fb8789ff3..eb43b85f30 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to null type */
@@ -180,9 +172,6 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to null --
@@ -576,14 +565,4 @@ string(6) "object"
bool(true)
NULL
string(4) "NULL"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-NULL
-string(4) "NULL"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-NULL
-string(4) "NULL"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
index d44c04e5dd..5e49821f2c 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
@@ -42,10 +42,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -153,10 +149,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
// test conversion to these types
@@ -189,9 +181,6 @@ foreach ($types as $type) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing settype() & gettype() : usage variations ***
-- Setting type of data to integer --
@@ -588,16 +577,6 @@ string(6) "object"
bool(true)
int(1)
string(7) "integer"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
-- Setting type of data to int --
-- Iteration 1 --
@@ -993,14 +972,4 @@ string(6) "object"
bool(true)
int(1)
string(7) "integer"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
index 71b03461eb..f17b261437 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
// test conversion to these types
@@ -185,9 +177,6 @@ foreach ($types as $type) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing settype() & gettype() : usage variations ***
-- Setting type of data to float --
@@ -584,16 +573,6 @@ string(6) "object"
bool(true)
float(1)
string(6) "double"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
-- Setting type of data to double --
-- Iteration 1 --
@@ -989,14 +968,4 @@ string(6) "object"
bool(true)
float(1)
string(6) "double"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
index a14cb73dbb..00da4bf4bb 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -160,10 +156,6 @@ $var_values = array (
new point(0, 0),
new class_with_no_member,
- /* undefined/unset vars */
- $unset_var,
- $undef_var,
-
/* binary strings */
b"0",
b'0',
@@ -210,9 +202,6 @@ foreach ($types as $type) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing settype() & gettype() : usage variations ***
-- Setting type of data to boolean --
@@ -632,24 +621,24 @@ bool(true)
bool(true)
string(7) "boolean"
-- Iteration 84 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 85 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 86 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 87 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 88 --
string(6) "string"
@@ -696,16 +685,6 @@ string(6) "string"
bool(true)
bool(true)
string(7) "boolean"
--- Iteration 97 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
--- Iteration 98 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
-- Setting type of data to bool --
-- Iteration 1 --
@@ -1124,24 +1103,24 @@ bool(true)
bool(true)
string(7) "boolean"
-- Iteration 84 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 85 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 86 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 87 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 88 --
string(6) "string"
@@ -1188,14 +1167,4 @@ string(6) "string"
bool(true)
bool(true)
string(7) "boolean"
--- Iteration 97 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
--- Iteration 98 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
index c5e2640f9c..6437baa10b 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to resource type */
@@ -179,10 +171,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to resource --
@@ -699,16 +688,4 @@ object(point)#3 (2) {
int(0)
}
string(6) "object"
--- Iteration 79 --
-string(4) "NULL"
-2: settype(): Cannot convert to resource type
-bool(false)
-NULL
-string(4) "NULL"
--- Iteration 80 --
-string(4) "NULL"
-2: settype(): Cannot convert to resource type
-bool(false)
-NULL
-string(4) "NULL"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
index 27beaa0744..7c5ea5efb6 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to array type */
@@ -181,10 +173,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to array --
@@ -831,16 +820,4 @@ array(2) {
int(0)
}
string(5) "array"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-array(0) {
-}
-string(5) "array"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-array(0) {
-}
-string(5) "array"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
index dae20a1856..b282cbdab1 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to object type */
@@ -179,10 +171,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to object --
@@ -829,16 +818,4 @@ object(point)#3 (2) {
int(0)
}
string(6) "object"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-object(stdClass)#4 (0) {
-}
-string(6) "object"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-object(stdClass)#4 (0) {
-}
-string(6) "object"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
index 97f550e446..7ddfe54ab6 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to string type */
@@ -179,10 +171,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to string --
@@ -399,31 +388,31 @@ string(12) "@$%#$%^$%^&^"
string(6) "string"
-- Iteration 43 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 44 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 45 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 46 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 47 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
@@ -582,14 +571,4 @@ string(6) "object"
bool(true)
string(11) "ObjectPoint"
string(6) "string"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-string(0) ""
-string(6) "string"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-string(0) ""
-string(6) "string"
Done
diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt
index 059c56b258..f8d4c28338 100644
--- a/ext/standard/tests/general_functions/head.phpt
+++ b/ext/standard/tests/general_functions/head.phpt
@@ -1,11 +1,5 @@
--TEST--
header() and friends
---SKIPIF--
-<?php
-if (php_sapi_name() != "cli") {
- die("skip this test is for CLI");
-}
-?>
--FILE--
<?php
diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt
index 23c5bc45aa..ffadbc280c 100644
--- a/ext/standard/tests/general_functions/include_path.phpt
+++ b/ext/standard/tests/general_functions/include_path.phpt
@@ -6,14 +6,9 @@ include_path=.
<?php
var_dump(get_include_path());
-var_dump(get_include_path("var"));
var_dump(restore_include_path());
-var_dump(restore_include_path(""));
-
-var_dump(set_include_path());
-var_dump(get_include_path());
var_dump(set_include_path("var"));
var_dump(get_include_path());
@@ -32,9 +27,6 @@ var_dump(get_include_path());
var_dump(restore_include_path());
var_dump(get_include_path());
-var_dump(set_include_path(array()));
-var_dump(get_include_path());
-
var_dump(restore_include_path());
var_dump(get_include_path());
@@ -44,21 +36,9 @@ echo "Done\n";
--EXPECTF--
string(1) "."
-Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Deprecated: Function restore_include_path() is deprecated in %s on line %d
-NULL
-
Deprecated: Function restore_include_path() is deprecated in %s on line %d
-
-Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d
NULL
string(1) "."
-string(1) "."
string(3) "var"
Deprecated: Function restore_include_path() is deprecated in %s on line %d
@@ -77,10 +57,6 @@ Deprecated: Function restore_include_path() is deprecated in %s on line %d
NULL
string(1) "."
-Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
-string(1) "."
-
Deprecated: Function restore_include_path() is deprecated in %s on line %d
NULL
string(1) "."
diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt
index 1650b91c6f..c56bdd7b94 100644
--- a/ext/standard/tests/general_functions/intval.phpt
+++ b/ext/standard/tests/general_functions/intval.phpt
@@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) {
var_dump( intval($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( intval() );
-
-//arguments more than expected
-var_dump( intval(TRUE, FALSE, TRUE) );
-
echo "\n--- Done ---\n";
@@ -295,12 +288,4 @@ int(0)
int(0)
int(0)
-*** Testing error conditions ***
-
-Warning: intval() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: intval() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
--- Done ---
diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt
index e76d7083d4..e44bc1db80 100644
--- a/ext/standard/tests/general_functions/intval_variation1.phpt
+++ b/ext/standard/tests/general_functions/intval_variation1.phpt
@@ -11,8 +11,8 @@ Test intval() function : usage variation
echo "*** Testing intval() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt
index 66e5b64934..200ecbd6ac 100644
--- a/ext/standard/tests/general_functions/is_array.phpt
+++ b/ext/standard/tests/general_functions/is_array.phpt
@@ -98,13 +98,6 @@ foreach ($varient_arrays as $type ) {
var_dump( is_array ($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_array() );
-
-//arguments more than expected
-var_dump( is_array ($fp, $fp) );
-
echo "Done\n";
/* close resources */
fclose($fp);
@@ -202,12 +195,4 @@ bool(false)
bool(false)
-- Iteration 29 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt
index 34d5e0ef6c..7c8d693a1b 100644
--- a/ext/standard/tests/general_functions/is_bool.phpt
+++ b/ext/standard/tests/general_functions/is_bool.phpt
@@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) {
var_dump( is_bool($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_bool() );
-
-//arguments more than expected
-var_dump( is_bool(TRUE, FALSE) );
-
echo "Done\n";
// close resources
@@ -283,12 +276,4 @@ bool(false)
bool(false)
-- Iteration 65 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt
index 7657875311..7b43191aab 100644
--- a/ext/standard/tests/general_functions/is_callable_basic2.phpt
+++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt
@@ -207,12 +207,12 @@ object_class::func
bool(false)
object_class::func
-- Innerloop iteration 10 of Outerloop iteration 1 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 2 ---
-- Innerloop iteration 1 of Outerloop iteration 2 --
@@ -288,12 +288,12 @@ no_member_class::func
bool(false)
no_member_class::func
-- Innerloop iteration 10 of Outerloop iteration 2 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 3 ---
-- Innerloop iteration 1 of Outerloop iteration 3 --
@@ -369,12 +369,12 @@ contains_object_class::func
bool(true)
contains_object_class::func
-- Innerloop iteration 10 of Outerloop iteration 3 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 4 ---
-- Innerloop iteration 1 of Outerloop iteration 4 --
@@ -450,12 +450,12 @@ contains_object_class::func
bool(true)
contains_object_class::func
-- Innerloop iteration 10 of Outerloop iteration 4 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 5 ---
-- Innerloop iteration 1 of Outerloop iteration 5 --
@@ -531,12 +531,12 @@ object_class::func
bool(false)
object_class::func
-- Innerloop iteration 10 of Outerloop iteration 5 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 6 ---
-- Innerloop iteration 1 of Outerloop iteration 6 --
@@ -612,12 +612,12 @@ no_member_class::func
bool(false)
no_member_class::func
-- Innerloop iteration 10 of Outerloop iteration 6 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 7 ---
-- Innerloop iteration 1 of Outerloop iteration 7 --
@@ -693,12 +693,12 @@ object_class::func
bool(false)
object_class::func
-- Innerloop iteration 10 of Outerloop iteration 7 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 8 ---
-- Innerloop iteration 1 of Outerloop iteration 8 --
@@ -774,11 +774,11 @@ Array
bool(false)
Array
-- Innerloop iteration 10 of Outerloop iteration 8 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
===DONE===
diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt
index 700077ef17..0cb18769d6 100644
--- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt
+++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt
@@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com)
var_dump(is_countable([1, 2, 3]));
var_dump(is_countable((array) 1));
var_dump(is_countable((object) ['foo', 'bar', 'baz']));
-var_dump(is_countable());
$foo = ['', []];
@@ -24,9 +23,6 @@ if (!is_countable($bar)) {
bool(true)
bool(true)
bool(false)
-
-Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
int(2)
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt
index 6d4ada6701..76cfa80565 100644
--- a/ext/standard/tests/general_functions/is_float.phpt
+++ b/ext/standard/tests/general_functions/is_float.phpt
@@ -127,17 +127,6 @@ foreach ($not_floats as $value ) {
var_dump( @is_real($value) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_float() );
-var_dump( is_double() );
-var_dump( is_real() );
-
-//arguments more than expected
-var_dump( is_float( $floats[0], $floats[1]) );
-var_dump( is_double( $floats[0], $floats[1]) );
-var_dump( is_real( $floats[0], $floats[1]) );
-
echo "Done\n";
// close the resources used
@@ -417,28 +406,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt
index be5843a7d5..dc6df0f109 100644
--- a/ext/standard/tests/general_functions/is_float_64bit.phpt
+++ b/ext/standard/tests/general_functions/is_float_64bit.phpt
@@ -129,17 +129,6 @@ foreach ($not_floats as $value ) {
var_dump( @is_real($value) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_float() );
-var_dump( is_double() );
-var_dump( is_real() );
-
-//arguments more than expected
-var_dump( is_float( $floats[0], $floats[1]) );
-var_dump( is_double( $floats[0], $floats[1]) );
-var_dump( is_real( $floats[0], $floats[1]) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -414,28 +403,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt
index 4cfbf653be..25e6c2564e 100644
--- a/ext/standard/tests/general_functions/is_int.phpt
+++ b/ext/standard/tests/general_functions/is_int.phpt
@@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) {
var_dump( is_long($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_int() );
-var_dump( is_integer() );
-var_dump( is_long() );
-
-//arguments more than expected
-var_dump( is_int(TRUE, FALSE) );
-var_dump( is_integer(TRUE, FALSE) );
-var_dump( is_long(TRUE, FALSE) );
-
echo "Done\n";
// close the resources
@@ -442,24 +431,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt
index dabc7be705..e5c6ce77e0 100644
--- a/ext/standard/tests/general_functions/is_int_64bit.phpt
+++ b/ext/standard/tests/general_functions/is_int_64bit.phpt
@@ -134,17 +134,6 @@ foreach ($not_int_types as $type ) {
var_dump( is_long($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_int() );
-var_dump( is_integer() );
-var_dump( is_long() );
-
-//arguments more than expected
-var_dump( is_int(TRUE, FALSE) );
-var_dump( is_integer(TRUE, FALSE) );
-var_dump( is_long(TRUE, FALSE) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -439,24 +428,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt
index 9082f5fcd1..4fc325c744 100644
--- a/ext/standard/tests/general_functions/is_null.phpt
+++ b/ext/standard/tests/general_functions/is_null.phpt
@@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) {
var_dump( is_null($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_null() );
-
-//arguments more than expected
-var_dump( is_null(NULL, null) );
-
echo "Done\n";
// close the resources used
@@ -285,12 +278,4 @@ bool(false)
bool(false)
-- Iteration 59 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt
index c23e5e3b8c..491aa5d15b 100644
--- a/ext/standard/tests/general_functions/is_numeric.phpt
+++ b/ext/standard/tests/general_functions/is_numeric.phpt
@@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) {
var_dump( is_numeric($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_numeric() );
-
-//arguments more than expected
-var_dump( is_numeric("10", "20") );
-
echo "Done\n";
// close the resources used
@@ -373,12 +366,4 @@ bool(false)
bool(false)
-- Iteration 29 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt
index 96c515bf65..dd0e7689fd 100644
--- a/ext/standard/tests/general_functions/is_object.phpt
+++ b/ext/standard/tests/general_functions/is_object.phpt
@@ -138,13 +138,6 @@ foreach ($not_objects as $type ) {
var_dump( is_object($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_object() );
-
-//arguments more than expected
-var_dump( is_object($myClass_object, $myClass_object) );
-
echo "Done\n";
// close the resources used
@@ -216,12 +209,4 @@ bool(false)
bool(false)
-- Iteration 19 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt
index 53620178c4..f7ef3f5317 100644
--- a/ext/standard/tests/general_functions/is_scalar.phpt
+++ b/ext/standard/tests/general_functions/is_scalar.phpt
@@ -105,14 +105,6 @@ foreach( $variation_array as $value ) {
var_dump( is_scalar($value) );
}
-echo "\n*** Testing error conditions ***\n";
-// Zero arguments
-var_dump( is_scalar() );
-
-// Arguments more than expected
-var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) );
-var_dump( is_scalar( new stdclass, new stdclass) );
-
echo "Done\n";
// close the resources used
@@ -226,15 +218,4 @@ bool(false)
bool(false)
-- Iteration 18 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt
index ea2fb36a24..a062cc17e1 100644
--- a/ext/standard/tests/general_functions/is_string.phpt
+++ b/ext/standard/tests/general_functions/is_string.phpt
@@ -140,13 +140,6 @@ foreach ($not_strings as $type ) {
var_dump( is_string($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_string() );
-
-//arguments more than expected
-var_dump( is_string("string", "test") );
-
echo "Done\n";
// close the resources used
@@ -292,12 +285,4 @@ bool(false)
bool(false)
-- Iteration 45 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
index 0664043eba..5603e3d238 100644
--- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt
+++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
@@ -12,10 +12,6 @@ output_buffering=0
echo "*** Testing ob_get_flush() : error conditions ***\n";
-// One extra argument
-$extra_arg = 10;
-var_dump( ob_get_flush( $extra_arg ) );
-
// No ob_start() executed
var_dump( ob_get_flush() );
@@ -24,9 +20,6 @@ var_dump( ob_get_flush() );
--EXPECTF--
*** Testing ob_get_flush() : error conditions ***
-Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d
bool(false)
===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
index b3470bec55..75e22e7741 100644
--- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt
+++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
@@ -31,9 +31,6 @@ dump_string_length( ' lsf' );
dump_string_length( '' );
dump_string_length( null );
-// Extra argument
-var_dump( ob_get_length( 'foobar' ) );
-
?>
===DONE===
--EXPECTF--
@@ -45,7 +42,4 @@ int(1)
int(15)
int(0)
int(0)
-
-Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
===DONE===
diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt
index 368d262a6e..201bb481fc 100644
--- a/ext/standard/tests/general_functions/parse_ini_file.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_file.phpt
@@ -8,8 +8,6 @@ parse_ini_file() multiple calls
$filename = __DIR__."/parse_ini_file.dat";
@unlink($filename); /* Make sure the file really does not exist! */
-var_dump(parse_ini_file());
-var_dump(parse_ini_file(1,1,1,1));
var_dump(parse_ini_file($filename));
var_dump(parse_ini_file($filename, true));
@@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true));
echo "Done\n";
?>
--EXPECTF--
-Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d
bool(false)
-Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7
-bool(false)
-
-Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8
-bool(false)
-
-Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d
bool(false)
array(1) {
["test"]=>
@@ -138,11 +130,11 @@ array(1) {
}
Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
- in %sparse_ini_file.php on line 20
+ in %sparse_ini_file.php on line %d
bool(false)
Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
- in %sparse_ini_file.php on line 26
+ in %sparse_ini_file.php on line %d
bool(false)
array(1) {
["test"]=>
diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
index 106cd0c842..384398cdb2 100644
--- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
@@ -3,9 +3,6 @@ parse_ini_string() multiple calls
--FILE--
<?php
-var_dump(parse_ini_string());
-var_dump(parse_ini_string(1,1,1,1));
-
$ini = "
test =
";
@@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true));
echo "Done\n";
?>
--EXPECTF--
-Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s
-bool(false)
-
-Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s
-bool(false)
array(1) {
["test"]=>
string(0) ""
diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt
index 392e1c930e..ec5b2b5839 100644
--- a/ext/standard/tests/general_functions/php_uname_error.phpt
+++ b/ext/standard/tests/general_functions/php_uname_error.phpt
@@ -8,49 +8,15 @@ Test php_uname() function - error conditions - pass function incorrect argument
echo "*** Testing php_uname() - error test\n";
-echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n";
-var_dump( php_uname('a', true) );
-
echo "\n-- Testing php_uname() function with invalid mode --\n";
// am invalid mode should result in same o/p as mode 'a'
var_dump( php_uname('z') == php_uname('z') );
-class barClass {
-}
-
-$fp = fopen(__FILE__, "r");
-
-echo "\n-- Testing php_uname() function with invalid argument types --\n";
-var_dump(php_uname(array()));
-var_dump(php_uname(array('color' => 'red', 'item' => 'pen')));
-var_dump(php_uname(new barClass()));
-var_dump(php_uname($fp));
-
-fclose($fp);
?>
===DONE===
--EXPECTF--
*** Testing php_uname() - error test
--- Testing php_uname() function with more than expected no. of arguments --
-
-Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-- Testing php_uname() function with invalid mode --
bool(true)
-
--- Testing php_uname() function with invalid argument types --
-
-Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d
-NULL
===DONE===
diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt
index 044232570e..dfcddc61f3 100644
--- a/ext/standard/tests/general_functions/phpcredits.phpt
+++ b/ext/standard/tests/general_functions/phpcredits.phpt
@@ -4,7 +4,6 @@ phpcredits()
<?php
var_dump(phpcredits());
-var_dump(phpcredits(array()));
echo "--\n";
var_dump(phpcredits(0));
@@ -40,9 +39,6 @@ PHP Quality Assurance Team
%wWebsites and Infrastructure team%w
%a
bool(true)
-
-Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4
-NULL
--
PHP Credits
bool(true)
diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt
index 9966f23a96..6aa023e919 100644
--- a/ext/standard/tests/general_functions/phpcredits2.phpt
+++ b/ext/standard/tests/general_functions/phpcredits2.phpt
@@ -6,7 +6,6 @@ dummy=x
<?php
var_dump(phpcredits());
-var_dump(phpcredits(array()));
echo "--\n";
var_dump(phpcredits(0));
@@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP));
--EXPECTF--
<!DOCTYPE %a>%s</html>
bool(true)
-
-Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4
-NULL
--
<h1>PHP Credits</h1>
bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
index a805876aab..5f4d99ffba 100644
--- a/ext/standard/tests/general_functions/phpinfo.phpt
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -5,9 +5,6 @@ phpinfo()
var_dump(phpinfo());
echo "--\n";
-var_dump(phpinfo(array()));
-
-echo "--\n";
var_dump(phpinfo(0));
echo "--\n";
@@ -62,10 +59,6 @@ PHP License
%A
bool(true)
--
-
-Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5
-NULL
---
phpinfo()
bool(true)
--
diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt
index f422f923d9..5a36aa9d28 100644
--- a/ext/standard/tests/general_functions/phpinfo2.phpt
+++ b/ext/standard/tests/general_functions/phpinfo2.phpt
@@ -7,9 +7,6 @@ dummy=x
var_dump(phpinfo());
echo "--\n";
-var_dump(phpinfo(array()));
-
-echo "--\n";
var_dump(phpinfo(0));
echo "--\n";
@@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE));
<!DOCTYPE %s>
%a</html>bool(true)
--
-
-Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5
-NULL
---
<!DOCTYPE %s>
%a</html>bool(true)
--
diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt
index bcf5231144..cdb9f338a8 100644
--- a/ext/standard/tests/general_functions/print_r.phpt
+++ b/ext/standard/tests/general_functions/print_r.phpt
@@ -271,24 +271,6 @@ $misc_values = array (
/* calling check_printr() to display miscelleneous data using print_r() */
check_printr($misc_values);
-/* checking print_r() on functions */
-echo "\n*** Testing print_r() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-print_r( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump( print_r() );
-
-//passing more than required no. of arguments
-var_dump( print_r(123, true, "abc") );
-
-// check when second arg is given other than boolean TRUE
-var_dump( print_r ($value, "string") );
-
/* closing resource handle used */
closedir($dir_handle);
@@ -1714,23 +1696,4 @@ Array
-- Iteration 4 --
-
-*** Testing print_r() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-2 * 3 = 6
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-
-*** Testing error conditions ***
-
-Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: value in %s on line %d
-string(0) ""
Done
diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt
index 8584f08758..71f2b5d64c 100644
--- a/ext/standard/tests/general_functions/print_r_64bit.phpt
+++ b/ext/standard/tests/general_functions/print_r_64bit.phpt
@@ -275,24 +275,6 @@ $misc_values = array (
/* calling check_printr() to display miscelleneous data using print_r() */
check_printr($misc_values);
-/* checking print_r() on functions */
-echo "\n*** Testing print_r() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-print_r( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump( print_r() );
-
-//passing more than required no. of arguments
-var_dump( print_r(123, true, "abc") );
-
-// check when second arg is given other than boolean TRUE
-var_dump( print_r ($value, "string") );
-
/* closing resource handle used */
closedir($dir_handle);
@@ -1718,23 +1700,4 @@ Array
-- Iteration 4 --
-
-*** Testing print_r() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-2 * 3 = 6
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-
-*** Testing error conditions ***
-
-Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: value in %s on line %d
-string(0) ""
Done
diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
index 87a4545501..37f8e17af2 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
@@ -8,10 +8,6 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
die('skip: Only for Windows');
}
-if (PHP_SAPI != 'cli') {
- die('skip: Only for CLI');
-}
-
if (getenv('SKIP_SLOW_TESTS')) {
doe('skip: Slow test');
}
diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt
index 4ff38267ad..03befdfb26 100644
--- a/ext/standard/tests/general_functions/proc_open-mb0.phpt
+++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt
@@ -2,7 +2,6 @@
proc_open with bypass_shell subprocess parameter passing
--SKIPIF--
<?php
-if (php_sapi_name() != "cli") die('skip CLI only test');
if (!function_exists("proc_open")) echo "skip proc_open() is not available";
?>
--FILE--
diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt
index e7a7a4cbfc..46115c6337 100644
--- a/ext/standard/tests/general_functions/proc_open-mb1.phpt
+++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt
@@ -2,7 +2,6 @@
proc_open without bypass_shell subprocess parameter passing
--SKIPIF--
<?php
-if (php_sapi_name() != "cli") die('skip CLI only test');
if (!function_exists("proc_open")) echo "skip proc_open() is not available";
?>
--FILE--
diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt
index e6639a71c7..73dec4eb75 100644
--- a/ext/standard/tests/general_functions/rand.phpt
+++ b/ext/standard/tests/general_functions/rand.phpt
@@ -4,60 +4,36 @@ rand() and mt_rand() tests
<?php
var_dump(mt_rand());
-var_dump(mt_rand(-1));
var_dump(mt_rand(-1,1));
var_dump(mt_rand(0,3));
var_dump(rand());
-var_dump(rand(-1));
var_dump(rand(-1,1));
var_dump(rand(0,3));
var_dump(srand());
var_dump(srand(-1));
-var_dump(srand(array()));
var_dump(mt_srand());
var_dump(mt_srand(-1));
-var_dump(mt_srand(array()));
var_dump(getrandmax());
-var_dump(getrandmax(1));
var_dump(mt_getrandmax());
-var_dump(mt_getrandmax(1));
echo "Done\n";
?>
--EXPECTF--
int(%d)
-
-Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(%i)
int(%d)
int(%d)
-
-Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(%i)
int(%d)
NULL
NULL
-
-Warning: srand() expects parameter 1 to be int, array given in %s on line %d
-NULL
-NULL
NULL
-
-Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d
NULL
int(%d)
-
-Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
int(%d)
-
-Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt
index c4f069a3d2..3b46a35e5d 100644
--- a/ext/standard/tests/general_functions/sleep_error.phpt
+++ b/ext/standard/tests/general_functions/sleep_error.phpt
@@ -10,14 +10,6 @@ Test sleep() function : error conditions
echo "*** Testing sleep() : error conditions ***\n";
-echo "\n-- Testing sleep() function with zero arguments --\n";
-var_dump( sleep() );
-
-echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
-$seconds = 10;
-$extra_arg = 10;
-var_dump( sleep($seconds, $extra_arg) );
-
echo "\n-- Testing sleep() function with negative interval --\n";
$seconds = -10;
var_dump( sleep($seconds) );
@@ -27,16 +19,6 @@ var_dump( sleep($seconds) );
--EXPECTF--
*** Testing sleep() : error conditions ***
--- Testing sleep() function with zero arguments --
-
-Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing sleep() function with more than expected no. of arguments --
-
-Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing sleep() function with negative interval --
Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt
index e904fdcaa0..a75ac12272 100644
--- a/ext/standard/tests/general_functions/strval.phpt
+++ b/ext/standard/tests/general_functions/strval.phpt
@@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) {
var_dump( strval($value) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( strval() );
-
-//arguments more than expected
-var_dump( strval( $scalars[0], $scalars[1]) );
-
echo "Done\n";
// close the resources used
@@ -284,19 +277,19 @@ string(14) "Resource id #%d"
string(14) "Resource id #%d"
-- Iteration 4 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 5 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 6 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 7 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 8 --
string(0) ""
@@ -306,12 +299,4 @@ string(0) ""
string(0) ""
-- Iteration 11 --
string(0) ""
-
-*** Testing error conditions ***
-
-Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt
index 5763084f70..1775978a12 100644
--- a/ext/standard/tests/general_functions/sys_getloadavg.phpt
+++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt
@@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip");
--FILE--
<?php
-var_dump(sys_getloadavg(""));
var_dump(sys_getloadavg());
echo "Done\n";
?>
--EXPECTF--
-Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s
-NULL
array(3) {
[0]=>
float(%f)
diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt
index 474aab7d5d..283e7f30e5 100644
--- a/ext/standard/tests/general_functions/usleep_error.phpt
+++ b/ext/standard/tests/general_functions/usleep_error.phpt
@@ -11,14 +11,6 @@ set_time_limit(20);
echo "*** Testing usleep() : error conditions ***\n";
-echo "\n-- Testing usleep() function with zero arguments --\n";
-var_dump( usleep() );
-
-echo "\n-- Testing usleep() function with more than expected no. of arguments --\n";
-$seconds = 10;
-$extra_arg = 10;
-var_dump( usleep($seconds, $extra_arg) );
-
echo "\n-- Testing usleep() function with negative interval --\n";
$seconds = -10;
var_dump( usleep($seconds) );
@@ -28,16 +20,6 @@ var_dump( usleep($seconds) );
--EXPECTF--
*** Testing usleep() : error conditions ***
--- Testing usleep() function with zero arguments --
-
-Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing usleep() function with more than expected no. of arguments --
-
-Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-- Testing usleep() function with negative interval --
Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d
diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt
index 4641051541..336abbdf9f 100644
--- a/ext/standard/tests/general_functions/var_dump.phpt
+++ b/ext/standard/tests/general_functions/var_dump.phpt
@@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n";
var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
$objects, $misc_values, $variations );
-/* checking var_dump() on functions */
-echo "\n*** Testing var_dump() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-var_dump( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump();
-
/* closing resource handle used */
closedir($dir_handle);
@@ -1561,17 +1549,4 @@ array(6) {
string(5) "/00\7"
}
}
-
-*** Testing var_dump() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-string(9) "2 * 3 = 6"
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-string(9) "
-
-*** Testing error conditions ***
-
-Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
Done
diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt
index 738de410e4..cd74d585bc 100644
--- a/ext/standard/tests/general_functions/var_dump_64bit.phpt
+++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt
@@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n";
var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
$objects, $misc_values, $variations );
-/* checking var_dump() on functions */
-echo "\n*** Testing var_dump() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-var_dump( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump();
-
/* closing resource handle used */
closedir($dir_handle);
@@ -1561,17 +1549,4 @@ array(6) {
string(5) "/00\7"
}
}
-
-*** Testing var_dump() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-string(9) "2 * 3 = 6"
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-string(9) "
-
-*** Testing error conditions ***
-
-Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
Done
diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt
index 61d94f83f4..3512006624 100644
--- a/ext/standard/tests/general_functions/var_export-locale.phpt
+++ b/ext/standard/tests/general_functions/var_export-locale.phpt
@@ -303,14 +303,7 @@ echo "\n";
$counter++;
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_export( var_export() );
-
-//arguments more than expected
-var_export( var_export(TRUE, FALSE, TRUE) );
-
-echo "\n\nDone";
+echo "\nDone";
?>
@@ -1138,11 +1131,4 @@ NULL
string(4) "NULL"
-*** Testing error conditions ***
-
-Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/general_functions/var_export-locale_32.phpt b/ext/standard/tests/general_functions/var_export-locale_32.phpt
index af9efd9e24..311b6395cd 100644
--- a/ext/standard/tests/general_functions/var_export-locale_32.phpt
+++ b/ext/standard/tests/general_functions/var_export-locale_32.phpt
@@ -303,14 +303,7 @@ echo "\n";
$counter++;
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_export( var_export() );
-
-//arguments more than expected
-var_export( var_export(TRUE, FALSE, TRUE) );
-
-echo "\n\nDone";
+echo "\nDone";
?>
@@ -1138,11 +1131,4 @@ NULL
string(4) "NULL"
-*** Testing error conditions ***
-
-Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt
index eedb757d20..7ce21205b1 100644
--- a/ext/standard/tests/general_functions/var_export_error2.phpt
+++ b/ext/standard/tests/general_functions/var_export_error2.phpt
@@ -8,11 +8,12 @@ Test var_export() function : error conditions - recursive object
* Alias to functions:
*/
-@$obj->p =& $obj;
+$obj = new stdClass;
+$obj->p =& $obj;
var_export($obj, true);
?>
===DONE===
--EXPECTF--
-Warning: var_export does not handle circular references in %s on line 9
+Warning: var_export does not handle circular references in %s on line 10
===DONE===
diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt
index c475a9cb05..240b015f1f 100644
--- a/ext/standard/tests/image/getimagesize_variation2.phpt
+++ b/ext/standard/tests/image/getimagesize_variation2.phpt
@@ -8,8 +8,8 @@ Test getimagesize() function : usage variations - unexpected type for arg 2
* Alias to functions:
*/
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -79,10 +79,10 @@ foreach($values as $key => $value) {
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing getimagesize() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(%d)
-Error: 8 - Undefined variable: unset_var, %s(%d)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
-- Arg value 0 --
string(28) "4a46494600010201006000600000"
diff --git a/ext/standard/tests/image/getimagesize_variation3.phpt b/ext/standard/tests/image/getimagesize_variation3.phpt
index a608047707..fba79ed461 100644
--- a/ext/standard/tests/image/getimagesize_variation3.phpt
+++ b/ext/standard/tests/image/getimagesize_variation3.phpt
@@ -60,10 +60,10 @@ array(0) {
-- Empty File (blank_file.bmp) --
-Notice: getimagesize(): Read error! in %s on line %d
+Notice: getimagesize(): Error reading from %s! in %s on line %d
bool(false)
-Notice: getimagesize(): Read error! in %s on line %d
+Notice: getimagesize(): Error reading from %s! in %s on line %d
bool(false)
array(0) {
}
diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt
index 8418a4b8c7..249df57943 100644
--- a/ext/standard/tests/image/image_type_to_extension.phpt
+++ b/ext/standard/tests/image/image_type_to_extension.phpt
@@ -29,12 +29,8 @@ image_type_to_extension()
printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false));
}
- var_dump(image_type_to_extension(-1, array()));
- var_dump(image_type_to_extension(new stdclass));
var_dump(image_type_to_extension(1000000, NULL));
- var_dump(image_type_to_extension());
var_dump(image_type_to_extension(0));
- var_dump(image_type_to_extension(0, 0, 0));
?>
Done
--EXPECTF--
@@ -89,18 +85,6 @@ Constant: IMAGETYPE_XBM
Constant: IMAGETYPE_WEBP
With dot: .webp
Without dot: webp
-
-Warning: image_type_to_extension() expects parameter 2 to be bool, array given in %s on line %d
-bool(false)
-
-Warning: image_type_to_extension() expects parameter 1 to be int, object given in %s on line %d
-bool(false)
bool(false)
-
-Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-bool(false)
-
-Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt
index fd671855e1..e6838f7f72 100644
--- a/ext/standard/tests/math/abs_variation.phpt
+++ b/ext/standard/tests/math/abs_variation.phpt
@@ -73,14 +73,18 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(abs($input) );
+ try {
+ var_dump(abs($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing abs() : usage variations ***
-- Iteration 1 --
@@ -102,27 +106,25 @@ int(1)
int(0)
-- Iteration 7 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 8 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 9 --
-bool(false)
+abs() expects parameter 1 to be int or float, array given
-- Iteration 10 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 11 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 12 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 13 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-int(1)
+abs() expects parameter 1 to be int or float, object given
-- Iteration 14 --
int(0)
@@ -131,5 +133,5 @@ int(0)
int(0)
-- Iteration 16 --
-int(%d)
+abs() expects parameter 1 to be int or float, resource given
===Done===
diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt
index 5575ec5796..4fe8437fd5 100644
--- a/ext/standard/tests/math/acos_variation.phpt
+++ b/ext/standard/tests/math/acos_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-
-Warning: acos() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(NAN)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt
index cc89ce3e76..12200e035c 100644
--- a/ext/standard/tests/math/acosh_variation.phpt
+++ b/ext/standard/tests/math/acosh_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(3.828168471)
float(3.828168471)
float(3.847562739)
float(3.847562739)
-
-Warning: acosh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(7.60090221)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt
index c8063849fd..c5d170e8db 100644
--- a/ext/standard/tests/math/asin_variation.phpt
+++ b/ext/standard/tests/math/asin_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-
-Warning: asin() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(NAN)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt
index 5e41a45900..2470f7d401 100644
--- a/ext/standard/tests/math/asinh_variation.phpt
+++ b/ext/standard/tests/math/asinh_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(3.829113652)
float(3.829113652)
float(3.848471992)
float(3.848471992)
-
-Warning: asinh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(7.60090271)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt
index b6a9a9ec32..625b6d0b83 100644
--- a/ext/standard/tests/math/atan_variation.phpt
+++ b/ext/standard/tests/math/atan_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(1.527345431)
float(1.527345431)
float(1.528178225)
float(1.528178225)
-
-Warning: atan() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(1.569796327)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt
index 2b0a4b1085..f14406bb0d 100644
--- a/ext/standard/tests/math/atanh_variation.phpt
+++ b/ext/standard/tests/math/atanh_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-
-Warning: atanh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(NAN)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
index 96e774b51f..5bd64a536b 100644
--- a/ext/standard/tests/math/base_convert_error.phpt
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -14,14 +14,10 @@ class classA
{
}
-echo "Incorrect number of arguments\n";
-base_convert();
-base_convert(35);
-base_convert(35,2);
+echo "Incorrect input\n";
base_convert(1234, 1, 10);
base_convert(1234, 10, 37);
-echo "Incorrect input\n";
try {
base_convert(new classA(), 8, 10);
} catch (Error $e) {
@@ -31,16 +27,9 @@ try {
?>
--EXPECTF--
*** Testing base_convert() : error conditions ***
-Incorrect number of arguments
-
-Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d
-
-Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d
-
-Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d
+Incorrect input
Warning: base_convert(): Invalid `from base' (1) in %s on line %d
Warning: base_convert(): Invalid `to base' (37) in %s on line %d
-Incorrect input
Object of class classA could not be converted to string
diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt
index 9f106bc704..ee151e3f7f 100644
--- a/ext/standard/tests/math/base_convert_variation1.phpt
+++ b/ext/standard/tests/math/base_convert_variation1.phpt
@@ -148,7 +148,7 @@ string(1) "0"
-- Iteration 19 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
string(1) "0"
diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt
index f59cb81bbe..a8444c5395 100644
--- a/ext/standard/tests/math/bindec_variation1.phpt
+++ b/ext/standard/tests/math/bindec_variation1.phpt
@@ -73,7 +73,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(bindec($input));
+ try {
+ var_dump(bindec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
@@ -148,11 +152,7 @@ int(0)
int(0)
-- Iteration 18 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+bindec() expects parameter 1 to be string, array given
-- Iteration 19 --
@@ -176,7 +176,5 @@ int(0)
int(0)
-- Iteration 24 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+bindec() expects parameter 1 to be string, resource given
===Done===
diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt
index 4f96268b37..0fdfe4b5eb 100644
--- a/ext/standard/tests/math/bindec_variation1_64bit.phpt
+++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt
@@ -73,7 +73,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(bindec($input));
+ try {
+ var_dump(bindec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
@@ -148,11 +152,7 @@ int(0)
int(0)
-- Iteration 18 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+bindec() expects parameter 1 to be string, array given
-- Iteration 19 --
@@ -176,7 +176,5 @@ int(0)
int(0)
-- Iteration 24 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+bindec() expects parameter 1 to be string, resource given
===Done===
diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt
index 05f308a4a0..07481126fd 100644
--- a/ext/standard/tests/math/ceil_variation1.phpt
+++ b/ext/standard/tests/math/ceil_variation1.phpt
@@ -67,13 +67,17 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(ceil($input));
+ try {
+ var_dump(ceil($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing ceil() : usage variations ***
-- Iteration 1 --
@@ -95,27 +99,25 @@ float(1)
float(0)
-- Iteration 7 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 8 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 9 --
-bool(false)
+ceil() expects parameter 1 to be int or float, array given
-- Iteration 10 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 11 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 12 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 13 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-float(1)
+ceil() expects parameter 1 to be int or float, object given
-- Iteration 14 --
float(0)
@@ -124,5 +126,5 @@ float(0)
float(0)
-- Iteration 16 --
-float(%d)
+ceil() expects parameter 1 to be int or float, resource given
===Done===
diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt
index 6323042dc7..f9d1b26246 100644
--- a/ext/standard/tests/math/cos_variation.phpt
+++ b/ext/standard/tests/math/cos_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(-0.5328330203)
float(-0.5328330203)
float(-0.1117112391)
float(-0.1117112391)
-
-Warning: cos() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(0.5623790763)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt
index cd64670668..ec58c0151f 100644
--- a/ext/standard/tests/math/cosh_variation.phpt
+++ b/ext/standard/tests/math/cosh_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(4872401723)
float(4872401723)
float(7641446995)
float(7641446995)
-
-Warning: cosh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(INF)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt
index d5f6920ea7..eb3c7eae0e 100644
--- a/ext/standard/tests/math/deg2rad_variation.phpt
+++ b/ext/standard/tests/math/deg2rad_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(0.401425728)
float(0.401425728)
float(0.4092797096)
float(0.4092797096)
-
-Warning: deg2rad() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(17.45329252)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/fdiv.phpt b/ext/standard/tests/math/fdiv.phpt
new file mode 100644
index 0000000000..dd50cfdb78
--- /dev/null
+++ b/ext/standard/tests/math/fdiv.phpt
@@ -0,0 +1,78 @@
+--TEST--
+fdiv() function
+--FILE--
+<?php
+
+var_dump(fdiv(10, 3));
+var_dump(fdiv(10., 3.));
+var_dump(fdiv(-10., 2.5));
+var_dump(fdiv(10., -2.5));
+echo "\n";
+var_dump(fdiv(10., 0.));
+var_dump(fdiv(10., -0.));
+var_dump(fdiv(-10., 0.));
+var_dump(fdiv(-10., -0.));
+echo "\n";
+var_dump(fdiv(INF, 0.));
+var_dump(fdiv(INF, -0.));
+var_dump(fdiv(-INF, 0.));
+var_dump(fdiv(-INF, -0.));
+echo "\n";
+var_dump(fdiv(0., 0.));
+var_dump(fdiv(0., -0.));
+var_dump(fdiv(-0., 0.));
+var_dump(fdiv(-0., -0.));
+echo "\n";
+var_dump(fdiv(INF, INF));
+var_dump(fdiv(INF, -INF));
+var_dump(fdiv(-INF, INF));
+var_dump(fdiv(-INF, -INF));
+echo "\n";
+var_dump(fdiv(0., INF));
+var_dump(fdiv(0., -INF));
+var_dump(fdiv(-0., INF));
+var_dump(fdiv(-0., -INF));
+echo "\n";
+var_dump(fdiv(NAN, NAN));
+var_dump(fdiv(INF, NAN));
+var_dump(fdiv(0., NAN));
+var_dump(fdiv(NAN, INF));
+var_dump(fdiv(NAN, 0.));
+
+?>
+--EXPECT--
+float(3.3333333333333)
+float(3.3333333333333)
+float(-4)
+float(-4)
+
+float(INF)
+float(-INF)
+float(-INF)
+float(INF)
+
+float(INF)
+float(-INF)
+float(-INF)
+float(INF)
+
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+float(0)
+float(-0)
+float(-0)
+float(0)
+
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt
index aef4c742b9..e3406eba87 100644
--- a/ext/standard/tests/math/floor_variation1.phpt
+++ b/ext/standard/tests/math/floor_variation1.phpt
@@ -67,13 +67,17 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(floor($input));
+ try {
+ var_dump(floor($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
?>
===Done===
---EXPECTF--
+--EXPECT--
*** Testing floor() : usage variations ***
-- Iteration 1 --
@@ -95,27 +99,25 @@ float(1)
float(0)
-- Iteration 7 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 8 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 9 --
-bool(false)
+floor() expects parameter 1 to be int or float, array given
-- Iteration 10 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 11 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 12 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 13 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-float(1)
+floor() expects parameter 1 to be int or float, object given
-- Iteration 14 --
float(0)
@@ -124,5 +126,5 @@ float(0)
float(0)
-- Iteration 16 --
-float(%f)
+floor() expects parameter 1 to be int or float, resource given
===Done===
diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt
index 8f066cb11d..e7748a04d0 100644
--- a/ext/standard/tests/math/hexdec_variation1.phpt
+++ b/ext/standard/tests/math/hexdec_variation1.phpt
@@ -77,7 +77,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(hexdec($input));
+ try {
+ var_dump(hexdec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
@@ -154,11 +158,7 @@ int(0)
int(0)
-- Iteration 20 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(170)
+hexdec() expects parameter 1 to be string, array given
-- Iteration 21 --
@@ -182,7 +182,5 @@ int(0)
int(0)
-- Iteration 26 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(970453)
+hexdec() expects parameter 1 to be string, resource given
===Done===
diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
index 759997979f..31cc71b0e6 100644
--- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt
+++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
@@ -77,7 +77,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(hexdec($input));
+ try {
+ var_dump(hexdec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
@@ -154,11 +158,7 @@ int(0)
int(0)
-- Iteration 20 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(170)
+hexdec() expects parameter 1 to be string, array given
-- Iteration 21 --
@@ -182,7 +182,5 @@ int(0)
int(0)
-- Iteration 26 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(970453)
+hexdec() expects parameter 1 to be string, resource given
===Done===
diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt
index 44304f2475..7660f67c24 100644
--- a/ext/standard/tests/math/lcg_value_basic.phpt
+++ b/ext/standard/tests/math/lcg_value_basic.phpt
@@ -21,22 +21,6 @@ if ($i != 100) {
echo "PASSED\n";
}
-echo "\n lcg_value error cases..\n";
-$res = lcg_value(23);
-
-if (is_null($res)) {
- echo "PASSED\n";
-} else {
- echo "FAILED\n";
-}
-
-$res = lcg_value(10,false);
-if (is_null($res)) {
- echo "PASSED\n";
-} else {
- echo "FAILED\n";
-}
-
echo "MATHS test script completed\n";
?>
@@ -45,12 +29,4 @@ MATHS test script started
lcg_value tests...
PASSED
-
- lcg_value error cases..
-
-Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d
-PASSED
-
-Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d
-PASSED
MATHS test script completed
diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt
index 5304325952..8dbea47a84 100644
--- a/ext/standard/tests/math/log10_variation.phpt
+++ b/ext/standard/tests/math/log10_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(1.361727836)
float(1.361727836)
float(1.370142847)
float(1.370142847)
-
-Warning: log10() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(3)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt
index 48a23df3c0..7c305a4cba 100644
--- a/ext/standard/tests/math/log_error.phpt
+++ b/ext/standard/tests/math/log_error.phpt
@@ -4,13 +4,7 @@ Test log() - wrong params test log()
precision=14
--FILE--
<?php
-log();
-log(36,4,true);
log(36, -4);
?>
--EXPECTF--
-Warning: log() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: log() expects at most 2 parameters, 3 given in %s on line %d
-
Warning: log(): base must be greater than 0 in %s on line %d
diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt
index 84be45dbb3..b59b3b71eb 100644
--- a/ext/standard/tests/math/octdec_variation1.phpt
+++ b/ext/standard/tests/math/octdec_variation1.phpt
@@ -73,7 +73,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(octdec($input));
+ try {
+ var_dump(octdec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$iterator++;
};
fclose($fp);
@@ -156,11 +160,7 @@ int(0)
int(0)
-- Iteration 20 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+octdec() expects parameter 1 to be string, array given
-- Iteration 21 --
@@ -184,7 +184,5 @@ int(0)
int(0)
-- Iteration 26 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(5)
+octdec() expects parameter 1 to be string, resource given
---Done---
diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt
index 596a1940a4..6ea7d0c8a4 100644
--- a/ext/standard/tests/math/rad2deg_variation.phpt
+++ b/ext/standard/tests/math/rad2deg_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(1317.802929)
float(1317.802929)
float(1343.58603)
float(1343.58603)
-
-Warning: rad2deg() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(57295.77951)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt
index 5b635dfbdc..d044a16b40 100644
--- a/ext/standard/tests/math/sin_variation.phpt
+++ b/ext/standard/tests/math/sin_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(-0.8462204042)
float(-0.8462204042)
float(-0.9937407102)
float(-0.9937407102)
-
-Warning: sin() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(0.8268795405)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt
index e47e94d629..5e576f447f 100644
--- a/ext/standard/tests/math/sinh_variation.phpt
+++ b/ext/standard/tests/math/sinh_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(4872401723)
float(4872401723)
float(7641446995)
float(7641446995)
-
-Warning: sinh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(INF)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt
index 7369b98dfd..6e2304b437 100644
--- a/ext/standard/tests/math/sqrt_variation.phpt
+++ b/ext/standard/tests/math/sqrt_variation.phpt
@@ -22,7 +22,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -47,9 +46,6 @@ float(4.7958315233127)
float(4.7958315233127)
float(4.8425200051213)
float(4.8425200051213)
-
-Warning: sqrt() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(31.622776601684)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt
index 81546bbf6f..2c9ede4738 100644
--- a/ext/standard/tests/math/tan_variation.phpt
+++ b/ext/standard/tests/math/tan_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(1.588153083)
float(1.588153083)
float(8.895619796)
float(8.895619796)
-
-Warning: tan() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(1.470324156)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt
index b1b477c150..907f802b8a 100644
--- a/ext/standard/tests/math/tanh_variation.phpt
+++ b/ext/standard/tests/math/tanh_variation.phpt
@@ -21,7 +21,6 @@ $values = array(23,
"23",
"23.45",
"2.345e1",
- "nonsense",
"1000",
"1000ABC",
null,
@@ -44,9 +43,6 @@ float(1)
float(1)
float(1)
float(1)
-
-Warning: tanh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(1)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt
index c8689d8370..dea6cb27f7 100644
--- a/ext/standard/tests/misc/get_browser_error.phpt
+++ b/ext/standard/tests/misc/get_browser_error.phpt
@@ -30,9 +30,6 @@ echo "*** Testing get_browser() : error functionality ***\n";
/* Unknown browser uses defaults. */
var_dump( get_browser( 'foobar', true ) );
-/* More than expected arguments */
-var_dump( get_browser( 'foobar', true, 15 ) );
-
/* Some wrong parameters, no HTTP_USER_AGENT set */
var_dump( get_browser( null, 'foobar' ) );
@@ -111,9 +108,6 @@ array(34) {
string(1) "0"
}
-Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d
bool(false)
===DONE===
diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt
index 638412b47f..ea08335f2d 100644
--- a/ext/standard/tests/network/fsockopen_error.phpt
+++ b/ext/standard/tests/network/fsockopen_error.phpt
@@ -11,21 +11,6 @@ Test fsockopen() function : error conditions
echo "*** Testing fsockopen() : basic error conditions ***\n";
-
-echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n";
-$hostname = 'string_val';
-$port = 10;
-$errno = 10;
-$errstr = 'string_val';
-$timeout = 10.5;
-$extra_arg = 10;
-var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) );
-var_dump($errstr);
-var_dump($errno);
-
-echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n";
-var_dump( fsockopen() );
-
echo "\n-- Attempting to connect to a non-existent socket --\n";
$hostname = 'tcp://127.0.0.1'; // loopback address
$port = 31337;
@@ -49,18 +34,6 @@ echo "Done";
--EXPECTF--
*** Testing fsockopen() : basic error conditions ***
--- Testing fsockopen() function with more than expected no. of arguments --
-
-Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d
-bool(false)
-string(10) "string_val"
-int(10)
-
--- Testing fsockopen() function with less than expected no. of arguments --
-
-Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-- Attempting to connect to a non-existent socket --
Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d
diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt
index f7982d5ca4..a33a71185f 100644
--- a/ext/standard/tests/network/gethostbyaddr_error.phpt
+++ b/ext/standard/tests/network/gethostbyaddr_error.phpt
@@ -11,16 +11,6 @@ Test gethostbyaddr() function : error conditions
echo "Testing gethostbyaddr : error conditions\n";
-// Zero arguments
-echo "\n-- Testing gethostbyaddr function with Zero arguments --\n";
-var_dump( gethostbyaddr() );
-
-//Test gethostbyaddr with one more than the expected number of arguments
-echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n";
-$ip_address = 'string_val';
-$extra_arg = 10;
-var_dump( gethostbyaddr($ip_address, $extra_arg) );
-
echo "\n-- Testing gethostbyaddr function with invalid addresses --\n";
$ip_address = 'invalid';
@@ -37,16 +27,6 @@ echo "Done";
--EXPECTREGEX--
Testing gethostbyaddr : error conditions
--- Testing gethostbyaddr function with Zero arguments --
-
-Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+
-NULL
-
--- Testing gethostbyaddr function with more than expected no. of arguments --
-
-Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+
-NULL
-
-- Testing gethostbyaddr function with invalid addresses --
Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
diff --git a/ext/standard/tests/network/gethostname.phpt b/ext/standard/tests/network/gethostname.phpt
index e7caaf48eb..57f4c498d0 100644
--- a/ext/standard/tests/network/gethostname.phpt
+++ b/ext/standard/tests/network/gethostname.phpt
@@ -5,10 +5,6 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p
--FILE--
<?php
var_dump(gethostname());
-var_dump(gethostname("php-zend-brazil"));
?>
--EXPECTF--
-%s
-
-Warning: gethostname() expects exactly %d parameters, %d given in %s on line %d
-NULL
+string(%d) "%s"
diff --git a/ext/standard/tests/network/getprotobyname_error.phpt b/ext/standard/tests/network/getprotobyname_error.phpt
index 7ee366ac7a..52ef3b8ee0 100644
--- a/ext/standard/tests/network/getprotobyname_error.phpt
+++ b/ext/standard/tests/network/getprotobyname_error.phpt
@@ -4,13 +4,8 @@ getprotobyname function errors test
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
- // empty protocol name
- var_dump(getprotobyname());
-
- // invalid protocol name
- var_dump(getprotobyname('abc'));
+// invalid protocol name
+var_dump(getprotobyname('abc'));
?>
---EXPECTF--
-Warning: getprotobyname() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
diff --git a/ext/standard/tests/network/getprotobynumber_error.phpt b/ext/standard/tests/network/getprotobynumber_error.phpt
index 7df12e864a..dda2661b5a 100644
--- a/ext/standard/tests/network/getprotobynumber_error.phpt
+++ b/ext/standard/tests/network/getprotobynumber_error.phpt
@@ -4,13 +4,8 @@ getprotobynumber function errors test
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
- // empty protocol number
- var_dump(getprotobynumber());
-
- // invalid protocol number
- var_dump(getprotobynumber(999));
+// invalid protocol number
+var_dump(getprotobynumber(999));
?>
---EXPECTF--
-Warning: getprotobynumber() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt
index a1e70a0020..81db0016b5 100644
--- a/ext/standard/tests/network/inet.phpt
+++ b/ext/standard/tests/network/inet.phpt
@@ -14,12 +14,10 @@ var_dump(inet_ntop($packed));
$packed = chr(255) . chr(255) . chr(255) . chr(0);
var_dump(inet_ntop($packed));
-var_dump(inet_ntop());
var_dump(inet_ntop(-1));
var_dump(inet_ntop(""));
var_dump(inet_ntop("blah-blah"));
-var_dump(inet_pton());
var_dump(inet_pton(""));
var_dump(inet_pton(-1));
var_dump(inet_pton("abra"));
@@ -40,15 +38,9 @@ echo "Done\n";
--EXPECTF--
string(9) "127.0.0.1"
string(13) "255.255.255.0"
-
-Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt
index 5237c89776..831eee018a 100644
--- a/ext/standard/tests/network/ip.phpt
+++ b/ext/standard/tests/network/ip.phpt
@@ -21,16 +21,11 @@ foreach ($array as $ip) {
var_dump(long2ip($long));
}
-var_dump(ip2long());
var_dump(ip2long(""));
var_dump(ip2long("777.777.777.777"));
var_dump(ip2long("111.111.111.111"));
-var_dump(ip2long(array()));
-var_dump(long2ip());
var_dump(long2ip(-110000));
-var_dump(long2ip(""));
-var_dump(long2ip(array()));
echo "Done\n";
?>
@@ -47,23 +42,8 @@ int(0)
string(7) "0.0.0.0"
int(1118019956)
string(14) "66.163.161.116"
-
-Warning: ip2long() expects exactly 1 parameter, 0 given in %sip.php on line %d
-NULL
bool(false)
bool(false)
int(1869573999)
-
-Warning: ip2long() expects parameter 1 to be string, array given in %sip.php on line %d
-NULL
-
-Warning: long2ip() expects exactly 1 parameter, 0 given in %sip.php on line %d
-NULL
string(13) "255.254.82.80"
-
-Warning: long2ip() expects parameter 1 to be int, string given in %sip.php on line %d
-NULL
-
-Warning: long2ip() expects parameter 1 to be int, array given in %sip.php on line %d
-NULL
Done
diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt
index 3c530b8371..06ed1549a6 100644
--- a/ext/standard/tests/network/ip_x86_64.phpt
+++ b/ext/standard/tests/network/ip_x86_64.phpt
@@ -21,16 +21,11 @@ foreach ($array as $ip) {
var_dump(long2ip($long));
}
-var_dump(ip2long());
var_dump(ip2long(""));
var_dump(ip2long("777.777.777.777"));
var_dump(ip2long("111.111.111.111"));
-var_dump(ip2long(array()));
-var_dump(long2ip());
var_dump(long2ip(-110000));
-var_dump(long2ip(""));
-var_dump(long2ip(array()));
echo "Done\n";
?>
@@ -47,23 +42,8 @@ int(0)
string(7) "0.0.0.0"
int(1118019956)
string(14) "66.163.161.116"
-
-Warning: ip2long() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d
-NULL
bool(false)
bool(false)
int(1869573999)
-
-Warning: ip2long() expects parameter 1 to be string, array given in %sip_x86_64.php on line %d
-NULL
-
-Warning: long2ip() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d
-NULL
string(13) "255.254.82.80"
-
-Warning: long2ip() expects parameter 1 to be int, string given in %sip_x86_64.php on line %d
-NULL
-
-Warning: long2ip() expects parameter 1 to be int, array given in %sip_x86_64.php on line %d
-NULL
Done
diff --git a/ext/standard/tests/password/password_bcrypt_errors.phpt b/ext/standard/tests/password/password_bcrypt_errors.phpt
index a0826080e6..64496744cb 100644
--- a/ext/standard/tests/password/password_bcrypt_errors.phpt
+++ b/ext/standard/tests/password/password_bcrypt_errors.phpt
@@ -8,14 +8,6 @@ var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3)));
var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32)));
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "foo")));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "123456789012345678901")));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => 123)));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => "foo")));
-
?>
--EXPECTF--
Warning: password_hash(): Invalid bcrypt cost parameter specified: 3 in %s on line %d
@@ -23,21 +15,3 @@ NULL
Warning: password_hash(): Invalid bcrypt cost parameter specified: 32 in %s on line %d
NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 21 expecting 22 in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d
-NULL
-
-Warning: password_hash(): Invalid bcrypt cost parameter specified: 0 in %s on line %d
-NULL
diff --git a/ext/standard/tests/password/password_deprecated_salts.phpt b/ext/standard/tests/password/password_deprecated_salts.phpt
deleted file mode 100644
index c173401067..0000000000
--- a/ext/standard/tests/password/password_deprecated_salts.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test deprecated operation of password_hash()
---FILE--
-<?php
-//-=-=-=-
-
-
-var_dump(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt")));
-
-var_dump(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))));
-
-echo "OK!";
-?>
---EXPECTF--
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-string(60) "$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi"
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-string(60) "$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y"
-OK!
diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt
index 6416eca91b..0eec2383c1 100644
--- a/ext/standard/tests/password/password_hash_error.phpt
+++ b/ext/standard/tests/password/password_hash_error.phpt
@@ -4,51 +4,38 @@ Test error operation of password_hash()
<?php
//-=-=-=-
-var_dump(password_hash());
-
-var_dump(password_hash("foo"));
+try {
+ var_dump(password_hash("foo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(password_hash("foo", array()));
var_dump(password_hash("foo", 19, new StdClass));
-var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz"));
-
-var_dump(password_hash(array(), PASSWORD_BCRYPT));
+try {
+ var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-var_dump(password_hash("123", PASSWORD_BCRYPT, array("salt" => array())));
-
-/* Non-string salt, checking for memory leaks */
-var_dump(password_hash('123', PASSWORD_BCRYPT, array('salt' => 1234)));
+try {
+ var_dump(password_hash(array(), PASSWORD_BCRYPT));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d
-NULL
+password_hash() expects at least 2 parameters, 1 given
-Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: password_hash(): Unknown password hashing algorithm: Array in %s on line %d
NULL
Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d
NULL
-
-Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d
-NULL
-
-Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Non-string salt parameter supplied in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d
-NULL
+password_hash() expects parameter 3 to be array, string given
+password_hash() expects parameter 1 to be string, array given
diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt
index 7180d11de7..f64723ee85 100644
--- a/ext/standard/tests/password/password_needs_rehash_error.phpt
+++ b/ext/standard/tests/password/password_needs_rehash_error.phpt
@@ -3,29 +3,32 @@ Test error operation of password_needs_rehash()
--FILE--
<?php
//-=-=-=-
-var_dump(password_needs_rehash());
-var_dump(password_needs_rehash(''));
+try {
+ var_dump(password_needs_rehash(''));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(password_needs_rehash('', []));
-var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT));
+try {
+ var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo"));
+try {
+ var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "OK!";
?>
--EXPECTF--
-Warning: password_needs_rehash() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d
-NULL
+password_needs_rehash() expects at least 2 parameters, 1 given
bool(false)
-
-Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: password_needs_rehash() expects parameter 3 to be array, string given in %s on line %d
-NULL
+password_needs_rehash() expects parameter 1 to be string, array given
+password_needs_rehash() expects parameter 3 to be array, string given
OK!
diff --git a/ext/standard/tests/password/password_removed_salt_option.phpt b/ext/standard/tests/password/password_removed_salt_option.phpt
new file mode 100644
index 0000000000..356bdec3e8
--- /dev/null
+++ b/ext/standard/tests/password/password_removed_salt_option.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test removed support for explicit salt option
+--FILE--
+<?php
+//-=-=-=-
+
+
+var_dump(strlen(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt"))));
+
+var_dump(strlen(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0)))));
+
+echo "OK!";
+?>
+--EXPECTF--
+Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d
+int(60)
+
+Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d
+int(60)
+OK!
diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt
index 7f680af448..192a4ae288 100644
--- a/ext/standard/tests/password/password_verify_error.phpt
+++ b/ext/standard/tests/password/password_verify_error.phpt
@@ -4,14 +4,12 @@ Test error operation of password_verify()
<?php
//-=-=-=-
-var_dump(password_verify());
-
-var_dump(password_verify("foo"));
+try {
+ var_dump(password_verify("foo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: password_verify() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: password_verify() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
+--EXPECT--
+password_verify() expects exactly 2 parameters, 1 given
diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt
index c4dbcd6926..abd0281a12 100644
--- a/ext/standard/tests/serialize/bug69152.phpt
+++ b/ext/standard/tests/serialize/bug69152.phpt
@@ -9,8 +9,6 @@ $x->test();
?>
--EXPECTF--
-Exception in %s:%d
-Stack trace:
-#0 {main}
-
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
+Fatal error: Uncaught TypeError: trace is not an array in %s:%d
+%a
+ thrown in %s on line %d
diff --git a/ext/standard/tests/serialize/bug69793.phpt b/ext/standard/tests/serialize/bug69793.phpt
index 8426c1573e..b2d9fbb256 100644
--- a/ext/standard/tests/serialize/bug69793.phpt
+++ b/ext/standard/tests/serialize/bug69793.phpt
@@ -7,11 +7,11 @@ $e = unserialize('O:9:"Exception":7:{s:17:"'."\0".'Exception'."\0".'string";s:1:
var_dump($e."");
?>
--EXPECTF--
-Notice: Undefined property: Exception::$file in %s%ebug69793.php on line %d
+Warning: Undefined property: Exception::$file in %s on line %d
-Notice: Undefined property: Exception::$previous in %s%ebug69793.php on line %d
+Warning: Undefined property: Exception::$previous in %s on line %d
-Notice: Undefined property: Exception::$previous in %s%ebug69793.php on line %d
+Warning: Undefined property: Exception::$previous in %s on line %d
string(41) "Exception in :1337
Stack trace:
#0 {main}"
diff --git a/ext/standard/tests/serialize/serialization_objects_002.phpt b/ext/standard/tests/serialize/serialization_objects_002.phpt
index c7f9e1cbd3..920fd35310 100644
--- a/ext/standard/tests/serialize/serialization_objects_002.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_002.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
index 4c631c6a59..48325f4fba 100644
--- a/ext/standard/tests/serialize/serialization_objects_005.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -77,7 +77,7 @@ string(9) "p.changed"
bool(false)
bool(true)
-Notice: Undefined property: C::$x in %s on line 37
+Warning: Undefined property: C::$x in %s on line %d
NULL
diff --git a/ext/standard/tests/serialize/typed_property_refs.phpt b/ext/standard/tests/serialize/typed_property_refs.phpt
index 9475e8a783..72bad612b0 100644
--- a/ext/standard/tests/serialize/typed_property_refs.phpt
+++ b/ext/standard/tests/serialize/typed_property_refs.phpt
@@ -66,8 +66,8 @@ object(B)#1 (2) {
["b"]=>
&int(1)
}
-Typed property A::$a must be int, null used
-Typed property B::$b must be int, null used
-Typed property C::$b must be string, int used
-Typed property C::$a must be int, string used
+Cannot assign null to property A::$a of type int
+Cannot assign null to property B::$b of type int
+Cannot assign int to property C::$b of type string
+Cannot assign string to property C::$a of type int
Reference with value of type int held by property D::$a of type int is not compatible with property D::$b of type float
diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt
index 8c95ea456e..b69c6c557b 100644
--- a/ext/standard/tests/streams/bug46426.phpt
+++ b/ext/standard/tests/streams/bug46426.phpt
@@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0);
echo "\n";
echo stream_get_contents($tmp, -1);
-@unlink($tmp);
-
?>
--EXPECT--
23
diff --git a/ext/standard/tests/streams/bug53903.phpt b/ext/standard/tests/streams/bug53903.phpt
index fd0b770f6b..ca04a5ca14 100644
--- a/ext/standard/tests/streams/bug53903.phpt
+++ b/ext/standard/tests/streams/bug53903.phpt
@@ -24,7 +24,7 @@ $s[] = 1; // Cannot use a scalar value as an array
print_r($s);
--EXPECTF--
-Notice: Undefined property: sw::$undefined in %s on line %d
+Warning: Undefined property: sw::$undefined in %s on line %d
Array
(
[0] => 1
diff --git a/ext/standard/tests/streams/bug54623.phpt b/ext/standard/tests/streams/bug54623.phpt
index c21dc82019..02b1924eea 100644
--- a/ext/standard/tests/streams/bug54623.phpt
+++ b/ext/standard/tests/streams/bug54623.phpt
@@ -9,9 +9,12 @@ $sock2 = pfsockopen('udp://127.0.0.1', '63844');
var_dump((int)$sock2);
@fwrite($sock2, "2");
fclose($sock2);
-fwrite($sock, "3");
+try {
+ fwrite($sock, "3");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
--EXPECTF--
int(%d)
int(%d)
-
-Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d
+fwrite(): supplied resource is not a valid stream resource
diff --git a/ext/standard/tests/streams/bug60602.phpt b/ext/standard/tests/streams/bug60602.phpt
index 82917ecbd6..4f88c8dd2c 100644
--- a/ext/standard/tests/streams/bug60602.phpt
+++ b/ext/standard/tests/streams/bug60602.phpt
@@ -48,7 +48,7 @@ if (is_resource($p)) {
?>
==DONE==
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
int(%d)
int(0)
bool(true)
diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt
index dc7fcb239c..6f5abcb782 100644
--- a/ext/standard/tests/streams/stream_get_contents_001.phpt
+++ b/ext/standard/tests/streams/stream_get_contents_001.phpt
@@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n";
echo stream_get_contents($tmp, 2, 3), "--\n";
echo stream_get_contents($tmp, 2, -1), "--\n";
-@unlink($tmp);
-
?>
--EXPECT--
--
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
index bb98d7c6e7..7bfa4f0510 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
@@ -10,48 +10,20 @@ Test stream_get_meta_data() function : error conditions
echo "*** Testing stream_get_meta_data() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
-var_dump( stream_get_meta_data() );
-
-//Test stream_get_meta_data with one more than the expected number of arguments
-echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
-
-$fp = null;
-$extra_arg = 10;
-var_dump( stream_get_meta_data($fp, $extra_arg) );
-
-echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
-$fp = null;
-var_dump(stream_get_meta_data($fp));
-
echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
$fp = fopen(__FILE__, 'r');
fclose($fp);
-var_dump(stream_get_meta_data($fp));
+try {
+ var_dump(stream_get_meta_data($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing stream_get_meta_data() : error conditions ***
--- Testing stream_get_meta_data() function with Zero arguments --
-
-Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing stream_get_meta_data() function with more than expected no. of arguments --
-
-Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing stream_get_meta_data() function with invalid stream resource --
-
-Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d
-NULL
-
-- Testing stream_get_meta_data() function with closed stream resource --
-
-Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+stream_get_meta_data(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt
index 4109b5672e..f77c0730f3 100644
--- a/ext/standard/tests/streams/stream_resolve_include_path.phpt
+++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt
@@ -14,8 +14,6 @@ mkdir($include_path_nested);
file_put_contents($include_path_file, 'include_path');
file_put_contents($include_path_nested_file, 'include_path');
-var_dump(stream_resolve_include_path());
-
set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
var_dump(stream_resolve_include_path('file-does-not-exist'));
@@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file'));
set_include_path($include_path_nested . PATH_SEPARATOR . $include_path);
var_dump(stream_resolve_include_path('file'));
+?>
+--CLEAN--
+<?php
+$include_path = __DIR__ . '/test_path';
+$include_path_nested = $include_path . '/nested';
+$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file';
+$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file';
+
unlink($include_path_nested_file);
rmdir($include_path_nested);
unlink($include_path_file);
rmdir($include_path);
+?>
--EXPECTF--
-Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
bool(false)
string(%d) "%stest_path%sfile"
string(%d) "%stest_path%snested%sfile"
diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt
index 8c2ae9865b..851fd2cfcf 100644
--- a/ext/standard/tests/streams/stream_set_chunk_size.phpt
+++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt
@@ -51,7 +51,6 @@ var_dump(strlen(fwrite($f, str_repeat('b', 250))));
echo "\nerror conditions\n";
var_dump(stream_set_chunk_size($f, 0));
var_dump(stream_set_chunk_size($f, -1));
-var_dump(stream_set_chunk_size($f, array()));
--EXPECTF--
bool(true)
should return previous chunk size (8192)
@@ -87,6 +86,3 @@ bool(false)
Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d
bool(false)
-
-Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d
-bool(false)
diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt
index 0334b951e0..7dcc645422 100644
--- a/ext/standard/tests/streams/stream_set_timeout_error.phpt
+++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt
@@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions
echo "*** Testing stream_set_timeout() : error conditions ***\n";
-//Test stream_set_timeout with one more than the expected number of arguments
-echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n";
-
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
@@ -26,22 +23,14 @@ $client = fsockopen("tcp://127.0.0.1:$port");
$seconds = 10;
$microseconds = 10;
-$extra_arg = 10;
-var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) );
-
-// Testing stream_set_timeout with one less than the expected number of arguments
-echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n";
-
-$seconds = 10;
-var_dump( stream_set_timeout($client) );
-
echo "\n-- Testing stream_set_timeout() function with a closed socket --\n";
fclose($client);
-var_dump( stream_set_timeout($client, $seconds) );
-
-echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n";
-var_dump( stream_set_timeout($seconds, $seconds) );
+try {
+ var_dump( stream_set_timeout($client, $seconds) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n";
$filestream = fopen(__FILE__, "r");
@@ -55,25 +44,8 @@ echo "Done";
--EXPECTF--
*** Testing stream_set_timeout() : error conditions ***
--- Testing stream_set_timeout() function with more than expected no. of arguments --
-
-Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
--- Testing stream_set_timeout() function with less than expected no. of arguments --
-
-Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-- Testing stream_set_timeout() function with a closed socket --
-
-Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
--- Testing stream_set_timeout() function with an invalid stream --
-
-Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d
-NULL
+stream_set_timeout(): supplied resource is not a valid stream resource
-- Testing stream_set_timeout() function with a stream that does not support timeouts --
bool(false)
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt
index 4080c7214d..5b60f6168d 100644
--- a/ext/standard/tests/strings/addcslashes_001.phpt
+++ b/ext/standard/tests/strings/addcslashes_001.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt
deleted file mode 100644
index f85c9c1e54..0000000000
--- a/ext/standard/tests/strings/bug24208.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #24208 (parse_str() is not working)
---FILE--
-<?php
-$a = $b = $c = "oops";
-parse_str("a=1&b=2&c=3");
-var_dump($a, $b, $c);
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-string(1) "1"
-string(1) "2"
-string(1) "3"
diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt
index 7ba38f94f5..b3cb2ece95 100644
--- a/ext/standard/tests/strings/bug33605.phpt
+++ b/ext/standard/tests/strings/bug33605.phpt
@@ -2,10 +2,12 @@
Bug #33605 (substr_compare crashes)
--FILE--
<?php
-$res = substr_compare("aa", "a", -99999999, -1, 0);
-var_dump($res);
+try {
+ substr_compare("aa", "a", -99999999, -1, 0);
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
?>
--EXPECTF--
-Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
-bool(false)
+The length must be greater than or equal to zero
diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt
index b964c4a659..92abb29206 100644
--- a/ext/standard/tests/strings/bug37262.phpt
+++ b/ext/standard/tests/strings/bug37262.phpt
@@ -2,9 +2,7 @@
Bug #37262 (var_export() does not escape \0 character)
--FILE--
<?php
-$func = create_function('$a', 'return $a;');
-var_export($func);
+var_export("foo\0bar");
?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-'' . "\0" . 'lambda_%d'
+--EXPECT--
+'foo' . "\0" . 'bar'
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
index 26ea5bc770..d502bff829 100644
--- a/ext/standard/tests/strings/bug40754.phpt
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -53,10 +53,10 @@ bool(false)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
int(2)
string(8) "abcdeabc"
diff --git a/ext/standard/tests/strings/bug54238.phpt b/ext/standard/tests/strings/bug54238.phpt
index 0f60098ff0..e679bb6928 100644
--- a/ext/standard/tests/strings/bug54238.phpt
+++ b/ext/standard/tests/strings/bug54238.phpt
@@ -1,7 +1,5 @@
--TEST--
Bug #54238 (use-after-free in substr_replace())
---INI--
-error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
$f = array(array('A', 'A'));
@@ -9,7 +7,10 @@ $f = array(array('A', 'A'));
$z = substr_replace($f, $f, $f, 1);
var_dump($z, $f);
?>
---EXPECT--
+--EXPECTF--
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
string(9) "AArrayray"
diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt
index 6b8d10daa7..f31f94fd84 100644
--- a/ext/standard/tests/strings/bug54322.phpt
+++ b/ext/standard/tests/strings/bug54322.phpt
@@ -2,9 +2,11 @@
Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion
--FILE--
<?php
-var_dump(
-get_html_translation_table(NAN, 0, "UTF-8") > 0
-);
---EXPECTF--
-Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
+try {
+ var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+get_html_translation_table() expects parameter 1 to be int, float given
diff --git a/ext/standard/tests/strings/bug61116.phpt b/ext/standard/tests/strings/bug61116.phpt
index b9b38a7bbb..a21ac519b5 100644
--- a/ext/standard/tests/strings/bug61116.phpt
+++ b/ext/standard/tests/strings/bug61116.phpt
@@ -9,18 +9,20 @@ echo new ReflectionFunction('get_html_translation_table'), "\n";
Function [ <internal:standard> function htmlspecialchars ] {
- Parameters [4] {
- Parameter #0 [ <required> $string ]
- Parameter #1 [ <optional> $quote_style ]
- Parameter #2 [ <optional> $encoding ]
- Parameter #3 [ <optional> $double_encode ]
+ Parameter #0 [ <required> string $string ]
+ Parameter #1 [ <optional> int $quote_style ]
+ Parameter #2 [ <optional> ?string $encoding ]
+ Parameter #3 [ <optional> bool $double_encode ]
}
+ - Return [ string ]
}
Function [ <internal:standard> function get_html_translation_table ] {
- Parameters [3] {
- Parameter #0 [ <optional> $table ]
- Parameter #1 [ <optional> $quote_style ]
- Parameter #2 [ <optional> $encoding ]
+ Parameter #0 [ <optional> int $table ]
+ Parameter #1 [ <optional> int $quote_style ]
+ Parameter #2 [ <optional> string $encoding ]
}
+ - Return [ array ]
}
diff --git a/ext/standard/tests/strings/bug63943.phpt b/ext/standard/tests/strings/bug63943.phpt
deleted file mode 100644
index 6018879b24..0000000000
--- a/ext/standard/tests/strings/bug63943.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Bug #63943 (Bad warning text from strpos() on empty needle)
---FILE--
-<?php
-strpos("lllllll", '');
-?>
---EXPECTF--
-Warning: strpos(): Empty needle in %sbug63943.php on line %d
diff --git a/ext/standard/tests/strings/bug77439.phpt b/ext/standard/tests/strings/bug77439.phpt
index ee8a3d2845..98ae56222b 100644
--- a/ext/standard/tests/strings/bug77439.phpt
+++ b/ext/standard/tests/strings/bug77439.phpt
@@ -2,12 +2,11 @@
Bug #77439: parse_str segfaults when inserting item into existing array
--FILE--
<?php
-$a = [];
-parse_str('a[1]=1');
-var_dump($a);
+$vars = ['a' => []];
+parse_str('a[1]=1', $vars);
+var_dump($vars['a']);
?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
+--EXPECT--
array(1) {
[1]=>
string(1) "1"
diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt
index 4d595543bb..820cadece0 100644
--- a/ext/standard/tests/strings/chr_error.phpt
+++ b/ext/standard/tests/strings/chr_error.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
index 648388f23a..a2696cd26b 100644
--- a/ext/standard/tests/strings/chunk_split.phpt
+++ b/ext/standard/tests/strings/chunk_split.phpt
@@ -7,17 +7,6 @@ echo chunk_split('foooooooooooooooo', 5)."\n";
echo chunk_split(str_repeat('X', 2*76))."\n";
echo chunk_split("test", 10, "|end") . "\n";
-$a=str_repeat("B", 65535);
-$b=1;
-$c=str_repeat("B", 65535);
-var_dump(chunk_split($a,$b,$c));
-
-$a=str_repeat("B", 65537);
-$b=1;
-$c=str_repeat("B", 65537);
-var_dump(chunk_split($a,$b,$c));
-
-
?>
--EXPECT--
a-b-c-
@@ -30,5 +19,3 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
test|end
-bool(false)
-bool(false)
diff --git a/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt b/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt
new file mode 100644
index 0000000000..f9825eb438
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 1
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***\n";
+
+$a=str_repeat("B", 65535);
+$b=1;
+$c=str_repeat("B", 65535);
+var_dump(chunk_split($a,$b,$c));
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt b/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt
new file mode 100644
index 0000000000..ca0948d999
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 2
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n";
+
+$a=str_repeat("B", 65537);
+$b=1;
+$c=str_repeat("B", 65537);
+var_dump(chunk_split($a,$b,$c));
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***
+
+Fatal error: Possible integer overflow in memory allocation (65537 * 65537 + 65556) in %s on line %d
diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt
new file mode 100644
index 0000000000..3992e212d5
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation3.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected large number of chunks
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+$chunk_length = 1;
+
+echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n";
+
+echo "Body generation\n";
+$body = str_repeat("Hello", 10000000);
+
+echo "Using chunk_split()\n";
+var_dump(chunk_split($body, $chunk_length));
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***
+Body generation
+Using chunk_split()
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt
index 8a5a8cd6bb..bea49d24b4 100644
--- a/ext/standard/tests/strings/chunk_split_variation5.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt
index bfafd1af0b..15c224962e 100644
--- a/ext/standard/tests/strings/chunk_split_variation8.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation8.phpt
@@ -46,7 +46,13 @@ $values = array (
// loop through each element of values for 'chunklen'
for($count = 0; $count < count($values); $count++) {
echo "-- Iteration ".($count+1). " --\n";
- var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
+ try {
+ var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
echo "Done"
@@ -54,18 +60,14 @@ echo "Done"
--EXPECTF--
*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
-- Iteration 1 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
+Chunk length should be greater than zero
-- Iteration 2 --
string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: :::
::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.:::
:::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t:::
:::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::"
-- Iteration 3 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
+Chunk length should be greater than zero
-- Iteration 4 --
string(129) "This's heredoc string with and
white space char.
@@ -82,11 +84,7 @@ string(129) "This's heredoc string with and
It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
chunk_split():::"
-- Iteration 7 --
-
-Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d
-NULL
+chunk_split() expects parameter 2 to be int, float given
-- Iteration 8 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
+Chunk length should be greater than zero
Done
diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt
index 01bd0f50fc..3bbde00cf1 100644
--- a/ext/standard/tests/strings/convert_cyr_string.phpt
+++ b/ext/standard/tests/strings/convert_cyr_string.phpt
@@ -4,7 +4,6 @@ basic convert_cyr_string() tests
<?php
var_dump(convert_cyr_string("", "", ""));
-var_dump(convert_cyr_string(array(), array(), array()));
var_dump(convert_cyr_string("[[[[[[", "q", "m"));
var_dump(convert_cyr_string("[[[[[[", "k", "w"));
@@ -26,11 +25,6 @@ string(0) ""
Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d
string(6) "[[[[[["
diff --git a/ext/standard/tests/strings/count_chars_basic.phpt b/ext/standard/tests/strings/count_chars_basic.phpt
index c39889be15..ddf7adac87 100644
--- a/ext/standard/tests/strings/count_chars_basic.phpt
+++ b/ext/standard/tests/strings/count_chars_basic.phpt
@@ -20,6 +20,11 @@ var_dump(count_chars($string, 2));
var_dump(count_chars($string, 3));
var_dump(bin2hex(count_chars($string, 4)));
+try {
+ count_chars($string, 5);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
@@ -1571,4 +1576,5 @@ array(238) {
}
string(18) " Rabcdefghimnorstu"
string(476) "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f5051535455565758595a5b5c5d5e5f606a6b6c7071767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
+Unknown mode
===DONE===
diff --git a/ext/standard/tests/strings/crc32_variation3.phpt b/ext/standard/tests/strings/crc32_variation3.phpt
index 691703103e..bc219c43e9 100644
--- a/ext/standard/tests/strings/crc32_variation3.phpt
+++ b/ext/standard/tests/strings/crc32_variation3.phpt
@@ -77,9 +77,9 @@ echo "Done";
--EXPECTF--
*** Testing crc32() : with different strings in double quotes ***
-Notice: Undefined variable: hello in %s on line %d
+Warning: Undefined variable: hello in %s on line %d
-Notice: Undefined variable: world in %s on line %d
+Warning: Undefined variable: world in %s on line %d
-- Iteration 1 --
int(0)
diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt
index f64b61cb5f..270f0372d1 100644
--- a/ext/standard/tests/strings/crypt.phpt
+++ b/ext/standard/tests/strings/crypt.phpt
@@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR
echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
var_dump(crypt($str));
-var_dump(crypt());
-var_dump(crypt("", "", ""));
?>
--EXPECTF--
@@ -31,9 +29,3 @@ BLO
Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d
string(%d) "%s"
-
-Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt
index 98a9ea5b45..daf4e2cb0a 100644
--- a/ext/standard/tests/strings/dirname_error.phpt
+++ b/ext/standard/tests/strings/dirname_error.phpt
@@ -6,26 +6,17 @@ Test dirname() function : error conditions
Description: Returns directory name component of path.
*/
echo "*** Testing error conditions ***\n";
-// zero arguments
-var_dump( dirname() );
// Bad arg
-var_dump( dirname("/var/tmp/bar.gz", 0) );
-
-// more than expected no. of arguments
-var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") );
+try {
+ dirname("/var/tmp/bar.gz", 0);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "Done\n";
?>
--EXPECTF--
*** Testing error conditions ***
-
-Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d
-NULL
-
-Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d
-NULL
+Invalid argument, levels must be >= 1
Done
diff --git a/ext/standard/tests/strings/dirname_multi.phpt b/ext/standard/tests/strings/dirname_multi.phpt
index febbd0c293..f95bf16d2a 100644
--- a/ext/standard/tests/strings/dirname_multi.phpt
+++ b/ext/standard/tests/strings/dirname_multi.phpt
@@ -11,14 +11,17 @@ if((substr(PHP_OS, 0, 3) == "WIN"))
Description: Returns directory name component of path.
*/
for ($i=0 ; $i<5 ; $i++) {
- var_dump(dirname("/foo/bar/baz", $i));
+ try {
+ var_dump(dirname("/foo/bar/baz", $i));
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
?>
Done
--EXPECTF--
-Warning: dirname(): Invalid argument, levels must be >= 1 in %sdirname_multi.php on line %d
-NULL
+Invalid argument, levels must be >= 1
string(8) "/foo/bar"
string(4) "/foo"
string(1) "/"
diff --git a/ext/standard/tests/strings/dirname_multi_win.phpt b/ext/standard/tests/strings/dirname_multi_win.phpt
index 4fed5895e6..9dc0c05c59 100644
--- a/ext/standard/tests/strings/dirname_multi_win.phpt
+++ b/ext/standard/tests/strings/dirname_multi_win.phpt
@@ -10,17 +10,22 @@ if((substr(PHP_OS, 0, 3) != "WIN"))
/* Prototype: string dirname ( string $path [, int nb]);
Description: Returns directory name component of path.
*/
+
for ($i=0 ; $i<5 ; $i++) {
- var_dump(dirname("/foo/bar/baz", $i));
+ try {
+ var_dump(dirname("/foo/bar/baz", $i));
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
+
var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
var_dump(dirname("g:/foo/bar/baz", PHP_INT_MAX));
var_dump(dirname("g:foo/bar/baz", PHP_INT_MAX));
?>
Done
---EXPECTF--
-Warning: dirname(): Invalid argument, levels must be >= 1 in %sdirname_multi_win.php on line %d
-NULL
+--EXPECT--
+Invalid argument, levels must be >= 1
string(8) "/foo/bar"
string(4) "/foo"
string(1) "\"
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
index 84cdcb985f..8fa3b62079 100644
--- a/ext/standard/tests/strings/explode.phpt
+++ b/ext/standard/tests/strings/explode.phpt
@@ -8,21 +8,40 @@ error_reporting=2047
<?php
/* From http://bugs.php.net/19865 */
echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE);
+echo "\n";
echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
echo "\n";
-var_dump(@explode("", ""));
-var_dump(@explode("", NULL));
-var_dump(@explode(NULL, ""));
-var_dump(@explode("a", ""));
-var_dump(@explode("a", "a"));
-var_dump(@explode("a", NULL));
-var_dump(@explode(NULL, "a"));
-var_dump(@explode("abc", "acb"));
-var_dump(@explode("somestring", "otherstring"));
-var_dump(@explode("somestring", "otherstring", -1));
-var_dump(@explode("a", "aaaaaa"));
-var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10)));
-var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10)));
+
+try {
+ var_dump(explode("", ""));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump(explode("", NULL));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump(explode(NULL, ""));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump(explode("a", ""));
+var_dump(explode("a", "a"));
+var_dump(explode("a", NULL));
+try {
+ var_dump(explode(NULL, "a"));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump(explode("abc", "acb"));
+var_dump(explode("somestring", "otherstring"));
+var_dump(explode("somestring", "otherstring", -1));
+var_dump(explode("a", "aaaaaa"));
+var_dump(explode("==", str_repeat("-=".ord(0)."=-", 10)));
+var_dump(explode("=", str_repeat("-=".ord(0)."=-", 10)));
//////////////////////////////////////
var_dump(explode(":","a lazy dog:jumps:over:",-1));
var_dump(explode(":","a lazy dog:jumps:over", -1));
@@ -39,10 +58,11 @@ array (
2 => 'f',
3 => '1',
4 => 'd',
-)d6bee42a771449205344c0938ad4f035
-bool(false)
-bool(false)
-bool(false)
+)
+d6bee42a771449205344c0938ad4f035
+Empty delimiter
+Empty delimiter
+Empty delimiter
array(1) {
[0]=>
string(0) ""
@@ -57,7 +77,7 @@ array(1) {
[0]=>
string(0) ""
}
-bool(false)
+Empty delimiter
array(1) {
[0]=>
string(3) "acb"
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
index 6842947605..4d692e49e8 100644
--- a/ext/standard/tests/strings/explode1.phpt
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -32,12 +32,29 @@ $string = "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND";
*/
$counter = 1;
foreach($delimiters as $delimiter) {
- echo "-- Iteration $counter --\n";
- var_dump( explode($delimiter, $string, -1) );
- var_dump( explode($delimiter, $string, 0) );
- var_dump( explode($delimiter, $string, 1) );
- var_dump( explode($delimiter, $string, 2) );
- $counter++;
+ echo "-- Iteration $counter --\n";
+
+ try {
+ var_dump( explode($delimiter, $string, -1) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 0) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 1) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 2) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ $counter++;
}
echo "\n*** Testing explode() with miscelleneous input arguments ***\n";
@@ -77,41 +94,20 @@ class string1 {
$obj = new string1;
var_dump( explode("b", $obj) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for arguments <2 and >3 */
-var_dump( explode(":", "array1:array2:array3", -1, -33) );
-var_dump( explode(":") );
-
echo "Done\n";
?>
--EXPECTF--
*** Testing explode() for basic operations ***
-- Iteration 1 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 2 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 3 --
array(1) {
[0]=>
@@ -213,18 +209,10 @@ array(2) {
string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
-- Iteration 7 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 8 --
array(2) {
[0]=>
@@ -498,12 +486,4 @@ array(2) {
[1]=>
string(4) "ject"
}
-
-*** Testing error conditions ***
-
-Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: explode() expects at least 2 parameters, 1 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt
index ccc37407e8..1ffc188051 100644
--- a/ext/standard/tests/strings/fprintf_error.phpt
+++ b/ext/standard/tests/strings/fprintf_error.phpt
@@ -7,25 +7,31 @@ Test fprintf() function (errors)
echo "*** Testing Error Conditions ***\n";
/* zero argument */
-var_dump( fprintf() );
+try {
+ var_dump( fprintf() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* scalar argument */
-var_dump( fprintf(3) );
+try {
+ var_dump( fprintf(3) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* NULL argument */
-var_dump( fprintf(NULL) );
+try {
+ var_dump( fprintf(NULL) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECTF--
*** Testing Error Conditions ***
-
-Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
-NULL
-
-Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
-NULL
-
-Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
-NULL
+Wrong parameter count for fprintf()
+Wrong parameter count for fprintf()
+Wrong parameter count for fprintf()
Done
diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt
index 4eba32aebc..895e53358c 100644
--- a/ext/standard/tests/strings/highlight_file.phpt
+++ b/ext/standard/tests/strings/highlight_file.phpt
@@ -13,7 +13,6 @@ allow_url_fopen=1
$filename = __DIR__."/highlight_file.dat";
-var_dump(highlight_file());
var_dump(highlight_file($filename));
var_dump(highlight_file('data:,<?php echo "test"; ?>'));
@@ -39,9 +38,6 @@ echo "Done\n";
--EXPECTF--
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
-Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d
Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt
index 5a023df701..f2abfd5ba8 100644
--- a/ext/standard/tests/strings/htmlentities24.phpt
+++ b/ext/standard/tests/strings/htmlentities24.phpt
@@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) );
var_dump( htmlentities($str, ENT_NOQUOTES) );
var_dump( htmlentities($str, ENT_COMPAT) );
-echo "\n*** Testing error conditions ***\n";
-/* zero argument */
-var_dump( htmlentities() );
-/* arguments more than expected */
-var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") );
-
echo "Done\n";
?>
--EXPECTF--
@@ -320,10 +314,4 @@ string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
-
-*** Testing error conditions ***
-
-Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-string(14) "&bdquo;&lsquo;"
Done
diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt
index 8506c73e72..6e5c5fac36 100644
--- a/ext/standard/tests/strings/htmlspecialchars.phpt
+++ b/ext/standard/tests/strings/htmlspecialchars.phpt
@@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) );
var_dump( htmlspecialchars($str, ENT_NOQUOTES) );
var_dump( htmlspecialchars($str, ENT_COMPAT) );
-echo "\n*** Testing error conditions ***\n";
-/* zero argument */
-var_dump( htmlspecialchars() );
-
-/* giving arguments more than expected */
-var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") );
-
echo "Done\n"
?>
--EXPECTF--
@@ -321,10 +314,4 @@ string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
-
-*** Testing error conditions ***
-
-Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-string(10) "&lt;br&gt;"
Done
diff --git a/ext/standard/tests/strings/implode.phpt b/ext/standard/tests/strings/implode.phpt
index 330ba2ff30..ec685586ef 100644
--- a/ext/standard/tests/strings/implode.phpt
+++ b/ext/standard/tests/strings/implode.phpt
@@ -12,5 +12,5 @@ echo implode(':', array('foo', array('bar', 'baz'), 'burp'))."\n";
foobarbaz
foo:bar:baz
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
foo:Array:burp
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
index 629f4ce60c..500bdc6dce 100644
--- a/ext/standard/tests/strings/implode1.phpt
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt
index 36ee9d7ba6..fa15b75da5 100644
--- a/ext/standard/tests/strings/join_error.phpt
+++ b/ext/standard/tests/strings/join_error.phpt
@@ -10,41 +10,21 @@ Test join() function: error conditions
echo "*** Testing join() : error conditions ***\n";
-// Zero argument
-echo "\n-- Testing join() function with Zero arguments --\n";
-var_dump( join() );
-
-// More than expected number of arguments
-echo "\n-- Testing join() function with more than expected no. of arguments --\n";
-$glue = 'string_val';
-$pieces = array(1, 2);
-$extra_arg = 10;
-
-var_dump( join($glue, $pieces, $extra_arg) );
-
// Less than expected number of arguments
echo "\n-- Testing join() with less than expected no. of arguments --\n";
$glue = 'string_val';
-var_dump( join($glue));
+try {
+ var_dump(join($glue));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing join() : error conditions ***
--- Testing join() function with Zero arguments --
-
-Warning: join() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing join() function with more than expected no. of arguments --
-
-Warning: join() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing join() with less than expected no. of arguments --
-
-Warning: join(): Argument must be an array in %s on line %d
-NULL
+Argument must be an array
Done
diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt
index 695ee2ddca..33c519f13e 100644
--- a/ext/standard/tests/strings/join_variation1.phpt
+++ b/ext/standard/tests/strings/join_variation1.phpt
@@ -122,31 +122,31 @@ string(29) "element11.07654321E-9element2"
string(19) "element10.5element2"
-- Iteration 10 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
string(0) ""
-- Iteration 11 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
string(1) "0"
-- Iteration 12 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
string(1) "1"
-- Iteration 13 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
string(7) "1Array2"
-- Iteration 14 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
string(11) "redArraypen"
diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt
index 03b3250b40..16e053cce1 100644
--- a/ext/standard/tests/strings/join_variation2.phpt
+++ b/ext/standard/tests/strings/join_variation2.phpt
@@ -86,12 +86,16 @@ $values = array (
echo "\n--- Testing join() by supplying different values for 'pieces' argument ---\n";
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- $pieces = $values [$index];
+ echo "-- Iteration $counter --\n";
+ $pieces = $values [$index];
- var_dump( join($glue, $pieces) );
+ try {
+ var_dump( join($glue, $pieces) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
- $counter ++;
+ $counter ++;
}
// close the resources used
@@ -99,100 +103,54 @@ fclose($fp);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing join() : usage variations ***
--- Testing join() by supplying different values for 'pieces' argument ---
-- Iteration 1 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 2 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 3 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 4 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 5 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 6 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 7 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 8 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 9 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 10 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 11 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 12 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 13 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 14 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 15 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 16 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 17 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 18 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 19 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 20 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 21 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 22 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
-- Iteration 23 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+Invalid arguments passed
Done
diff --git a/ext/standard/tests/strings/join_variation3.phpt b/ext/standard/tests/strings/join_variation3.phpt
index c3799cc01a..a896123321 100644
--- a/ext/standard/tests/strings/join_variation3.phpt
+++ b/ext/standard/tests/strings/join_variation3.phpt
@@ -62,9 +62,9 @@ string(6) "1], [2"
string(10) "1.1], [2.2"
-- Iteration 3 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion 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(14) "Array], [Array"
-- Iteration 4 --
string(5) "], [1"
diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt
index f6154f1e4d..49cbfa15bc 100644
--- a/ext/standard/tests/strings/join_variation4.phpt
+++ b/ext/standard/tests/strings/join_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_variation5.phpt b/ext/standard/tests/strings/join_variation5.phpt
index e3f3e7ec08..f81524543d 100644
--- a/ext/standard/tests/strings/join_variation5.phpt
+++ b/ext/standard/tests/strings/join_variation5.phpt
@@ -33,19 +33,19 @@ echo "Done\n";
--EXPECTF--
*** Testing implode() : usage variations - sub arrays ***
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion 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(27) "ArrayTESTArrayTESTPHPTEST50"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
string(19) "1Array2Array3Array4"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion 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(18) "Array2Array2PHP250"
string(10) "1, 2, 3, 4"
string(8) "one, two"
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
index 8178fa2eb5..109b8e5a5d 100644
--- a/ext/standard/tests/strings/lcfirst.phpt
+++ b/ext/standard/tests/strings/lcfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt
index 1ac05cf2ae..b4b7c03e7f 100644
--- a/ext/standard/tests/strings/levenshtein.phpt
+++ b/ext/standard/tests/strings/levenshtein.phpt
@@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl
echo ($n==0)?"all passed\n":"$n failed\n";
-var_dump(levenshtein(array(), array()));
var_dump(levenshtein("", "", -1, -1, -1));
var_dump(levenshtein("", "", 10, 10, 10));
-var_dump(levenshtein(""));
?>
--EXPECTF--
@@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d
Warning: levenshtein(): Argument string(s) too long in %s on line %d
all passed
-
-Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d
-NULL
int(0)
int(0)
-
-Warning: Wrong parameter count for levenshtein() in %s on line %d
-NULL
diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt
index 638c93557f..51287e04d7 100644
--- a/ext/standard/tests/strings/ltrim.phpt
+++ b/ext/standard/tests/strings/ltrim.phpt
@@ -9,12 +9,6 @@ Test ltrim() function
echo "\n *** Output for Error Conditions ***\n";
- echo "\n *** Output for zero argument ***\n";
- var_dump( ltrim() );
-
- echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n";
- var_dump( ltrim("", " ", 1) );
-
/* heredoc string */
$str = <<<EOD
us
@@ -50,16 +44,6 @@ echo "\nDone\n";
--EXPECTF--
*** Output for Error Conditions ***
- *** Output for zero argument ***
-
-Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
- *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***
-
-Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
*** Using heredoc string ***
string(17) "ng heredoc string"
diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt
index 694d9fea18..58324d7f3a 100644
--- a/ext/standard/tests/strings/ltrim_error.phpt
+++ b/ext/standard/tests/strings/ltrim_error.phpt
@@ -11,14 +11,6 @@ Test ltrim() function : error conditions
echo "*** Testing ltrim() : error conditions ***\n";
-echo "\n-- Testing ltrim() function with no arguments --\n";
-var_dump( ltrim() );
-
-echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( ltrim("Hello World", "Heo", $extra_arg) );
-
-
$hello = " Hello World\n";
echo "\n-- Test ltrim function with various invalid charlists\n";
var_dump(ltrim($hello, "..a"));
@@ -31,16 +23,6 @@ var_dump(ltrim($hello, "a..b..c"));
--EXPECTF--
*** Testing ltrim() : error conditions ***
--- Testing ltrim() function with no arguments --
-
-Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing ltrim() function with more than expected no. of arguments --
-
-Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Test ltrim function with various invalid charlists
Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt
index 45009669f4..e56987cd6a 100644
--- a/ext/standard/tests/strings/md5_file.phpt
+++ b/ext/standard/tests/strings/md5_file.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt
index ef1d23d89a..c70b4846a1 100644
--- a/ext/standard/tests/strings/metaphone.phpt
+++ b/ext/standard/tests/strings/metaphone.phpt
@@ -3,7 +3,6 @@ metaphone() tests
--FILE--
<?php
-var_dump(metaphone());
var_dump(metaphone(""));
var_dump(metaphone(-1));
var_dump(metaphone(-1, -1));
@@ -26,8 +25,6 @@ foreach($array as $str) {
echo "Done\n";
?>
--EXPECTF--
-Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d
-NULL
string(0) ""
string(0) ""
bool(false)
diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt
index da725a4131..d593c0ec7f 100644
--- a/ext/standard/tests/strings/money_format_error.phpt
+++ b/ext/standard/tests/strings/money_format_error.phpt
@@ -23,15 +23,6 @@ $extra_arg = 10;
echo "*** Testing money_format() : error conditions ***\n";
-echo "\n-- Testing money_format() function with no arguments --\n";
-var_dump( money_format() );
-
-echo "\n-- Testing money_format() function with insufficient arguments --\n";
-var_dump( money_format($string) );
-
-echo "\n-- Testing money_format() function with more than expected no. of arguments --\n";
-var_dump( money_format($string, $value, $extra_arg) );
-
echo "\n-- Testing money_format() function with more than one token --\n";
var_dump( money_format($string . $string, $value) );
?>
@@ -39,27 +30,6 @@ var_dump( money_format($string . $string, $value) );
--EXPECTF--
*** Testing money_format() : error conditions ***
--- Testing money_format() function with no arguments --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing money_format() function with insufficient arguments --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing money_format() function with more than expected no. of arguments --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing money_format() function with more than one token --
Deprecated: Function money_format() is deprecated in %s on line %d
diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt
index b3f2fe5cfc..e442c0fd70 100644
--- a/ext/standard/tests/strings/parse_str_basic1.phpt
+++ b/ext/standard/tests/strings/parse_str_basic1.phpt
@@ -3,18 +3,13 @@ Test parse_str() function : basic functionality
--FILE--
<?php
-/* Prototype : void parse_str ( string $str [, array &$arr ] )
+/* Prototype : void parse_str ( string $str , array &$arr )
* Description: Parses the string into variables
* Source code: ext/standard/string.c
*/
echo "*** Testing parse_str() : basic functionality ***\n";
-echo "Basic test WITHOUT result arg\n";
-$s1 = "first=val1&second=val2&third=val3";
-var_dump(parse_str($s1));
-var_dump($first, $second, $third);
-
echo "\nBasic test WITH undefined var for result arg\n";
$s1 = "first=val1&second=val2&third=val3";
var_dump(parse_str($s1, $res1));
@@ -35,13 +30,6 @@ var_dump($res3_array);
===DONE===
--EXPECTF--
*** Testing parse_str() : basic functionality ***
-Basic test WITHOUT result arg
-
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-NULL
-string(4) "val1"
-string(4) "val2"
-string(4) "val3"
Basic test WITH undefined var for result arg
NULL
diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt
index 0368dea5f9..06f9579188 100644
--- a/ext/standard/tests/strings/parse_str_basic3.phpt
+++ b/ext/standard/tests/strings/parse_str_basic3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt
index a3d735069d..2bbea73588 100644
--- a/ext/standard/tests/strings/pathinfo.phpt
+++ b/ext/standard/tests/strings/pathinfo.phpt
@@ -3,7 +3,6 @@ pathinfo() tests
--FILE--
<?php
-var_dump(pathinfo());
var_dump(pathinfo(""));
var_dump(pathinfo("."));
var_dump(pathinfo(".."));
@@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME));
echo "Done\n";
?>
--EXPECTF--
-Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d
-NULL
array(2) {
["basename"]=>
string(0) ""
diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt
index 442672c6aa..5fb314c168 100644
--- a/ext/standard/tests/strings/php_strip_whitespace.phpt
+++ b/ext/standard/tests/strings/php_strip_whitespace.phpt
@@ -5,7 +5,6 @@ php_strip_whitespace() tests
$filename = __DIR__."/php_strip_whitespace.dat";
-var_dump(php_strip_whitespace());
var_dump(php_strip_whitespace($filename));
$data = '/* test comment */';
@@ -40,9 +39,6 @@ var_dump(php_strip_whitespace($filename));
echo "Done\n";
?>
--EXPECTF--
-Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d
string(0) ""
string(18) "/* test comment */"
diff --git a/ext/standard/tests/strings/print_variation1.phpt b/ext/standard/tests/strings/print_variation1.phpt
index 19a28678f2..38fe919528 100644
--- a/ext/standard/tests/strings/print_variation1.phpt
+++ b/ext/standard/tests/strings/print_variation1.phpt
@@ -110,17 +110,17 @@ int(1)
int(1)
-- Iteration 9 --
-Notice: Array to string conversion in %sprint_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(1)
-- Iteration 10 --
-Notice: Array to string conversion in %sprint_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(1)
-- Iteration 11 --
-Notice: Array to string conversion in %sprint_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(1)
-- Iteration 12 --
diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt
index eab44a4a65..89b1b9ace2 100644
--- a/ext/standard/tests/strings/printf.phpt
+++ b/ext/standard/tests/strings/printf.phpt
@@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' );
/* Zero argument */
echo "\n*** Output for zero argument ***\n";
-printf();
+try {
+ printf();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* Number of arguments not matching as specified in format field */
echo "\n*** Output for insufficient number of arguments ***\n";
@@ -226,8 +230,7 @@ printf("%d", $tempstring);
?>
--EXPECTF--
*** Output for zero argument ***
-
-Warning: printf() expects at least %d parameter, %d given in %s on line %d
+printf() expects at least %d parameter, %d given
*** Output for insufficient number of arguments ***
diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt
index 1a90970371..0106f71445 100644
--- a/ext/standard/tests/strings/printf_64bit.phpt
+++ b/ext/standard/tests/strings/printf_64bit.phpt
@@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' );
/* Zero argument */
echo "\n*** Output for zero argument ***\n";
-printf();
+try {
+ printf();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* Number of arguments not matching as specified in format field */
echo "\n*** Output for insufficient number of arguments ***\n";
@@ -226,8 +230,7 @@ printf("%d", $tempstring);
?>
--EXPECTF--
*** Output for zero argument ***
-
-Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
+printf() expects at least 1 parameter, 0 given
*** Output for insufficient number of arguments ***
diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt
index a88390bc04..aff95426e6 100644
--- a/ext/standard/tests/strings/printf_error.phpt
+++ b/ext/standard/tests/strings/printf_error.phpt
@@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing printf() function with Zero arguments --\n";
-var_dump( printf() );
+try {
+ var_dump( printf() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing printf() function with less than expected no. of arguments --\n";
$format1 = '%s';
@@ -38,9 +42,7 @@ var_dump( printf($format3) );
*** Testing printf() : error conditions ***
-- Testing printf() function with Zero arguments --
-
-Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
+printf() expects at least 1 parameter, 0 given
-- Testing printf() function with less than expected no. of arguments --
diff --git a/ext/standard/tests/strings/printf_variation1.phpt b/ext/standard/tests/strings/printf_variation1.phpt
index fcf69ebaa7..62f5e21916 100644
--- a/ext/standard/tests/strings/printf_variation1.phpt
+++ b/ext/standard/tests/strings/printf_variation1.phpt
@@ -188,71 +188,71 @@ int(3)
-- Iteration 10 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 11 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 12 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 13 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 14 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
diff --git a/ext/standard/tests/strings/printf_variation2.phpt b/ext/standard/tests/strings/printf_variation2.phpt
index 8e7d5ec910..6cf3e90d62 100644
--- a/ext/standard/tests/strings/printf_variation2.phpt
+++ b/ext/standard/tests/strings/printf_variation2.phpt
@@ -7,8 +7,6 @@ Test printf() function : usage variations - with all types of values for arg1 ar
* Source code: ext/standard/formatted_print.c
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing printf() : with different types of values passed for arg1 argument ***\n";
// initialing required variables
@@ -166,32 +164,52 @@ int(3)
int(3)
-- Iteration 10 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 11 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 12 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 13 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 14 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
index 1ce7d791dc..df26d5cf4b 100644
--- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt
+++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
@@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1
--FILE--
<?php
-var_dump(quoted_printable_encode());
var_dump(quoted_printable_encode(""));
var_dump(quoted_printable_encode("test"));
-var_dump(quoted_printable_encode("test", "more"));
-$a = array("str");
-var_dump(quoted_printable_encode($a));
var_dump(quoted_printable_encode(1));
var_dump(quoted_printable_encode(NULL));
var_dump(quoted_printable_encode(false));
echo "Done\n";
?>
---EXPECTF--
-Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
string(0) ""
string(4) "test"
-
-Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(1) "1"
string(0) ""
string(0) ""
diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt
index 4b479a9a60..4d1feb5ae1 100644
--- a/ext/standard/tests/strings/quotemeta_basic_1.phpt
+++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test function quotemeta() - using an empty string is given as str.
+Test function quotemeta() - using an empty string is given as str
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
User Group: PHPSP #PHPTestFestBrasil
@@ -9,4 +9,4 @@ $str = "";
var_dump(quotemeta($str));
?>
--EXPECT--
-bool(false)
+string(0) ""
diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt
index 5f57b0e850..223a839f58 100644
--- a/ext/standard/tests/strings/rtrim.phpt
+++ b/ext/standard/tests/strings/rtrim.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt
index 108f96a1f0..210fb58c4e 100644
--- a/ext/standard/tests/strings/rtrim_error.phpt
+++ b/ext/standard/tests/strings/rtrim_error.phpt
@@ -11,14 +11,6 @@ Test rtrim() function : error conditions
echo "*** Testing rtrim() : error conditions ***\n";
-echo "\n-- Testing rtrim() function with no arguments --\n";
-var_dump( rtrim() );
-
-echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( rtrim("Hello World", "Heo", $extra_arg) );
-
-
$hello = " Hello World\n";
echo "\n-- Test rtrim function with various invalid charlists\n";
var_dump(rtrim($hello, "..a"));
@@ -31,16 +23,6 @@ var_dump(rtrim($hello, "a..b..c"));
--EXPECTF--
*** Testing rtrim() : error conditions ***
--- Testing rtrim() function with no arguments --
-
-Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing rtrim() function with more than expected no. of arguments --
-
-Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Test rtrim function with various invalid charlists
Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt
index 14bb7d7ed5..c2b18b1992 100644
--- a/ext/standard/tests/strings/setlocale_error.phpt
+++ b/ext/standard/tests/strings/setlocale_error.phpt
@@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
echo "*** Testing setlocale() : error conditions ***\n";
-// Zero argument
-echo "\n-- Testing setlocale() function with Zero arguments --";
-var_dump( setlocale());
-
-// One argument
-echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --";
-var_dump( setlocale(LC_ALL) );
-
echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n";
//Invalid array of locales
$invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid");
@@ -44,14 +36,6 @@ echo "\nDone";
--EXPECTF--
*** Testing setlocale() : error conditions ***
--- Testing setlocale() function with Zero arguments --
-Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing setlocale() function with One argument, 'category' = LC_ALL --
-Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --
bool(false)
diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt
index 102dab75ff..09e81be014 100644
--- a/ext/standard/tests/strings/sha1_file.phpt
+++ b/ext/standard/tests/strings/sha1_file.phpt
@@ -46,12 +46,6 @@ var_dump( sha1_file(12) );
echo "\n-- NULL as filename --\n";
var_dump( sha1_file(NULL) );
-echo "\n-- Zero arguments --\n";
- var_dump ( sha1_file() );
-
-echo "\n-- More than valid number of arguments ( valid is 2) --\n";
-var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) );
-
echo "\n-- Hexadecimal Output for Empty file as Argument --\n";
var_dump( sha1_file("EmptyFileSHA1.txt") );
@@ -95,16 +89,6 @@ bool(false)
Warning: sha1_file(): Filename cannot be empty in %s on line %d
bool(false)
--- Zero arguments --
-
-Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- More than valid number of arguments ( valid is 2) --
-
-Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Hexadecimal Output for Empty file as Argument --
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt
index 650236c2e5..744f71c17a 100644
--- a/ext/standard/tests/strings/soundex.phpt
+++ b/ext/standard/tests/strings/soundex.phpt
@@ -5,7 +5,6 @@ soundex() tests
var_dump(soundex(""));
var_dump(soundex(-1));
-var_dump(soundex(array()));
$array = array(
"From",
@@ -34,9 +33,6 @@ echo "Done\n";
--EXPECTF--
bool(false)
string(4) "0000"
-
-Warning: soundex() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(4) "F650"
string(4) "T300"
string(4) "T500"
diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt
index 1c12cd3168..1b21b8b141 100644
--- a/ext/standard/tests/strings/sprintf_error.phpt
+++ b/ext/standard/tests/strings/sprintf_error.phpt
@@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing sprintf() function with Zero arguments --\n";
-var_dump( sprintf() );
+try {
+ var_dump( sprintf() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n";
$format1 = '%s';
@@ -38,9 +42,7 @@ echo "Done";
*** Testing sprintf() : error conditions ***
-- Testing sprintf() function with Zero arguments --
-
-Warning: sprintf() expects at least %d parameter, %d given in %s on line %d
-bool(false)
+sprintf() expects at least %d parameter, %d given
-- Testing sprintf() function with less than expected no. of arguments --
diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt
index bf77e3bc06..33320b9f1c 100644
--- a/ext/standard/tests/strings/sprintf_variation1.phpt
+++ b/ext/standard/tests/strings/sprintf_variation1.phpt
@@ -155,57 +155,57 @@ string(3) "0.5"
-- Iteration 10 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 11 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 12 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 13 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 14 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 15 --
diff --git a/ext/standard/tests/strings/sprintf_variation18.phpt b/ext/standard/tests/strings/sprintf_variation18.phpt
index 2bf9322c83..74547cf53e 100644
--- a/ext/standard/tests/strings/sprintf_variation18.phpt
+++ b/ext/standard/tests/strings/sprintf_variation18.phpt
@@ -7,8 +7,6 @@ Test sprintf() function : usage variations - string formats with array values
* Source code: ext/standard/formatted_print.c
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing sprintf() : string formats with array values ***\n";
// different arrays used to test he function
@@ -47,185 +45,377 @@ foreach($array_values as $array_value) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing sprintf() : string formats with array values ***
-- Iteration 1 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 2 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 3 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 4 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 5 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 6 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 7 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 8 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 9 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 10 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 11 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 12 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt
index 1bab5dc862..0f8290a9a7 100644
--- a/ext/standard/tests/strings/sprintf_variation2.phpt
+++ b/ext/standard/tests/strings/sprintf_variation2.phpt
@@ -7,8 +7,6 @@ Test sprintf() function : usage variations - with all types of values for arg1 a
* Source code: ext/standard/formatted_print.c
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing sprintf() : with different types of values passed for arg1 argument ***\n";
// initialing required variables
@@ -144,23 +142,43 @@ string(3) "0.5"
string(3) "0.5"
-- Iteration 10 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 11 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 12 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 13 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 14 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 15 --
diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt
index ca967758ab..3e54a42f1e 100644
--- a/ext/standard/tests/strings/sscanf_error.phpt
+++ b/ext/standard/tests/strings/sscanf_error.phpt
@@ -12,12 +12,6 @@ echo "*** Testing sscanf() : error conditions ***\n";
$str = "Hello World";
$format = "%s %s";
-echo "\n-- Testing sscanf() function with no arguments --\n";
-var_dump( sscanf() );
-
-echo "\n-- Testing sscanf() function with one argument --\n";
-var_dump( sscanf($str) );
-
echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n";
var_dump( sscanf($str, $format, $str1, $str2, $extra_str) );
@@ -27,16 +21,6 @@ var_dump( sscanf($str, $format, $str1, $str2, $extra_str) );
--EXPECTF--
*** Testing sscanf() : error conditions ***
--- Testing sscanf() function with no arguments --
-
-Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing sscanf() function with one argument --
-
-Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-- Testing sscanf() function with more than expected no. of arguments --
Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt
index 526b8ac723..71a9d1e127 100644
--- a/ext/standard/tests/strings/str_ireplace.phpt
+++ b/ext/standard/tests/strings/str_ireplace.phpt
@@ -3,9 +3,6 @@ str_ireplace() tests
--FILE--
<?php
-var_dump(str_ireplace());
-var_dump(str_ireplace(""));
-var_dump(str_ireplace("", ""));
var_dump(str_ireplace("", "", ""));
var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
@@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data));
echo "Done\n";
?>
--EXPECTF--
-Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
string(0) ""
string(8) "aaaaaaaT"
string(8) "aaaaaaaT"
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index b44a9517ab..a4f60bfa6a 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt
new file mode 100644
index 0000000000..6123bc60c9
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation1.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test str_pad() function : usage variations - large values for '$pad_length' argument
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$pad_length'
+ * and expected type for '$input'
+*/
+
+echo "*** Testing str_pad() function: with large value for for 'pad_length' argument ***\n";
+
+//defining '$input' argument
+$input = "Test string";
+
+$extra_large_pad_length = PHP_INT_MAX*5;
+try {
+ var_dump( str_pad($input, $extra_large_pad_length) );
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+$php_int_max_pad_length = PHP_INT_MAX;
+var_dump( str_pad($input, $php_int_max_pad_length) );
+
+
+?>
+--EXPECTF--
+*** Testing str_pad() function: with large value for for 'pad_length' argument ***
+str_pad() expects parameter 2 to be int, float given
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
+
diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt
new file mode 100644
index 0000000000..1ebf1b2825
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation2.phpt
@@ -0,0 +1,70 @@
+--TEST--
+str_pad() function: usage variations - Non printable chars
+--INI--
+precision=14
+--FILE--
+<?php
+// Split from str_pad for NUL Bytes
+// 7-bit ASCII
+$string = chr(0).chr(255).chr(128).chr(234).chr(143);
+
+/* different pad_lengths */
+$pad_lengths = [
+ -PHP_INT_MAX, // huge negative value
+ -1, // negative value
+ 0, // pad_length < sizeof(input_string)
+ 9, // pad_length <= sizeof(input_string)
+ 10, // pad_length > sizeof(input_string)
+ 16, // pad_length > sizeof(input_string)
+];
+
+$pad_string = "=";
+
+/*loop through to use each variant of $pad_length on
+ each element of $input_strings array */
+foreach ($pad_lengths as $pad_length ) {
+ // default pad_string & pad_type
+ var_dump( bin2hex( str_pad($string, $pad_length) ) );
+ // default pad_type
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string) ) );
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_LEFT) ) );
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_RIGHT) ) );
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_BOTH) ) );
+}
+
+?>
+
+DONE
+--EXPECT--
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(18) "00ff80ea8f20202020"
+string(18) "00ff80ea8f3d3d3d3d"
+string(18) "3d3d3d3d00ff80ea8f"
+string(18) "00ff80ea8f3d3d3d3d"
+string(18) "3d3d00ff80ea8f3d3d"
+string(20) "00ff80ea8f2020202020"
+string(20) "00ff80ea8f3d3d3d3d3d"
+string(20) "3d3d3d3d3d00ff80ea8f"
+string(20) "00ff80ea8f3d3d3d3d3d"
+string(20) "3d3d00ff80ea8f3d3d3d"
+string(32) "00ff80ea8f2020202020202020202020"
+string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d"
+string(32) "3d3d3d3d3d3d3d3d3d3d3d00ff80ea8f"
+string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d"
+string(32) "3d3d3d3d3d00ff80ea8f3d3d3d3d3d3d"
+
+DONE
diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt
index 8eade37df3..41a70e675a 100644
--- a/ext/standard/tests/strings/str_pad_variation5.phpt
+++ b/ext/standard/tests/strings/str_pad_variation5.phpt
@@ -31,4 +31,4 @@ var_dump( str_pad($input, $pad_length) );
--EXPECTF--
*** Testing str_pad() function: with large value for for 'pad_length' argument ***
-Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
index 306b7d381a..6e5f0cf68e 100644
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ b/ext/standard/tests/strings/str_repeat.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_repeat_variation1.phpt b/ext/standard/tests/strings/str_repeat_variation1.phpt
new file mode 100644
index 0000000000..4740f7c5b8
--- /dev/null
+++ b/ext/standard/tests/strings/str_repeat_variation1.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test str_repeat() function: usage variations - complex strings containing other than 7-bit chars
+--INI--
+precision=14
+--FILE--
+<?php
+$str = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255);
+
+$withCodePoint = str_repeat($str, chr(51)); // ASCII value of '3' given
+$explicit = str_repeat($str, 3);
+
+var_dump($withCodePoint === $explicit);
+var_dump( bin2hex( $withCodePoint ) );
+var_dump( bin2hex( $explicit ) );
+
+?>
+DONE
+--EXPECT--
+bool(true)
+string(42) "008081eaebfeff008081eaebfeff008081eaebfeff"
+string(42) "008081eaebfeff008081eaebfeff008081eaebfeff"
+DONE
diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt
index 7b411abac5..b0ca488f3c 100644
--- a/ext/standard/tests/strings/str_replace.phpt
+++ b/ext/standard/tests/strings/str_replace.phpt
@@ -223,15 +223,6 @@ var_dump( str_replace("worldS", "FOUND", "$strS") );
var_dump( str_replace("worldS", "FOUND", "${str}S") );
var_dump( str_replace("worldS", "FOUND", "{$str}S") );
-
-echo "\n*** Testing error conditions ***";
-/* Invalid arguments */
-var_dump( str_replace() );
-var_dump( str_replace("") );
-var_dump( str_replace(NULL) );
-var_dump( str_replace(1, 2) );
-var_dump( str_replace(1,2,3,$var,5) );
-
fclose($resource1);
closedir($resource2);
echo "Done\n";
@@ -885,7 +876,7 @@ array(2) {
}
int(6)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(2) {
[0]=>
string(15) "ArrayArrayArray"
@@ -934,24 +925,8 @@ int(0)
string(5) "FOUND"
string(5) "FOUND"
-Notice: Undefined variable: strS in %s on line %d
+Warning: Undefined variable: strS in %s on line %d
string(0) ""
string(5) "FOUND"
string(5) "FOUND"
-
-*** Testing error conditions ***
-Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/strings/str_replace_variation3.phpt b/ext/standard/tests/strings/str_replace_variation3.phpt
index 8ae709745f..c6851c5c9c 100644
--- a/ext/standard/tests/strings/str_replace_variation3.phpt
+++ b/ext/standard/tests/strings/str_replace_variation3.phpt
@@ -173,7 +173,7 @@ array(2) {
}
int(6)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
string(15) "ArrayArrayArray"
@@ -220,7 +220,7 @@ int(0)
string(5) "FOUND"
string(5) "FOUND"
-Notice: Undefined variable: strS in %s on line %d
+Warning: Undefined variable: strS in %s on line %d
string(0) ""
string(5) "FOUND"
string(5) "FOUND"
diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt
index a477800a26..111eb11858 100644
--- a/ext/standard/tests/strings/str_split_variation6.phpt
+++ b/ext/standard/tests/strings/str_split_variation6.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
* passing different integer values for 'split_length' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' ***\n";
//Initialise variables
$str = 'This is a string with 123 & escape char \t';
@@ -30,23 +30,25 @@ $values = array (
0234, //octal number
0x1A, //hexadecimal number
2147483647, //max positive integer number
- 2147483648, //max positive integer+1
-2147483648, //min negative integer
);
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(42) {
[0]=>
@@ -135,9 +137,7 @@ array(42) {
string(1) "t"
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -156,11 +156,5 @@ array(1) {
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 7 --
-
-Warning: str_split() expects parameter 2 to be int, float given in %s line %d
-NULL
--- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
Done
diff --git a/ext/standard/tests/strings/str_split_variation6_64bit.phpt b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
index 583c7db3cf..e6893e9263 100644
--- a/ext/standard/tests/strings/str_split_variation6_64bit.phpt
+++ b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
@@ -36,17 +36,19 @@ $values = array (
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
echo "Done"
?>
---EXPECTF--
+--EXPECT--
*** Testing str_split() : different intger values for 'split_length' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(42) {
[0]=>
@@ -135,9 +137,7 @@ array(42) {
string(1) "t"
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -161,7 +161,5 @@ array(1) {
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
Done
diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt
index 5082c7ba2f..a810dd7ecb 100644
--- a/ext/standard/tests/strings/str_split_variation7.phpt
+++ b/ext/standard/tests/strings/str_split_variation7.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n";
//Initialise variables
$str = <<<EOT
string with 123,escape char \t.
@@ -32,23 +32,25 @@ $values = array (
0234, //octal number
0x1A, //hexadecimal number
2147483647, //max positive integer number
- 2147483648, //max positive integer+1
-2147483648, //min negative integer
);
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(30) {
[0]=>
@@ -113,9 +115,7 @@ array(30) {
string(1) "."
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -134,11 +134,5 @@ array(1) {
string(30) "string with 123,escape char ."
}
-- Iteration 7 --
-
-Warning: str_split() expects parameter 2 to be int, float given in %s on line %d
-NULL
--- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
Done
diff --git a/ext/standard/tests/strings/str_split_variation7_64bit.phpt b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
index bff61adb30..1a1980028a 100644
--- a/ext/standard/tests/strings/str_split_variation7_64bit.phpt
+++ b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n";
//Initialise variables
$str = <<<EOT
string with 123,escape char \t.
@@ -38,17 +38,19 @@ $values = array (
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(30) {
[0]=>
@@ -113,9 +115,7 @@ array(30) {
string(1) "."
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -139,7 +139,5 @@ array(1) {
string(30) "string with 123,escape char ."
}
-- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
Done
diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt
index f88646370b..375f26dee0 100644
--- a/ext/standard/tests/strings/str_word_count.phpt
+++ b/ext/standard/tests/strings/str_word_count.phpt
@@ -2,39 +2,51 @@
str_word_count()
--FILE--
<?php
-error_reporting(E_ALL);
$str = "Hello friend, you're
looking good today!";
$b =& $str;
var_dump(str_word_count($str, 1));
var_dump(str_word_count($str, 2));
var_dump(str_word_count($str));
-var_dump(str_word_count($str, 3));
-var_dump(str_word_count($str, 123));
-var_dump(str_word_count($str, -1));
-var_dump(str_word_count($str, 999999999));
-var_dump(str_word_count($str, array()));
-var_dump(str_word_count($str, $b));
+
+try {
+ var_dump(str_word_count($str, 3));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count($str, 123));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count($str, -1));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count($str, 999999999));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump($str);
$str2 = "F0o B4r 1s bar foo";
var_dump(str_word_count($str2, NULL, "04"));
var_dump(str_word_count($str2, NULL, "01"));
var_dump(str_word_count($str2, NULL, "014"));
-var_dump(str_word_count($str2, NULL, array()));
-var_dump(str_word_count($str2, NULL, new stdClass));
var_dump(str_word_count($str2, NULL, ""));
var_dump(str_word_count($str2, 1, "04"));
var_dump(str_word_count($str2, 1, "01"));
var_dump(str_word_count($str2, 1, "014"));
-var_dump(str_word_count($str2, 1, array()));
-var_dump(str_word_count($str2, 1, new stdClass));
var_dump(str_word_count($str2, 1, ""));
var_dump(str_word_count($str2, 2, "04"));
var_dump(str_word_count($str2, 2, "01"));
var_dump(str_word_count($str2, 2, "014"));
-var_dump(str_word_count($str2, 2, array()));
-var_dump(str_word_count($str2, 2, new stdClass));
var_dump(str_word_count($str2, 2, ""));
var_dump(str_word_count("foo'0 bar-0var", 2, "0"));
var_dump(str_word_count("'foo'", 2));
@@ -42,9 +54,10 @@ var_dump(str_word_count("'foo'", 2, "'"));
var_dump(str_word_count("-foo-", 2));
var_dump(str_word_count("-foo-", 2, "-"));
-echo "Done\n";
?>
---EXPECTF--
+
+DONE
+--EXPECT--
array(6) {
[0]=>
string(5) "Hello"
@@ -74,35 +87,15 @@ array(6) {
string(5) "today"
}
int(6)
-
-Warning: str_word_count(): Invalid format value 3 in %s on line %d
-bool(false)
-
-Warning: str_word_count(): Invalid format value 123 in %s on line %d
-bool(false)
-
-Warning: str_word_count(): Invalid format value -1 in %s on line %d
-bool(false)
-
-Warning: str_word_count(): Invalid format value 999999999 in %s on line %d
-bool(false)
-
-Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d
-NULL
+Invalid format value 3
+Invalid format value 123
+Invalid format value -1
+Invalid format value 999999999
string(55) "Hello friend, you're
looking good today!"
int(5)
int(6)
int(5)
-
-Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
-NULL
int(7)
array(5) {
[0]=>
@@ -142,12 +135,6 @@ array(5) {
[4]=>
string(3) "foo"
}
-
-Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
-NULL
array(7) {
[0]=>
string(1) "F"
@@ -202,12 +189,6 @@ array(5) {
[15]=>
string(3) "foo"
}
-
-Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
-NULL
array(7) {
[0]=>
string(1) "F"
@@ -246,4 +227,5 @@ array(1) {
[0]=>
string(5) "-foo-"
}
-Done
+
+DONE
diff --git a/ext/standard/tests/strings/str_word_count1.phpt b/ext/standard/tests/strings/str_word_count1.phpt
index e942a17385..6ce8c38f22 100644
--- a/ext/standard/tests/strings/str_word_count1.phpt
+++ b/ext/standard/tests/strings/str_word_count1.phpt
@@ -4,23 +4,31 @@ str_word_count() and invalid arguments
<?php
var_dump(str_word_count(""));
-var_dump(str_word_count("", -1));
-var_dump(str_word_count("", -1, $a));
-var_dump($a);
-echo "Done\n";
+try {
+ var_dump(str_word_count("", -1));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count("", -1, $a));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump($a);
?>
+
+DONE
--EXPECTF--
int(0)
+Invalid format value -1
-Warning: str_word_count(): Invalid format value -1 in %s on line %d
-bool(false)
-
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
+Invalid format value -1
-Warning: str_word_count(): Invalid format value -1 in %s on line %d
-bool(false)
-
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
-Done
+
+DONE
diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt
index 3086c2be92..4cca47ac96 100644
--- a/ext/standard/tests/strings/strcasecmp.phpt
+++ b/ext/standard/tests/strings/strcasecmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt
index 397e072c52..1e0f5d18a2 100644
--- a/ext/standard/tests/strings/strcmp.phpt
+++ b/ext/standard/tests/strings/strcmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt
index 057b8ca494..bc2a7bc8e5 100644
--- a/ext/standard/tests/strings/stripos.phpt
+++ b/ext/standard/tests/strings/stripos.phpt
@@ -25,10 +25,10 @@ stripos() function test
var_dump(stripos("0", false));
var_dump(stripos("1", true));
var_dump(stripos("\\\\a", "\\a"));
-
- echo "Done\n";
?>
---EXPECTF--
+
+DONE
+--EXPECT--
int(0)
int(5)
int(5)
@@ -37,31 +37,20 @@ int(10)
int(2)
int(0)
int(0)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(0)
int(0)
bool(false)
bool(false)
+int(0)
bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
+int(0)
+int(0)
+int(0)
int(1)
-Done
+
+DONE
diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt
index 324014cf6d..0420bb090b 100644
--- a/ext/standard/tests/strings/stripos_error.phpt
+++ b/ext/standard/tests/strings/stripos_error.phpt
@@ -8,14 +8,6 @@ Test stripos() function : error conditions
*/
echo "*** Testing stripos() function: error conditions ***\n";
-echo "\n-- With Zero arguments --";
-var_dump( stripos() );
-
-echo "\n-- With less than expected number of arguments --";
-var_dump( stripos("String") );
-
-echo "\n-- With more than expected number of arguments --";
-var_dump( stripos("string", "String", 1, 'extra_arg') );
echo "\n-- Offset beyond the end of the string --";
var_dump( stripos("Hello World", "o", 12) );
@@ -28,18 +20,6 @@ echo "*** Done ***";
--EXPECTF--
*** Testing stripos() function: error conditions ***
--- With Zero arguments --
-Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- With less than expected number of arguments --
-Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- With more than expected number of arguments --
-Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Offset beyond the end of the string --
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt
index a3fc324dd7..c34917ffce 100644
--- a/ext/standard/tests/strings/stripos_variation1.phpt
+++ b/ext/standard/tests/strings/stripos_variation1.phpt
@@ -81,7 +81,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with double quoted strings ***
-- Iteration 1 --
int(2)
@@ -117,36 +117,20 @@ int(9)
int(8)
bool(false)
-- Iteration 12 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(11)
-- Iteration 13 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(12)
-- Iteration 14 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(13)
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(14)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(0)
+int(15)
-- Iteration 17 --
int(10)
int(47)
diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt
index 81b8f5adb1..879da88aa7 100644
--- a/ext/standard/tests/strings/stripos_variation10.phpt
+++ b/ext/standard/tests/strings/stripos_variation10.phpt
@@ -83,7 +83,11 @@ $needles = array (
$counter = 1;
for($index = 0; $index < count($needles); $index ++) {
echo "\n-- Iteration $counter --\n";
- var_dump( stripos($haystack, $needles[$index]) );
+ try {
+ var_dump( stripos($haystack, $needles[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,134 +95,84 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function with unexpected values for needle ***
-- Iteration 1 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(7)
-- Iteration 2 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(9)
-- Iteration 3 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 5 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(16)
-- Iteration 6 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(21)
-- Iteration 7 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 8 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 9 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(17)
-- Iteration 10 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 12 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 13 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 14 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(9)
-- Iteration 16 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 17 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(9)
-- Iteration 18 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(64)
-- Iteration 20 --
-bool(false)
+int(0)
-- Iteration 21 --
-bool(false)
+int(0)
-- Iteration 22 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 23 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 24 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-%s
+stripos() expects parameter 2 to be string, resource given
-- Iteration 25 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 26 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt
index b4b83a1641..4f002ed0ca 100644
--- a/ext/standard/tests/strings/stripos_variation11.phpt
+++ b/ext/standard/tests/strings/stripos_variation11.phpt
@@ -81,8 +81,16 @@ $counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
$haystack = $values[$index];
- var_dump( stripos($values[$index], $values[$index]) );
- var_dump( stripos($values[$index], $values[$index], 1) );
+ try {
+ var_dump( stripos($values[$index], $values[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( stripos($values[$index], $values[$index], 1) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,172 +99,96 @@ echo "*** Done ***";
--EXPECTF--
*** Testing stripos() function with unexpected values for haystack and needle ***
-- Iteration 1 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 2 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 3 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 4 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 5 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 6 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 7 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 8 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 9 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 10 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+stripos() expects parameter 1 to be string, array given
+stripos() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+stripos() expects parameter 1 to be string, array given
+stripos() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+stripos() expects parameter 1 to be string, array given
+stripos() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+stripos() expects parameter 1 to be string, array given
+stripos() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+stripos() expects parameter 1 to be string, array given
+stripos() expects parameter 1 to be string, array given
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 16 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 17 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 18 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 20 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 21 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 22 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 23 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 24 --
-
-Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
-NULL
+stripos() expects parameter 1 to be string, resource given
+stripos() expects parameter 1 to be string, resource given
-- Iteration 25 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 26 --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt
index bb77d1becb..294b088d02 100644
--- a/ext/standard/tests/strings/stripos_variation2.phpt
+++ b/ext/standard/tests/strings/stripos_variation2.phpt
@@ -83,7 +83,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with single quoted strings ***
-- Iteration 1 --
int(2)
@@ -119,36 +119,20 @@ bool(false)
int(10)
int(10)
-- Iteration 12 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(11)
-- Iteration 13 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(12)
-- Iteration 14 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(13)
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(14)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(0)
+int(15)
-- Iteration 17 --
int(14)
int(51)
@@ -234,11 +218,7 @@ bool(false)
bool(false)
bool(false)
-- Iteration 45 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(26)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+bool(false)
bool(false)
-- Iteration 46 --
int(0)
diff --git a/ext/standard/tests/strings/stripos_variation3.phpt b/ext/standard/tests/strings/stripos_variation3.phpt
index 936f870579..32faf63871 100644
--- a/ext/standard/tests/strings/stripos_variation3.phpt
+++ b/ext/standard/tests/strings/stripos_variation3.phpt
@@ -32,6 +32,6 @@ echo "*** Done ***";
int(14)
int(23)
int(23)
-bool(false)
+int(0)
int(7)
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt
index 04c636365f..a21686876d 100644
--- a/ext/standard/tests/strings/stripos_variation7.phpt
+++ b/ext/standard/tests/strings/stripos_variation7.phpt
@@ -25,10 +25,10 @@ echo "*** Done ***";
--EXPECTF--
*** Testing stripos() function: with heredoc strings ***
-- With empty heredoc string --
-bool(false)
+int(0)
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-bool(false)
-bool(false)
+int(0)
+int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt
index 8fca54b082..0d47e80bcb 100644
--- a/ext/standard/tests/strings/stristr.phpt
+++ b/ext/standard/tests/strings/stristr.phpt
@@ -2,42 +2,27 @@
stristr() function
--FILE--
<?php
- var_dump(stristr());
- var_dump(stristr(array(), ""));
- var_dump(stristr("", array()));
- var_dump(stristr(array(), array()));
var_dump(stristr("tEsT sTrInG", "tEsT"));
var_dump(stristr("tEsT sTrInG", "stRiNg"));
var_dump(stristr("tEsT sTrInG", "stRiN"));
var_dump(stristr("tEsT sTrInG", "t S"));
var_dump(stristr("tEsT sTrInG", "g"));
var_dump(md5(stristr("te".chr(0)."st", chr(0))));
- var_dump(@stristr("", ""));
- var_dump(@stristr("a", ""));
- var_dump(@stristr("", "a"));
- var_dump(md5(@stristr("\\\\a\\", "\\a")));
+ var_dump(stristr("", ""));
+ var_dump(stristr("a", ""));
+ var_dump(stristr("", "a"));
+ var_dump(md5(stristr("\\\\a\\", "\\a")));
var_dump(stristr("tEsT sTrInG", " "));
?>
--EXPECTF--
-Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: stristr() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
-
-Warning: stristr() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(11) "tEsT sTrInG"
string(6) "sTrInG"
string(6) "sTrInG"
string(8) "T sTrInG"
string(1) "G"
string(32) "7272696018bdeb2c9a3f8d01fc2a9273"
-bool(false)
-bool(false)
+string(0) ""
+string(1) "a"
bool(false)
string(32) "6ec19f52f0766c463f3bb240f4396913"
string(7) " sTrInG"
diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt
index b899b4739d..ae2c8e93cf 100644
--- a/ext/standard/tests/strings/stristr2.phpt
+++ b/ext/standard/tests/strings/stristr2.phpt
@@ -16,14 +16,10 @@ var_dump(stristr($email, 97));
var_dump(stristr($email, 97, 1));
?>
---EXPECTF--
+--EXPECT--
string(7) "cCdEfGh"
string(2) "Ab"
string(5) "eEfGh"
string(4) "AbCd"
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(11) "azAbCdeEfGh"
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(1) "w"
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt
deleted file mode 100644
index a0057574f9..0000000000
--- a/ext/standard/tests/strings/stristr_error.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-Test stristr() function : error conditions
---FILE--
-<?php
-
-/* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] )
- Description: Case-insensitive strstr()
-*/
-echo "*** Testing stristr() : error conditions ***\n";
-
-echo "\n-- Testing stristr() function with no arguments --\n";
-var_dump( stristr() );
-var_dump( stristr("") );
-
-echo "\n-- Testing stristr() function with no needle --\n";
-var_dump( stristr("Hello World") ); // without "needle"
-
-echo "\n-- Testing stristr() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( stristr("Hello World", "World", true, $extra_arg) );
-
-echo "\n-- Testing stristr() function with empty haystack --\n";
-var_dump( stristr(NULL, "") );
-
-echo "\n-- Testing stristr() function with empty needle --\n";
-var_dump( stristr("Hello World", "") );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing stristr() : error conditions ***
-
--- Testing stristr() function with no arguments --
-
-Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing stristr() function with no needle --
-
-Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing stristr() function with more than expected no. of arguments --
-
-Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
--- Testing stristr() function with empty haystack --
-
-Warning: stristr(): Empty needle in %s on line %d
-bool(false)
-
--- Testing stristr() function with empty needle --
-
-Warning: stristr(): Empty needle in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt
index 4a0b62f261..dd0b34f883 100644
--- a/ext/standard/tests/strings/stristr_variation2.phpt
+++ b/ext/standard/tests/strings/stristr_variation2.phpt
@@ -72,7 +72,11 @@ $pad_length = "20";
$count = 1;
foreach($inputs as $input) {
echo "-- Iteration $count --\n";
- var_dump( stristr("Hello World", $input) );
+ try {
+ var_dump( stristr("Hello World", $input) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count ++;
}
@@ -80,88 +84,46 @@ fclose($file_handle); //closing the file handle
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing stristr() function: with unexpected inputs for 'needle' argument ***
-- Iteration 1 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 2 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 3 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 5 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 6 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 7 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 8 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, array given
-- Iteration 9 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, array given
-- Iteration 10 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 12 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 13 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 14 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 15 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 16 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 17 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 18 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, resource given
-- Iteration 19 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 20 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
===DONE===
diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt
index a546bdb8d2..0db36eea22 100644
--- a/ext/standard/tests/strings/strlen.phpt
+++ b/ext/standard/tests/strings/strlen.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt
index d443f8113b..00ddfaed9b 100644
--- a/ext/standard/tests/strings/strncasecmp_error.phpt
+++ b/ext/standard/tests/strings/strncasecmp_error.phpt
@@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions
echo "*** Testing strncasecmp() function: error conditions ***\n";
$str1 = 'string_val';
$str2 = 'string_val';
-$len = 10;
-$extra_arg = 10;
-
-echo "\n-- Testing strncasecmp() function with Zero arguments --";
-var_dump( strncasecmp() );
-
-echo "\n-- Testing strncasecmp() function with less than expected number of arguments --";
-var_dump( strncasecmp($str1) );
-var_dump( strncasecmp($str1, $str2) );
-
-echo "\n-- Testing strncasecmp() function with more than expected number of arguments --";
-var_dump( strncasecmp($str1, $str2, $len, $extra_arg) );
echo "\n-- Testing strncasecmp() function with invalid argument --";
$len = -10;
@@ -31,21 +19,6 @@ echo "*** Done ***\n";
--EXPECTF--
*** Testing strncasecmp() function: error conditions ***
--- Testing strncasecmp() function with Zero arguments --
-Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
--- Testing strncasecmp() function with less than expected number of arguments --
-Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing strncasecmp() function with more than expected number of arguments --
-Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing strncasecmp() function with invalid argument --
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt
index 4eb73eb318..13a4cb0350 100644
--- a/ext/standard/tests/strings/strncmp_error.phpt
+++ b/ext/standard/tests/strings/strncmp_error.phpt
@@ -12,13 +12,6 @@ Test strncmp() function : error conditions
echo "*** Testing strncmp() function: error conditions ***\n";
$str1 = 'string_val';
$str2 = 'string_val';
-$len = 10;
-$extra_arg = 10;
-
-var_dump( strncmp() ); //Zero argument
-var_dump( strncmp($str1) ); //One argument, less than expected no. of args
-var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args
-var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args
/* Invalid argument for $len */
$len = -10;
@@ -28,18 +21,6 @@ echo "*** Done ***\n";
--EXPECTF--
*** Testing strncmp() function: error conditions ***
-Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt
index 658e2f429e..cce843c2f1 100644
--- a/ext/standard/tests/strings/strpbrk_error.phpt
+++ b/ext/standard/tests/strings/strpbrk_error.phpt
@@ -11,47 +11,17 @@ Test strpbrk() function : error conditions
echo "*** Testing strpbrk() : error conditions ***\n";
$haystack = 'This is a Simple text.';
-$char_list = 'string_val';
-$extra_arg = 10;
-
-echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n";
-var_dump( strpbrk($haystack, $char_list, $extra_arg) );
-
-echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n";
-var_dump( strpbrk($haystack) );
echo "\n-- Testing strpbrk() function with empty second argument --\n";
var_dump( strpbrk($haystack, '') );
-echo "\n-- Testing strpbrk() function with arrays --\n";
-var_dump( strpbrk($haystack, array('a', 'b', 'c') ) );
-var_dump( strpbrk(array('foo', 'bar'), 'b') );
-
?>
===DONE===
--EXPECTF--
*** Testing strpbrk() : error conditions ***
--- Testing strpbrk() function with more than expected no. of arguments --
-
-Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
--- Testing strpbrk() function with less than expected no. of arguments --
-
-Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
-- Testing strpbrk() function with empty second argument --
Warning: strpbrk(): The character list cannot be empty in %s on line %d
bool(false)
-
--- Testing strpbrk() function with arrays --
-
-Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
===DONE===
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index 578539804d..8e1a1a7472 100644
--- a/ext/standard/tests/strings/strpos.phpt
+++ b/ext/standard/tests/strings/strpos.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt
index fd045c64d3..76cf8e59ef 100644
--- a/ext/standard/tests/strings/strpos_number.phpt
+++ b/ext/standard/tests/strings/strpos_number.phpt
@@ -9,10 +9,7 @@ var_dump(strpos("foo bar", 111));
// string("11") is contained
var_dump(strpos("foo 11", "11"));
?>
---EXPECTF--
-Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+--EXPECT--
+int(4)
bool(false)
-
-Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(1)
int(4)
diff --git a/ext/standard/tests/strings/strpos_variation1.phpt b/ext/standard/tests/strings/strpos_variation1.phpt
new file mode 100644
index 0000000000..f28517316d
--- /dev/null
+++ b/ext/standard/tests/strings/strpos_variation1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strpos() function : usage variations - complex strings containing other than 7-bit chars
+--FILE--
+<?php
+$string = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255);
+$stringAsHex = bin2hex($string);
+echo "-- Positions of some chars in the string '$stringAsHex' are as follows --\n";
+echo bin2hex( chr(128) ) ." => ";
+var_dump( strpos($string, chr(128)) );
+echo bin2hex( chr(255) ) ." => ";
+var_dump( strpos($string, chr(255), 3) );
+echo bin2hex( chr(256) ) ." => ";
+var_dump( strpos($string, chr(256)) );
+?>
+
+DONE
+--EXPECT--
+-- Positions of some chars in the string '008081eaebfeff' are as follows --
+80 => int(1)
+ff => int(6)
+00 => int(0)
+
+DONE
diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt
index 5043128945..a75dd96bbf 100644
--- a/ext/standard/tests/strings/strrchr_variation1.phpt
+++ b/ext/standard/tests/strings/strrchr_variation1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt
index 3b06b20be1..1004a3d915 100644
--- a/ext/standard/tests/strings/strrchr_variation10.phpt
+++ b/ext/standard/tests/strings/strrchr_variation10.phpt
@@ -121,7 +121,11 @@ $needles = array (
$count = 1;
for($index = 0; $index < count($haystacks); $index++) {
echo "-- Iteration $count --\n";
- var_dump( strrchr($haystacks[$index], $needles[$index]) );
+ try {
+ var_dump( strrchr($haystacks[$index], $needles[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count ++;
}
@@ -129,108 +133,58 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrchr() function with unexpected inputs for needle ***
-- Iteration 1 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "0"
-- Iteration 2 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 3 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(2) "-2"
-- Iteration 5 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(4) "10.5"
-- Iteration 6 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "-10.5"
-- Iteration 7 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(2) "10"
-- Iteration 8 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(2) "10"
-- Iteration 9 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 10 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 12 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 13 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 14 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 16 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 17 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 18 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 19 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 20 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 21 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(6) "object"
-- Iteration 22 --
bool(false)
-- Iteration 23 --
bool(false)
-- Iteration 24 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 26 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt
index 108ba2e0f2..79ffe4c2ec 100644
--- a/ext/standard/tests/strings/strrchr_variation11.phpt
+++ b/ext/standard/tests/strings/strrchr_variation11.phpt
@@ -80,7 +80,11 @@ $values = array (
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
- var_dump( strrchr($values[$index], $values[$index]) );
+ try {
+ var_dump( strrchr($values[$index], $values[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -88,108 +92,58 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrchr() function: with unexpected inputs for haystack and needle ***
-- Iteration 1 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "0"
-- Iteration 2 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 3 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "12345"
-- Iteration 4 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "-2345"
-- Iteration 5 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(4) "10.5"
-- Iteration 6 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "-10.5"
-- Iteration 7 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(10) "1234567000"
-- Iteration 8 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(4) "1E-9"
-- Iteration 9 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(3) "0.5"
-- Iteration 10 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 16 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 17 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 18 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(6) "object"
-- Iteration 20 --
bool(false)
-- Iteration 21 --
bool(false)
-- Iteration 22 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 23 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 24 --
-
-Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 26 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt
index 730811ea47..a17902604a 100644
--- a/ext/standard/tests/strings/strrchr_variation12.phpt
+++ b/ext/standard/tests/strings/strrchr_variation12.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt
index ddce2c2ccb..2ff6720fb9 100644
--- a/ext/standard/tests/strings/strrchr_variation2.phpt
+++ b/ext/standard/tests/strings/strrchr_variation2.phpt
@@ -117,23 +117,15 @@ bool(false)
string(5) "\101 "
-- Iteration 12 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 13 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 14 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 15 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 16 --
@@ -221,9 +213,7 @@ bool(false)
string(7) "4 \101 "
-- Iteration 44 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-string(37) "*+-./:;<=>?@hello123456he \x234 \101 "
+string(7) "4 \101 "
-- Iteration 45 --
string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt
index 6b49b698f4..31a727ed6f 100644
--- a/ext/standard/tests/strings/strrchr_variation8.phpt
+++ b/ext/standard/tests/strings/strrchr_variation8.phpt
@@ -30,15 +30,11 @@ foreach($needles as $needle) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrchr() function: with heredoc strings ***
bool(false)
bool(false)
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt
index 291ff78cd7..c343e92731 100644
--- a/ext/standard/tests/strings/strripos.phpt
+++ b/ext/standard/tests/strings/strripos.phpt
@@ -10,14 +10,11 @@ strripos() function
var_dump(strripos("te".chr(0)."st", chr(0)));
var_dump(strripos("tEst", "test"));
var_dump(strripos("teSt", "test"));
- var_dump(@strripos("foo", "f", 1));
- var_dump(@strripos("", ""));
- var_dump(@strripos("a", ""));
- var_dump(@strripos("", "a"));
- var_dump(@strripos("\\\\a", "\\a"));
-
- $fp = fopen(__FILE__, "r");
- var_dump(@strripos("", $fp));
+ var_dump(strripos("foo", "f", 1));
+ var_dump(strripos("", ""));
+ var_dump(strripos("a", ""));
+ var_dump(strripos("", "a"));
+ var_dump(strripos("\\\\a", "\\a"));
?>
--EXPECT--
int(5)
@@ -29,8 +26,7 @@ int(2)
int(0)
int(0)
bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(0)
int(1)
bool(false)
+int(1)
diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt
index 70a9534ebd..7dc0ce0d61 100644
--- a/ext/standard/tests/strings/strripos_offset.phpt
+++ b/ext/standard/tests/strings/strripos_offset.phpt
@@ -3,11 +3,12 @@ strripos() offset integer overflow
--FILE--
<?php
-var_dump(strripos("t", "t", PHP_INT_MAX+1));
-var_dump(strripos("tttt", "tt", PHP_INT_MAX+1));
-var_dump(strripos(100, 101, PHP_INT_MAX+1));
-var_dump(strripos(1024, 1024, PHP_INT_MAX+1));
-var_dump(strripos(array(), array(), PHP_INT_MAX+1));
+try {
+ var_dump(strripos("t", "t", PHP_INT_MAX+1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
var_dump(strripos(1024, 1024, -PHP_INT_MAX));
var_dump(strripos(1024, "te", -PHP_INT_MAX));
var_dump(strripos(1024, 1024, -PHP_INT_MAX-1));
@@ -16,34 +17,17 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1));
echo "Done\n";
?>
--EXPECTF--
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
+strripos() expects parameter 3 to be int, float given
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: strripos() expects parameter 1 to be string, array given in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
-Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt
index 59d7a64686..8b0c3a35cc 100644
--- a/ext/standard/tests/strings/strripos_variation1.phpt
+++ b/ext/standard/tests/strings/strripos_variation1.phpt
@@ -74,7 +74,7 @@ foreach ($needles as $needle) {
}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing strripos() function: with double quoted strings ***
-- Iteration 1 --
int(28)
@@ -132,62 +132,30 @@ int(8)
bool(false)
int(8)
-- Iteration 12 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 13 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 14 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 15 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 16 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 17 --
int(43)
int(43)
diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt
index 7b47b787be..affe72a50a 100644
--- a/ext/standard/tests/strings/strripos_variation2.phpt
+++ b/ext/standard/tests/strings/strripos_variation2.phpt
@@ -75,7 +75,7 @@ foreach ($needles as $needle) {
}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing strripos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
@@ -133,62 +133,30 @@ int(10)
bool(false)
int(10)
-- Iteration 12 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 13 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 14 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 15 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 16 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 17 --
int(53)
int(53)
@@ -280,18 +248,10 @@ bool(false)
bool(false)
bool(false)
-- Iteration 35 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
-- Iteration 36 --
int(0)
bool(false)
diff --git a/ext/standard/tests/strings/strripos_variation3.phpt b/ext/standard/tests/strings/strripos_variation3.phpt
index 4fccaeb47e..0f531f03da 100644
--- a/ext/standard/tests/strings/strripos_variation3.phpt
+++ b/ext/standard/tests/strings/strripos_variation3.phpt
@@ -54,6 +54,6 @@ bool(false)
-- Multi line strings with no offset --
int(18)
int(31)
-bool(false)
+int(63)
int(55)
===DONE===
diff --git a/ext/standard/tests/strings/strripos_variation6.phpt b/ext/standard/tests/strings/strripos_variation6.phpt
new file mode 100644
index 0000000000..92bb70440a
--- /dev/null
+++ b/ext/standard/tests/strings/strripos_variation6.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strrpos() function : usage variations - negative offset with empty needle
+--FILE--
+<?php
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
+
+var_dump(strlen($haystack));
+
+var_dump( strripos($haystack, "", -1) );
+var_dump( strripos($haystack, "", -10) );
+var_dump( strripos($haystack, "", -26) );
+var_dump( strripos($haystack, "", -44) );
+?>
+
+DONE
+--EXPECT--
+int(44)
+int(43)
+int(34)
+int(18)
+int(0)
+
+DONE
diff --git a/ext/standard/tests/strings/strrpos.phpt b/ext/standard/tests/strings/strrpos.phpt
index 691f67e599..f672d93a2a 100644
--- a/ext/standard/tests/strings/strrpos.phpt
+++ b/ext/standard/tests/strings/strrpos.phpt
@@ -10,11 +10,11 @@ strrpos() function
var_dump(strrpos("te".chr(0)."st", chr(0)));
var_dump(strrpos("tEst", "test"));
var_dump(strrpos("teSt", "test"));
- var_dump(@strrpos("foo", "f", 1));
- var_dump(@strrpos("", ""));
- var_dump(@strrpos("a", ""));
- var_dump(@strrpos("", "a"));
- var_dump(@strrpos("\\\\a", "\\a"));
+ var_dump(strrpos("foo", "f", 1));
+ var_dump(strrpos("", ""));
+ var_dump(strrpos("a", ""));
+ var_dump(strrpos("", "a"));
+ var_dump(strrpos("\\\\a", "\\a"));
?>
--EXPECT--
int(5)
@@ -26,7 +26,7 @@ int(2)
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
+int(0)
+int(1)
bool(false)
int(1)
diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt
index 9ef4f42d18..fdff39fdb2 100644
--- a/ext/standard/tests/strings/strrpos_offset.phpt
+++ b/ext/standard/tests/strings/strrpos_offset.phpt
@@ -3,10 +3,12 @@ strrpos() offset integer overflow
--FILE--
<?php
-var_dump(strrpos("t", "t", PHP_INT_MAX+1));
-var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1));
-var_dump(strrpos(100, 101, PHP_INT_MAX+1));
-var_dump(strrpos(1024, 1024, PHP_INT_MAX+1));
+try {
+ var_dump(strrpos("t", "t", PHP_INT_MAX+1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
var_dump(strrpos(1024, 1024, -PHP_INT_MAX));
var_dump(strrpos(1024, "te", -PHP_INT_MAX));
var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1));
@@ -15,31 +17,17 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1));
echo "Done\n";
?>
--EXPECTF--
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
+strrpos() expects parameter 3 to be int, float given
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt
index fd236d04d4..d54adaec73 100644
--- a/ext/standard/tests/strings/strrpos_variation1.phpt
+++ b/ext/standard/tests/strings/strrpos_variation1.phpt
@@ -72,7 +72,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with double quoted strings ***
-- Iteration 1 --
int(28)
@@ -108,36 +108,20 @@ int(9)
int(8)
bool(false)
-- Iteration 12 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 13 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 14 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(44)
+int(44)
-- Iteration 17 --
int(43)
int(43)
diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt
index b9b24b9cb1..2a6b84337c 100644
--- a/ext/standard/tests/strings/strrpos_variation10.phpt
+++ b/ext/standard/tests/strings/strrpos_variation10.phpt
@@ -83,7 +83,11 @@ $needles = array (
$counter = 1;
for($index = 0; $index < count($needles); $index ++) {
echo "-- Iteration $counter --\n";
- var_dump( strrpos($haystack, $needles[$index]) );
+ try {
+ var_dump( strrpos($haystack, $needles[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,108 +95,58 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function with unexpected values for needle ***
-- Iteration 1 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(42)
-- Iteration 2 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(41)
-- Iteration 3 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 5 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(27)
-- Iteration 6 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(21)
-- Iteration 7 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 8 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 9 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(28)
-- Iteration 10 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 12 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 13 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 14 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(41)
-- Iteration 16 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 17 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(41)
-- Iteration 18 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(64)
-- Iteration 20 --
-bool(false)
+int(87)
-- Iteration 21 --
-bool(false)
+int(87)
-- Iteration 22 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 23 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 24 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 26 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt
index 94c1b9d96d..2fbe78e30a 100644
--- a/ext/standard/tests/strings/strrpos_variation11.phpt
+++ b/ext/standard/tests/strings/strrpos_variation11.phpt
@@ -81,8 +81,16 @@ $counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
$haystack = $values[$index];
- var_dump( strrpos($values[$index], $values[$index]) );
- var_dump( strrpos($values[$index], $values[$index], 1) );
+ try {
+ var_dump( strrpos($values[$index], $values[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( strrpos($values[$index], $values[$index], 1) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,181 +99,97 @@ echo "*** Done ***";
--EXPECTF--
*** Testing strrpos() function with unexpected values for haystack and needle ***
-- Iteration 1 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 2 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 3 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 4 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 5 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 6 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 7 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 8 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 9 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 10 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+strrpos() expects parameter 1 to be string, array given
+strrpos() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+strrpos() expects parameter 1 to be string, array given
+strrpos() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+strrpos() expects parameter 1 to be string, array given
+strrpos() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+strrpos() expects parameter 1 to be string, array given
+strrpos() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+strrpos() expects parameter 1 to be string, array given
+strrpos() expects parameter 1 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 16 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 17 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 18 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 20 --
-bool(false)
+int(0)
+
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 21 --
-bool(false)
-bool(false)
--- Iteration 22 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
+-- Iteration 22 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 23 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 24 --
-
-Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
-bool(false)
+strrpos() expects parameter 1 to be string, resource given
+strrpos() expects parameter 1 to be string, resource given
-- Iteration 25 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
-- Iteration 26 --
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt
new file mode 100644
index 0000000000..d244a19e47
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation14.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strrpos() function : usage variations - negative offset with empty needle
+--FILE--
+<?php
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
+
+var_dump(strlen($haystack));
+
+var_dump( strrpos($haystack, "", -1) );
+var_dump( strrpos($haystack, "", -10) );
+var_dump( strrpos($haystack, "", -26) );
+var_dump( strrpos($haystack, "", -44) );
+?>
+
+DONE
+--EXPECT--
+int(44)
+int(43)
+int(34)
+int(18)
+int(0)
+
+DONE
diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt
deleted file mode 100644
index 798a6877e4..0000000000
--- a/ext/standard/tests/strings/strrpos_variation15.phpt
+++ /dev/null
@@ -1,205 +0,0 @@
---TEST--
-Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments
---SKIPIF--
-<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only");
---FILE--
-<?php
-/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
- * Description: Find position of last occurrence of 'needle' in 'haystack'.
- * Source code: ext/standard/string.c
-*/
-
-/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */
-
-echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n";
-
-// get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-// defining a class
-class sample {
- public function __toString() {
- return "object";
- }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
-// array with different values
-$values = array (
-
- // integer values
- 0,
- 1,
- 12345,
- -2345,
-
- // float values
- 10.5,
- -10.5,
- 10.5e10,
- 10.6E-10,
- .5,
-
- // array values
- array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // objects
- new sample(),
-
- // empty string
- "",
- '',
-
- // null values
- NULL,
- null,
-
- //resource
- $file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
-);
-
-
-// loop through each element of the array and check the working of strrpos()
-$counter = 1;
-for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- var_dump( strrpos($values[$index], $values[$index], $values[$index]) );
- $counter ++;
-}
-
-echo "*** Done ***";
-?>
---EXPECTF--
-*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***
--- Iteration 1 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 7 --
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
--- Iteration 8 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 9 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 10 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 11 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 12 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 13 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 14 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 16 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 17 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 18 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 19 --
-
-Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d
-bool(false)
--- Iteration 20 --
-
-Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d
-bool(false)
--- Iteration 21 --
-
-Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d
-bool(false)
--- Iteration 22 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 23 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 24 --
-
-Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
-bool(false)
--- Iteration 25 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 26 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt
index 9c0a320785..3accd165bb 100644
--- a/ext/standard/tests/strings/strrpos_variation2.phpt
+++ b/ext/standard/tests/strings/strrpos_variation2.phpt
@@ -73,7 +73,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
@@ -109,36 +109,20 @@ bool(false)
int(10)
int(10)
-- Iteration 12 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 13 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 14 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(54)
+int(54)
-- Iteration 17 --
int(53)
int(53)
@@ -194,11 +178,7 @@ bool(false)
bool(false)
bool(false)
-- Iteration 35 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+bool(false)
bool(false)
-- Iteration 36 --
int(0)
diff --git a/ext/standard/tests/strings/strrpos_variation3.phpt b/ext/standard/tests/strings/strrpos_variation3.phpt
index 460f18cca5..1ebe9e7a21 100644
--- a/ext/standard/tests/strings/strrpos_variation3.phpt
+++ b/ext/standard/tests/strings/strrpos_variation3.phpt
@@ -32,6 +32,6 @@ echo "*** Done ***";
int(44)
int(44)
int(44)
-bool(false)
+int(63)
int(55)
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt
index 54db4b372e..d5aa8b561c 100644
--- a/ext/standard/tests/strings/strrpos_variation7.phpt
+++ b/ext/standard/tests/strings/strrpos_variation7.phpt
@@ -25,12 +25,10 @@ echo "*** Done ***";
--EXPECTF--
*** Testing strrpos() function: with heredoc strings ***
-- With empty heredoc string --
-bool(false)
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
bool(false)
+int(0)
+int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
index 2908de7a27..22fe2d0da9 100644
--- a/ext/standard/tests/strings/strstr.phpt
+++ b/ext/standard/tests/strings/strstr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strstr_variation1.phpt b/ext/standard/tests/strings/strstr_variation1.phpt
new file mode 100644
index 0000000000..aade1fd5f8
--- /dev/null
+++ b/ext/standard/tests/strings/strstr_variation1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strstr() function : usage variations - complex strings containing other than 7-bit chars
+--FILE--
+<?php
+$string = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255);
+$stringAsHex = bin2hex($string);
+echo "-- Positions of some chars in the string '$stringAsHex' are as follows --\n";
+echo bin2hex( chr(128) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(128) ) ) );
+echo bin2hex( chr(255) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(255) ) ) );
+echo bin2hex( chr(256) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(256) ) ) );
+?>
+
+DONE
+--EXPECT--
+-- Positions of some chars in the string '008081eaebfeff' are as follows --
+80 => string(12) "8081eaebfeff"
+ff => string(2) "ff"
+00 => string(14) "008081eaebfeff"
+
+DONE
diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt
index c0ad1d0115..ff631754df 100644
--- a/ext/standard/tests/strings/strtolower-win32.phpt
+++ b/ext/standard/tests/strings/strtolower-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt
index 47dfe09762..7c7e2bb4c7 100644
--- a/ext/standard/tests/strings/strtolower.phpt
+++ b/ext/standard/tests/strings/strtolower.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt
index 60701652e1..7240e5c021 100644
--- a/ext/standard/tests/strings/strtoupper1-win32.phpt
+++ b/ext/standard/tests/strings/strtoupper1-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt
index e0ebf42ea7..c243ff10c7 100644
--- a/ext/standard/tests/strings/strtoupper1.phpt
+++ b/ext/standard/tests/strings/strtoupper1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt
index 5e06da6178..272e58a544 100644
--- a/ext/standard/tests/strings/strtr_variation6.phpt
+++ b/ext/standard/tests/strings/strtr_variation6.phpt
@@ -103,15 +103,15 @@ string(6) "m1tatm"
string(6) "tm0atm"
-- Iteration 7 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(6) "0120tm"
-- Iteration 8 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(6) "0120tm"
-- Iteration 9 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(6) "0120tm"
-- Iteration 10 --
string(6) "0a2atm"
diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt
index 8d29db1cc3..2e2843335d 100644
--- a/ext/standard/tests/strings/strtr_variation8.phpt
+++ b/ext/standard/tests/strings/strtr_variation8.phpt
@@ -75,10 +75,15 @@ $replace_pairs_arr = array (
// loop through with each element of the $replace_pairs array to test strtr() function
$count = 1;
for($index = 0; $index < count($replace_pairs_arr); $index++) {
- echo "\n-- Iteration $count --\n";
- $replace_pairs = $replace_pairs_arr[$index];
- var_dump( strtr($str, $replace_pairs) );
- $count ++;
+ echo "\n-- Iteration $count --\n";
+ $replace_pairs = $replace_pairs_arr[$index];
+ try {
+ var_dump( strtr($str, $replace_pairs) );
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ $count ++;
}
fclose($file_handle); //closing the file handle
@@ -89,34 +94,22 @@ echo "*** Done ***";
*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***
-- Iteration 1 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 2 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 3 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 4 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 5 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 6 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 7 --
string(6) "012atm"
@@ -128,52 +121,32 @@ string(6) "012atm"
string(6) "122atm"
-- Iteration 10 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 11 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 12 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 13 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 14 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 15 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 16 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 17 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 18 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
-- Iteration 19 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+The second argument is not an array
*** Done ***
diff --git a/ext/standard/tests/strings/strval.phpt b/ext/standard/tests/strings/strval.phpt
index b837a079d4..8f01cbfc0b 100644
--- a/ext/standard/tests/strings/strval.phpt
+++ b/ext/standard/tests/strings/strval.phpt
@@ -22,5 +22,5 @@ string(3) "1.1"
string(1) "1"
string(0) ""
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt
index 4e1ece6016..3cd76c5e15 100644
--- a/ext/standard/tests/strings/strval_error.phpt
+++ b/ext/standard/tests/strings/strval_error.phpt
@@ -16,17 +16,6 @@ class MyClass
// no toString() method defined
}
-$string = "Hello";
-$extra_arg = 10;
-
-//Test strval with one more than the expected number of arguments
-echo "\n-- Testing strval() function with more than expected no. of arguments --\n";
-var_dump( strval($string, $extra_arg) );
-
-// Testing strval with one less than the expected number of arguments
-echo "\n-- Testing strval() function with less than expected no. of arguments --\n";
-var_dump( strval() );
-
// Testing strval with a object which has no toString() method
echo "\n-- Testing strval() function with object which has not toString() method --\n";
try {
@@ -40,16 +29,6 @@ try {
--EXPECTF--
*** Testing strval() : error conditions ***
--- Testing strval() function with more than expected no. of arguments --
-
-Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing strval() function with less than expected no. of arguments --
-
-Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-- Testing strval() function with object which has not toString() method --
Object of class MyClass could not be converted to string
===DONE===
diff --git a/ext/standard/tests/strings/strval_variation1.phpt b/ext/standard/tests/strings/strval_variation1.phpt
index 5918c286e2..d833fa01be 100644
--- a/ext/standard/tests/strings/strval_variation1.phpt
+++ b/ext/standard/tests/strings/strval_variation1.phpt
@@ -9,8 +9,6 @@ Test strval() function : usage variations - Pass different data types as strval
echo "*** Testing strval() : usage variations ***\n";
-error_reporting(E_ALL ^ E_NOTICE);
-
//get an unset variable
$unset_var = 10;
unset ($unset_var);
@@ -147,9 +145,13 @@ string(14) "1.007654321E-8"
string(3) "0.5"
-- Iteration 18 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 19 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 20 --
diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt
index 0901d2082e..fe687ed1ae 100644
--- a/ext/standard/tests/strings/substr.phpt
+++ b/ext/standard/tests/strings/substr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt
index f1edf0afdf..6a0bca4336 100644
--- a/ext/standard/tests/strings/substr_compare.phpt
+++ b/ext/standard/tests/strings/substr_compare.phpt
@@ -4,6 +4,7 @@ substr_compare()
<?php
var_dump(substr_compare("abcde", "df", -2) < 0);
+var_dump(substr_compare("abcde", "df", -2, null) < 0);
var_dump(substr_compare("abcde", "bc", 1, 2));
var_dump(substr_compare("abcde", "bcg", 1, 2));
var_dump(substr_compare("abcde", "BC", 1, 2, true));
@@ -12,16 +13,20 @@ var_dump(substr_compare("abcde", "cd", 1, 2) < 0);
var_dump(substr_compare("abcde", "abc", 5, 1));
var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0);
var_dump(substr_compare("abcde", "abc", 0, 0));
-var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass));
echo "Test\n";
-var_dump(substr_compare("abcde", "abc", 0, -1));
+
+try {
+ substr_compare("abcde", "abc", 0, -1);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0);
-var_dump(substr_compare("abcde", -1, 0, "str", new stdClass));
echo "Done\n";
?>
--EXPECTF--
bool(true)
+bool(true)
int(0)
int(0)
int(0)
@@ -30,15 +35,7 @@ bool(true)
int(-1)
bool(true)
int(0)
-
-Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d
-bool(false)
Test
-
-Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
-bool(false)
+The length must be greater than or equal to zero
bool(true)
-
-Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt
index 4023a774d8..a6d715ed67 100644
--- a/ext/standard/tests/strings/substr_count_basic.phpt
+++ b/ext/standard/tests/strings/substr_count_basic.phpt
@@ -4,20 +4,30 @@ Test substr_count() function (basic)
<?php
echo "***Testing basic operations ***\n";
-var_dump(@substr_count("", ""));
-var_dump(@substr_count("a", ""));
-var_dump(@substr_count("", "a"));
-var_dump(@substr_count("", "a"));
-var_dump(@substr_count("", chr(0)));
+try {
+ substr_count("", "");
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ substr_count("a", "");
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump(substr_count("", "a"));
+var_dump(substr_count("", "a"));
+var_dump(substr_count("", chr(0)));
$a = str_repeat("abcacba", 100);
-var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca"));
$a = str_repeat("abcacbabca", 100);
-var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca"));
var_dump(substr_count($a, "bca", 200));
+var_dump(substr_count($a, "bca", 200, null));
var_dump(substr_count($a, "bca", 200, 50));
var_dump(substr_count($a, "bca", -200));
+var_dump(substr_count($a, "bca", -200, null));
var_dump(substr_count($a, "bca", -200, 50));
var_dump(substr_count($a, "bca", -200, -50));
@@ -26,16 +36,18 @@ echo "Done\n";
?>
--EXPECT--
***Testing basic operations ***
-bool(false)
-bool(false)
+Empty substring
+Empty substring
int(0)
int(0)
int(0)
int(100)
int(200)
int(160)
+int(160)
int(10)
int(40)
+int(40)
int(10)
int(30)
Done
diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt
index eecc251e6c..246963d13b 100644
--- a/ext/standard/tests/strings/substr_count_error.phpt
+++ b/ext/standard/tests/strings/substr_count_error.phpt
@@ -6,12 +6,6 @@ Test substr_count() function (error conditions)
echo "\n*** Testing error conditions ***\n";
$str = 'abcdefghik';
-/* Zero argument */
-var_dump( substr_count() );
-
-/* more than expected no. of args */
-var_dump( substr_count($str, "t", 0, 15, 30) );
-
/* offset before start */
var_dump(substr_count($str, "t", -20));
@@ -22,9 +16,6 @@ var_dump(substr_count($str, "t", 25));
Warning message expected, as length+offset > length of string */
var_dump( substr_count($str, "i", 5, 7) );
-/* Invalid offset argument */
-var_dump( substr_count($str, "t", "") );
-
/* length too small */
var_dump( substr_count($str, "t", 2, -20) );
@@ -34,12 +25,6 @@ echo "Done\n";
--EXPECTF--
*** Testing error conditions ***
-Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: substr_count(): Offset not contained in string in %s on line %d
bool(false)
@@ -49,9 +34,6 @@ bool(false)
Warning: substr_count(): Invalid length value in %s on line %d
bool(false)
-Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
Warning: substr_count(): Invalid length value in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt
index 71f2d223e1..19a9a0310d 100644
--- a/ext/standard/tests/strings/substr_count_variation_001.phpt
+++ b/ext/standard/tests/strings/substr_count_variation_001.phpt
@@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") );
var_dump( substr_count($str, "i", "5t", "10t") );
echo "\n-- 3rd or 4th arg as NULL --\n";
-var_dump( substr_count($str, "t", "") );
-var_dump( substr_count($str, "T", "") );
-var_dump( substr_count($str, "t", "", 15) );
var_dump( substr_count($str, "I", NULL) );
var_dump( substr_count($str, "i", NULL, 10) );
@@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d
int(2)
-- 3rd or 4th arg as NULL --
-
-Warning: substr_count() expects parameter 3 to be int, string given %s on line %d
-NULL
-
-Warning: substr_count() expects parameter 3 to be int, string given %s on line %d
-NULL
-
-Warning: substr_count() expects parameter 3 to be int, string given %s on line %d
-NULL
int(0)
int(2)
diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt
index ac945349fe..936d0fd1d5 100644
--- a/ext/standard/tests/strings/substr_replace_error.phpt
+++ b/ext/standard/tests/strings/substr_replace_error.phpt
@@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n";
$s1 = "Good morning";
-echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n";
-var_dump(substr_replace());
-var_dump(substr_replace($s1, "evening"));
-
-echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n";
-var_dump(substr_replace($s1, "evening", 5, 7, true));
-
echo "\n-- Testing substr_replace() function with start and length different types --\n";
var_dump(substr_replace($s1, "evening", array(5)));
var_dump(substr_replace($s1, "evening", 5, array(8)));
@@ -37,19 +30,6 @@ var_dump(substr_replace($s1, "evening", array(5), array(8)));
--EXPECTF--
*** Testing substr_replace() : error conditions ***
--- Testing substr_replace() function with less than expected no. of arguments --
-
-Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing substr_replace() function with more than expected no. of arguments --
-
-Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing substr_replace() function with start and length different types --
Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d
diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt
index d0e4070d80..1ad504c61d 100644
--- a/ext/standard/tests/strings/trim1.phpt
+++ b/ext/standard/tests/strings/trim1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt
index b845cee1ac..046a2b04f9 100644
--- a/ext/standard/tests/strings/trim_error.phpt
+++ b/ext/standard/tests/strings/trim_error.phpt
@@ -11,14 +11,6 @@ Test trim() function : error conditions
echo "*** Testing trim() : error conditions ***\n";
-echo "\n-- Testing trim() function with no arguments --\n";
-var_dump( trim() );
-
-echo "\n-- Testing trim() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( trim("Hello World", "Heo", $extra_arg) );
-
-
$hello = " Hello World\n";
echo "\n-- Test trim function with various invalid charlists --\n";
var_dump(trim($hello, "..a"));
@@ -31,16 +23,6 @@ var_dump(trim($hello, "a..b..c"));
--EXPECTF--
*** Testing trim() : error conditions ***
--- Testing trim() function with no arguments --
-
-Warning: trim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing trim() function with more than expected no. of arguments --
-
-Warning: trim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Test trim function with various invalid charlists --
Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
index b524b45e59..ea575f6f11 100644
--- a/ext/standard/tests/strings/ucfirst.phpt
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt
index f04e493772..b34be23267 100644
--- a/ext/standard/tests/strings/unpack_error.phpt
+++ b/ext/standard/tests/strings/unpack_error.phpt
@@ -10,13 +10,6 @@ Test unpack() function : error conditions
echo "*** Testing unpack() : error conditions ***\n";
-echo "\n-- Testing unpack() function with no arguments --\n";
-var_dump( unpack() );
-
-echo "\n-- Testing unpack() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump(unpack("I", pack("I", 65534), 0, $extra_arg));
-
echo "\n-- Testing unpack() function with invalid format character --\n";
$extra_arg = 10;
var_dump(unpack("B", pack("I", 65534)));
@@ -25,16 +18,6 @@ var_dump(unpack("B", pack("I", 65534)));
--EXPECTF--
*** Testing unpack() : error conditions ***
--- Testing unpack() function with no arguments --
-
-Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing unpack() function with more than expected no. of arguments --
-
-Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing unpack() function with invalid format character --
Warning: unpack(): Invalid format type B in %s on line %d
diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt
index 5a1f3d2a24..8199a2ed05 100644
--- a/ext/standard/tests/strings/uuencode.phpt
+++ b/ext/standard/tests/strings/uuencode.phpt
@@ -3,9 +3,6 @@ uuencode family tests
--FILE--
<?php
-var_dump(convert_uuencode(array()));
-var_dump(convert_uudecode(array()));
-
var_dump(convert_uuencode(""));
var_dump(convert_uudecode(""));
var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ"));
@@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10)));
echo "Done\n";
?>
--EXPECTF--
-Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
bool(false)
bool(false)
string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA:
diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt
index c56631ecd7..b4548e8b49 100644
--- a/ext/standard/tests/strings/vfprintf_error1.phpt
+++ b/ext/standard/tests/strings/vfprintf_error1.phpt
@@ -20,8 +20,16 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments
$format = 'string_val';
$args = array( 1, 2 );
$extra_arg = 10;
-var_dump( vfprintf( $fp, $format, $args, $extra_arg ) );
-var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) );
+try {
+ var_dump( vfprintf( $fp, $format, $args, $extra_arg ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// Close handle
fclose($fp);
@@ -37,10 +45,6 @@ unlink( $file );
?>
--EXPECTF--
-- Testing vfprintf() function with more than expected no. of arguments --
-
-Warning: Wrong parameter count for vfprintf() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for vfprintf() in %s on line %d
-NULL
+Wrong parameter count for vfprintf()
+Wrong parameter count for vfprintf()
===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_error3.phpt b/ext/standard/tests/strings/vfprintf_error3.phpt
index 8be51e1798..d02855d61e 100644
--- a/ext/standard/tests/strings/vfprintf_error3.phpt
+++ b/ext/standard/tests/strings/vfprintf_error3.phpt
@@ -46,7 +46,7 @@ unlink( $file );
--EXPECTF--
-- Testing vfprintf() function with wrong variable types as argument --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
int(5)
string(5) "Array"
int(9)
diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt
index 2865d42a9e..e54e34f4cd 100644
--- a/ext/standard/tests/strings/vfprintf_error4.phpt
+++ b/ext/standard/tests/strings/vfprintf_error4.phpt
@@ -17,7 +17,11 @@ $file = 'vfprintf_error4.txt';
$fp = fopen( $file, "a+" );
echo "\n-- Testing vfprintf() function with other strangeties --\n";
-var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) );
+try {
+ var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) );
// Close handle
@@ -34,9 +38,7 @@ unlink( $file );
?>
--EXPECTF--
-- Testing vfprintf() function with other strangeties --
-
-Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
+vfprintf() expects parameter 1 to be resource, string given
Warning: vfprintf(): Argument number must be greater than zero in %s on line %d
bool(false)
diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt
index 76422011c2..7c969ffff9 100644
--- a/ext/standard/tests/strings/vfprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation1.phpt
@@ -48,8 +48,6 @@ writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) );
writeAndDump( $fp, "%02d", array( 50 ) );
writeAndDump( $fp, "", array() );
writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) );
-@writeAndDump( $funset, "Foo with %s", array( 'string' ) );
-@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) );
// Close handle
fclose( $fp );
@@ -79,8 +77,4 @@ string(0) ""
int(0)
string(38) "Testing 1001 6 2.550200 30 foobar f 41"
int(38)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation20.phpt b/ext/standard/tests/strings/vfprintf_variation20.phpt
index 1f8dfefca4..6285bd11f1 100644
--- a/ext/standard/tests/strings/vfprintf_variation20.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation20.phpt
@@ -108,15 +108,15 @@ unlink($data_file);
--EXPECTF--
*** Testing vfprintf() : with unexpected values for format argument ***
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion 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
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion 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
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
*** Testing vprintf() with with unexpected values for format argument ***
diff --git a/ext/standard/tests/strings/vfprintf_variation8.phpt b/ext/standard/tests/strings/vfprintf_variation8.phpt
index ff806154f4..6f3250e5f1 100644
--- a/ext/standard/tests/strings/vfprintf_variation8.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation8.phpt
@@ -12,8 +12,6 @@ Test vfprintf() function : usage variations - string formats with non-string val
* the '$format' and '$args' arguments of the function
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing vfprintf() : string formats and non-string values ***\n";
// defining array of string formats
@@ -81,9 +79,45 @@ unlink($data_file);
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing vfprintf() : string formats and non-string values ***
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
-- Iteration 1 --
2.2 0.2 10.2
123456.234 s -1234.6789 1234.6789
diff --git a/ext/standard/tests/strings/vprintf_variation1.phpt b/ext/standard/tests/strings/vprintf_variation1.phpt
index 5cf50105ab..94158243b7 100644
--- a/ext/standard/tests/strings/vprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vprintf_variation1.phpt
@@ -141,31 +141,31 @@ int(3)
-- Iteration 10 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 11 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 12 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 13 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 14 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(5)
diff --git a/ext/standard/tests/strings/vprintf_variation8.phpt b/ext/standard/tests/strings/vprintf_variation8.phpt
index f635b1d4c0..eecc60ac3c 100644
--- a/ext/standard/tests/strings/vprintf_variation8.phpt
+++ b/ext/standard/tests/strings/vprintf_variation8.phpt
@@ -12,8 +12,6 @@ Test vprintf() function : usage variations - string formats with non-string valu
* the '$format' and '$args' arguments of the function
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing vprintf() : string formats and non-string values ***\n";
// defining array of string formats
@@ -72,7 +70,7 @@ foreach($args_array as $args) {
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing vprintf() : string formats and non-string values ***
-- Iteration 1 --
@@ -92,6 +90,42 @@ int(172)
int(132)
-- Iteration 3 --
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
Array Array Array
Array s Array Array
Arra Arra Array Arra
diff --git a/ext/standard/tests/strings/vsprintf_variation1.phpt b/ext/standard/tests/strings/vsprintf_variation1.phpt
index 15c749d3f8..33bc043927 100644
--- a/ext/standard/tests/strings/vsprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation1.phpt
@@ -130,27 +130,27 @@ string(3) "0.5"
-- Iteration 10 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 11 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 12 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 13 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 14 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 15 --
diff --git a/ext/standard/tests/strings/vsprintf_variation8.phpt b/ext/standard/tests/strings/vsprintf_variation8.phpt
index 0efd8bb008..a2adbfa093 100644
--- a/ext/standard/tests/strings/vsprintf_variation8.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation8.phpt
@@ -12,8 +12,6 @@ Test vsprintf() function : usage variations - string formats with non-string val
* the '$format' and '$args' arguments of the function
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing vsprintf() : string formats and non-string values ***\n";
// defining array of string formats
@@ -70,7 +68,7 @@ foreach($args_array as $args) {
?>
===DONE===
---EXPECT--
+--EXPECTF--
*** Testing vsprintf() : string formats and non-string values ***
-- Iteration 1 --
@@ -88,6 +86,42 @@ string(130) "2 -2 2
2 123456 2 -2"
-- Iteration 3 --
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
string(129) "Array Array Array
Array Array Array
Arra Arra Array Arra
diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt
index 543c41fdd9..8c2b08f046 100644
--- a/ext/standard/tests/strings/wordwrap.phpt
+++ b/ext/standard/tests/strings/wordwrap.phpt
@@ -27,10 +27,17 @@ $tests = <<<TESTS
"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
-FALSE === @wordwrap(chr(0), 0, "")
-
TESTS;
include(__DIR__ . '/../../../../tests/quicktester.inc');
+
+echo "\n";
+
+try {
+ wordwrap(chr(0), 0, "");
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
--EXPECT--
OK
+Break string cannot be empty
diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt
index 41c5cbdb69..f0fa80f63d 100644
--- a/ext/standard/tests/strings/wordwrap_error.phpt
+++ b/ext/standard/tests/strings/wordwrap_error.phpt
@@ -9,19 +9,10 @@ Test wordwrap() function : error conditions
echo "*** Testing wordwrap() : error conditions ***\n";
-// Zero argument
-echo "\n-- Testing wordwrap() function with Zero arguments --\n";
-var_dump( wordwrap() );
-
-// More than expected number of arguments
-echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n";
$str = 'testing wordwrap function';
$width = 10;
$break = '<br />\n';
$cut = true;
-$extra_arg = "extra_arg";
-
-var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) );
// $width arg as negative value
echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n";
@@ -35,7 +26,12 @@ echo "-- width = 0 & cut = true --\n";
// width as zero and cut as true
$width = 0;
$cut = true;
-var_dump( wordwrap($str, $width, $break, $cut) );
+
+try {
+ wordwrap($str, $width, $break, $cut);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "-- width = -10 & cut = false --\n";
// width as -ne and cut as false
@@ -54,23 +50,11 @@ echo "Done\n";
--EXPECTF--
*** Testing wordwrap() : error conditions ***
--- Testing wordwrap() function with Zero arguments --
-
-Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing wordwrap() function with more than expected no. of arguments --
-
-Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing wordwrap() function with negative/zero value for width argument --
-- width = 0 & cut = false --
string(39) "testing<br />\nwordwrap<br />\nfunction"
-- width = 0 & cut = true --
-
-Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
-bool(false)
+Can't force cut when width is zero
-- width = -10 & cut = false --
string(39) "testing<br />\nwordwrap<br />\nfunction"
-- width = -10 & cut = true --
diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt
index f49025be44..3f7bbbdb82 100644
--- a/ext/standard/tests/time/strptime_error.phpt
+++ b/ext/standard/tests/time/strptime_error.phpt
@@ -19,20 +19,8 @@ date_default_timezone_set("Europe/London");
echo "*** Testing strptime() : error conditions ***\n";
-echo "\n-- Testing strptime() function with Zero arguments --\n";
-var_dump( strptime() );
-
-echo "\n-- Testing strptime() function with less than expected no. of arguments --\n";
-$format = '%b %d %Y %H:%M:%S';
-$timestamp = mktime(8, 8, 8, 8, 8, 2008);
-$date = strftime($format, $timestamp);
-var_dump( strptime($date) );
-
-echo "\n-- Testing strptime() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( strptime($date, $format, $extra_arg) );
-
echo "\n-- Testing strptime() function on failure --\n";
+$format = '%b %d %Y %H:%M:%S';
var_dump( strptime('foo', $format) );
?>
@@ -40,21 +28,6 @@ var_dump( strptime('foo', $format) );
--EXPECTF--
*** Testing strptime() : error conditions ***
--- Testing strptime() function with Zero arguments --
-
-Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing strptime() function with less than expected no. of arguments --
-
-Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing strptime() function with more than expected no. of arguments --
-
-Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing strptime() function on failure --
bool(false)
===DONE===
diff --git a/ext/standard/type.c b/ext/standard/type.c
index d2e267bb3f..af847bf352 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.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, |
@@ -206,7 +204,7 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(arg)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(arg) == type) {
if (type == IS_RESOURCE) {
@@ -249,7 +247,7 @@ PHP_FUNCTION(is_bool)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(arg)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_BOOL(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE);
}
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index 97a886c592..08a315edbe 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.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/ext/standard/uniqid.h b/ext/standard/uniqid.h
index ed6528e5b2..ed1472ff06 100644
--- a/ext/standard/uniqid.h
+++ b/ext/standard/uniqid.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/ext/standard/url.c b/ext/standard/url.c
index a04d941498..622c4aa693 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.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, |
@@ -654,7 +652,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
}
/* }}} */
-/* {{{ proto array get_headers(string url[, int format[, resource context]])
+/* {{{ proto array|false get_headers(string url[, int format[, resource context]])
fetches all the headers sent by the server in response to a HTTP request */
PHP_FUNCTION(get_headers)
{
diff --git a/ext/standard/url.h b/ext/standard/url.h
index 782fe65e6a..d242518a08 100644
--- a/ext/standard/url.h
+++ b/ext/standard/url.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/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h
index 6a8b8fdbb1..a756db6586 100644
--- a/ext/standard/url_scanner_ex.h
+++ b/ext/standard/url_scanner_ex.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/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 1877e68918..a83a91b534 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -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/ext/standard/user_filters.c b/ext/standard/user_filters.c
index 6aff083a06..9f3acf73fd 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.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, |
@@ -164,7 +162,7 @@ php_stream_filter_status_t userfilter_filter(
zval func_name;
zval retval;
zval args[4];
- zval zpropname;
+ zend_string *propname;
int call_result;
/* the userfilter object probably doesn't exist anymore */
@@ -239,9 +237,9 @@ php_stream_filter_status_t userfilter_filter(
/* filter resources are cleaned up by the stream destructor,
* keeping a reference to the stream resource here would prevent it
* from being destroyed properly */
- ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1);
- Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, NULL);
- zval_ptr_dtor(&zpropname);
+ propname = zend_string_init("stream", sizeof("stream")-1, 0);
+ Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL);
+ zend_string_release_ex(propname, 0);
zval_ptr_dtor(&args[3]);
zval_ptr_dtor(&args[2]);
@@ -391,7 +389,7 @@ static void filter_item_dtor(zval *zv)
efree(fdat);
}
-/* {{{ proto object stream_bucket_make_writeable(resource brigade)
+/* {{{ proto object|false stream_bucket_make_writeable(resource brigade)
Return a bucket object from the brigade for operating on */
PHP_FUNCTION(stream_bucket_make_writeable)
{
@@ -401,11 +399,11 @@ PHP_FUNCTION(stream_bucket_make_writeable)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zbrigade)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource(
Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) {
- RETURN_FALSE;
+ return;
}
ZVAL_NULL(return_value);
@@ -433,7 +431,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zbrigade)
Z_PARAM_OBJECT(zobject)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (NULL == (pzbucket = zend_hash_str_find(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) {
php_error_docref(NULL, E_WARNING, "Object has no bucket property");
@@ -442,11 +440,11 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource(
Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) {
- RETURN_FALSE;
+ return;
}
if ((bucket = (php_stream_bucket *)zend_fetch_resource_ex(pzbucket, PHP_STREAM_BUCKET_RES_NAME, le_bucket)) == NULL) {
- RETURN_FALSE;
+ return;
}
if (NULL != (pzdata = zend_hash_str_find(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) {
@@ -504,7 +502,7 @@ PHP_FUNCTION(stream_bucket_new)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_ZVAL(zstream)
Z_PARAM_STRING(buffer, buffer_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -564,7 +562,7 @@ PHP_FUNCTION(stream_filter_register)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(filtername)
Z_PARAM_STR(classname)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETVAL_FALSE;
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index dbc99a9634..036e190f24 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.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, |
@@ -196,7 +194,7 @@ err:
}
/* }}} */
-/* {{{ proto string convert_uuencode(string data)
+/* {{{ proto string|false convert_uuencode(string data)
uuencode a string */
PHP_FUNCTION(convert_uuencode)
{
@@ -204,14 +202,14 @@ PHP_FUNCTION(convert_uuencode)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(src)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
RETURN_STR(php_uuencode(ZSTR_VAL(src), ZSTR_LEN(src)));
}
/* }}} */
-/* {{{ proto string convert_uudecode(string data)
+/* {{{ proto string|false convert_uudecode(string data)
decode a uuencoded string */
PHP_FUNCTION(convert_uudecode)
{
@@ -220,7 +218,7 @@ PHP_FUNCTION(convert_uudecode)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(src)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
if ((dest = php_uudecode(ZSTR_VAL(src), ZSTR_LEN(src))) == NULL) {
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 5ba2b3c8eb..4987729e3c 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.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, |
@@ -76,13 +74,11 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze
}
if (Z_TYPE_P(zv) == IS_UNDEF) {
- ZEND_ASSERT(prop_info->type);
- php_printf("%*cuninitialized(%s%s)\n",
- level + 1, ' ',
- ZEND_TYPE_ALLOW_NULL(prop_info->type) ? "?" : "",
- ZEND_TYPE_IS_CLASS(prop_info->type) ?
- ZSTR_VAL(ZEND_TYPE_IS_CE(prop_info->type) ? ZEND_TYPE_CE(prop_info->type)->name : ZEND_TYPE_NAME(prop_info->type)) :
- zend_get_type_by_const(ZEND_TYPE_CODE(prop_info->type)));
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(prop_info->type));
+ zend_string *type_str = zend_type_to_string(prop_info->type);
+ php_printf("%*cuninitialized(%s)\n",
+ level + 1, ' ', ZSTR_VAL(type_str));
+ zend_string_release(type_str);
} else {
php_var_dump(zv, level + 2);
}
@@ -260,13 +256,10 @@ static void zval_object_property_dump(zend_property_info *prop_info, zval *zv, z
ZEND_PUTS("]=>\n");
}
if (prop_info && Z_TYPE_P(zv) == IS_UNDEF) {
- ZEND_ASSERT(prop_info->type);
- php_printf("%*cuninitialized(%s%s)\n",
- level + 1, ' ',
- ZEND_TYPE_ALLOW_NULL(prop_info->type) ? "?" : "",
- ZEND_TYPE_IS_CLASS(prop_info->type) ?
- ZSTR_VAL(ZEND_TYPE_IS_CE(prop_info->type) ? ZEND_TYPE_CE(prop_info->type)->name : ZEND_TYPE_NAME(prop_info->type)) :
- zend_get_type_by_const(ZEND_TYPE_CODE(prop_info->type)));
+ zend_string *type_str = zend_type_to_string(prop_info->type);
+ php_printf("%*cuninitialized(%s)\n",
+ level + 1, ' ', ZSTR_VAL(type_str));
+ zend_string_release(type_str);
} else {
php_debug_zval_dump(zv, level + 2);
}
@@ -1191,7 +1184,7 @@ PHP_FUNCTION(unserialize)
Z_PARAM_STRING(buf, buf_len)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (buf_len == 0) {
RETURN_FALSE;
@@ -1305,7 +1298,7 @@ PHP_FUNCTION(memory_get_usage) {
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(real_usage)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(zend_memory_usage(real_usage));
}
@@ -1319,7 +1312,7 @@ PHP_FUNCTION(memory_get_peak_usage) {
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(real_usage)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(zend_memory_peak_usage(real_usage));
}
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index a444cdef5b..172f414797 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -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/ext/standard/versioning.c b/ext/standard/versioning.c
index e4353130d6..c134823968 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.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, |
@@ -201,7 +199,7 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
}
/* }}} */
-/* {{{ proto int version_compare(string ver1, string ver2 [, string oper])
+/* {{{ proto int|bool|null version_compare(string ver1, string ver2 [, string oper])
Compares two "PHP-standardized" version number strings */
PHP_FUNCTION(version_compare)
diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h
index af5e1da9ab..5aa075f741 100644
--- a/ext/sysvmsg/php_sysvmsg.h
+++ b/ext/sysvmsg/php_sysvmsg.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/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index d113ef56d5..94b0edd770 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.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, |
@@ -24,6 +22,7 @@
#include "php_globals.h"
#include "ext/standard/info.h"
#include "php_sysvmsg.h"
+#include "sysvmsg_arginfo.h"
#include "ext/standard/php_var.h"
#include "zend_smart_str.h"
@@ -62,50 +61,6 @@ struct php_msgbuf {
/* True global resources - no need for thread safety here */
static int le_sysvmsg;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_get_queue, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, perms)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_send, 0, 0, 3)
- ZEND_ARG_INFO(0, queue)
- ZEND_ARG_INFO(0, msgtype)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, serialize)
- ZEND_ARG_INFO(0, blocking)
- ZEND_ARG_INFO(1, errorcode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_receive, 0, 0, 5)
- ZEND_ARG_INFO(0, queue)
- ZEND_ARG_INFO(0, desiredmsgtype)
- ZEND_ARG_INFO(1, msgtype)
- ZEND_ARG_INFO(0, maxsize)
- ZEND_ARG_INFO(1, message)
- ZEND_ARG_INFO(0, unserialize)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(1, errorcode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_remove_queue, 0, 0, 1)
- ZEND_ARG_INFO(0, queue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_stat_queue, 0, 0, 1)
- ZEND_ARG_INFO(0, queue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_set_queue, 0, 0, 2)
- ZEND_ARG_INFO(0, queue)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_queue_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvmsg_functions[]
*
* Every user visible function must have an entry in sysvmsg_functions[].
diff --git a/ext/sysvmsg/sysvmsg.stub.php b/ext/sysvmsg/sysvmsg.stub.php
new file mode 100644
index 0000000000..a85090d96d
--- /dev/null
+++ b/ext/sysvmsg/sysvmsg.stub.php
@@ -0,0 +1,32 @@
+<?php
+
+/** @return resource|false */
+function msg_get_queue(int $key, int $perms = 0666) {}
+
+/**
+ * @param resource $queue
+ */
+function msg_send($queue, int $msgtype, $message, bool $serialize = true, bool $blocking = true, &$errorcode = null): bool {}
+
+/**
+ * @param resource $queue
+ */
+function msg_receive($queue, int $desiredmsgtype, &$msgtype, int $maxsize, &$message, bool $unserialize = true, int $flags = 0, &$errorcode = null): bool {}
+
+/**
+ * @param resource $queue
+ */
+function msg_remove_queue($queue): bool {}
+
+/**
+ * @param resource $queue
+ * @return array|false
+ */
+function msg_stat_queue($queue) {}
+
+/**
+ * @param resource $queue
+ */
+function msg_set_queue($queue, array $data): bool {}
+
+function msg_queue_exists(int $key): bool {}
diff --git a/ext/sysvmsg/sysvmsg_arginfo.h b/ext/sysvmsg/sysvmsg_arginfo.h
new file mode 100644
index 0000000000..05616cfc5a
--- /dev/null
+++ b/ext/sysvmsg/sysvmsg_arginfo.h
@@ -0,0 +1,43 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_get_queue, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_send, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ ZEND_ARG_TYPE_INFO(0, msgtype, IS_LONG, 0)
+ ZEND_ARG_INFO(0, message)
+ ZEND_ARG_TYPE_INFO(0, serialize, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, blocking, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, errorcode)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_receive, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ ZEND_ARG_TYPE_INFO(0, desiredmsgtype, IS_LONG, 0)
+ ZEND_ARG_INFO(1, msgtype)
+ ZEND_ARG_TYPE_INFO(0, maxsize, IS_LONG, 0)
+ ZEND_ARG_INFO(1, message)
+ ZEND_ARG_TYPE_INFO(0, unserialize, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(1, errorcode)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_remove_queue, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_stat_queue, 0, 0, 1)
+ ZEND_ARG_INFO(0, queue)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_set_queue, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_queue_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/sysvmsg/tests/005.phpt b/ext/sysvmsg/tests/005.phpt
index a2680c21c0..0016ab82c2 100644
--- a/ext/sysvmsg/tests/005.phpt
+++ b/ext/sysvmsg/tests/005.phpt
@@ -10,13 +10,12 @@ $tests = array(null, 'foo');
foreach ($tests as $q) {
if ($q === null) {
- do {
- $id = ftok(__FILE__, chr(mt_rand(0, 255)));
- } while (msg_queue_exists($id));
+ do {
+ $id = ftok(__FILE__, chr(mt_rand(0, 255))); } while (msg_queue_exists($id));
+ }
$q = msg_get_queue($id) or die("Failed to create queue");
msg_remove_queue($q) or die("Failed to close queue");
- }
echo "Using '$q' as queue resource:\n";
@@ -50,22 +49,16 @@ bool(false)
Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d
bool(false)
bool(true)
-Using 'foo' as queue resource:
-
-Warning: msg_set_queue() expects parameter 1 to be resource, string given in %s on line %d
+Using 'Resource id #5' as queue resource:
bool(false)
-
-Warning: msg_stat_queue() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: msg_receive() expects parameter 1 to be resource, string given in %s on line %d
bool(false)
bool(false)
+bool(true)
-Warning: msg_receive() expects parameter 1 to be resource, string given in %s on line %d
+Warning: msg_receive(): maximum size of the message has to be greater than zero in %s on line %d
bool(false)
-Warning: msg_send() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
+Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d
bool(false)
+bool(true)
Done
diff --git a/ext/sysvsem/php_sysvsem.h b/ext/sysvsem/php_sysvsem.h
index a78a49b350..980ddbe021 100644
--- a/ext/sysvsem/php_sysvsem.h
+++ b/ext/sysvsem/php_sysvsem.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/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index 6086d1f066..ef710eb6be 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.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, |
@@ -38,6 +36,7 @@
#include <sys/sem.h>
#include <errno.h>
+#include "sysvsem_arginfo.h"
#include "php_sysvsem.h"
#include "ext/standard/info.h"
@@ -55,28 +54,6 @@ union semun {
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, max_acquire)
- ZEND_ARG_INFO(0, perm)
- ZEND_ARG_INFO(0, auto_release)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_acquire, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
- ZEND_ARG_INFO(0, nowait)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_release, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_remove, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvsem_functions[]
*/
static const zend_function_entry sysvsem_functions[] = {
diff --git a/ext/sysvsem/sysvsem.stub.php b/ext/sysvsem/sysvsem.stub.php
new file mode 100644
index 0000000000..cb64eec3a5
--- /dev/null
+++ b/ext/sysvsem/sysvsem.stub.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @todo use bool for $auto_release
+ * @return resource|false
+ */
+function sem_get(int $key, int $max_acquire = 1, int $perm = 0666, int $auto_release = 1) {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_acquire($sem_identifier, bool $nowait = false): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_release($sem_identifier): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_remove($sem_identifier): bool {}
diff --git a/ext/sysvsem/sysvsem_arginfo.h b/ext/sysvsem/sysvsem_arginfo.h
new file mode 100644
index 0000000000..f45cae2498
--- /dev/null
+++ b/ext/sysvsem/sysvsem_arginfo.h
@@ -0,0 +1,19 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, max_acquire, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perm, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, auto_release, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_acquire, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, sem_identifier)
+ ZEND_ARG_TYPE_INFO(0, nowait, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_release, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, sem_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sem_remove arginfo_sem_release
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
index c2c5036245..8ff2e26b37 100644
--- a/ext/sysvshm/php_sysvshm.h
+++ b/ext/sysvshm/php_sysvshm.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/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index 6526efa250..dbf907e945 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.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, |
@@ -33,48 +31,12 @@
#include <errno.h>
#include "php_sysvshm.h"
+#include "sysvshm_arginfo.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
#include "zend_smart_str.h"
#include "php_ini.h"
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_attach, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, memsize)
- ZEND_ARG_INFO(0, perm)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_detach, 0, 0, 1)
- ZEND_ARG_INFO(0, shm_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_has_var, 0, 0, 2)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, variable_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_remove, 0, 0, 1)
- ZEND_ARG_INFO(0, shm_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_put_var, 0, 0, 3)
- ZEND_ARG_INFO(0, shm_identifier)
- ZEND_ARG_INFO(0, variable_key)
- ZEND_ARG_INFO(0, variable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_get_var, 0, 0, 2)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, variable_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_remove_var, 0, 0, 2)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, variable_key)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvshm_functions[]
*/
static const zend_function_entry sysvshm_functions[] = {
diff --git a/ext/sysvshm/sysvshm.stub.php b/ext/sysvshm/sysvshm.stub.php
new file mode 100644
index 0000000000..673f9c6f04
--- /dev/null
+++ b/ext/sysvshm/sysvshm.stub.php
@@ -0,0 +1,35 @@
+<?php
+
+/** @return resource|false */
+function shm_attach(int $key, int $memsize = UNKNOWN, int $perm = 0666) {}
+
+/**
+ * @param resource $shm_identifier
+ */
+function shm_detach($shm_identifier): bool {}
+
+/**
+ * @param resource $id
+ */
+function shm_has_var($id, int $variable_key): bool {}
+
+/**
+ * @param resource $shm_identifier
+ */
+function shm_remove($shm_identifier): bool {}
+
+/**
+ * @param resource $shm_identifier
+ */
+function shm_put_var($shm_identifier, int $variable_key, $variable): bool {}
+
+/**
+ * @param resource $id
+ * @return mixed
+ */
+function shm_get_var($id, int $variable_key) {}
+
+/**
+ * @param resource $id
+ */
+function shm_remove_var($id, int $variable_key): bool {}
diff --git a/ext/sysvshm/sysvshm_arginfo.h b/ext/sysvshm/sysvshm_arginfo.h
new file mode 100644
index 0000000000..dd00aa6349
--- /dev/null
+++ b/ext/sysvshm/sysvshm_arginfo.h
@@ -0,0 +1,31 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_attach, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memsize, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perm, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_detach, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, shm_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_has_var, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, id)
+ ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_shm_remove arginfo_shm_detach
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_put_var, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, shm_identifier)
+ ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
+ ZEND_ARG_INFO(0, variable)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_get_var, 0, 0, 2)
+ ZEND_ARG_INFO(0, id)
+ ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_shm_remove_var arginfo_shm_has_var
diff --git a/ext/sysvshm/tests/001.phpt b/ext/sysvshm/tests/001.phpt
index 55fd8eec1d..55d5444b98 100644
--- a/ext/sysvshm/tests/001.phpt
+++ b/ext/sysvshm/tests/001.phpt
@@ -8,10 +8,6 @@ if (!function_exists('ftok')){ print 'skip'; }
--FILE--
<?php
-var_dump(ftok());
-var_dump(ftok(1));
-var_dump(ftok(1,1,1));
-
var_dump(ftok("",""));
var_dump(ftok(-1, -1));
var_dump(ftok("qwertyu","qwertyu"));
@@ -23,15 +19,6 @@ var_dump(ftok(__FILE__,"q"));
echo "Done\n";
?>
--EXPECTF--
-Warning: ftok() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ftok() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ftok() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: ftok(): Pathname is invalid in %s on line %d
int(-1)
diff --git a/ext/sysvshm/tests/002.phpt b/ext/sysvshm/tests/002.phpt
index 3bfb28e5c6..d558623242 100644
--- a/ext/sysvshm/tests/002.phpt
+++ b/ext/sysvshm/tests/002.phpt
@@ -10,19 +10,14 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__FILE__, 't');
-var_dump(shm_attach());
-var_dump(shm_attach(1,2,3,4));
-
var_dump(shm_attach(-1, 0));
var_dump(shm_attach(0, -1));
var_dump(shm_attach(123, -1));
-var_dump($s = shm_attach($key, -1));
-shm_remove($s);
-var_dump($s = shm_attach($key, 0));
-shm_remove($s);
+var_dump(shm_attach($key, -1));
+var_dump(shm_attach($key, 0));
var_dump($s = shm_attach($key, 1024));
-shm_remove($key);
+shm_remove($s);
var_dump($s = shm_attach($key, 1024));
shm_remove($s);
var_dump($s = shm_attach($key, 1024, 0666));
@@ -36,12 +31,6 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_attach() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: shm_attach() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
bool(false)
@@ -54,15 +43,9 @@ bool(false)
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
bool(false)
-Warning: shm_remove() expects parameter 1 to be resource, bool given in %s on line %d
-
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
bool(false)
-
-Warning: shm_remove() expects parameter 1 to be resource, bool given in %s on line %d
resource(%d) of type (sysvshm)
-
-Warning: shm_remove() expects parameter 1 to be resource, int given in %s on line %d
resource(%d) of type (sysvshm)
resource(%d) of type (sysvshm)
resource(%d) of type (sysvshm)
diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt
index e141353dec..a7fe128aa5 100644
--- a/ext/sysvshm/tests/003.phpt
+++ b/ext/sysvshm/tests/003.phpt
@@ -10,18 +10,19 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__DIR__."/003.phpt", 'q');
-var_dump(shm_detach());
-var_dump(shm_detach(1,1));
-
$s = shm_attach($key);
var_dump(shm_detach($s));
-var_dump(shm_detach($s));
-shm_remove($s);
-
-var_dump(shm_detach(0));
-var_dump(shm_detach(1));
-var_dump(shm_detach(-1));
+try {
+ var_dump(shm_detach($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ shm_remove($s);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -33,25 +34,8 @@ $s = shm_attach($key);
shm_remove($s);
?>
---EXPECTF--
-Warning: shm_detach() expects exactly 1 parameter, 0 given in %s003.php on line %d
-NULL
-
-Warning: shm_detach() expects exactly 1 parameter, 2 given in %s003.php on line %d
-NULL
+--EXPECT--
bool(true)
-
-Warning: shm_detach(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
-bool(false)
-
-Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
-
-Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
-NULL
-
-Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
-NULL
-
-Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
-NULL
+shm_detach(): supplied resource is not a valid sysvshm resource
+shm_remove(): supplied resource is not a valid sysvshm resource
Done
diff --git a/ext/sysvshm/tests/004.phpt b/ext/sysvshm/tests/004.phpt
index ee64491840..23496f5c1c 100644
--- a/ext/sysvshm/tests/004.phpt
+++ b/ext/sysvshm/tests/004.phpt
@@ -11,9 +11,6 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__FILE__, 't');
$s = shm_attach($key, 1024);
-var_dump(shm_put_var());
-var_dump(shm_put_var(-1, -1, -1));
-var_dump(shm_put_var(-1, 10, "qwerty"));
var_dump(shm_put_var($s, -1, "qwerty"));
var_dump(shm_put_var($s, 10, "qwerty"));
var_dump(shm_put_var($s, 10, "qwerty"));
@@ -26,18 +23,10 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_put_var() expects exactly 3 parameters, 0 given in %s004.php on line %d
-NULL
-
-Warning: shm_put_var() expects parameter 1 to be resource, int given in %s004.php on line %d
-NULL
-
-Warning: shm_put_var() expects parameter 1 to be resource, int given in %s004.php on line %d
-NULL
bool(true)
bool(true)
bool(true)
-Warning: shm_put_var(): not enough shared memory left in %s004.php on line 14
+Warning: shm_put_var(): not enough shared memory left in %s004.php on line %d
bool(false)
Done
diff --git a/ext/sysvshm/tests/005.phpt b/ext/sysvshm/tests/005.phpt
index 0a3d3422e8..879be31c13 100644
--- a/ext/sysvshm/tests/005.phpt
+++ b/ext/sysvshm/tests/005.phpt
@@ -17,14 +17,9 @@ shm_put_var($s, 1, array(1,2,3));
shm_put_var($s, 2, false);
shm_put_var($s, 3, null);
-var_dump(shm_get_var());
-
-var_dump(shm_get_var(-1, -1));
-
var_dump(shm_get_var($s, 1000));
var_dump(shm_get_var($s, -10000));
-var_dump(shm_get_var($s, array()));
var_dump(shm_get_var($s, -1));
var_dump(shm_get_var($s, 0));
var_dump(shm_get_var($s, 1));
@@ -41,20 +36,11 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_get_var() expects exactly 2 parameters, 0 given in %s005.php on line %d
-NULL
-
-Warning: shm_get_var() expects parameter 1 to be resource, int given in %s005.php on line %d
-NULL
-
Warning: shm_get_var(): variable key 1000 doesn't exist in %s005.php on line %d
bool(false)
Warning: shm_get_var(): variable key -10000 doesn't exist in %s005.php on line %d
bool(false)
-
-Warning: shm_get_var() expects parameter 2 to be int, array given in %s005.php on line %d
-NULL
string(11) "test string"
object(stdClass)#%d (0) {
}
diff --git a/ext/sysvshm/tests/006.phpt b/ext/sysvshm/tests/006.phpt
index b38aee02a1..278838f063 100644
--- a/ext/sysvshm/tests/006.phpt
+++ b/ext/sysvshm/tests/006.phpt
@@ -13,8 +13,6 @@ $s = shm_attach($key, 1024);
shm_put_var($s, 1, "test string");
-var_dump(shm_remove_var());
-var_dump(shm_remove_var(-1, -1));
var_dump(shm_remove_var($s, -10));
var_dump(shm_get_var($s, 1));
@@ -29,12 +27,6 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_remove_var() expects exactly 2 parameters, 0 given in %s006.php on line %d
-NULL
-
-Warning: shm_remove_var() expects parameter 1 to be resource, int given in %s006.php on line %d
-NULL
-
Warning: shm_remove_var(): variable key -10 doesn't exist in %s006.php on line %d
bool(false)
string(11) "test string"
diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt
index a165a8bfbf..730e9a3fbd 100644
--- a/ext/sysvshm/tests/007.phpt
+++ b/ext/sysvshm/tests/007.phpt
@@ -11,32 +11,18 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__FILE__, 't');
$s = shm_attach($key, 1024);
-var_dump(shm_remove());
-var_dump(shm_remove(-1));
-var_dump(shm_remove(0));
-var_dump(shm_remove(""));
-
var_dump(shm_remove($s));
shm_detach($s);
-var_dump(shm_remove($s));
+try {
+ var_dump(shm_remove($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: shm_remove() expects exactly 1 parameter, 0 given in %s007.php on line %d
-NULL
-
-Warning: shm_remove() expects parameter 1 to be resource, int given in %s007.php on line %d
-NULL
-
-Warning: shm_remove() expects parameter 1 to be resource, int given in %s007.php on line %d
-NULL
-
-Warning: shm_remove() expects parameter 1 to be resource, string given in %s007.php on line %d
-NULL
+--EXPECT--
bool(true)
-
-Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s007.php on line %d
-bool(false)
+shm_remove(): supplied resource is not a valid sysvshm resource
Done
diff --git a/ext/tidy/php_tidy.h b/ext/tidy/php_tidy.h
index 3be6bf4388..3318497c98 100644
--- a/ext/tidy/php_tidy.h
+++ b/ext/tidy/php_tidy.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/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt
index 188b8cd4e9..425b42889d 100644
--- a/ext/tidy/tests/019.phpt
+++ b/ext/tidy/tests/019.phpt
@@ -7,17 +7,14 @@ tidy_repair_*() and invalid parameters
$l = 1;
$s = "";
-$a = array();
-tidy_repair_string($s, $l, $l, $l);
-tidy_repair_string($s, $s, $s, $s);
-tidy_repair_string($l, $l, $l ,$l);
-tidy_repair_string($a, $a, $a, $a);
+tidy_repair_string($s, $l, $l);
+tidy_repair_string($s, $s, $s);
+tidy_repair_string($l, $l, $l);
tidy_repair_file($s, $l, $l, $l);
tidy_repair_file($s, $s, $s, $s);
tidy_repair_file($l, $l, $l ,$l);
-tidy_repair_file($a, $a, $a, $a);
echo "Done\n";
?>
@@ -32,11 +29,7 @@ Warning: tidy_repair_string(): Could not load configuration file '1' in %s on li
Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d
-Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d
-
Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d
Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d
-
-Warning: tidy_repair_file() expects parameter 1 to be a valid path, array given in %s on line %d
Done
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 295ca8d8f0..a519cd39cc 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.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, |
@@ -40,6 +38,8 @@
#include "buffio.h"
#endif
+#include "tidy_arginfo.h"
+
/* compatibility with older versions of libtidy */
#ifndef TIDY_CALL
#define TIDY_CALL
@@ -54,15 +54,9 @@
#define TIDY_FETCH_OBJECT \
PHPTidyObj *obj; \
- TIDY_SET_CONTEXT; \
- if (object) { \
- if (zend_parse_parameters_none() == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "O", &object, tidy_ce_doc) == FAILURE) { \
- RETURN_FALSE; \
- } \
+ zval *object; \
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, tidy_ce_doc) == FAILURE) { \
+ return; \
} \
obj = Z_TIDY_P(object); \
@@ -215,8 +209,8 @@ static void tidy_object_free_storage(zend_object *);
static zend_object *tidy_object_new_node(zend_class_entry *);
static zend_object *tidy_object_new_doc(zend_class_entry *);
static zval * tidy_instanciate(zend_class_entry *, zval *);
-static int tidy_doc_cast_handler(zval *, zval *, int);
-static int tidy_node_cast_handler(zval *, zval *, int);
+static int tidy_doc_cast_handler(zend_object *, zval *, int);
+static int tidy_node_cast_handler(zend_object *, zval *, int);
static void tidy_doc_update_properties(PHPTidyObj *);
static void tidy_add_default_properties(PHPTidyObj *, tidy_obj_type);
static void *php_tidy_get_opt_val(PHPTidyDoc *, TidyOption, TidyOptionType *);
@@ -286,132 +280,6 @@ STD_PHP_INI_ENTRY("tidy.default_config", "", PHP_INI_SYSTEM, OnUpdateString,
STD_PHP_INI_ENTRY("tidy.clean_output", "0", PHP_INI_USER, php_tidy_set_clean_output, clean_output, zend_tidy_globals, tidy_globals)
PHP_INI_END()
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_parse_string, 0, 0, 1)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, config_options)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_error_buffer, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_output, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_parse_file, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, config_options)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_clean_repair, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_repair_string, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, config_file)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_repair_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, config_file)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_diagnose, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_tidy_get_release, 0)
-ZEND_END_ARG_INFO()
-
-#if HAVE_TIDYOPTGETDOC
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_opt_doc, 0, 0, 2)
- ZEND_ARG_INFO(0, resource)
- ZEND_ARG_INFO(0, optname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_opt_doc_method, 0, 0, 1)
- ZEND_ARG_INFO(0, optname)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_config, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_status, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_html_ver, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_is_xhtml, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_is_xml, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_error_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_warning_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_access_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_config_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt_method, 0, 0, 1)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_root, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_html, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_head, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_body, 0, 0, 1)
- ZEND_ARG_INFO(0, tidy)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_construct, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, config_file)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry tidy_functions[] = {
PHP_FE(tidy_getopt, arginfo_tidy_getopt)
PHP_FE(tidy_parse_string, arginfo_tidy_parse_string)
@@ -443,41 +311,41 @@ static const zend_function_entry tidy_functions[] = {
};
static const zend_function_entry tidy_funcs_doc[] = {
- TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_tidy_getopt_method)
- TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, NULL)
- TIDY_DOC_ME(parseFile, arginfo_tidy_parse_file)
- TIDY_DOC_ME(parseString, arginfo_tidy_parse_string)
- TIDY_METHOD_MAP(repairString, tidy_repair_string, arginfo_tidy_repair_string)
- TIDY_METHOD_MAP(repairFile, tidy_repair_file, arginfo_tidy_repair_file)
- TIDY_METHOD_MAP(diagnose, tidy_diagnose, NULL)
- TIDY_METHOD_MAP(getRelease, tidy_get_release, NULL)
- TIDY_METHOD_MAP(getConfig, tidy_get_config, NULL)
- TIDY_METHOD_MAP(getStatus, tidy_get_status, NULL)
- TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, NULL)
+ TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_class_tidy_getOpt)
+ TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, arginfo_class_tidy_cleanRepair)
+ TIDY_DOC_ME(parseFile, arginfo_class_tidy_parseFile)
+ TIDY_DOC_ME(parseString, arginfo_class_tidy_parseString)
+ TIDY_METHOD_MAP(repairString, tidy_repair_string, arginfo_class_tidy_repairString)
+ TIDY_METHOD_MAP(repairFile, tidy_repair_file, arginfo_class_tidy_repairFile)
+ TIDY_METHOD_MAP(diagnose, tidy_diagnose, arginfo_class_tidy_diagnose)
+ TIDY_METHOD_MAP(getRelease, tidy_get_release, arginfo_class_tidy_getRelease)
+ TIDY_METHOD_MAP(getConfig, tidy_get_config, arginfo_class_tidy_getConfig)
+ TIDY_METHOD_MAP(getStatus, tidy_get_status, arginfo_class_tidy_getStatus)
+ TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, arginfo_class_tidy_getHtmlVer)
#if HAVE_TIDYOPTGETDOC
- TIDY_METHOD_MAP(getOptDoc, tidy_get_opt_doc, arginfo_tidy_get_opt_doc_method)
+ TIDY_METHOD_MAP(getOptDoc, tidy_get_opt_doc, arginfo_class_tidy_getOptDoc)
#endif
- TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, NULL)
- TIDY_METHOD_MAP(isXml, tidy_is_xml, NULL)
- TIDY_METHOD_MAP(root, tidy_get_root, NULL)
- TIDY_METHOD_MAP(head, tidy_get_head, NULL)
- TIDY_METHOD_MAP(html, tidy_get_html, NULL)
- TIDY_METHOD_MAP(body, tidy_get_body, NULL)
- TIDY_DOC_ME(__construct, arginfo_tidy_construct)
+ TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, arginfo_class_tidy_isXhtml)
+ TIDY_METHOD_MAP(isXml, tidy_is_xml, arginfo_class_tidy_isXml)
+ TIDY_METHOD_MAP(root, tidy_get_root, arginfo_class_tidy_root)
+ TIDY_METHOD_MAP(head, tidy_get_head, arginfo_class_tidy_head)
+ TIDY_METHOD_MAP(html, tidy_get_html, arginfo_class_tidy_html)
+ TIDY_METHOD_MAP(body, tidy_get_body, arginfo_class_tidy_body)
+ TIDY_DOC_ME(__construct, arginfo_class_tidy___construct)
PHP_FE_END
};
static const zend_function_entry tidy_funcs_node[] = {
- TIDY_NODE_ME(hasChildren, NULL)
- TIDY_NODE_ME(hasSiblings, NULL)
- TIDY_NODE_ME(isComment, NULL)
- TIDY_NODE_ME(isHtml, NULL)
- TIDY_NODE_ME(isText, NULL)
- TIDY_NODE_ME(isJste, NULL)
- TIDY_NODE_ME(isAsp, NULL)
- TIDY_NODE_ME(isPhp, NULL)
- TIDY_NODE_ME(getParent, NULL)
- TIDY_NODE_PRIVATE_ME(__construct, NULL)
+ TIDY_NODE_ME(hasChildren, arginfo_class_tidyNode_hasChildren)
+ TIDY_NODE_ME(hasSiblings, arginfo_class_tidyNode_hasSiblings)
+ TIDY_NODE_ME(isComment, arginfo_class_tidyNode_isComment)
+ TIDY_NODE_ME(isHtml, arginfo_class_tidyNode_isHtml)
+ TIDY_NODE_ME(isText, arginfo_class_tidyNode_isText)
+ TIDY_NODE_ME(isJste, arginfo_class_tidyNode_isJste)
+ TIDY_NODE_ME(isAsp, arginfo_class_tidyNode_isAsp)
+ TIDY_NODE_ME(isPhp, arginfo_class_tidyNode_isPhp)
+ TIDY_NODE_ME(getParent, arginfo_class_tidyNode_getParent)
+ TIDY_NODE_PRIVATE_ME(__construct, arginfo_class_tidyNode___construct)
PHP_FE_END
};
@@ -582,22 +450,23 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
{
char *enc = NULL;
size_t enc_len = 0;
- zend_bool use_include_path = 0;
TidyDoc doc;
TidyBuffer *errbuf;
zend_string *data, *arg1;
zval *config = NULL;
if (is_file) {
+ zend_bool use_include_path = 0;
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &arg1, &config, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (!(data = php_tidy_file_to_mem(ZSTR_VAL(arg1), use_include_path))) {
RETURN_FALSE;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zsb", &arg1, &config, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zs", &arg1, &config, &enc, &enc_len) == FAILURE) {
+ return;
}
data = arg1;
}
@@ -760,7 +629,7 @@ static zval * tidy_instanciate(zend_class_entry *pce, zval *object)
return object;
}
-static int tidy_doc_cast_handler(zval *in, zval *out, int type)
+static int tidy_doc_cast_handler(zend_object *in, zval *out, int type)
{
TidyBuffer output;
PHPTidyObj *obj;
@@ -780,7 +649,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type)
break;
case IS_STRING:
- obj = Z_TIDY_P(in);
+ obj = php_tidy_fetch_object(in);
tidyBufInit(&output);
tidySaveBuffer (obj->ptdoc->doc, &output);
if (output.size) {
@@ -798,7 +667,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type)
return SUCCESS;
}
-static int tidy_node_cast_handler(zval *in, zval *out, int type)
+static int tidy_node_cast_handler(zend_object *in, zval *out, int type)
{
TidyBuffer buf;
PHPTidyObj *obj;
@@ -818,7 +687,7 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type)
break;
case IS_STRING:
- obj = Z_TIDY_P(in);
+ obj = php_tidy_fetch_object(in);
tidyBufInit(&buf);
if (obj->ptdoc) {
tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
@@ -1239,7 +1108,7 @@ static PHP_FUNCTION(tidy_parse_string)
PHPTidyObj *obj;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zs", &input, &options, &enc, &enc_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(input))) {
@@ -1302,7 +1171,7 @@ static PHP_FUNCTION(tidy_parse_file)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &inputfile,
&options, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ return;
}
tidy_instanciate(tidy_ce_doc, return_value);
@@ -1401,17 +1270,10 @@ static PHP_FUNCTION(tidy_get_opt_doc)
char *optval, *optname;
size_t optname_len;
TidyOption opt;
+ zval *object;
- TIDY_SET_CONTEXT;
-
- if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
- } else {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
+ return;
}
obj = Z_TIDY_P(object);
@@ -1562,17 +1424,10 @@ static PHP_FUNCTION(tidy_getopt)
size_t optname_len;
TidyOption opt;
TidyOptionType optt;
+ zval *object;
- TIDY_SET_CONTEXT;
-
- if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
- } else {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
+ return;
}
obj = Z_TIDY_P(object);
@@ -1624,7 +1479,7 @@ static TIDY_DOC_METHOD(__construct)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|Pzsb", &inputfile,
&options, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ return;
}
obj = Z_TIDY_P(object);
@@ -1663,7 +1518,7 @@ static TIDY_DOC_METHOD(parseFile)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &inputfile,
&options, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (!(contents = php_tidy_file_to_mem(ZSTR_VAL(inputfile), use_include_path))) {
@@ -1698,7 +1553,7 @@ static TIDY_DOC_METHOD(parseString)
TIDY_SET_CONTEXT;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zs", &input, &options, &enc, &enc_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(input))) {
diff --git a/ext/tidy/tidy.stub.php b/ext/tidy/tidy.stub.php
new file mode 100644
index 0000000000..b2d36f96c4
--- /dev/null
+++ b/ext/tidy/tidy.stub.php
@@ -0,0 +1,143 @@
+<?php
+
+/**
+ * @param array|string $config_options
+ * @return tidy|false
+ */
+function tidy_parse_string(string $input, $config_options = UNKNOWN, string $encoding = UNKNOWN) {}
+
+/** @return string|false */
+function tidy_get_error_buffer(tidy $object) {}
+
+function tidy_get_output(tidy $object): string {}
+
+/**
+ * @param array|string $config_options
+ * @return tidy|false
+ */
+function tidy_parse_file(string $file, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false) {}
+
+function tidy_clean_repair(tidy $object): bool {}
+
+/**
+ * @param array|string $config_options
+ * @return string|false
+ */
+function tidy_repair_string(string $data, $config_file = UNKNOWN, string $encoding = UNKNOWN) {}
+
+/**
+ * @param array|string $config_options
+ * @return string|false
+ */
+function tidy_repair_file(string $filename, $config_file = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false) {}
+
+function tidy_diagnose(tidy $object): bool {}
+
+function tidy_get_release(): string {}
+
+#if HAVE_TIDYOPTGETDOC
+/** @return string|false */
+function tidy_get_opt_doc(tidy $object, string $optname) {}
+#endif
+
+function tidy_get_config(tidy $object): array {}
+
+function tidy_get_status(tidy $object): int {}
+
+function tidy_get_html_ver(tidy $object): int {}
+
+function tidy_is_xhtml(tidy $object): bool {}
+
+function tidy_is_xml(tidy $object): bool {}
+
+function tidy_error_count(tidy $object): int {}
+
+function tidy_warning_count(tidy $object): int {}
+
+function tidy_access_count(tidy $object): int {}
+
+function tidy_config_count(tidy $object): int {}
+
+/** @return string|int|bool */
+function tidy_getopt(tidy $object, string $option) {}
+
+function tidy_get_root(tidy $object): ?tidyNode {}
+
+function tidy_get_html(tidy $object): ?tidyNode {}
+
+function tidy_get_head(tidy $object): ?tidyNode {}
+
+function tidy_get_body(tidy $tidy): ?tidyNode {}
+
+class tidy
+{
+ /** @param array|string $config_options */
+ public function __construct(string $filename = UNKNOWN, $config_file = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false) {}
+
+ /** @return string|int|bool */
+ public function getOpt(string $option) {}
+
+ public function cleanRepair(): bool {}
+
+ /** @param array|string $config_options */
+ public function parseFile(string $file, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false): bool {}
+
+ /** @param array|string $config_options */
+ public function parseString(string $input, $config_optinons = UNKNOWN, string $encoding = UNKNOWN): bool {}
+
+ /** @param array|string $config_options */
+ public function repairString(string $data, $config_file = UNKNOWN, string $encoding = UNKNOWN): bool {}
+
+ /** @param array|string $config_options */
+ public function repairFile(string $filename, $config_file = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false): bool {}
+
+ public function diagnose(): bool {}
+
+ public function getRelease(): string {}
+
+ public function getConfig(): array {}
+
+ public function getStatus(): int {}
+
+ public function getHtmlVer(): int {}
+
+#if HAVE_TIDYOPTGETDOC
+ /** @return string|false */
+ public function getOptDoc(string $optname) {}
+#endif
+
+ public function isXhtml(): bool {}
+
+ public function isXml(): bool {}
+
+ public function root(): ?tidyNode {}
+
+ public function head(): ?tidyNode {}
+
+ public function html(): ?tidyNode {}
+
+ public function body(): ?tidyNode {}
+}
+
+class tidyNode
+{
+ private function __construct() {}
+
+ public function hasChildren(): bool {}
+
+ public function hasSiblings(): bool {}
+
+ public function isComment(): bool {}
+
+ public function isHtml(): bool {}
+
+ public function isText(): bool {}
+
+ public function isJste(): bool {}
+
+ public function isAsp(): bool {}
+
+ public function isPhp(): bool {}
+
+ public function getParent(): ?tidyNode {}
+}
diff --git a/ext/tidy/tidy_arginfo.h b/ext/tidy/tidy_arginfo.h
new file mode 100644
index 0000000000..2b0335e970
--- /dev/null
+++ b/ext/tidy/tidy_arginfo.h
@@ -0,0 +1,182 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_parse_string, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_error_buffer, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_output, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_parse_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_clean_repair, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_repair_string, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_file)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_repair_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_file)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_tidy_diagnose arginfo_tidy_clean_repair
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_release, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_TIDYOPTGETDOC
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_opt_doc, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_config, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_status, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_tidy_get_html_ver arginfo_tidy_get_status
+
+#define arginfo_tidy_is_xhtml arginfo_tidy_clean_repair
+
+#define arginfo_tidy_is_xml arginfo_tidy_clean_repair
+
+#define arginfo_tidy_error_count arginfo_tidy_get_status
+
+#define arginfo_tidy_warning_count arginfo_tidy_get_status
+
+#define arginfo_tidy_access_count arginfo_tidy_get_status
+
+#define arginfo_tidy_config_count arginfo_tidy_get_status
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_tidy_get_root, 0, 1, tidyNode, 1)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_tidy_get_html arginfo_tidy_get_root
+
+#define arginfo_tidy_get_head arginfo_tidy_get_root
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_tidy_get_body, 0, 1, tidyNode, 1)
+ ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_file)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOpt, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_cleanRepair, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_parseFile, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_parseString, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_optinons)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_repairString, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_file)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_repairFile, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_file)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidy_diagnose arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidy_getRelease arginfo_tidy_get_release
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_getConfig, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_getStatus, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidy_getHtmlVer arginfo_class_tidy_getStatus
+
+#if HAVE_TIDYOPTGETDOC
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOptDoc, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_class_tidy_isXhtml arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidy_isXml arginfo_class_tidy_cleanRepair
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_tidy_root, 0, 0, tidyNode, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidy_head arginfo_class_tidy_root
+
+#define arginfo_class_tidy_html arginfo_class_tidy_root
+
+#define arginfo_class_tidy_body arginfo_class_tidy_root
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidyNode___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidyNode_hasChildren arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_hasSiblings arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isComment arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isHtml arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isText arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isJste arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isAsp arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isPhp arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_getParent arginfo_class_tidy_root
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
index f6b431d038..32a6203276 100644
--- a/ext/tokenizer/php_tokenizer.h
+++ b/ext/tokenizer/php_tokenizer.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/ext/tokenizer/tests/001.phpt b/ext/tokenizer/tests/001.phpt
index 4c6295cdf8..8e58c81891 100644
--- a/ext/tokenizer/tests/001.phpt
+++ b/ext/tokenizer/tests/001.phpt
@@ -126,8 +126,6 @@ echo token_name(T_HALT_COMPILER), "\n";
echo token_name(-1), "\n";
echo token_name(0x8000000F), "\n";
-echo token_name("string"), "\n";
-echo token_name(array()), "\n";
echo "Done\n";
?>
@@ -251,10 +249,4 @@ T_CLONE
T_HALT_COMPILER
UNKNOWN
UNKNOWN
-
-Warning: token_name() expects parameter 1 to be int, string given in %s on line %d
-
-
-Warning: token_name() expects parameter 1 to be int, array given in %s on line %d
-
Done
diff --git a/ext/tokenizer/tests/003.phpt b/ext/tokenizer/tests/003.phpt
index 3ba6d594df..6c3cc4c559 100644
--- a/ext/tokenizer/tests/003.phpt
+++ b/ext/tokenizer/tests/003.phpt
@@ -5,8 +5,6 @@ token_get_all() and wrong parameters
--FILE--
<?php
-var_dump(token_get_all(array()));
-var_dump(token_get_all(new stdClass));
var_dump(token_get_all(""));
var_dump(token_get_all(0));
var_dump(token_get_all(-1));
@@ -14,11 +12,6 @@ var_dump(token_get_all(-1));
echo "Done\n";
?>
--EXPECTF--
-Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: token_get_all() expects parameter 1 to be string, object given in %s on line %d
-NULL
array(0) {
}
array(1) {
diff --git a/ext/tokenizer/tests/bad_character.phpt b/ext/tokenizer/tests/bad_character.phpt
index 87f0179004..5456530ca3 100644
--- a/ext/tokenizer/tests/bad_character.phpt
+++ b/ext/tokenizer/tests/bad_character.phpt
@@ -19,27 +19,21 @@ foreach ($codes as $code) {
echo $token, "\n";
}
}
+ echo "\n";
}
?>
---EXPECTF--
-Warning: Unexpected character in input: ' in %s on line %d
+--EXPECT--
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_WHITESPACE 1
T_STRING 3
-Warning: Unexpected character in input: '%s' (ASCII=1) state=0 in %s on line %d
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_WHITESPACE 1
T_STRING 3
-Warning: Unexpected character in input: '%s' (ASCII=1) state=0 in %s on line %d
-
-Warning: Unexpected character in input: '%s' (ASCII=2) state=0 in %s on line %d
-
-Warning: Unexpected character in input: '%s' (ASCII=3) state=0 in %s on line %d
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_BAD_CHARACTER 1
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index 3d343fec4d..cf5be94226 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.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, |
@@ -24,6 +22,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_tokenizer.h"
+#include "tokenizer_arginfo.h"
#include "zend.h"
#include "zend_exceptions.h"
@@ -42,17 +41,6 @@ void tokenizer_token_get_all_register_constants(INIT_FUNC_ARGS) {
REGISTER_LONG_CONSTANT("TOKEN_PARSE", TOKEN_PARSE, CONST_CS|CONST_PERSISTENT);
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_token_get_all, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_token_name, 0, 0, 1)
- ZEND_ARG_INFO(0, token)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ tokenizer_functions[]
*
* Every user visible function must have an entry in tokenizer_functions[].
diff --git a/ext/tokenizer/tokenizer.stub.php b/ext/tokenizer/tokenizer.stub.php
new file mode 100644
index 0000000000..8abcd37811
--- /dev/null
+++ b/ext/tokenizer/tokenizer.stub.php
@@ -0,0 +1,6 @@
+<?php
+
+/** @return array|false */
+function token_get_all(string $source, int $flags = 0) {}
+
+function token_name(int $token): string {}
diff --git a/ext/tokenizer/tokenizer_arginfo.h b/ext/tokenizer/tokenizer_arginfo.h
new file mode 100644
index 0000000000..f1b601358e
--- /dev/null
+++ b/ext/tokenizer/tokenizer_arginfo.h
@@ -0,0 +1,10 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_token_get_all, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_name, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, token, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c
index cc3a1f939f..414202ff3b 100644
--- a/ext/tokenizer/tokenizer_data.c
+++ b/ext/tokenizer/tokenizer_data.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/ext/tokenizer/tokenizer_data_gen.sh b/ext/tokenizer/tokenizer_data_gen.sh
index 979ecb983c..4d5e97ddde 100755
--- a/ext/tokenizer/tokenizer_data_gen.sh
+++ b/ext/tokenizer/tokenizer_data_gen.sh
@@ -18,8 +18,6 @@ fi
echo '/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index be988a822f..aaef302ef2 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.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/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index 350d42f0c6..e5673be779 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.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/ext/xml/php_xml.h b/ext/xml/php_xml.h
index f8bb415f32..56d983b451 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.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/ext/xml/tests/bug72793.phpt b/ext/xml/tests/bug72793.phpt
new file mode 100644
index 0000000000..edbbaed884
--- /dev/null
+++ b/ext/xml/tests/bug72793.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #72793: xml_parser_free leaks mem when execute xml_set_object
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+class xml {
+ var $parser;
+
+ function __construct()
+ {
+ $this->parser = xml_parser_create();
+ xml_set_object($this->parser, $this);
+ }
+
+ function parse($data)
+ {
+ xml_parse($this->parser, $data);
+ }
+
+ function free(){
+ xml_parser_free($this->parser);
+ }
+}
+
+$xml_test = '<?xml version="1.0" encoding="utf-8"?><test></test>';
+$xml_parser = new xml();
+$xml_parser->parse($xml_test);
+$xml_parser->free();
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/xml/tests/bug76874.phpt b/ext/xml/tests/bug76874.phpt
new file mode 100644
index 0000000000..c4377f0b88
--- /dev/null
+++ b/ext/xml/tests/bug76874.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #76874: xml_parser_free() should never leak memory
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+class c
+{
+ private $xml;
+ private $test;
+
+ public function test()
+ {
+ $this->xml = xml_parser_create();
+ xml_set_character_data_handler($this->xml, array(&$this, 'handle_cdata'));
+ xml_parser_free($this->xml);
+ }
+
+ public function handle_cdata(&$parser, $data)
+ {
+ }
+}
+
+$object = new c();
+$object->test();
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/xml/tests/bug78563.phpt b/ext/xml/tests/bug78563.phpt
new file mode 100644
index 0000000000..3203bbddc6
--- /dev/null
+++ b/ext/xml/tests/bug78563.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #78563: parsers should not be clonable
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+$parser = xml_parser_create();
+clone $parser;
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Uncaught Error: Trying to clone an uncloneable object of class XmlParser in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/xml/tests/bug78563_final.phpt b/ext/xml/tests/bug78563_final.phpt
new file mode 100644
index 0000000000..23fac0d9bf
--- /dev/null
+++ b/ext/xml/tests/bug78563_final.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #78563: parsers should not be extendable
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+class Dummy extends Xmlparser {
+
+}
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Class Dummy may not inherit from final class (XmlParser) in %s on line %d
diff --git a/ext/xml/tests/bug78563_serialize.phpt b/ext/xml/tests/bug78563_serialize.phpt
new file mode 100644
index 0000000000..d480446d24
--- /dev/null
+++ b/ext/xml/tests/bug78563_serialize.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #78563: parsers should not be serializable
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+$parser = xml_parser_create();
+serialize($parser);
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Uncaught Exception: Serialization of 'XmlParser' is not allowed in %s:%d
+Stack trace:
+#0 %s(%d): serialize(Object(XmlParser))
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/xml/tests/xml_parser_set_option_variation3.phpt b/ext/xml/tests/xml_parser_set_option_variation3.phpt
index 836ee7a469..4187ddf068 100644
--- a/ext/xml/tests/xml_parser_set_option_variation3.phpt
+++ b/ext/xml/tests/xml_parser_set_option_variation3.phpt
@@ -15,7 +15,6 @@ if (!extension_loaded("xml")) {
*/
echo "*** Testing xml_parser_set_option() : usage variations ***\n";
-error_reporting(E_ALL & ~E_NOTICE);
class aClass {
function __toString() {
@@ -79,12 +78,6 @@ $values = array(
// resource data
$fp,
-
- // undefined data
- $undefined_var,
-
- // unset data
- $unset_var,
);
// loop through each element of the array for value
@@ -174,14 +167,10 @@ Arg value string
bool(true)
Arg value Some Ascii Data
-bool(true)
-Arg value Resource id %s
+Notice: Object of class aClass could not be converted to int in %s on line %d
bool(true)
-Arg value
-bool(true)
-
-Arg value
+Arg value Resource id %s
bool(true)
Done
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index fb60883226..a033accfdb 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.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, |
@@ -28,6 +26,7 @@
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "ext/standard/html.h"
+#include "zend_interfaces.h"
#if HAVE_XML
@@ -37,6 +36,8 @@
#include "ext/libxml/php_libxml.h"
#endif
+#include "xml_arginfo.h"
+
/* Short-term TODO list:
* - Implement XML_ExternalEntityParserCreate()
* - XML_SetCommentHandler
@@ -66,7 +67,15 @@ typedef struct {
XML_Parser parser;
XML_Char *target_encoding;
+ /* Reference to the object itself, for convenience.
+ * It is not owned, do not release it. */
zval index;
+
+ /* We return a pointer to these zvals in get_gc(), so it's
+ * important that a) they are adjacent b) object is the first
+ * and c) the number of zvals is kept up to date. */
+#define XML_PARSER_NUM_ZVALS 12
+ zval object;
zval startElementHandler;
zval endElementHandler;
zval characterDataHandler;
@@ -91,8 +100,6 @@ typedef struct {
zend_function *startNamespaceDeclPtr;
zend_function *endNamespaceDeclPtr;
- zval object;
-
zval data;
zval info;
int level;
@@ -105,6 +112,8 @@ typedef struct {
int isparsing;
XML_Char *baseURI;
+
+ zend_object std;
} xml_parser;
@@ -135,6 +144,8 @@ ZEND_GET_MODULE(xml)
#define SKIP_TAGSTART(str) ((str) + (parser->toffset > (int)strlen(str) ? strlen(str) : parser->toffset))
+static zend_class_entry *xml_parser_ce;
+static zend_object_handlers xml_parser_object_handlers;
/* {{{ function prototypes */
PHP_MINIT_FUNCTION(xml);
@@ -164,8 +175,12 @@ PHP_FUNCTION(xml_parser_set_option);
PHP_FUNCTION(xml_parser_get_option);
PHP_FUNCTION(xml_parse_into_struct);
+static zend_object *xml_parser_create_object(zend_class_entry *class_type);
+static void xml_parser_free_obj(zend_object *object);
+static HashTable *xml_parser_get_gc(zend_object *object, zval **table, int *n);
+static zend_function *xml_parser_get_constructor(zend_object *object);
+
static zend_string *xml_utf8_decode(const XML_Char *, size_t, const XML_Char *);
-static void xml_parser_dtor(zend_resource *rsrc);
static void xml_set_handler(zval *, zval *);
inline static unsigned short xml_encode_iso_8859_1(unsigned char);
inline static char xml_decode_iso_8859_1(unsigned short);
@@ -191,114 +206,6 @@ void _xml_endNamespaceDeclHandler(void *, const XML_Char *);
/* }}} */
/* {{{ extension definition structures */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, sep)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_object, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_element_handler, 0, 0, 3)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, shdl)
- ZEND_ARG_INFO(0, ehdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_character_data_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_processing_instruction_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_default_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_unparsed_entity_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_notation_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_external_entity_ref_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_start_namespace_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_end_namespace_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parse, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, isfinal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parse_into_struct, 0, 0, 3)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, values)
- ZEND_ARG_INFO(1, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_error_code, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_error_string, 0, 0, 1)
- ZEND_ARG_INFO(0, code)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_line_number, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_column_number, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_byte_index, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_free, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_set_option, 0, 0, 3)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_get_option, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry xml_functions[] = {
PHP_FE(xml_parser_create, arginfo_xml_parser_create)
PHP_FE(xml_parser_create_ns, arginfo_xml_parser_create_ns)
@@ -366,9 +273,6 @@ const xml_encoding xml_encodings[] = {
static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
-/* True globals, no need for thread safety */
-static int le_xml_parser;
-
/* }}} */
/* {{{ startup, shutdown and info functions */
@@ -397,9 +301,26 @@ static void php_xml_free_wrapper(void *ptr)
}
}
+static const zend_function_entry xml_parser_methods[] = {
+ PHP_FE_END
+};
+
PHP_MINIT_FUNCTION(xml)
{
- le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number);
+ zend_class_entry ce;
+ INIT_CLASS_ENTRY(ce, "XmlParser", xml_parser_methods);
+ xml_parser_ce = zend_register_internal_class(&ce);
+ xml_parser_ce->create_object = xml_parser_create_object;
+ xml_parser_ce->ce_flags |= ZEND_ACC_FINAL;
+ xml_parser_ce->serialize = zend_class_serialize_deny;
+ xml_parser_ce->unserialize = zend_class_unserialize_deny;
+
+ memcpy(&xml_parser_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
+ xml_parser_object_handlers.offset = XtOffsetOf(xml_parser, std);
+ xml_parser_object_handlers.free_obj = xml_parser_free_obj;
+ xml_parser_object_handlers.get_gc = xml_parser_get_gc;
+ xml_parser_object_handlers.get_constructor = xml_parser_get_constructor;
+ xml_parser_object_handlers.clone_obj = NULL;
REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
@@ -474,10 +395,26 @@ static void _xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encodi
}
/* }}} */
-/* {{{ xml_parser_dtor() */
-static void xml_parser_dtor(zend_resource *rsrc)
+static inline xml_parser *xml_parser_from_obj(zend_object *obj) {
+ return (xml_parser *)((char *)(obj) - XtOffsetOf(xml_parser, std));
+}
+
+#define Z_XMLPARSER_P(zv) xml_parser_from_obj(Z_OBJ_P(zv))
+
+static zend_object *xml_parser_create_object(zend_class_entry *class_type) {
+ xml_parser *intern = zend_object_alloc(sizeof(xml_parser), class_type);
+ memset(intern, 0, sizeof(xml_parser) - sizeof(zend_object));
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &xml_parser_object_handlers;
+
+ return &intern->std;
+}
+
+static void xml_parser_free_obj(zend_object *object)
{
- xml_parser *parser = (xml_parser *)rsrc->ptr;
+ xml_parser *parser = xml_parser_from_obj(object);
if (parser->parser) {
XML_ParserFree(parser->parser);
@@ -528,9 +465,21 @@ static void xml_parser_dtor(zend_resource *rsrc)
zval_ptr_dtor(&parser->object);
}
- efree(parser);
+ zend_object_std_dtor(&parser->std);
+}
+
+static HashTable *xml_parser_get_gc(zend_object *object, zval **table, int *n)
+{
+ xml_parser *parser = xml_parser_from_obj(object);
+ *table = &parser->object;
+ *n = XML_PARSER_NUM_ZVALS;
+ return zend_std_get_properties(object);
+}
+
+static zend_function *xml_parser_get_constructor(zend_object *object) {
+ zend_throw_error(NULL, "Cannot directly construct XmlParser, use xml_parser_create() or xml_parser_create_ns() instead");
+ return NULL;
}
-/* }}} */
/* {{{ xml_set_handler() */
static void xml_set_handler(zval *handler, zval *data)
@@ -1118,7 +1067,7 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
XML_Char *encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|ss": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (encoding_param != NULL) {
@@ -1146,7 +1095,8 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
ns_param = ":";
}
- parser = ecalloc(1, sizeof(xml_parser));
+ object_init_ex(return_value, xml_parser_ce);
+ parser = Z_XMLPARSER_P(return_value);
parser->parser = XML_ParserCreate_MM((auto_detect ? NULL : encoding),
&php_xml_mem_hdlrs, (XML_Char*)ns_param);
@@ -1155,9 +1105,7 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
parser->isparsing = 0;
XML_SetUserData(parser->parser, parser);
-
- RETVAL_RES(zend_register_resource(parser, le_xml_parser));
- ZVAL_COPY(&parser->index, return_value);
+ ZVAL_COPY_VALUE(&parser->index, return_value);
}
/* }}} */
@@ -1184,22 +1132,13 @@ PHP_FUNCTION(xml_set_object)
xml_parser *parser;
zval *pind, *mythis;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ro", &pind, &mythis) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oo", &pind, xml_parser_ce, &mythis) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again) */
- if (!Z_ISUNDEF(parser->object)) {
- zval_ptr_dtor(&parser->object);
- }
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again) */
- /* zval_add_ref(&parser->object); */
+ parser = Z_XMLPARSER_P(pind);
+ zval_ptr_dtor(&parser->object);
Z_ADDREF_P(mythis);
ZVAL_OBJ(&parser->object, Z_OBJ_P(mythis));
@@ -1214,14 +1153,11 @@ PHP_FUNCTION(xml_set_element_handler)
xml_parser *parser;
zval *pind, *shdl, *ehdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzz", &pind, &shdl, &ehdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ozz", &pind, xml_parser_ce, &shdl, &ehdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->startElementHandler, shdl);
xml_set_handler(&parser->endElementHandler, ehdl);
XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
@@ -1236,14 +1172,11 @@ PHP_FUNCTION(xml_set_character_data_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->characterDataHandler, hdl);
XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
RETVAL_TRUE;
@@ -1257,14 +1190,11 @@ PHP_FUNCTION(xml_set_processing_instruction_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->processingInstructionHandler, hdl);
XML_SetProcessingInstructionHandler(parser->parser, _xml_processingInstructionHandler);
RETVAL_TRUE;
@@ -1278,14 +1208,11 @@ PHP_FUNCTION(xml_set_default_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->defaultHandler, hdl);
XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
RETVAL_TRUE;
@@ -1299,14 +1226,11 @@ PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->unparsedEntityDeclHandler, hdl);
XML_SetUnparsedEntityDeclHandler(parser->parser, _xml_unparsedEntityDeclHandler);
RETVAL_TRUE;
@@ -1320,14 +1244,11 @@ PHP_FUNCTION(xml_set_notation_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->notationDeclHandler, hdl);
XML_SetNotationDeclHandler(parser->parser, _xml_notationDeclHandler);
RETVAL_TRUE;
@@ -1341,14 +1262,11 @@ PHP_FUNCTION(xml_set_external_entity_ref_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->externalEntityRefHandler, hdl);
XML_SetExternalEntityRefHandler(parser->parser, (void *) _xml_externalEntityRefHandler);
RETVAL_TRUE;
@@ -1362,14 +1280,11 @@ PHP_FUNCTION(xml_set_start_namespace_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->startNamespaceDeclHandler, hdl);
XML_SetStartNamespaceDeclHandler(parser->parser, _xml_startNamespaceDeclHandler);
RETVAL_TRUE;
@@ -1383,14 +1298,11 @@ PHP_FUNCTION(xml_set_end_namespace_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->endNamespaceDeclHandler, hdl);
XML_SetEndNamespaceDeclHandler(parser->parser, _xml_endNamespaceDeclHandler);
RETVAL_TRUE;
@@ -1408,14 +1320,11 @@ PHP_FUNCTION(xml_parse)
int ret;
zend_bool isFinal = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b", &pind, &data, &data_len, &isFinal) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|b", &pind, xml_parser_ce, &data, &data_len, &isFinal) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
parser->isparsing = 1;
ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, isFinal);
parser->isparsing = 0;
@@ -1426,7 +1335,6 @@ PHP_FUNCTION(xml_parse)
/* {{{ proto int xml_parse_into_struct(resource parser, string data, array &values [, array &index ])
Parsing a XML document */
-
PHP_FUNCTION(xml_parse_into_struct)
{
xml_parser *parser;
@@ -1435,10 +1343,12 @@ PHP_FUNCTION(xml_parse_into_struct)
size_t data_len;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|z", &pind, &data, &data_len, &xdata, &info) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Osz|z", &pind, xml_parser_ce, &data, &data_len, &xdata, &info) == FAILURE) {
return;
}
+ parser = Z_XMLPARSER_P(pind);
+
if (info) {
info = zend_try_array_init(info);
if (!info) {
@@ -1446,10 +1356,6 @@ PHP_FUNCTION(xml_parse_into_struct)
}
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
xdata = zend_try_array_init(xdata);
if (!xdata) {
return;
@@ -1482,14 +1388,11 @@ PHP_FUNCTION(xml_get_error_code)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
RETURN_LONG((zend_long)XML_GetErrorCode(parser->parser));
}
/* }}} */
@@ -1519,14 +1422,11 @@ PHP_FUNCTION(xml_get_current_line_number)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser));
}
/* }}} */
@@ -1538,14 +1438,11 @@ PHP_FUNCTION(xml_get_current_column_number)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser));
}
/* }}} */
@@ -1557,14 +1454,11 @@ PHP_FUNCTION(xml_get_current_byte_index)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser));
}
/* }}} */
@@ -1576,23 +1470,16 @@ PHP_FUNCTION(xml_parser_free)
zval *pind;
xml_parser *parser;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
if (parser->isparsing == 1) {
php_error_docref(NULL, E_WARNING, "Parser cannot be freed while it is parsing.");
RETURN_FALSE;
}
- if (zend_list_delete(Z_RES(parser->index)) == FAILURE) {
- RETURN_FALSE;
- }
-
RETURN_TRUE;
}
/* }}} */
@@ -1605,14 +1492,11 @@ PHP_FUNCTION(xml_parser_set_option)
zval *pind, *val;
zend_long opt;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &pind, &opt, &val) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olz", &pind, xml_parser_ce, &opt, &val) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
parser->case_folding = zval_get_long(val);
@@ -1658,14 +1542,11 @@ PHP_FUNCTION(xml_parser_get_option)
zval *pind;
zend_long opt;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pind, &opt) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &pind, xml_parser_ce, &opt) == FAILURE) {
return;
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
+ parser = Z_XMLPARSER_P(pind);
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
RETURN_LONG(parser->case_folding);
diff --git a/ext/xml/xml.stub.php b/ext/xml/xml.stub.php
new file mode 100644
index 0000000000..45adb61f30
--- /dev/null
+++ b/ext/xml/xml.stub.php
@@ -0,0 +1,59 @@
+<?php
+
+/** @return XmlParser|false */
+function xml_parser_create(string $encoding = UNKNOWN) {}
+
+/** @return XmlParser|false */
+function xml_parser_create_ns(string $encoding = UNKNOWN, string $sep = ':') {}
+
+function xml_set_object(XmlParser $parser, object $obj): bool {}
+
+/**
+ * @param callable $shdl
+ * @param callable $ehdl
+ */
+function xml_set_element_handler(XmlParser $parser, $shdl, $ehdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_character_data_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_processing_instruction_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_default_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_unparsed_entity_decl_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_notation_decl_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_external_entity_ref_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_start_namespace_decl_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_end_namespace_decl_handler(XmlParser $parser, $hdl): bool {}
+
+function xml_parse(XmlParser $parser, string $data, bool $isfinal = false): int {}
+
+function xml_parse_into_struct(XmlParser $parser, string $data, &$values, &$index = UNKNOWN): int {}
+
+function xml_get_error_code(XmlParser $parser): int {}
+
+function xml_error_string(int $code): ?string {}
+
+function xml_get_current_line_number(XmlParser $parser): int {}
+
+function xml_get_current_column_number(XmlParser $parser): int {}
+
+function xml_get_current_byte_index(XmlParser $parser): int {}
+
+function xml_parser_free(XmlParser $parser): bool {}
+
+function xml_parser_set_option(XmlParser $parser, int $option, $value): bool {}
+
+function xml_parser_get_option(XmlParser $parser, int $option) {}
diff --git a/ext/xml/xml_arginfo.h b/ext/xml/xml_arginfo.h
new file mode 100644
index 0000000000..c49779cac1
--- /dev/null
+++ b/ext/xml/xml_arginfo.h
@@ -0,0 +1,82 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sep, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_object, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_element_handler, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_INFO(0, shdl)
+ ZEND_ARG_INFO(0, ehdl)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_character_data_handler, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xml_set_processing_instruction_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_default_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_unparsed_entity_decl_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_notation_decl_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_external_entity_ref_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_start_namespace_decl_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_end_namespace_decl_handler arginfo_xml_set_character_data_handler
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isfinal, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse_into_struct, 0, 3, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(1, values)
+ ZEND_ARG_INFO(1, index)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_get_error_code, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_error_string, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xml_get_current_line_number arginfo_xml_get_error_code
+
+#define arginfo_xml_get_current_column_number arginfo_xml_get_error_code
+
+#define arginfo_xml_get_current_byte_index arginfo_xml_get_error_code
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_free, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_set_option, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_get_option, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 20960d96d5..d1c683ed00 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.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, |
@@ -31,6 +29,7 @@
#endif
#include <libxml/xmlreader.h>
#include <libxml/uri.h>
+#include "xmlreader_arginfo.h"
zend_class_entry *xmlreader_class_entry;
@@ -114,34 +113,20 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl
/* }}} */
/* {{{ xmlreader_get_property_ptr_ptr */
-zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
+zval *xmlreader_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
{
xmlreader_object *obj;
- zval tmp_member;
zval *retval = NULL;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return NULL;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd == NULL) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return retval;
@@ -149,26 +134,16 @@ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void
/* }}} */
/* {{{ xmlreader_read_property */
-zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *xmlreader_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
xmlreader_object *obj;
- zval tmp_member;
zval *retval = NULL;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -178,45 +153,28 @@ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache
retval = rv;
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
return retval;
}
/* }}} */
/* {{{ xmlreader_write_property */
-zval *xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *xmlreader_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
xmlreader_object *obj;
- zval tmp_member;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
php_error_docref(NULL, E_WARNING, "Cannot write to read-only property");
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -438,6 +396,10 @@ static void php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_in
int retval;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
@@ -462,6 +424,10 @@ static void php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAMETERS, xmlreader_
char *retchar = NULL;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
@@ -540,6 +506,10 @@ PHP_METHOD(xmlreader, close)
zval *id;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
/* libxml is segfaulting in versions up to 2.6.8 using xmlTextReaderClose so for
@@ -789,6 +759,10 @@ PHP_METHOD(xmlreader, read)
int retval;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
if (intern != NULL && intern->ptr != NULL) {
@@ -1157,135 +1131,35 @@ PHP_METHOD(xmlreader, expand)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_close, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getAttribute, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getAttributeNo, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getAttributeNs, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, namespaceURI)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getParserProperty, 0)
- ZEND_ARG_INFO(0, property)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_isValid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_lookupNamespace, 0)
-ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToAttribute, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToAttributeNo, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToAttributeNs, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, namespaceURI)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToElement, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToFirstAttribute, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToNextAttribute, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_read, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_next, 0, 0, 0)
- ZEND_ARG_INFO(0, localname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_open, 0, 0, 1)
- ZEND_ARG_INFO(0, URI)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_readInnerXml, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_readOuterXml, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_readString, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setSchema, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setParserProperty, 0)
- ZEND_ARG_INFO(0, property)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setRelaxNGSchema, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setRelaxNGSchemaSource, 0)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_XML, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_expand, 0, 0, 0)
- ZEND_ARG_INFO(0, basenode)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry xmlreader_functions[] /* {{{ */ = {
- PHP_ME(xmlreader, close, arginfo_xmlreader_close, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttribute, arginfo_xmlreader_getAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttributeNo, arginfo_xmlreader_getAttributeNo, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttributeNs, arginfo_xmlreader_getAttributeNs, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getParserProperty, arginfo_xmlreader_getParserProperty, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, isValid, arginfo_xmlreader_isValid, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, lookupNamespace, arginfo_xmlreader_lookupNamespace, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttributeNo, arginfo_xmlreader_moveToAttributeNo, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttribute, arginfo_xmlreader_moveToAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttributeNs, arginfo_xmlreader_moveToAttributeNs, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToElement, arginfo_xmlreader_moveToElement, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToFirstAttribute, arginfo_xmlreader_moveToFirstAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToNextAttribute, arginfo_xmlreader_moveToNextAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(xmlreader, read, arginfo_xmlreader_read, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, next, arginfo_xmlreader_next, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readInnerXml, arginfo_xmlreader_readInnerXml, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readOuterXml, arginfo_xmlreader_readOuterXml, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readString, arginfo_xmlreader_readString, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, setSchema, arginfo_xmlreader_setSchema, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, close, arginfo_class_XMLReader_close, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getAttribute, arginfo_class_XMLReader_getAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getAttributeNo, arginfo_class_XMLReader_getAttributeNo, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getAttributeNs, arginfo_class_XMLReader_getAttributeNs, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getParserProperty, arginfo_class_XMLReader_getParserProperty, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, isValid, arginfo_class_XMLReader_isValid, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, lookupNamespace, arginfo_class_XMLReader_lookupNamespace, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToAttributeNo, arginfo_class_XMLReader_moveToAttributeNo, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToAttribute, arginfo_class_XMLReader_moveToAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToAttributeNs, arginfo_class_XMLReader_moveToAttributeNs, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToElement, arginfo_class_XMLReader_moveToElement, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToFirstAttribute, arginfo_class_XMLReader_moveToFirstAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToNextAttribute, arginfo_class_XMLReader_moveToNextAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, open, arginfo_class_XMLReader_open, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, read, arginfo_class_XMLReader_read, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, next, arginfo_class_XMLReader_next, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, readInnerXml, arginfo_class_XMLReader_readInnerXml, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, readOuterXml, arginfo_class_XMLReader_readOuterXml, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, readString, arginfo_class_XMLReader_readString, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setSchema, arginfo_class_XMLReader_setSchema, ZEND_ACC_PUBLIC)
/* Not Yet Implemented though defined in libxml as of 2.6.9dev
PHP_ME(xmlreader, resetState, NULL, ZEND_ACC_PUBLIC)
*/
- PHP_ME(xmlreader, setParserProperty, arginfo_xmlreader_setParserProperty, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, setRelaxNGSchema, arginfo_xmlreader_setRelaxNGSchema, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, setRelaxNGSchemaSource, arginfo_xmlreader_setRelaxNGSchemaSource, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, XML, arginfo_xmlreader_XML, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(xmlreader, expand, arginfo_xmlreader_expand, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setParserProperty, arginfo_class_XMLReader_setParserProperty, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setRelaxNGSchema, arginfo_class_XMLReader_setRelaxNGSchema, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setRelaxNGSchemaSource, arginfo_class_XMLReader_setRelaxNGSchemaSource, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, XML, arginfo_class_XMLReader_XML, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, expand, arginfo_class_XMLReader_expand, ZEND_ACC_PUBLIC)
PHP_FE_END
}; /* }}} */
diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h
index 6c7802224a..f9499c8423 100644
--- a/ext/xmlreader/php_xmlreader.h
+++ b/ext/xmlreader/php_xmlreader.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/ext/xmlreader/xmlreader.stub.php b/ext/xmlreader/xmlreader.stub.php
new file mode 100644
index 0000000000..6608e60768
--- /dev/null
+++ b/ext/xmlreader/xmlreader.stub.php
@@ -0,0 +1,79 @@
+<?php
+
+class XMLReader
+{
+ /** @return bool */
+ function close() {}
+
+ /** @return string|null|false */
+ function getAttribute(string $name) {}
+
+ /** @return ?string */
+ function getAttributeNo(int $index) {}
+
+ /** @return string|null|false */
+ function getAttributeNs(string $name, string $namespaceURI) {}
+
+ /** @return bool */
+ function getParserProperty(int $property) {}
+
+ /** @return bool */
+ function isValid() {}
+
+ /** @return string|null|false */
+ function lookupNamespace(string $prefix) {}
+
+ /** @return bool */
+ function moveToAttribute(string $name) {}
+
+ /** @return bool */
+ function moveToAttributeNo(int $index) {}
+
+ /** @return bool */
+ function moveToAttributeNs(string $name, string $namespaceURI) {}
+
+ /** @return bool */
+ function moveToElement() {}
+
+ /** @return bool */
+ function moveToFirstAttribute() {}
+
+ /** @return bool */
+ function moveToNextAttribute() {}
+
+ /** @return bool */
+ function read() {}
+
+ /** @return bool */
+ function next(string $localname = UNKNOWN) {}
+
+ /** @return bool|XMLReader */
+ function open(string $URI, ?string $encoding = null, int $options = 0) {}
+
+ /** @return string */
+ function readInnerXml() {}
+
+ /** @return string */
+ function readOuterXml() {}
+
+ /** @return string */
+ function readString() {}
+
+ /** @return bool */
+ function setSchema(?string $filename) {}
+
+ /** @return bool */
+ function setParserProperty(int $property, bool $value) {}
+
+ /** @return bool */
+ function setRelaxNGSchema(?string $filename) {}
+
+ /** @return bool */
+ function setRelaxNGSchemaSource(?string $source) {}
+
+ /** @return bool|XMLReader */
+ function XML(string $source, ?string $encoding = null, int $options = 0) {}
+
+ /** @return DOMNode|bool */
+ function expand(?DOMNode $basenode = null) {}
+}
diff --git a/ext/xmlreader/xmlreader_arginfo.h b/ext/xmlreader/xmlreader_arginfo.h
new file mode 100644
index 0000000000..2c93edeee6
--- /dev/null
+++ b/ext/xmlreader/xmlreader_arginfo.h
@@ -0,0 +1,82 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttribute, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttributeNo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttributeNs, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getParserProperty, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, property, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_isValid arginfo_class_XMLReader_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_lookupNamespace, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_moveToAttribute arginfo_class_XMLReader_getAttribute
+
+#define arginfo_class_XMLReader_moveToAttributeNo arginfo_class_XMLReader_getAttributeNo
+
+#define arginfo_class_XMLReader_moveToAttributeNs arginfo_class_XMLReader_getAttributeNs
+
+#define arginfo_class_XMLReader_moveToElement arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_moveToFirstAttribute arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_moveToNextAttribute arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_read arginfo_class_XMLReader_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_next, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, localname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, URI, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_readInnerXml arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_readOuterXml arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_readString arginfo_class_XMLReader_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setSchema, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setParserProperty, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, property, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_setRelaxNGSchema arginfo_class_XMLReader_setSchema
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setRelaxNGSchemaSource, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_XML, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_expand, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, basenode, DOMNode, 1)
+ZEND_END_ARG_INFO()
diff --git a/ext/xmlrpc/php_xmlrpc.h b/ext/xmlrpc/php_xmlrpc.h
index fbc29485ec..419784a55c 100644
--- a/ext/xmlrpc/php_xmlrpc.h
+++ b/ext/xmlrpc/php_xmlrpc.h
@@ -35,8 +35,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xmlrpc/tests/001.phpt b/ext/xmlrpc/tests/001.phpt
index 49dfba8f10..af41530ab2 100644
--- a/ext/xmlrpc/tests/001.phpt
+++ b/ext/xmlrpc/tests/001.phpt
@@ -7,7 +7,6 @@ xmlrpc_encode_request() with wrong arguments
var_dump(xmlrpc_encode_request(-1, 1));
var_dump(xmlrpc_encode_request("", 1));
-var_dump(xmlrpc_encode_request(array(), 1));
var_dump(xmlrpc_encode_request(3.4, 1));
echo "Done\n";
@@ -37,9 +36,6 @@ string(160) "<?xml version="1.0" encoding="iso-8859-1"?>
</params>
</methodCall>
"
-
-Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(175) "<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>3.4</methodName>
diff --git a/ext/xmlrpc/tests/002.phpt b/ext/xmlrpc/tests/002.phpt
index cb4b4aa818..a791082337 100644
--- a/ext/xmlrpc/tests/002.phpt
+++ b/ext/xmlrpc/tests/002.phpt
@@ -21,10 +21,6 @@ $r = xmlrpc_encode_request(-1, "");
var_dump(xmlrpc_decode_request($r, $method));
var_dump($method);
-$r = xmlrpc_encode_request(array(), 1);
-var_dump(xmlrpc_decode_request($r, $method));
-var_dump($method);
-
echo "Done\n";
?>
--EXPECTF--
@@ -46,8 +42,4 @@ array(1) {
string(0) ""
}
string(2) "-1"
-
-Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d
-NULL
-string(2) "-1"
Done
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 64ae65eec8..a3f54b8bcb 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -35,8 +35,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -70,75 +68,10 @@
#include "php_ini.h"
#include "php_xmlrpc.h"
#include "xmlrpc.h"
+#include "xmlrpc_arginfo.h"
static int le_xmlrpc_server;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode_request, 0, 0, 2)
- ZEND_ARG_INFO(0, xml)
- ZEND_ARG_INFO(1, method)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_encode_request, 0, 0, 2)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, params)
- ZEND_ARG_INFO(0, output_options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_set_type, 0, 0, 2)
- ZEND_ARG_INFO(1, value)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_is_fault, 0, 0, 1)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlrpc_server_create, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_destroy, 0, 0, 1)
- ZEND_ARG_INFO(0, server)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_register_method, 0, 0, 3)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, method_name)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, xml)
- ZEND_ARG_INFO(0, user_data)
- ZEND_ARG_INFO(0, output_options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 0, 1)
- ZEND_ARG_INFO(0, xml)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_add_introspection_data, 0, 0, 2)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, desc)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_register_introspection_callback, 0, 0, 2)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry xmlrpc_functions[] = {
PHP_FE(xmlrpc_encode, arginfo_xmlrpc_encode)
PHP_FE(xmlrpc_decode, arginfo_xmlrpc_decode)
@@ -1144,7 +1077,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data)
}
if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) {
- RETURN_FALSE;
+ return;
}
xDesc = PHP_to_XMLRPC(desc);
diff --git a/ext/xmlrpc/xmlrpc.stub.php b/ext/xmlrpc/xmlrpc.stub.php
new file mode 100644
index 0000000000..751aa7c325
--- /dev/null
+++ b/ext/xmlrpc/xmlrpc.stub.php
@@ -0,0 +1,33 @@
+<?php
+
+function xmlrpc_encode($value): ?string {}
+
+function xmlrpc_decode(string $xml, string $encoding = "iso-8859-1") {}
+
+function xmlrpc_decode_request(string $xml, &$method, string $encoding = "iso-8859-1") {}
+
+function xmlrpc_encode_request(?string $method, $params, array $output_options = UNKNOWN): ?string {}
+
+function xmlrpc_set_type(&$value, string $type): bool {}
+
+function xmlrpc_is_fault(array $arg): bool {}
+
+/** @return resource */
+function xmlrpc_server_create() {}
+
+/** @param resource $server */
+function xmlrpc_server_destroy($server): bool {}
+
+/** @param resource $server */
+function xmlrpc_server_register_method($server, string $method_name, $function): bool {}
+
+/** @param resource $server */
+function xmlrpc_server_call_method($server, string $xml, $user_data, array $output_options = UNKNOWN) {}
+
+function xmlrpc_parse_method_descriptions(string $xml) {}
+
+/** @param resource $server */
+function xmlrpc_server_add_introspection_data($server, array $desc): int {}
+
+/** @param resource $server */
+function xmlrpc_server_register_introspection_callback($server, $function): bool {}
diff --git a/ext/xmlrpc/xmlrpc_arginfo.h b/ext/xmlrpc/xmlrpc_arginfo.h
new file mode 100644
index 0000000000..5beecc99e6
--- /dev/null
+++ b/ext/xmlrpc/xmlrpc_arginfo.h
@@ -0,0 +1,65 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode, 0, 1, IS_STRING, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode_request, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ ZEND_ARG_INFO(1, method)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode_request, 0, 2, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 1)
+ ZEND_ARG_INFO(0, params)
+ ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_set_type, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, value)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_is_fault, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_create, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_destroy, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, server)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_register_method, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_TYPE_INFO(0, method_name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, function)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ ZEND_ARG_INFO(0, user_data)
+ ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_add_introspection_data, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_TYPE_INFO(0, desc, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_register_introspection_callback, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_INFO(0, function)
+ZEND_END_ARG_INFO()
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 2fa4e32854..81fe003ace 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.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, |
@@ -27,6 +25,7 @@
#include "ext/standard/info.h"
#include "php_xmlwriter.h"
#include "ext/standard/php_string.h"
+#include "xmlwriter_arginfo.h"
static PHP_FUNCTION(xmlwriter_set_indent);
static PHP_FUNCTION(xmlwriter_set_indent_string);
@@ -73,35 +72,15 @@ static PHP_FUNCTION(xmlwriter_flush);
static zend_class_entry *xmlwriter_class_entry_ce;
-static void xmlwriter_free_resource_ptr(xmlwriter_object *intern);
-static void xmlwriter_dtor(zend_resource *rsrc);
-
typedef int (*xmlwriter_read_one_char_t)(xmlTextWriterPtr writer, const xmlChar *content);
typedef int (*xmlwriter_read_int_t)(xmlTextWriterPtr writer);
-/* {{{ xmlwriter_object_free_storage */
-static void xmlwriter_free_resource_ptr(xmlwriter_object *intern)
-{
- if (intern) {
- if (intern->ptr) {
- xmlFreeTextWriter(intern->ptr);
- intern->ptr = NULL;
- }
- if (intern->output) {
- xmlBufferFree(intern->output);
- intern->output = NULL;
- }
- efree(intern);
- }
-}
-/* }}} */
-
/* {{{ XMLWRITER_FROM_OBJECT */
-#define XMLWRITER_FROM_OBJECT(intern, object) \
+#define XMLWRITER_FROM_OBJECT(ptr, object) \
{ \
ze_xmlwriter_object *obj = Z_XMLWRITER_P(object); \
- intern = obj->xmlwriter_ptr; \
- if (!intern) { \
+ ptr = obj->ptr; \
+ if (!ptr) { \
php_error_docref(NULL, E_WARNING, "Invalid or uninitialized XMLWriter object"); \
RETURN_FALSE; \
} \
@@ -117,10 +96,14 @@ static void xmlwriter_object_free_storage(zend_object *object)
if (!intern) {
return;
}
- if (intern->xmlwriter_ptr) {
- xmlwriter_free_resource_ptr(intern->xmlwriter_ptr);
+ if (intern->ptr) {
+ xmlFreeTextWriter(intern->ptr);
+ intern->ptr = NULL;
+ }
+ if (intern->output) {
+ xmlBufferFree(intern->output);
+ intern->output = NULL;
}
- intern->xmlwriter_ptr = NULL;
zend_object_std_dtor(&intern->std);
}
/* }}} */
@@ -146,351 +129,47 @@ static zend_object *xmlwriter_object_new(zend_class_entry *class_type)
RETURN_FALSE; \
} \
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_xmlwriter_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_resource, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_open_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_set_indent, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, indent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_set_indent, 0, 0, 1)
- ZEND_ARG_INFO(0, indent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_set_indent_string, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, indentString)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_set_indent_string, 0, 0, 1)
- ZEND_ARG_INFO(0, indentString)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_attribute, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_attribute_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_attribute_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_attribute_ns, 0, 0, 5)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_attribute_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_attribute, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_element, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_element, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_element_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_element_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_element, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_element, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_element_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_element_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_pi, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, target)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_pi, 0, 0, 1)
- ZEND_ARG_INFO(0, target)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_pi, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_pi, 0, 0, 2)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_cdata, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_cdata, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_text, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_text, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_raw, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_raw, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_document, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, standalone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_document, 0, 0, 0)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, standalone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_comment, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_comment, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd, 0, 0, 1)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
- ZEND_ARG_INFO(0, subset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
- ZEND_ARG_INFO(0, subset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd_element, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd_element, 0, 0, 1)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd_element, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd_element, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd_attlist, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd_attlist, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd_attlist, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd_attlist, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd_entity, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, isparam)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd_entity, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, isparam)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd_entity, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd_entity, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_output_memory, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, flush)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_output_memory, 0, 0, 0)
- ZEND_ARG_INFO(0, flush)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_flush, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_flush, 0, 0, 0)
- ZEND_ARG_INFO(0, empty)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ xmlwriter_functions */
static const zend_function_entry xmlwriter_functions[] = {
PHP_FE(xmlwriter_open_uri, arginfo_xmlwriter_open_uri)
- PHP_FE(xmlwriter_open_memory, arginfo_xmlwriter_void)
+ PHP_FE(xmlwriter_open_memory, arginfo_xmlwriter_open_memory)
PHP_FE(xmlwriter_set_indent, arginfo_xmlwriter_set_indent)
PHP_FE(xmlwriter_set_indent_string, arginfo_xmlwriter_set_indent_string)
- PHP_FE(xmlwriter_start_comment, arginfo_xmlwriter_resource)
- PHP_FE(xmlwriter_end_comment, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_start_comment, arginfo_xmlwriter_start_comment)
+ PHP_FE(xmlwriter_end_comment, arginfo_xmlwriter_end_comment)
PHP_FE(xmlwriter_start_attribute, arginfo_xmlwriter_start_attribute)
- PHP_FE(xmlwriter_end_attribute, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_attribute, arginfo_xmlwriter_end_attribute)
PHP_FE(xmlwriter_write_attribute, arginfo_xmlwriter_write_attribute)
PHP_FE(xmlwriter_start_attribute_ns,arginfo_xmlwriter_start_attribute_ns)
PHP_FE(xmlwriter_write_attribute_ns,arginfo_xmlwriter_write_attribute_ns)
PHP_FE(xmlwriter_start_element, arginfo_xmlwriter_start_element)
- PHP_FE(xmlwriter_end_element, arginfo_xmlwriter_resource)
- PHP_FE(xmlwriter_full_end_element, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_element, arginfo_xmlwriter_end_element)
+ PHP_FE(xmlwriter_full_end_element, arginfo_xmlwriter_full_end_element)
PHP_FE(xmlwriter_start_element_ns, arginfo_xmlwriter_start_element_ns)
PHP_FE(xmlwriter_write_element, arginfo_xmlwriter_write_element)
PHP_FE(xmlwriter_write_element_ns, arginfo_xmlwriter_write_element_ns)
PHP_FE(xmlwriter_start_pi, arginfo_xmlwriter_start_pi)
- PHP_FE(xmlwriter_end_pi, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_pi, arginfo_xmlwriter_end_pi)
PHP_FE(xmlwriter_write_pi, arginfo_xmlwriter_write_pi)
- PHP_FE(xmlwriter_start_cdata, arginfo_xmlwriter_resource)
- PHP_FE(xmlwriter_end_cdata, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_start_cdata, arginfo_xmlwriter_start_cdata)
+ PHP_FE(xmlwriter_end_cdata, arginfo_xmlwriter_end_cdata)
PHP_FE(xmlwriter_write_cdata, arginfo_xmlwriter_write_cdata)
PHP_FE(xmlwriter_text, arginfo_xmlwriter_text)
PHP_FE(xmlwriter_write_raw, arginfo_xmlwriter_write_raw)
PHP_FE(xmlwriter_start_document, arginfo_xmlwriter_start_document)
- PHP_FE(xmlwriter_end_document, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_document, arginfo_xmlwriter_end_document)
PHP_FE(xmlwriter_write_comment, arginfo_xmlwriter_write_comment)
PHP_FE(xmlwriter_start_dtd, arginfo_xmlwriter_start_dtd)
- PHP_FE(xmlwriter_end_dtd, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd, arginfo_xmlwriter_end_dtd)
PHP_FE(xmlwriter_write_dtd, arginfo_xmlwriter_write_dtd)
PHP_FE(xmlwriter_start_dtd_element, arginfo_xmlwriter_start_dtd_element)
- PHP_FE(xmlwriter_end_dtd_element, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd_element, arginfo_xmlwriter_end_dtd_element)
PHP_FE(xmlwriter_write_dtd_element, arginfo_xmlwriter_write_dtd_element)
PHP_FE(xmlwriter_start_dtd_attlist, arginfo_xmlwriter_start_dtd_attlist)
- PHP_FE(xmlwriter_end_dtd_attlist, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd_attlist, arginfo_xmlwriter_end_dtd_attlist)
PHP_FE(xmlwriter_write_dtd_attlist, arginfo_xmlwriter_write_dtd_attlist)
PHP_FE(xmlwriter_start_dtd_entity, arginfo_xmlwriter_start_dtd_entity)
- PHP_FE(xmlwriter_end_dtd_entity, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd_entity, arginfo_xmlwriter_end_dtd_entity)
PHP_FE(xmlwriter_write_dtd_entity, arginfo_xmlwriter_write_dtd_entity)
PHP_FE(xmlwriter_output_memory, arginfo_xmlwriter_output_memory)
PHP_FE(xmlwriter_flush, arginfo_xmlwriter_flush)
@@ -500,48 +179,48 @@ static const zend_function_entry xmlwriter_functions[] = {
/* {{{ xmlwriter_class_functions */
static const zend_function_entry xmlwriter_class_functions[] = {
- PHP_ME_MAPPING(openUri, xmlwriter_open_uri, arginfo_xmlwriter_open_uri, 0)
- PHP_ME_MAPPING(openMemory, xmlwriter_open_memory, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(setIndent, xmlwriter_set_indent, arginfo_xmlwriter_method_set_indent, 0)
- PHP_ME_MAPPING(setIndentString, xmlwriter_set_indent_string, arginfo_xmlwriter_method_set_indent_string, 0)
- PHP_ME_MAPPING(startComment, xmlwriter_start_comment, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(endComment, xmlwriter_end_comment, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(startAttribute, xmlwriter_start_attribute, arginfo_xmlwriter_method_start_attribute, 0)
- PHP_ME_MAPPING(endAttribute, xmlwriter_end_attribute, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeAttribute, xmlwriter_write_attribute, arginfo_xmlwriter_method_write_attribute, 0)
- PHP_ME_MAPPING(startAttributeNs, xmlwriter_start_attribute_ns,arginfo_xmlwriter_method_start_attribute_ns, 0)
- PHP_ME_MAPPING(writeAttributeNs, xmlwriter_write_attribute_ns,arginfo_xmlwriter_method_write_attribute_ns, 0)
- PHP_ME_MAPPING(startElement, xmlwriter_start_element, arginfo_xmlwriter_method_start_element, 0)
- PHP_ME_MAPPING(endElement, xmlwriter_end_element, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(fullEndElement, xmlwriter_full_end_element, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(startElementNs, xmlwriter_start_element_ns, arginfo_xmlwriter_method_start_element_ns, 0)
- PHP_ME_MAPPING(writeElement, xmlwriter_write_element, arginfo_xmlwriter_method_write_element, 0)
- PHP_ME_MAPPING(writeElementNs, xmlwriter_write_element_ns, arginfo_xmlwriter_method_write_element_ns, 0)
- PHP_ME_MAPPING(startPi, xmlwriter_start_pi, arginfo_xmlwriter_method_start_pi, 0)
- PHP_ME_MAPPING(endPi, xmlwriter_end_pi, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writePi, xmlwriter_write_pi, arginfo_xmlwriter_method_write_pi, 0)
- PHP_ME_MAPPING(startCdata, xmlwriter_start_cdata, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(endCdata, xmlwriter_end_cdata, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeCdata, xmlwriter_write_cdata, arginfo_xmlwriter_method_write_cdata, 0)
- PHP_ME_MAPPING(text, xmlwriter_text, arginfo_xmlwriter_method_text, 0)
- PHP_ME_MAPPING(writeRaw, xmlwriter_write_raw, arginfo_xmlwriter_method_write_raw, 0)
- PHP_ME_MAPPING(startDocument, xmlwriter_start_document, arginfo_xmlwriter_method_start_document, 0)
- PHP_ME_MAPPING(endDocument, xmlwriter_end_document, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeComment, xmlwriter_write_comment, arginfo_xmlwriter_method_write_comment, 0)
- PHP_ME_MAPPING(startDtd, xmlwriter_start_dtd, arginfo_xmlwriter_method_start_dtd, 0)
- PHP_ME_MAPPING(endDtd, xmlwriter_end_dtd, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtd, xmlwriter_write_dtd, arginfo_xmlwriter_method_write_dtd, 0)
- PHP_ME_MAPPING(startDtdElement, xmlwriter_start_dtd_element,arginfo_xmlwriter_method_start_dtd_element, 0)
- PHP_ME_MAPPING(endDtdElement, xmlwriter_end_dtd_element, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtdElement, xmlwriter_write_dtd_element, arginfo_xmlwriter_method_write_dtd_element, 0)
- PHP_ME_MAPPING(startDtdAttlist, xmlwriter_start_dtd_attlist, arginfo_xmlwriter_method_start_dtd_attlist, 0)
- PHP_ME_MAPPING(endDtdAttlist, xmlwriter_end_dtd_attlist, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtdAttlist, xmlwriter_write_dtd_attlist, arginfo_xmlwriter_method_write_dtd_attlist, 0)
- PHP_ME_MAPPING(startDtdEntity, xmlwriter_start_dtd_entity, arginfo_xmlwriter_method_start_dtd_entity, 0)
- PHP_ME_MAPPING(endDtdEntity, xmlwriter_end_dtd_entity, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtdEntity, xmlwriter_write_dtd_entity, arginfo_xmlwriter_method_write_dtd_entity, 0)
- PHP_ME_MAPPING(outputMemory, xmlwriter_output_memory, arginfo_xmlwriter_method_output_memory, 0)
- PHP_ME_MAPPING(flush, xmlwriter_flush, arginfo_xmlwriter_method_flush, 0)
+ PHP_ME_MAPPING(openUri, xmlwriter_open_uri, arginfo_class_XMLWriter_openUri, 0)
+ PHP_ME_MAPPING(openMemory, xmlwriter_open_memory, arginfo_class_XMLWriter_openMemory, 0)
+ PHP_ME_MAPPING(setIndent, xmlwriter_set_indent, arginfo_class_XMLWriter_setIndent, 0)
+ PHP_ME_MAPPING(setIndentString, xmlwriter_set_indent_string, arginfo_class_XMLWriter_setIdentString, 0)
+ PHP_ME_MAPPING(startComment, xmlwriter_start_comment, arginfo_class_XMLWriter_startComment, 0)
+ PHP_ME_MAPPING(endComment, xmlwriter_end_comment, arginfo_class_XMLWriter_endComment, 0)
+ PHP_ME_MAPPING(startAttribute, xmlwriter_start_attribute, arginfo_class_XMLWriter_startAttribute, 0)
+ PHP_ME_MAPPING(endAttribute, xmlwriter_end_attribute, arginfo_class_XMLWriter_endAttribute, 0)
+ PHP_ME_MAPPING(writeAttribute, xmlwriter_write_attribute, arginfo_class_XMLWriter_writeAttribute, 0)
+ PHP_ME_MAPPING(startAttributeNs, xmlwriter_start_attribute_ns,arginfo_class_XMLWriter_startAttributeNs, 0)
+ PHP_ME_MAPPING(writeAttributeNs, xmlwriter_write_attribute_ns,arginfo_class_XMLWriter_writeAttributeNs, 0)
+ PHP_ME_MAPPING(startElement, xmlwriter_start_element, arginfo_class_XMLWriter_startElement, 0)
+ PHP_ME_MAPPING(endElement, xmlwriter_end_element, arginfo_class_XMLWriter_endElement, 0)
+ PHP_ME_MAPPING(fullEndElement, xmlwriter_full_end_element, arginfo_class_XMLWriter_fullEndElement, 0)
+ PHP_ME_MAPPING(startElementNs, xmlwriter_start_element_ns, arginfo_class_XMLWriter_startElementNs, 0)
+ PHP_ME_MAPPING(writeElement, xmlwriter_write_element, arginfo_class_XMLWriter_writeElement, 0)
+ PHP_ME_MAPPING(writeElementNs, xmlwriter_write_element_ns, arginfo_class_XMLWriter_writeElementNs, 0)
+ PHP_ME_MAPPING(startPi, xmlwriter_start_pi, arginfo_class_XMLWriter_startPi, 0)
+ PHP_ME_MAPPING(endPi, xmlwriter_end_pi, arginfo_class_XMLWriter_endPi, 0)
+ PHP_ME_MAPPING(writePi, xmlwriter_write_pi, arginfo_class_XMLWriter_writePi, 0)
+ PHP_ME_MAPPING(startCdata, xmlwriter_start_cdata, arginfo_class_XMLWriter_startCdata, 0)
+ PHP_ME_MAPPING(endCdata, xmlwriter_end_cdata, arginfo_class_XMLWriter_endCdata, 0)
+ PHP_ME_MAPPING(writeCdata, xmlwriter_write_cdata, arginfo_class_XMLWriter_writeCdata, 0)
+ PHP_ME_MAPPING(text, xmlwriter_text, arginfo_class_XMLWriter_text, 0)
+ PHP_ME_MAPPING(writeRaw, xmlwriter_write_raw, arginfo_class_XMLWriter_writeRaw, 0)
+ PHP_ME_MAPPING(startDocument, xmlwriter_start_document, arginfo_class_XMLWriter_startDocument, 0)
+ PHP_ME_MAPPING(endDocument, xmlwriter_end_document, arginfo_class_XMLWriter_endDocument, 0)
+ PHP_ME_MAPPING(writeComment, xmlwriter_write_comment, arginfo_class_XMLWriter_writeComment, 0)
+ PHP_ME_MAPPING(startDtd, xmlwriter_start_dtd, arginfo_class_XMLWriter_startDtd, 0)
+ PHP_ME_MAPPING(endDtd, xmlwriter_end_dtd, arginfo_class_XMLWriter_endDtd, 0)
+ PHP_ME_MAPPING(writeDtd, xmlwriter_write_dtd, arginfo_class_XMLWriter_writeDtd, 0)
+ PHP_ME_MAPPING(startDtdElement, xmlwriter_start_dtd_element,arginfo_class_XMLWriter_startDtdElement, 0)
+ PHP_ME_MAPPING(endDtdElement, xmlwriter_end_dtd_element, arginfo_class_XMLWriter_endDtdElement, 0)
+ PHP_ME_MAPPING(writeDtdElement, xmlwriter_write_dtd_element, arginfo_class_XMLWriter_writeDtdElement, 0)
+ PHP_ME_MAPPING(startDtdAttlist, xmlwriter_start_dtd_attlist, arginfo_class_XMLWriter_startDtdAttlist, 0)
+ PHP_ME_MAPPING(endDtdAttlist, xmlwriter_end_dtd_attlist, arginfo_class_XMLWriter_endDtdAttlist, 0)
+ PHP_ME_MAPPING(writeDtdAttlist, xmlwriter_write_dtd_attlist, arginfo_class_XMLWriter_writeDtdAttlist, 0)
+ PHP_ME_MAPPING(startDtdEntity, xmlwriter_start_dtd_entity, arginfo_class_XMLWriter_startDtdEntity, 0)
+ PHP_ME_MAPPING(endDtdEntity, xmlwriter_end_dtd_entity, arginfo_class_XMLWriter_endDtdEntity, 0)
+ PHP_ME_MAPPING(writeDtdEntity, xmlwriter_write_dtd_entity, arginfo_class_XMLWriter_writeDtdEntity, 0)
+ PHP_ME_MAPPING(outputMemory, xmlwriter_output_memory, arginfo_class_XMLWriter_outputMemory, 0)
+ PHP_ME_MAPPING(flush, xmlwriter_flush, arginfo_class_XMLWriter_flush, 0)
PHP_FE_END
};
/* }}} */
@@ -550,8 +229,6 @@ static const zend_function_entry xmlwriter_class_functions[] = {
static PHP_MINIT_FUNCTION(xmlwriter);
static PHP_MSHUTDOWN_FUNCTION(xmlwriter);
static PHP_MINFO_FUNCTION(xmlwriter);
-
-static int le_xmlwriter;
/* }}} */
/* _xmlwriter_get_valid_file_path should be made a
@@ -654,47 +331,23 @@ static void xmlwriter_objects_clone(void *object, void **object_clone)
}
}}} */
-/* {{{ xmlwriter_dtor */
-static void xmlwriter_dtor(zend_resource *rsrc) {
- xmlwriter_object *intern;
-
- intern = (xmlwriter_object *) rsrc->ptr;
- xmlwriter_free_resource_ptr(intern);
-}
-/* }}} */
-
static void php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_one_char_t internal_function, char *err_string)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name;
size_t name_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pind, &name, &name_len) == FAILURE) {
- return;
- }
-
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &self, xmlwriter_class_entry_ce, &name, &name_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (err_string != NULL) {
XMLW_NAME_CHK(err_string);
}
- ptr = intern->ptr;
-
if (ptr) {
retval = internal_function(ptr, (xmlChar *) name);
if (retval != -1) {
@@ -707,27 +360,14 @@ static void php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_rea
static void php_xmlwriter_end(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_int_t internal_function)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- XMLWRITER_FROM_OBJECT(intern, self);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &self, xmlwriter_class_entry_ce) == FAILURE) {
+ return;
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = internal_function(ptr);
@@ -739,34 +379,20 @@ static void php_xmlwriter_end(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_int_t
RETURN_FALSE;
}
-/* {{{ proto bool xmlwriter_set_indent(resource xmlwriter, bool indent)
+/* {{{ proto bool xmlwriter_set_indent(XMLWriter xmlwriter, bool indent)
Toggle indentation on/off - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_set_indent)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
zend_bool indent;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &indent) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &pind, &indent) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ob", &self, xmlwriter_class_entry_ce, &indent) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
-
- ptr = intern->ptr;
if (ptr) {
retval = xmlTextWriterSetIndent(ptr, indent);
if (retval == 0) {
@@ -778,7 +404,7 @@ static PHP_FUNCTION(xmlwriter_set_indent)
}
/* }}} */
-/* {{{ proto bool xmlwriter_set_indent_string(resource xmlwriter, string indentString)
+/* {{{ proto bool xmlwriter_set_indent_string(XMLWriter xmlwriter, string indentString)
Set string used for indenting - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_set_indent_string)
{
@@ -786,7 +412,7 @@ static PHP_FUNCTION(xmlwriter_set_indent_string)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_attribute(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_attribute(XMLWriter xmlwriter, string name)
Create start attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_attribute)
{
@@ -794,7 +420,7 @@ static PHP_FUNCTION(xmlwriter_start_attribute)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_attribute(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_attribute(XMLWriter xmlwriter)
End attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_attribute)
{
@@ -802,38 +428,24 @@ static PHP_FUNCTION(xmlwriter_end_attribute)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_attribute_ns(resource xmlwriter, string prefix, string name, string uri)
+/* {{{ proto bool xmlwriter_start_attribute_ns(XMLWriter xmlwriter, string prefix, string name, string uri)
Create start namespaced attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_attribute_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri;
size_t name_len, prefix_len, uri_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss!",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss!", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterStartAttributeNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
if (retval != -1) {
@@ -845,38 +457,24 @@ static PHP_FUNCTION(xmlwriter_start_attribute_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_attribute(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_attribute(XMLWriter xmlwriter, string name, string content)
Write full attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_attribute)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteAttribute(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -888,39 +486,24 @@ static PHP_FUNCTION(xmlwriter_write_attribute)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_attribute_ns(resource xmlwriter, string prefix, string name, string uri, string content)
+/* {{{ proto bool xmlwriter_write_attribute_ns(XMLWriter xmlwriter, string prefix, string name, string uri, string content)
Write full namespaced attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_attribute_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri, *content;
size_t name_len, prefix_len, uri_len, content_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss!s",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss!s", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!s", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteAttributeNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri, (xmlChar *)content);
if (retval != -1) {
@@ -932,7 +515,7 @@ static PHP_FUNCTION(xmlwriter_write_attribute_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_element(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_element(XMLWriter xmlwriter, string name)
Create start element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_element)
{
@@ -940,38 +523,24 @@ static PHP_FUNCTION(xmlwriter_start_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_element_ns(resource xmlwriter, string prefix, string name, string uri)
+/* {{{ proto bool xmlwriter_start_element_ns(XMLWriter xmlwriter, string prefix, string name, string uri)
Create start namespaced element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_element_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri;
size_t name_len, prefix_len, uri_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ss!",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ss!", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!ss!", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterStartElementNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
if (retval != -1) {
@@ -984,7 +553,7 @@ static PHP_FUNCTION(xmlwriter_start_element_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_element(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_element(XMLWriter xmlwriter)
End current element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_element)
{
@@ -992,7 +561,7 @@ static PHP_FUNCTION(xmlwriter_end_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_full_end_element(resource xmlwriter)
+/* {{{ proto bool xmlwriter_full_end_element(XMLWriter xmlwriter)
End current element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_full_end_element)
{
@@ -1000,38 +569,24 @@ static PHP_FUNCTION(xmlwriter_full_end_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_element(resource xmlwriter, string name[, string content])
+/* {{{ proto bool xmlwriter_write_element(XMLWriter xmlwriter, string name[, string content])
Write full element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_element)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content = NULL;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s!", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
if (!content) {
retval = xmlTextWriterStartElement(ptr, (xmlChar *)name);
@@ -1054,38 +609,24 @@ static PHP_FUNCTION(xmlwriter_write_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_element_ns(resource xmlwriter, string prefix, string name, string uri[, string content])
+/* {{{ proto bool xmlwriter_write_element_ns(XMLWriter xmlwriter, string prefix, string name, string uri[, string content])
Write full namesapced element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_element_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri, *content = NULL;
size_t name_len, prefix_len, uri_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ss!|s!",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ss!|s!", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!ss!|s!", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
if (!content) {
retval = xmlTextWriterStartElementNS(ptr,(xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
@@ -1108,7 +649,7 @@ static PHP_FUNCTION(xmlwriter_write_element_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_pi(resource xmlwriter, string target)
+/* {{{ proto bool xmlwriter_start_pi(XMLWriter xmlwriter, string target)
Create start PI tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_pi)
{
@@ -1116,7 +657,7 @@ static PHP_FUNCTION(xmlwriter_start_pi)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_pi(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_pi(XMLWriter xmlwriter)
End current PI - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_pi)
{
@@ -1124,39 +665,24 @@ static PHP_FUNCTION(xmlwriter_end_pi)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_pi(resource xmlwriter, string target, string content)
+/* {{{ proto bool xmlwriter_write_pi(XMLWriter xmlwriter, string target, string content)
Write full PI tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_pi)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid PI Target");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWritePI(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -1168,31 +694,18 @@ static PHP_FUNCTION(xmlwriter_write_pi)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_cdata(resource xmlwriter)
+/* {{{ proto bool xmlwriter_start_cdata(XMLWriter xmlwriter)
Create start CDATA tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_cdata)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &self, xmlwriter_class_entry_ce) == FAILURE) {
+ return;
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartCDATA(ptr);
@@ -1205,7 +718,7 @@ static PHP_FUNCTION(xmlwriter_start_cdata)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_cdata(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_cdata(XMLWriter xmlwriter)
End current CDATA - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_cdata)
{
@@ -1213,7 +726,7 @@ static PHP_FUNCTION(xmlwriter_end_cdata)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_cdata(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_write_cdata(XMLWriter xmlwriter, string content)
Write full CDATA tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_cdata)
{
@@ -1221,7 +734,7 @@ static PHP_FUNCTION(xmlwriter_write_cdata)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_raw(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_write_raw(XMLWriter xmlwriter, string content)
Write text - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_raw)
{
@@ -1229,7 +742,7 @@ static PHP_FUNCTION(xmlwriter_write_raw)
}
/* }}} */
-/* {{{ proto bool xmlwriter_text(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_text(XMLWriter xmlwriter, string content)
Write text - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_text)
{
@@ -1237,31 +750,18 @@ static PHP_FUNCTION(xmlwriter_text)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_comment(resource xmlwriter)
+/* {{{ proto bool xmlwriter_start_comment(XMLWriter xmlwriter)
Create start comment - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_comment)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &self, xmlwriter_class_entry_ce) == FAILURE) {
+ return;
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartComment(ptr);
@@ -1274,7 +774,7 @@ static PHP_FUNCTION(xmlwriter_start_comment)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_comment(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_comment(XMLWriter xmlwriter)
Create end comment - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_comment)
{
@@ -1282,7 +782,7 @@ static PHP_FUNCTION(xmlwriter_end_comment)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_comment(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_write_comment(XMLWriter xmlwriter, string content)
Write full comment tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_comment)
{
@@ -1290,34 +790,20 @@ static PHP_FUNCTION(xmlwriter_write_comment)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_document(resource xmlwriter, string version, string encoding, string standalone)
+/* {{{ proto bool xmlwriter_start_document(XMLWriter xmlwriter, string version, string encoding, string standalone)
Create document tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_document)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *version = NULL, *enc = NULL, *alone = NULL;
size_t version_len, enc_len, alone_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!s!", &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!s!s!", &pind, &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|s!s!s!", &self, xmlwriter_class_entry_ce, &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
+ return;
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartDocument(ptr, version, enc, alone);
@@ -1330,7 +816,7 @@ static PHP_FUNCTION(xmlwriter_start_document)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_document(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_document(XMLWriter xmlwriter)
End current document - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_document)
{
@@ -1338,33 +824,20 @@ static PHP_FUNCTION(xmlwriter_end_document)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd(resource xmlwriter, string name, string pubid, string sysid)
+/* {{{ proto bool xmlwriter_start_dtd(XMLWriter xmlwriter, string name, string pubid, string sysid)
Create start DTD tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL;
size_t name_len, pubid_len, sysid_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!", &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
- return;
- }
-
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s!s!", &self, xmlwriter_class_entry_ce, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
+ return;
}
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartDTD(ptr, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid);
@@ -1377,7 +850,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd(XMLWriter xmlwriter)
End current DTD - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd)
{
@@ -1385,35 +858,20 @@ static PHP_FUNCTION(xmlwriter_end_dtd)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd(resource xmlwriter, string name, string pubid, string sysid, string subset)
+/* {{{ proto bool xmlwriter_write_dtd(XMLWriter xmlwriter, string name, string pubid, string sysid, string subset)
Write full DTD tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL, *subset = NULL;
size_t name_len, pubid_len, sysid_len, subset_len;
int retval;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!s!", &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
- return;
- }
-
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
- return;
- }
+ zval *self;
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s!s!s!", &self, xmlwriter_class_entry_ce, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
+ return;
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterWriteDTD(ptr, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid, (xmlChar *)subset);
@@ -1426,7 +884,7 @@ static PHP_FUNCTION(xmlwriter_write_dtd)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd_element(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_dtd_element(XMLWriter xmlwriter, string name)
Create start DTD element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd_element)
{
@@ -1434,7 +892,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd_element(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd_element(XMLWriter xmlwriter)
End current DTD element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd_element)
{
@@ -1442,37 +900,24 @@ static PHP_FUNCTION(xmlwriter_end_dtd_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd_element(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_dtd_element(XMLWriter xmlwriter, string name, string content)
Write full DTD element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd_element)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteDTDElement(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -1484,7 +929,7 @@ static PHP_FUNCTION(xmlwriter_write_dtd_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd_attlist(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_dtd_attlist(XMLWriter xmlwriter, string name)
Create start DTD AttList - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd_attlist)
{
@@ -1492,7 +937,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_attlist)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd_attlist(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd_attlist(XMLWriter xmlwriter)
End current DTD AttList - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd_attlist)
{
@@ -1500,38 +945,24 @@ static PHP_FUNCTION(xmlwriter_end_dtd_attlist)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd_attlist(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_dtd_attlist(XMLWriter xmlwriter, string name, string content)
Write full DTD AttList tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd_attlist)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteDTDAttlist(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -1543,37 +974,24 @@ static PHP_FUNCTION(xmlwriter_write_dtd_attlist)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd_entity(resource xmlwriter, string name, bool isparam)
+/* {{{ proto bool xmlwriter_start_dtd_entity(XMLWriter xmlwriter, string name, bool isparam)
Create start DTD Entity - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd_entity)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name;
size_t name_len;
int retval;
zend_bool isparm;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sb", &name, &name_len, &isparm) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsb", &pind, &name, &name_len, &isparm) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osb", &self, xmlwriter_class_entry_ce, &name, &name_len, &isparm) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterStartDTDEntity(ptr, isparm, (xmlChar *)name);
if (retval != -1) {
@@ -1585,7 +1003,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_entity)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd_entity(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd_entity(XMLWriter xmlwriter)
End current DTD Entity - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd_entity)
{
@@ -1593,12 +1011,10 @@ static PHP_FUNCTION(xmlwriter_end_dtd_entity)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd_entity(resource xmlwriter, string name, string content [, bool pe [, string pubid [, string sysid [, string ndataid]]]])
+/* {{{ proto bool xmlwriter_write_dtd_entity(XMLWriter xmlwriter, string name, string content [, bool pe [, string pubid [, string sysid [, string ndataid]]]])
Write full DTD Entity tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd_entity)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
@@ -1607,30 +1023,17 @@ static PHP_FUNCTION(xmlwriter_write_dtd_entity)
char *pubid = NULL, *sysid = NULL, *ndataid = NULL;
zend_bool pe = 0;
size_t pubid_len, sysid_len, ndataid_len;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bsss",
- &name, &name_len, &content, &content_len, &pe, &pubid, &pubid_len,
- &sysid, &sysid_len, &ndataid, &ndataid_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss|bsss", &pind,
- &name, &name_len, &content, &content_len, &pe, &pubid, &pubid_len,
- &sysid, &sysid_len, &ndataid, &ndataid_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss|bsss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len, &pe, &pubid, &pubid_len,
+ &sysid, &sysid_len, &ndataid, &ndataid_len) == FAILURE) {
+ return;
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteDTDEntity(ptr, pe, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid, (xmlChar *)ndataid, (xmlChar *)content);
if (retval != -1) {
@@ -1642,12 +1045,11 @@ static PHP_FUNCTION(xmlwriter_write_dtd_entity)
}
/* }}} */
-/* {{{ proto resource xmlwriter_open_uri(string source)
+/* {{{ proto XMLWriter xmlwriter_open_uri(string source)
Create new xmlwriter using source uri for output */
static PHP_FUNCTION(xmlwriter_open_uri)
{
char *valid_file = NULL;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *source;
char resolved_path[MAXPATHLEN + 1];
@@ -1681,26 +1083,29 @@ static PHP_FUNCTION(xmlwriter_open_uri)
RETURN_FALSE;
}
- intern = emalloc(sizeof(xmlwriter_object));
- intern->ptr = ptr;
- intern->output = NULL;
if (self) {
- if (ze_obj->xmlwriter_ptr) {
- xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr);
+ if (ze_obj->ptr) {
+ xmlFreeTextWriter(ze_obj->ptr);
+ }
+ if (ze_obj->output) {
+ xmlBufferFree(ze_obj->output);
}
- ze_obj->xmlwriter_ptr = intern;
+ ze_obj->ptr = ptr;
+ ze_obj->output = NULL;
RETURN_TRUE;
} else {
- RETURN_RES(zend_register_resource(intern, le_xmlwriter));
+ ze_obj = php_xmlwriter_fetch_object(xmlwriter_object_new(xmlwriter_class_entry_ce));
+ ze_obj->ptr = ptr;
+ ze_obj->output = NULL;
+ RETURN_OBJ(&ze_obj->std);
}
}
/* }}} */
-/* {{{ proto resource xmlwriter_open_memory()
+/* {{{ proto XMLWriter xmlwriter_open_memory()
Create new xmlwriter using memory for string output */
static PHP_FUNCTION(xmlwriter_open_memory)
{
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
xmlBufferPtr buffer;
zval *self = getThis();
@@ -1728,17 +1133,21 @@ static PHP_FUNCTION(xmlwriter_open_memory)
RETURN_FALSE;
}
- intern = emalloc(sizeof(xmlwriter_object));
- intern->ptr = ptr;
- intern->output = buffer;
if (self) {
- if (ze_obj->xmlwriter_ptr) {
- xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr);
+ if (ze_obj->ptr) {
+ xmlFreeTextWriter(ze_obj->ptr);
+ }
+ if (ze_obj->output) {
+ xmlBufferFree(ze_obj->output);
}
- ze_obj->xmlwriter_ptr = intern;
+ ze_obj->ptr = ptr;
+ ze_obj->output = buffer;
RETURN_TRUE;
} else {
- RETURN_RES(zend_register_resource(intern, le_xmlwriter));
+ ze_obj = php_xmlwriter_fetch_object(xmlwriter_object_new(xmlwriter_class_entry_ce));
+ ze_obj->ptr = ptr;
+ ze_obj->output = buffer;
+ RETURN_OBJ(&ze_obj->std);
}
}
@@ -1746,32 +1155,19 @@ static PHP_FUNCTION(xmlwriter_open_memory)
/* {{{ php_xmlwriter_flush */
static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string) {
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
xmlBufferPtr buffer;
zend_bool empty = 1;
int output_bytes;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &empty) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|b", &pind, &empty) == FAILURE) {
- return;
- }
-
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|b", &self, xmlwriter_class_entry_ce, &empty) == FAILURE) {
+ return;
}
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
- buffer = intern->output;
+ buffer = Z_XMLWRITER_P(self)->output;
if (force_string == 1 && buffer == NULL) {
RETURN_EMPTY_STRING();
}
@@ -1791,7 +1187,7 @@ static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string)
}
/* }}} */
-/* {{{ proto string xmlwriter_output_memory(resource xmlwriter [,bool flush])
+/* {{{ proto string xmlwriter_output_memory(XMLWriter xmlwriter [,bool flush])
Output current buffer as string */
static PHP_FUNCTION(xmlwriter_output_memory)
{
@@ -1799,7 +1195,7 @@ static PHP_FUNCTION(xmlwriter_output_memory)
}
/* }}} */
-/* {{{ proto mixed xmlwriter_flush(resource xmlwriter [,bool empty])
+/* {{{ proto mixed xmlwriter_flush(XMLWriter xmlwriter [,bool empty])
Output current buffer */
static PHP_FUNCTION(xmlwriter_flush)
{
@@ -1812,7 +1208,6 @@ static PHP_FUNCTION(xmlwriter_flush)
static PHP_MINIT_FUNCTION(xmlwriter)
{
zend_class_entry ce;
- le_xmlwriter = zend_register_list_destructors_ex(xmlwriter_dtor, NULL, "xmlwriter", module_number);
memcpy(&xmlwriter_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
xmlwriter_object_handlers.offset = XtOffsetOf(ze_xmlwriter_object, std);
diff --git a/ext/xmlwriter/php_xmlwriter.h b/ext/xmlwriter/php_xmlwriter.h
index 0413d3031e..c65678ab3f 100644
--- a/ext/xmlwriter/php_xmlwriter.h
+++ b/ext/xmlwriter/php_xmlwriter.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, |
@@ -34,16 +32,10 @@ extern zend_module_entry xmlwriter_module_entry;
#include <libxml/xmlwriter.h>
#include <libxml/uri.h>
-/* Resource struct, not the object :) */
-typedef struct _xmlwriter_object {
- xmlTextWriterPtr ptr;
- xmlBufferPtr output;
-} xmlwriter_object;
-
-
/* Extends zend object */
typedef struct _ze_xmlwriter_object {
- xmlwriter_object *xmlwriter_ptr;
+ xmlTextWriterPtr ptr;
+ xmlBufferPtr output;
zend_object std;
} ze_xmlwriter_object;
diff --git a/ext/xmlwriter/tests/bug41326.phpt b/ext/xmlwriter/tests/bug41326.phpt
index c87af84722..886e149261 100644
--- a/ext/xmlwriter/tests/bug41326.phpt
+++ b/ext/xmlwriter/tests/bug41326.phpt
@@ -15,7 +15,6 @@ $xml->writeElement('foo', null);
$xml->writeElement('foo2', "");
$xml->writeElement('foo3');
$xml->startElement('bar');
-$xml->endElement('bar');
$xml->endElement();
$xml->endElement();
print $xml->flush(true);
@@ -37,7 +36,6 @@ $xw->endDocument();
print $xw->flush(true);
?>
--EXPECTF--
-Warning: XMLWriter::endElement() expects exactly 0 parameters, 1 given in %s on line %d
<?xml version="1.0"?>
<test>
<foo/>
diff --git a/ext/xmlwriter/xmlwriter.stub.php b/ext/xmlwriter/xmlwriter.stub.php
new file mode 100644
index 0000000000..0cdaf3bf39
--- /dev/null
+++ b/ext/xmlwriter/xmlwriter.stub.php
@@ -0,0 +1,176 @@
+<?php
+
+/** @return XMLWriter|false */
+function xmlwriter_open_uri(string $uri) {}
+
+/** @return XMLWriter|false */
+function xmlwriter_open_memory() {}
+
+function xmlwriter_set_indent(XMLWriter $xmlwriter, bool $indent): bool {}
+
+function xmlwriter_set_indent_string(XMLWriter $xmlwriter, string $indentString): bool {}
+
+function xmlwriter_start_comment(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_end_comment(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_start_attribute(XMLWriter $xmlwriter, string $name): bool {}
+
+function xmlwriter_end_attribute(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_attribute(XMLWriter $xmlwriter, string $name, string $value): bool {}
+
+function xmlwriter_start_attribute_ns(XMLWriter $xmlwriter, string $prefix, string $name, ?string $uri): bool {}
+
+function xmlwriter_write_attribute_ns(XMLWriter $xmlwriter, string $prefix, string $name, ?string $uri, string $content): bool {}
+
+function xmlwriter_start_element(XMLWriter $xmlwriter, string $name): bool {}
+
+function xmlwriter_end_element(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_full_end_element(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_start_element_ns(XMLWriter $xmlwriter, ?string $prefix, string $name, ?string $uri): bool {}
+
+function xmlwriter_write_element(XMLWriter $xmlwriter, string $name, ?string $content = null): bool {}
+
+function xmlwriter_write_element_ns(XMLWriter $xmlwriter, ?string $prefix, string $name, ?string $uri, ?string $content = null): bool {}
+
+function xmlwriter_start_pi(XMLWriter $xmlwriter, string $target): bool {}
+
+function xmlwriter_end_pi(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_pi(XMLWriter $xmlwriter, string $target, string $content): bool {}
+
+function xmlwriter_start_cdata(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_end_cdata(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_cdata(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_text(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_write_raw(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_start_document(XMLWriter $xmlwriter, ?string $version = '1.0', ?string $encoding = null, ?string $standalone = null) {}
+
+function xmlwriter_end_document(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_comment(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_start_dtd(XMLWriter $xmlwriter, string $qualifiedName, ?string $publicId = null, ?string $systemId = null): bool {}
+
+function xmlwriter_end_dtd(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd(XMLWriter $xmlwriter, string $name, ?string $publicId = null, ?string $systemId = null, ?string $subset = null): bool {}
+
+function xmlwriter_start_dtd_element(XMLWriter $xmlwriter, string $qualifiedName): bool {}
+
+function xmlwriter_end_dtd_element(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd_element(XMLWriter $xmlwriter, string $name, string $content): bool {}
+
+function xmlwriter_start_dtd_attlist(XMLWriter $xmlwriter, string $name): bool {}
+
+function xmlwriter_end_dtd_attlist(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd_attlist(XMLWriter $xmlwriter, string $name, string $content): bool {}
+
+function xmlwriter_start_dtd_entity(XMLWriter $xmlwriter, string $name, bool $isparam): bool {}
+
+function xmlwriter_end_dtd_entity(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd_entity(XMLWriter $xmlwriter, string $name, string $content, bool $isparam = false, string $publicId = UNKNOWN, string $systemId = UNKNOWN, string $ndataid = UNKNOWN): bool {}
+
+function xmlwriter_output_memory(XMLWriter $xmlwriter, bool $flush = true): string {}
+
+/** @return string|int */
+function xmlwriter_flush(XMLWriter $xmlwriter, bool $empty = true) {}
+
+class XMLWriter
+{
+ function openUri(string $uri): bool {}
+
+ function openMemory(): bool {}
+
+ function setIndent(bool $indent): bool {}
+
+ function setIdentString(string $indentString): bool {}
+
+ function startComment(): bool {}
+
+ function endComment(): bool {}
+
+ function startAttribute(string $name): bool {}
+
+ function endAttribute(): bool {}
+
+ function writeAttribute(string $name, string $value): bool {}
+
+ function startAttributeNs(string $prefix, string $name, ?string $uri): bool {}
+
+ function writeAttributeNs(string $prefix, string $name, ?string $uri, string $content): bool {}
+
+ function startElement(string $name): bool {}
+
+ function endElement(): bool {}
+
+ function fullEndElement(): bool {}
+
+ function startElementNs(?string $prefix, string $name, ?string $uri): bool {}
+
+ function writeElement(string $name, ?string $content = null): bool {}
+
+ function writeElementNs(?string $prefix, string $name, ?string $uri, ?string $content = null): bool {}
+
+ function startPi(string $target): bool {}
+
+ function endPi(): bool {}
+
+ function writePi(string $target, string $content): bool {}
+
+ function startCdata(): bool {}
+
+ function endCdata(): bool {}
+
+ function writeCdata(string $content): bool {}
+
+ function text(string $content): bool {}
+
+ function writeRaw(string $content): bool {}
+
+ function startDocument(?string $version = '1.0', ?string $encoding = null, ?string $standalone = null): bool {}
+
+ function endDocument(): bool {}
+
+ function writeComment(string $content): bool {}
+
+ function startDtd(string $qualifiedName, ?string $publicId = null, ?string $systemId = null): bool {}
+
+ function endDtd(): bool {}
+
+ function writeDtd(string $name, ?string $publicId = null, ?string $systemId = null, ?string $subset = null): bool {}
+
+ function startDtdElement(string $qualifiedName): bool {}
+
+ function endDtdElement(): bool {}
+
+ function writeDtdElement(string $name, string $content): bool {}
+
+ function startDtdAttlist(string $name): bool {}
+
+ function endDtdAttlist(): bool {}
+
+ function writeDtdAttlist(string $name, string $content): bool {}
+
+ function startDtdEntity(string $name, bool $isparam): bool {}
+
+ function endDtdEntity(): bool {}
+
+ function writeDtdEntity(string $name, string $content, bool $isparam, string $publicId = UNKNOWN, string $systemId = UNKNOWN, string $ndataid = UNKNOWN): bool {}
+
+ function outputMemory(bool $flush = true): string {}
+
+ /** @return string|int */
+ function flush(bool $empty = true) {}
+}
diff --git a/ext/xmlwriter/xmlwriter_arginfo.h b/ext/xmlwriter/xmlwriter_arginfo.h
new file mode 100644
index 0000000000..1a356dd8eb
--- /dev/null
+++ b/ext/xmlwriter/xmlwriter_arginfo.h
@@ -0,0 +1,336 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_open_uri, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_open_memory, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_set_indent, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, indent, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_set_indent_string, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, indentString, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_comment, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_comment arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_attribute, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_attribute arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_attribute, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_attribute_ns, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_attribute_ns, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_start_element arginfo_xmlwriter_start_attribute
+
+#define arginfo_xmlwriter_end_element arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_full_end_element arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_element_ns, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_element, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_element_ns, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_pi, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_pi arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_pi, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_start_cdata arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_end_cdata arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_cdata, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_text arginfo_xmlwriter_write_cdata
+
+#define arginfo_xmlwriter_write_raw arginfo_xmlwriter_write_cdata
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_document, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, standalone, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_document arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_write_comment arginfo_xmlwriter_write_cdata
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_dtd, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_dtd arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, subset, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_dtd_element, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_dtd_element arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd_element, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_start_dtd_attlist arginfo_xmlwriter_start_attribute
+
+#define arginfo_xmlwriter_end_dtd_attlist arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_write_dtd_attlist arginfo_xmlwriter_write_dtd_element
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_dtd_entity, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_dtd_entity arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd_entity, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ndataid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_output_memory, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, flush, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_flush, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_openUri, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_openMemory, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_setIndent, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, indent, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_setIdentString, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, indentString, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startComment arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_endComment arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startAttribute, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endAttribute arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeAttribute, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startAttributeNs, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeAttributeNs, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startElement arginfo_class_XMLWriter_startAttribute
+
+#define arginfo_class_XMLWriter_endElement arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_fullEndElement arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startElementNs, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeElement, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeElementNs, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startPi, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endPi arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writePi, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startCdata arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_endCdata arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeCdata, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_text arginfo_class_XMLWriter_writeCdata
+
+#define arginfo_class_XMLWriter_writeRaw arginfo_class_XMLWriter_writeCdata
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDocument, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, standalone, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDocument arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_writeComment arginfo_class_XMLWriter_writeCdata
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtd, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDtd arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtd, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, subset, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtdElement, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDtdElement arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtdElement, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startDtdAttlist arginfo_class_XMLWriter_startAttribute
+
+#define arginfo_class_XMLWriter_endDtdAttlist arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_writeDtdAttlist arginfo_class_XMLWriter_writeDtdElement
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtdEntity, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDtdEntity arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtdEntity, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ndataid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_outputMemory, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flush, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_flush, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 9202c8a03a..da67e9ea64 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.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/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h
index 6cbf2872b3..0d105ce2a0 100644
--- a/ext/xsl/php_xsl.h
+++ b/ext/xsl/php_xsl.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/ext/xsl/xsl_fe.h b/ext/xsl/xsl_fe.h
index f48a126789..fbb0186619 100644
--- a/ext/xsl/xsl_fe.h
+++ b/ext/xsl/xsl_fe.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/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 20d907dc4a..cb15486518 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.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, |
@@ -400,7 +398,8 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
xsl_object *intern;
int prevSubstValue, prevExtDtdValue, clone_docu = 0;
xmlNode *nodep = NULL;
- zval *cloneDocu, member, rv;
+ zval *cloneDocu, rv;
+ zend_string *member;
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &docp) == FAILURE) {
@@ -436,13 +435,13 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
intern = Z_XSL_P(id);
- ZVAL_STRING(&member, "cloneDocument");
- cloneDocu = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv);
+ member = zend_string_init("cloneDocument", sizeof("cloneDocument")-1, 0);
+ cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(cloneDocu) != IS_NULL) {
convert_to_long(cloneDocu);
clone_docu = Z_LVAL_P(cloneDocu);
}
- zval_ptr_dtor(&member);
+ zend_string_release_ex(member, 0);
if (clone_docu == 0) {
/* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */
nodep = xmlDocGetRootElement(sheetp->doc);
@@ -482,7 +481,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
php_libxml_node_object *object;
char **params = NULL;
int clone;
- zval *doXInclude, member, rv;
+ zval *doXInclude, rv;
+ zend_string *member;
FILE *f;
int secPrefsError = 0;
int secPrefsValue;
@@ -532,13 +532,13 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
ctxt = xsltNewTransformContext(style, doc);
ctxt->_private = (void *) intern;
- ZVAL_STRING(&member, "doXInclude");
- doXInclude = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv);
+ member = zend_string_init("doXInclude", sizeof("doXInclude")-1, 0);
+ doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(doXInclude) != IS_NULL) {
convert_to_long(doXInclude);
ctxt->xinclude = Z_LVAL_P(doXInclude);
}
- zval_ptr_dtor(&member);
+ zend_string_release_ex(member, 0);
secPrefsValue = intern->securityPrefs;
diff --git a/ext/zend_test/php_test.h b/ext/zend_test/php_test.h
index b76155e866..9d1784f0d9 100644
--- a/ext/zend_test/php_test.h
+++ b/ext/zend_test/php_test.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/ext/zend_test/test.c b/ext/zend_test/test.c
index 53af862d24..8f2e104d1e 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.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, |
@@ -50,7 +48,13 @@ ZEND_END_ARG_INFO()
ZEND_FUNCTION(zend_test_func)
{
- /* dummy */
+ RETVAL_STR_COPY(EX(func)->common.function_name);
+
+ /* Cleanup trampoline */
+ ZEND_ASSERT(EX(func)->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE);
+ zend_string_release(EX(func)->common.function_name);
+ zend_free_trampoline(EX(func));
+ EX(func) = NULL;
}
ZEND_FUNCTION(zend_test_array_return)
@@ -144,38 +148,47 @@ static zend_object *zend_test_class_new(zend_class_entry *class_type) /* {{{ */
/* }}} */
static zend_function *zend_test_class_method_get(zend_object **object, zend_string *name, const zval *key) /* {{{ */ {
- zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
- fptr->type = ZEND_OVERLOADED_FUNCTION_TEMPORARY;
+ zend_internal_function *fptr;
+
+ if (EXPECTED(EG(trampoline).common.function_name == NULL)) {
+ fptr = (zend_internal_function *) &EG(trampoline);
+ } else {
+ fptr = emalloc(sizeof(zend_internal_function));
+ }
+ memset(fptr, 0, sizeof(zend_internal_function));
+ fptr->type = ZEND_INTERNAL_FUNCTION;
fptr->num_args = 1;
- fptr->arg_info = NULL;
fptr->scope = (*object)->ce;
fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
fptr->function_name = zend_string_copy(name);
fptr->handler = ZEND_FN(zend_test_func);
- zend_set_function_arg_flags((zend_function*)fptr);
return (zend_function*)fptr;
}
/* }}} */
static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, zend_string *name) /* {{{ */ {
- zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
- fptr->type = ZEND_OVERLOADED_FUNCTION;
+ zend_internal_function *fptr;
+
+ if (EXPECTED(EG(trampoline).common.function_name == NULL)) {
+ fptr = (zend_internal_function *) &EG(trampoline);
+ } else {
+ fptr = emalloc(sizeof(zend_internal_function));
+ }
+ memset(fptr, 0, sizeof(zend_internal_function));
+ fptr->type = ZEND_INTERNAL_FUNCTION;
fptr->num_args = 1;
- fptr->arg_info = NULL;
fptr->scope = ce;
fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC;
- fptr->function_name = name;
+ fptr->function_name = zend_string_copy(name);
fptr->handler = ZEND_FN(zend_test_func);
- zend_set_function_arg_flags((zend_function*)fptr);
return (zend_function*)fptr;
}
/* }}} */
-static int zend_test_class_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ {
- RETVAL_STR(zend_string_copy(method));
- return 0;
+static ZEND_METHOD(_ZendTestClass, __toString) /* {{{ */ {
+ RETURN_EMPTY_STRING();
}
/* }}} */
@@ -184,6 +197,11 @@ static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
}
/* }}} */
+static const zend_function_entry zend_test_class_methods[] = {
+ ZEND_ME(_ZendTestClass, __toString, NULL, ZEND_ACC_DEPRECATED)
+ ZEND_FE_END
+};
+
static const zend_function_entry zend_test_trait_methods[] = {
ZEND_ME(_ZendTestTrait, testMethod, NULL, ZEND_ACC_PUBLIC)
ZEND_FE_END
@@ -196,8 +214,8 @@ PHP_MINIT_FUNCTION(zend_test)
INIT_CLASS_ENTRY(class_entry, "_ZendTestInterface", NULL);
zend_test_interface = zend_register_internal_interface(&class_entry);
zend_declare_class_constant_long(zend_test_interface, ZEND_STRL("DUMMY"), 0);
- INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", NULL);
- zend_test_class = zend_register_internal_class_ex(&class_entry, NULL);
+ INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", zend_test_class_methods);
+ zend_test_class = zend_register_internal_class(&class_entry);
zend_class_implements(zend_test_class, 1, zend_test_interface);
zend_test_class->create_object = zend_test_class_new;
zend_test_class->get_static_method = zend_test_class_static_method_get;
@@ -209,7 +227,7 @@ PHP_MINIT_FUNCTION(zend_test)
zval val;
ZVAL_LONG(&val, 123);
zend_declare_typed_property(
- zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL, ZEND_TYPE_ENCODE(IS_LONG, 0));
+ zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL, ZEND_TYPE_ENCODE_CODE(IS_LONG, 0));
zend_string_release(name);
}
@@ -230,7 +248,7 @@ PHP_MINIT_FUNCTION(zend_test)
ZVAL_LONG(&val, 123);
zend_declare_typed_property(
zend_test_class, name, &val, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC, NULL,
- ZEND_TYPE_ENCODE(IS_LONG, 0));
+ ZEND_TYPE_ENCODE_CODE(IS_LONG, 0));
zend_string_release(name);
}
@@ -239,7 +257,6 @@ PHP_MINIT_FUNCTION(zend_test)
memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers));
zend_test_class_handlers.get_method = zend_test_class_method_get;
- zend_test_class_handlers.call_method = zend_test_class_call_method;
INIT_CLASS_ENTRY(class_entry, "_ZendTestTrait", zend_test_trait_methods);
zend_test_trait = zend_register_internal_class(&class_entry);
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 966efb58e6..e4fcc362ec 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.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, |
@@ -30,6 +28,7 @@
#include "ext/standard/php_filestat.h"
#include "zend_interfaces.h"
#include "php_zip.h"
+#include "php_zip_arginfo.h"
/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
static PHP_NAMED_FUNCTION(zif_zip_open);
@@ -373,8 +372,8 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
ze_zip_object *obj = Z_ZIP_P(object); \
intern = obj->za; \
if (!intern) { \
- php_error_docref(NULL, E_WARNING, "Invalid or uninitialized Zip object"); \
- RETURN_FALSE; \
+ zend_value_error("Invalid or uninitialized Zip object"); \
+ return; \
} \
}
/* }}} */
@@ -714,51 +713,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_close, 0, 0, 1)
- ZEND_ARG_INFO(0, zip)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_read, 0, 0, 1)
- ZEND_ARG_INFO(0, zip)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_open, 0, 0, 2)
- ZEND_ARG_INFO(0, zip_dp)
- ZEND_ARG_INFO(0, zip_entry)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_close, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_ent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_read, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_name, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_compressedsize, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_filesize, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_compressionmethod, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ zend_function_entry */
static const zend_function_entry zip_functions[] = {
ZEND_RAW_FENTRY("zip_open", zif_zip_open, arginfo_zip_open, 0)
@@ -866,62 +820,36 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd,
}
/* }}} */
-static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *php_zip_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return NULL;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd == NULL) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return retval;
}
/* }}} */
-static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *php_zip_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -930,38 +858,23 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void **
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
}
/* }}} */
-static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static int php_zip_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zip_prop_handler *hnd = NULL;
int retval = 0;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return 0;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -979,18 +892,14 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac
zval_ptr_dtor(&tmp);
} else {
- retval = zend_std_has_property(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_has_property(object, name, type, cache_slot);
}
return retval;
}
/* }}} */
-static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *php_zip_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */
{
*gc_data = NULL;
*gc_data_count = 0;
@@ -998,14 +907,14 @@ static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_coun
}
/* }}} */
-static HashTable *php_zip_get_properties(zval *object)/* {{{ */
+static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */
{
ze_zip_object *obj;
HashTable *props;
zip_prop_handler *hnd;
zend_string *key;
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
props = zend_std_get_properties(object);
if (obj->prop_handler == NULL) {
@@ -1332,7 +1241,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
RETURN_NEW_STR(buffer);
} else {
zend_string_efree(buffer);
- RETURN_EMPTY_STRING()
+ RETURN_EMPTY_STRING();
}
} else {
RETURN_FALSE;
@@ -1522,6 +1431,10 @@ static ZIPARCHIVE_METHOD(close)
ze_zip_object *ze_obj;
int err;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
ZIP_FROM_OBJECT(intern, self);
ze_obj = Z_ZIP_P(self);
@@ -1556,6 +1469,10 @@ static ZIPARCHIVE_METHOD(count)
zval *self = ZEND_THIS;
zip_int64_t num;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
ZIP_FROM_OBJECT(intern, self);
num = zip_get_num_entries(intern, 0);
@@ -1576,6 +1493,10 @@ static ZIPARCHIVE_METHOD(getStatusString)
zip_error_t *err;
#endif
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
ZIP_FROM_OBJECT(intern, self);
#if LIBZIP_VERSION_MAJOR < 1
@@ -1682,6 +1603,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
size_t real_len = strlen(remove_path);
if ((real_len > 1) && ((remove_path[real_len - 1] == '/') || (remove_path[real_len - 1] == '\\'))) {
remove_path = estrndup(remove_path, real_len - 1);
+ remove_path_len -= 1;
}
}
@@ -1707,8 +1629,8 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
file_stripped = ZSTR_VAL(basename);
file_stripped_len = ZSTR_LEN(basename);
} else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) {
- file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1;
- file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1;
+ file_stripped = Z_STRVAL_P(zval_file) + remove_path_len;
+ file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len;
} else {
file_stripped = Z_STRVAL_P(zval_file);
file_stripped_len = Z_STRLEN_P(zval_file);
@@ -2558,6 +2480,10 @@ static ZIPARCHIVE_METHOD(unchangeAll)
struct zip *intern;
zval *self = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_all(intern) != 0) {
@@ -2575,6 +2501,10 @@ static ZIPARCHIVE_METHOD(unchangeArchive)
struct zip *intern;
zval *self = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_archive(intern) != 0) {
@@ -2784,226 +2714,51 @@ static ZIPARCHIVE_METHOD(getStream)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_open, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setpassword, 0, 0, 1)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ziparchive__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addemptydir, 0, 0, 1)
- ZEND_ARG_INFO(0, dirname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addglob, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addpattern, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filepath)
- ZEND_ARG_INFO(0, entryname)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addfromstring, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_statname, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_statindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setarchivecomment, 0, 0, 1)
- ZEND_ARG_INFO(0, comment)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcommentindex, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, comment)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getcommentname, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getcommentindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_renameindex, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, new_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_renamename, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, new_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_unchangeindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_unchangename, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_extractto, 0, 0, 1)
- ZEND_ARG_INFO(0, pathto)
- ZEND_ARG_INFO(0, files)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getfromname, 0, 0, 1)
- ZEND_ARG_INFO(0, entryname)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getfromindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getarchivecomment, 0, 0, 0)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcommentname, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, comment)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getstream, 0, 0, 1)
- ZEND_ARG_INFO(0, entryname)
-ZEND_END_ARG_INFO()
-
-#ifdef ZIP_OPSYS_DEFAULT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setextattrname, 0, 0, 3)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, opsys)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setextattrindex, 0, 0, 3)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, opsys)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getextattrname, 0, 0, 3)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(1, opsys)
- ZEND_ARG_INFO(1, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getextattrindex, 0, 0, 3)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(1, opsys)
- ZEND_ARG_INFO(1, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-#endif /* ifdef ZIP_OPSYS_DEFAULT */
-/* }}} */
-
-#ifdef HAVE_ENCRYPTION
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setencryption_name, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setencryption_index, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcompname, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, compflags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcompindex, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, compflags)
-ZEND_END_ARG_INFO()
-
/* {{{ ze_zip_object_class_functions */
static const zend_function_entry zip_class_functions[] = {
- ZIPARCHIVE_ME(open, arginfo_ziparchive_open, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setPassword, arginfo_ziparchive_setpassword, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(close, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(count, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getStatusString, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addEmptyDir, arginfo_ziparchive_addemptydir, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addFromString, arginfo_ziparchive_addfromstring, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addFile, arginfo_ziparchive_addfile, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addGlob, arginfo_ziparchive_addglob, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addPattern, arginfo_ziparchive_addpattern, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(renameIndex, arginfo_ziparchive_renameindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(renameName, arginfo_ziparchive_renamename, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setArchiveComment, arginfo_ziparchive_setarchivecomment, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getArchiveComment, arginfo_ziparchive_getarchivecomment, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setCommentIndex, arginfo_ziparchive_setcommentindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setCommentName, arginfo_ziparchive_setcommentname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getCommentIndex, arginfo_ziparchive_getcommentindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getCommentName, arginfo_ziparchive_getcommentname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(deleteIndex, arginfo_ziparchive_unchangeindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(deleteName, arginfo_ziparchive_unchangename, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(statName, arginfo_ziparchive_statname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(statIndex, arginfo_ziparchive_statindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(locateName, arginfo_ziparchive_statname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getNameIndex, arginfo_ziparchive_statindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeArchive, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeAll, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeIndex, arginfo_ziparchive_unchangeindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeName, arginfo_ziparchive_unchangename, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(extractTo, arginfo_ziparchive_extractto, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getFromName, arginfo_ziparchive_getfromname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getFromIndex, arginfo_ziparchive_getfromindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getStream, arginfo_ziparchive_getstream, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(open, arginfo_class_ZipArchive_open, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setPassword, arginfo_class_ZipArchive_setPassword, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(close, arginfo_class_ZipArchive_close, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(count, arginfo_class_ZipArchive_count, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getStatusString, arginfo_class_ZipArchive_getStatusString, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addEmptyDir, arginfo_class_ZipArchive_addEmptyDir, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addFromString, arginfo_class_ZipArchive_addFromString, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addFile, arginfo_class_ZipArchive_addFile, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addGlob, arginfo_class_ZipArchive_addGlob, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addPattern, arginfo_class_ZipArchive_addPattern, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(renameIndex, arginfo_class_ZipArchive_renameIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(renameName, arginfo_class_ZipArchive_renameName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setArchiveComment, arginfo_class_ZipArchive_setArchiveComment, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getArchiveComment, arginfo_class_ZipArchive_getArchiveComment, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCommentIndex, arginfo_class_ZipArchive_setCommentIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCommentName, arginfo_class_ZipArchive_setCommentName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getCommentIndex, arginfo_class_ZipArchive_getCommentIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getCommentName, arginfo_class_ZipArchive_getCommentName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(deleteIndex, arginfo_class_ZipArchive_deleteIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(deleteName, arginfo_class_ZipArchive_deleteName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(statName, arginfo_class_ZipArchive_statName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(statIndex, arginfo_class_ZipArchive_statIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(locateName, arginfo_class_ZipArchive_locateName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getNameIndex, arginfo_class_ZipArchive_getNameIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeArchive, arginfo_class_ZipArchive_unchangeArchive, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeAll, arginfo_class_ZipArchive_unchangeAll, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeIndex, arginfo_class_ZipArchive_unchangeIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeName, arginfo_class_ZipArchive_unchangeName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(extractTo, arginfo_class_ZipArchive_extractTo, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getFromName, arginfo_class_ZipArchive_getFromName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getFromIndex, arginfo_class_ZipArchive_getFromIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getStream, arginfo_class_ZipArchive_getStream, ZEND_ACC_PUBLIC)
#ifdef ZIP_OPSYS_DEFAULT
- ZIPARCHIVE_ME(setExternalAttributesName, arginfo_ziparchive_setextattrname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setExternalAttributesIndex, arginfo_ziparchive_setextattrindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getExternalAttributesName, arginfo_ziparchive_getextattrname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getExternalAttributesIndex, arginfo_ziparchive_getextattrindex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setExternalAttributesName, arginfo_class_ZipArchive_setExternalAttributesName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setExternalAttributesIndex, arginfo_class_ZipArchive_setExternalAttributesIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getExternalAttributesName, arginfo_class_ZipArchive_getExternalAttributesName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getExternalAttributesIndex, arginfo_class_ZipArchive_getExternalAttributesIndex, ZEND_ACC_PUBLIC)
#endif
- ZIPARCHIVE_ME(setCompressionName, arginfo_ziparchive_setcompname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setCompressionIndex, arginfo_ziparchive_setcompindex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCompressionName, arginfo_class_ZipArchive_setCompressionName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCompressionIndex, arginfo_class_ZipArchive_setCompressionIndex, ZEND_ACC_PUBLIC)
#ifdef HAVE_ENCRYPTION
- ZIPARCHIVE_ME(setEncryptionName, arginfo_ziparchive_setencryption_name, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setEncryptionIndex, arginfo_ziparchive_setencryption_index, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setEncryptionName, arginfo_class_ZipArchive_setEncryptionName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setEncryptionIndex, arginfo_class_ZipArchive_setEncryptionIndex, ZEND_ACC_PUBLIC)
#endif
PHP_FE_END
};
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
index dc5a7ddfdd..0dc39a8b60 100644
--- a/ext/zip/php_zip.h
+++ b/ext/zip/php_zip.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/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php
new file mode 100644
index 0000000000..451372110a
--- /dev/null
+++ b/ext/zip/php_zip.stub.php
@@ -0,0 +1,183 @@
+<?php
+
+/** @return resource|int|false */
+function zip_open(string $filename) {}
+
+/**
+ * @param resource $zip
+ */
+function zip_close($zip): void {}
+
+/**
+ * @param resource $zip
+ * @return resource|false
+ */
+function zip_read($zip) {}
+
+/**
+ * @param resource $zip_dp
+ * @param resource $zip_entry
+ */
+function zip_entry_open($zip_dp, $zip_entry, string $mode = 'rb'): bool {}
+
+/**
+ * @param resource $zip_ent
+ */
+function zip_entry_close($zip_ent): bool {}
+
+/**
+ * @param resource $zip_entry
+ * @return string|false
+ */
+function zip_entry_read($zip_entry, int $len = 1024) {}
+
+/**
+ * @param resource $zip_entry
+ * @return string|false
+ */
+function zip_entry_name($zip_entry) {}
+
+/**
+ * @param resource $zip_entry
+ * @return int|false
+ */
+function zip_entry_compressedsize($zip_entry) {}
+
+/**
+ * @param resource $zip_entry
+ * @return int|false
+ */
+function zip_entry_filesize($zip_entry) {}
+
+/**
+ * @param resource $zip_entry
+ * @return string|false
+ */
+function zip_entry_compressionmethod($zip_entry) {}
+
+class ZipArchive
+{
+ /** @return bool|int */
+ public function open(string $filename, int $flags = 0) {}
+
+ /** @return bool */
+ public function setPassword(string $password) {}
+
+ /** @return bool */
+ public function close() {}
+
+ /** @return int */
+ public function count() {}
+
+ /** @return string */
+ public function getStatusString() {}
+
+ /** @return bool */
+ public function addEmptyDir(string $dirname) {}
+
+ /** @return bool */
+ public function addFromString(string $name, string $content) {}
+
+ /** @return bool */
+ public function addFile(string $filepath, string $entryname = UNKNOWN, int $start = 0, int $length = 0) {}
+
+ /** @return array|false */
+ public function addGlob(string $pattern, int $flags = 0, $options = UNKNOWN) {}
+
+ /** @return array|false */
+ public function addPattern(string $pattern, string $path = UNKNOWN, $options = UNKNOWN) {}
+
+ /** @return bool */
+ public function renameIndex(int $index, string $new_name) {}
+
+ /** @return bool */
+ public function renameName(string $name, string $new_name) {}
+
+ /** @return bool */
+ public function setArchiveComment(string $comment) {}
+
+ /** @return string|false */
+ public function getArchiveComment(int $flags = 0) {}
+
+ /** @return null|false */
+ public function setCommentIndex(int $index, string $comment) {}
+
+ /** @return null|false */
+ public function setCommentName(string $name, string $comment) {}
+
+ /** @return string|false */
+ public function getCommentIndex(int $index, int $flags = 0) {}
+
+ /** @return string|false */
+ public function getCommentName(string $name, int $flags = 0) {}
+
+ /** @return bool */
+ public function deleteIndex(int $index) {}
+
+ /** @return bool */
+ public function deleteName(string $name) {}
+
+ /** @return array|false */
+ public function statName(string $filename, int $flags = 0) {}
+
+ /** @return array|false */
+ public function statIndex(int $index, int $flags = 0) {}
+
+ /** @return int|false */
+ public function locateName(string $filename, int $flags = 0) {}
+
+ /** @return string|false */
+ public function getNameIndex(int $index, int $flags = 0) {}
+
+ /** @return bool */
+ public function unchangeArchive() {}
+
+ /** @return bool */
+ public function unchangeAll() {}
+
+ /** @return bool */
+ public function unchangeIndex(int $index) {}
+
+ /** @return bool */
+ public function unchangeName(string $name) {}
+
+ /** @return bool */
+ public function extractTo(string $pathto, $files = UNKNOWN) {}
+
+ /** @return string|false */
+ public function getFromName(string $entryname, int $len = 0, int $flags = 0) {}
+
+ /** @return string|false */
+ public function getFromIndex(int $index, int $len = 0, int $flags = 0) {}
+
+ /** @return resource|false */
+ public function getStream(string $entryname) {}
+
+#ifdef ZIP_OPSYS_DEFAULT
+ /** @return bool */
+ public function setExternalAttributesName(string $name, int $opsys, int $attr, int $flags = 0) {}
+
+ /** @return bool */
+ public function setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0) {}
+
+ /** @return bool */
+ public function getExternalAttributesName(string $name, &$opsys, &$attr, int $flags = 0) {}
+
+ /** @return bool */
+ public function getExternalAttributesIndex(int $index, &$opsys, &$attr, int $flags = 0) {}
+#endif
+
+ /** @return bool */
+ public function setCompressionName(string $name, int $method, int $compflags = 0) {}
+
+ /** @return bool */
+ public function setCompressionIndex(int $index, int $method, int $compflags = 0) {}
+
+#ifdef HAVE_ENCRYPTION
+ /** @return bool */
+ public function setEncryptionName(string $name, int $method, string $password = UNKNOWN) {}
+
+ /** @return bool */
+ public function setEncryptionIndex(int $index, int $method, string $password = UNKNOWN) {}
+#endif
+}
diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h
new file mode 100644
index 0000000000..1cb56c890d
--- /dev/null
+++ b/ext/zip/php_zip_arginfo.h
@@ -0,0 +1,229 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zip_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, zip)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, zip)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zip_entry_open, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, zip_dp)
+ ZEND_ARG_INFO(0, zip_entry)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zip_entry_close, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, zip_ent)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, zip_entry)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, zip_entry)
+ZEND_END_ARG_INFO()
+
+#define arginfo_zip_entry_compressedsize arginfo_zip_entry_name
+
+#define arginfo_zip_entry_filesize arginfo_zip_entry_name
+
+#define arginfo_zip_entry_compressionmethod arginfo_zip_entry_name
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setPassword, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ZipArchive_count arginfo_class_ZipArchive_close
+
+#define arginfo_class_ZipArchive_getStatusString arginfo_class_ZipArchive_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addEmptyDir, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, dirname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addFromString, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addFile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filepath, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addGlob, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addPattern, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_renameIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, new_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_renameName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, new_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setArchiveComment, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getArchiveComment, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCommentIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCommentName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getCommentIndex, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getCommentName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_deleteIndex, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_deleteName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ZipArchive_statName arginfo_class_ZipArchive_open
+
+#define arginfo_class_ZipArchive_statIndex arginfo_class_ZipArchive_getCommentIndex
+
+#define arginfo_class_ZipArchive_locateName arginfo_class_ZipArchive_open
+
+#define arginfo_class_ZipArchive_getNameIndex arginfo_class_ZipArchive_getCommentIndex
+
+#define arginfo_class_ZipArchive_unchangeArchive arginfo_class_ZipArchive_close
+
+#define arginfo_class_ZipArchive_unchangeAll arginfo_class_ZipArchive_close
+
+#define arginfo_class_ZipArchive_unchangeIndex arginfo_class_ZipArchive_deleteIndex
+
+#define arginfo_class_ZipArchive_unchangeName arginfo_class_ZipArchive_deleteName
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_extractTo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pathto, IS_STRING, 0)
+ ZEND_ARG_INFO(0, files)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getFromName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getFromIndex, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getStream, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setExternalAttributesName, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opsys, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setExternalAttributesIndex, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, opsys, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getExternalAttributesName, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(1, opsys)
+ ZEND_ARG_INFO(1, attr)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getExternalAttributesIndex, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_INFO(1, opsys)
+ ZEND_ARG_INFO(1, attr)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCompressionName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, compflags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCompressionIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, compflags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_ENCRYPTION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setEncryptionName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_ENCRYPTION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setEncryptionIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/zip/tests/bug72374.phpt b/ext/zip/tests/bug72374.phpt
new file mode 100644
index 0000000000..b214be3eaf
--- /dev/null
+++ b/ext/zip/tests/bug72374.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)
+--SKIPIF--
+<?php
+if(!extension_loaded('zip')) die('skip');
+?>
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+include $dirname . 'utils.inc';
+
+$dirname = $dirname . 'bug72374/';
+mkdir($dirname);
+$file = $dirname . 'some-foo.txt';
+touch($file);
+
+$zip = new ZipArchive();
+$zip->open($dirname . 'test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
+$zip->addGlob($file, 0, array('remove_path' => $dirname . 'some-'));
+$zip->addGlob($file, 0, array('remove_path' => $dirname));
+verify_entries($zip, ['foo.txt', '/some-foo.txt']);
+$zip->close();
+?>
+--CLEAN--
+<?php
+$dirname = dirname(__FILE__) . '/';
+include $dirname . 'utils.inc';
+
+$dirname = $dirname . 'bug72374/';
+rmdir_rf($dirname);
+?>
+--EXPECT--
diff --git a/ext/zip/tests/doubleclose.phpt b/ext/zip/tests/doubleclose.phpt
index 48547e3c72..eb0ed7a829 100644
--- a/ext/zip/tests/doubleclose.phpt
+++ b/ext/zip/tests/doubleclose.phpt
@@ -11,9 +11,13 @@ echo "Procedural\n";
$zip = zip_open(__DIR__ . '/test.zip');
if (!is_resource($zip)) {
die("Failure");
- }
-var_dump(zip_close($zip));
+}
var_dump(zip_close($zip));
+try {
+ var_dump(zip_close($zip));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Object\n";
$zip = new ZipArchive();
@@ -22,7 +26,11 @@ if (!$zip->open(__DIR__ . '/test.zip')) {
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
var_dump($zip->close());
- var_dump($zip->close());
+ try {
+ $zip->close();
+ } catch (ValueError $err) {
+ echo $err->getMessage(), PHP_EOL;
+ }
} else {
die("Failure");
}
@@ -32,12 +40,8 @@ Done
--EXPECTF--
Procedural
NULL
-
-Warning: zip_close(): supplied resource is not a valid Zip Directory resource in %s
-bool(false)
+zip_close(): supplied resource is not a valid Zip Directory resource
Object
bool(true)
-
-Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s
-bool(false)
+Invalid or uninitialized Zip object
Done
diff --git a/ext/zip/tests/oo_addpattern.phpt b/ext/zip/tests/oo_addpattern.phpt
index fe1a57368d..19453bee49 100644
--- a/ext/zip/tests/oo_addpattern.phpt
+++ b/ext/zip/tests/oo_addpattern.phpt
@@ -25,7 +25,7 @@ if (!$zip->open($file)) {
exit('failed');
}
$dir = realpath($dirname);
-$options = array('add_path' => 'baz/', 'remove_path' => $dir);
+$options = array('add_path' => 'baz', 'remove_path' => $dir);
if (!$zip->addPattern('/\.txt$/', $dir, $options)) {
echo "failed\n";
}
@@ -35,8 +35,8 @@ if ($zip->status == ZIPARCHIVE::ER_OK) {
"foobar/",
"foobar/baz",
"entry1.txt",
- "baz/foo.txt",
- "baz/bar.txt"
+ "baz" . DIRECTORY_SEPARATOR . "foo.txt",
+ "baz" . DIRECTORY_SEPARATOR . "bar.txt"
])) {
echo "failed\n";
} else {
diff --git a/ext/zip/tests/oo_getcomment.phpt b/ext/zip/tests/oo_getcomment.phpt
index 4301a8aa34..333dfa96bb 100644
--- a/ext/zip/tests/oo_getcomment.phpt
+++ b/ext/zip/tests/oo_getcomment.phpt
@@ -20,7 +20,6 @@ echo $zip->getCommentName('foo') . "\n";
echo $zip->getCommentIndex($idx);
echo $zip->getCommentName('') . "\n";
-echo $zip->getCommentName() . "\n";
$zip->close();
@@ -30,6 +29,3 @@ Zip archive comment
foo comment
foo comment
Notice: ZipArchive::getCommentName(): Empty string as entry name in %s on line %d
-
-
-Warning: ZipArchive::getCommentName() expects at least 1 parameter, 0 given in %s on line %d
diff --git a/ext/zip/tests/oo_getnameindex.phpt b/ext/zip/tests/oo_getnameindex.phpt
index 91793b2d1d..838a5a91b1 100644
--- a/ext/zip/tests/oo_getnameindex.phpt
+++ b/ext/zip/tests/oo_getnameindex.phpt
@@ -44,3 +44,7 @@ string(10) "entry1.txt"
string(10) "entry2.txt"
string(15) "dir/entry2d.txt"
bool(false)
+--CLEAN--
+<?php
+unlink(__DIR__ . '/oo_getnameindex.zip');
+?>
diff --git a/ext/zip/tests/oo_namelocate.phpt b/ext/zip/tests/oo_namelocate.phpt
index 714346aba4..f6c837ac20 100644
--- a/ext/zip/tests/oo_namelocate.phpt
+++ b/ext/zip/tests/oo_namelocate.phpt
@@ -43,3 +43,7 @@ int(0)
bool(false)
int(1)
int(2)
+--CLEAN--
+<?php
+unlink(__DIR__ . '/oo_namelocate.zip');
+?>
diff --git a/ext/zip/tests/oo_properties.phpt b/ext/zip/tests/oo_properties.phpt
index b435d6c159..108a85e29b 100644
--- a/ext/zip/tests/oo_properties.phpt
+++ b/ext/zip/tests/oo_properties.phpt
@@ -40,7 +40,7 @@ zip->numFiles (4):
empty(): 0
isset(): 1
-Notice: Undefined property: ZipArchive::$bogus in %s on line %d
+Warning: Undefined property: ZipArchive::$bogus in %s on line %d
zip->bogus (0):
empty(): 1
isset(): 0
diff --git a/ext/zip/tests/zip_entry_close.phpt b/ext/zip/tests/zip_entry_close.phpt
index 2f2581b2d0..f11f3112a9 100644
--- a/ext/zip/tests/zip_entry_close.phpt
+++ b/ext/zip/tests/zip_entry_close.phpt
@@ -10,14 +10,16 @@ $zip = zip_open(__DIR__."/test_procedural.zip");
$entry = zip_read($zip);
echo "entry_open: "; var_dump(zip_entry_open($zip, $entry, "r"));
echo "entry_close: "; var_dump(zip_entry_close($entry));
-echo "entry_close: "; var_dump(zip_entry_close($entry));
+try {
+ echo "entry_close: "; var_dump(zip_entry_close($entry));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
zip_close($zip);
?>
Done
---EXPECTF--
+--EXPECT--
entry_open: bool(true)
entry_close: bool(true)
-entry_close:
-Warning: zip_entry_close(): supplied resource is not a valid Zip Entry resource in %s
-bool(false)
+entry_close: zip_entry_close(): supplied resource is not a valid Zip Entry resource
Done
diff --git a/ext/zip/tests/zip_open_error.phpt b/ext/zip/tests/zip_open_error.phpt
index eaa1d9731e..068956b81f 100644
--- a/ext/zip/tests/zip_open_error.phpt
+++ b/ext/zip/tests/zip_open_error.phpt
@@ -12,10 +12,7 @@ if(!extension_loaded('zip')) die('skip');
echo "Test case 1:";
$zip = zip_open("");
-echo "Test case 2:";
-$zip = zip_open("i_dont_care_about_this_parameter", "this_is_one_to_many");
-
-echo "Test case 3:\n";
+echo "Test case 2:\n";
$zip = zip_open("/non_exisitng_directory/test_procedural.zip");
echo is_resource($zip) ? "OK" : "Failure";
?>
@@ -23,6 +20,4 @@ echo is_resource($zip) ? "OK" : "Failure";
Test case 1:
Warning: zip_open(): Empty string as source in %s on line %d
Test case 2:
-Warning: zip_open() expects exactly 1 parameter, 2 given in %s on line %d
-Test case 3:
Failure
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index bce62f5614..58fcb0322b 100644
--- a/ext/zip/zip_stream.c
+++ b/ext/zip/zip_stream.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/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 8e77ee62b2..b8f25015ae 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.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/ext/zlib/tests/004-mb.phpt b/ext/zlib/tests/004-mb.phpt
index 07a26e5294..2b27beb66b 100644
--- a/ext/zlib/tests/004-mb.phpt
+++ b/ext/zlib/tests/004-mb.phpt
@@ -5,9 +5,7 @@ gzfile() with various invalid params
--FILE--
<?php
-var_dump(gzfile());
var_dump(gzfile("nonexistent_file_gzfile",1));
-var_dump(gzfile(1,1,1));
var_dump(gzfile(__DIR__."/004ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.gz"));
var_dump(gzfile(__DIR__."/004ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.gz", 1));
@@ -15,14 +13,8 @@ var_dump(gzfile(__DIR__."/004ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.gz", 1));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d
bool(false)
-
-Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d
-NULL
array(6) {
[0]=>
string(36) "When you're taught through feelings
diff --git a/ext/zlib/tests/004.phpt b/ext/zlib/tests/004.phpt
index 7689ad0cf1..94e0beba62 100644
--- a/ext/zlib/tests/004.phpt
+++ b/ext/zlib/tests/004.phpt
@@ -5,9 +5,7 @@ gzfile() with various invalid params
--FILE--
<?php
-var_dump(gzfile());
var_dump(gzfile("nonexistent_file_gzfile",1));
-var_dump(gzfile(1,1,1));
var_dump(gzfile(__DIR__."/004.txt.gz"));
var_dump(gzfile(__DIR__."/004.txt.gz", 1));
@@ -15,14 +13,8 @@ var_dump(gzfile(__DIR__."/004.txt.gz", 1));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d
bool(false)
-
-Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d
-NULL
array(6) {
[0]=>
string(36) "When you're taught through feelings
diff --git a/ext/zlib/tests/005.phpt b/ext/zlib/tests/005.phpt
index daa178ec69..cf93859d44 100644
--- a/ext/zlib/tests/005.phpt
+++ b/ext/zlib/tests/005.phpt
@@ -5,7 +5,6 @@ gzcompress()/gzuncompress() and invalid params
--FILE--
<?php
-var_dump(gzcompress());
var_dump(gzcompress("", 1000));
var_dump(gzcompress("", -1));
@@ -19,7 +18,6 @@ Desolation, grief and agony";
var_dump($data1 = gzcompress($string));
var_dump($data2 = gzcompress($string, 9));
-var_dump(gzuncompress());
var_dump(gzuncompress("", 1000));
var_dump(gzuncompress("", -1));
@@ -34,9 +32,6 @@ var_dump(gzuncompress($data2));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d
bool(false)
string(%d) "%a"
@@ -45,9 +40,6 @@ string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
-Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzuncompress(): %s error in %s on line %d
bool(false)
diff --git a/ext/zlib/tests/006.phpt b/ext/zlib/tests/006.phpt
index 1caebd7a62..ad1eb25f12 100644
--- a/ext/zlib/tests/006.phpt
+++ b/ext/zlib/tests/006.phpt
@@ -5,7 +5,6 @@ gzdeflate()/gzinflate() and invalid params
--FILE--
<?php
-var_dump(gzdeflate());
var_dump(gzdeflate("", 1000));
var_dump(gzdeflate("", -1));
@@ -19,7 +18,6 @@ Desolation, grief and agony";
var_dump($data1 = gzdeflate($string));
var_dump($data2 = gzdeflate($string, 9));
-var_dump(gzinflate());
var_dump(gzinflate(""));
var_dump(gzinflate("asfwe", 1000));
var_dump(gzinflate("asdf", -1));
@@ -35,9 +33,6 @@ var_dump(gzinflate($data2));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzdeflate(): compression level (1000) must be within -1..9 in %s on line %d
bool(false)
string(%d) "%a"
@@ -46,9 +41,6 @@ string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
-Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzinflate(): data error in %s on line %d
bool(false)
diff --git a/ext/zlib/tests/007.phpt b/ext/zlib/tests/007.phpt
index 6c42bf67db..6028104b9a 100644
--- a/ext/zlib/tests/007.phpt
+++ b/ext/zlib/tests/007.phpt
@@ -5,8 +5,6 @@ gzencode() and invalid params
--FILE--
<?php
-var_dump(gzencode());
-var_dump(gzencode(1,1,1,1));
var_dump(gzencode("", -10));
var_dump(gzencode("", 100));
var_dump(gzencode("", 1, 100));
@@ -27,12 +25,6 @@ var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: gzencode(): compression level (-10) must be within -1..9 in %s on line %d
bool(false)
diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt
index 0393db2c57..df8ab9c614 100644
--- a/ext/zlib/tests/gzclose_basic.phpt
+++ b/ext/zlib/tests/gzclose_basic.phpt
@@ -17,23 +17,29 @@ gzread($h, 20);
var_dump(gzclose($h));
//should fail.
-gzread($h, 20);
+try {
+ gzread($h, 20);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$h = gzopen($f, 'r');
gzread($h, 20);
var_dump(fclose($h));
//should fail.
-gzread($h, 20);
+try {
+ gzread($h, 20);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: gzread(): supplied resource is not a valid stream resource in %s on line %d
+gzread(): supplied resource is not a valid stream resource
bool(true)
-
-Warning: gzread(): supplied resource is not a valid stream resource in %s on line %d
+gzread(): supplied resource is not a valid stream resource
===DONE===
diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt
index 3f742a4dca..3601c61b53 100644
--- a/ext/zlib/tests/gzcompress_error1.phpt
+++ b/ext/zlib/tests/gzcompress_error1.phpt
@@ -20,53 +20,22 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzcompress() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzcompress() function with Zero arguments --\n";
-var_dump( gzcompress() );
-
-//Test gzcompress with one more than the expected number of arguments
-echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n";
-$data = 'string_val';
-$level = 2;
-$encoding = ZLIB_ENCODING_RAW;
-$extra_arg = 10;
-var_dump( gzcompress($data, $level, $encoding, $extra_arg) );
-
echo "\n-- Testing with incorrect compression level --\n";
+$data = 'string_val';
$bad_level = 99;
var_dump(gzcompress($data, $bad_level));
echo "\n-- Testing with invalid encoding --\n";
$data = 'string_val';
+$level = 2;
$encoding = 99;
var_dump(gzcompress($data, $level, $encoding));
-echo "\n-- Testing with incorrect parameters --\n";
-
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-$testclass = new Tester();
-var_dump(gzcompress($testclass));
-
?>
===Done===
--EXPECTF--
*** Testing gzcompress() : error conditions ***
--- Testing gzcompress() function with Zero arguments --
-
-Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzcompress() function with more than expected no. of arguments --
-
-Warning: gzcompress() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing with incorrect compression level --
Warning: gzcompress(): compression level (99) must be within -1..9 in %s on line %d
@@ -76,9 +45,4 @@ bool(false)
Warning: gzcompress(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzcompress() expects parameter 1 to be string, object given in %s on line %d
-NULL
===Done===
diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt
index 93f8c03b4c..af74d1c771 100644
--- a/ext/zlib/tests/gzdeflate_error1.phpt
+++ b/ext/zlib/tests/gzdeflate_error1.phpt
@@ -20,52 +20,22 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzdeflate() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzdeflate() function with Zero arguments --\n";
-var_dump( gzdeflate() );
-
-//Test gzdeflate with one more than the expected number of arguments
-echo "\n-- Testing gzdeflate() function with more than expected no. of arguments --\n";
$data = 'string_val';
-$level = 2;
-$encoding = ZLIB_ENCODING_RAW;
-$extra_arg = 10;
-var_dump( gzdeflate($data, $level, $encoding, $extra_arg) );
echo "\n-- Testing with incorrect compression level --\n";
$bad_level = 99;
var_dump(gzdeflate($data, $bad_level));
echo "\n-- Testing with incorrect encoding --\n";
+$level = 2;
$bad_encoding = 99;
var_dump(gzdeflate($data, $level, $bad_encoding));
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-echo "\n-- Testing with incorrect parameters --\n";
-$testclass = new Tester();
-var_dump(gzdeflate($testclass));
-var_dump(gzdeflate($data, $testclass));
-
?>
===Done===
--EXPECTF--
*** Testing gzdeflate() : error conditions ***
--- Testing gzdeflate() function with Zero arguments --
-
-Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzdeflate() function with more than expected no. of arguments --
-
-Warning: gzdeflate() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing with incorrect compression level --
Warning: gzdeflate(): compression level (99) must be within -1..9 in %s on line %d
@@ -75,12 +45,4 @@ bool(false)
Warning: gzdeflate(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzdeflate() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzdeflate() expects parameter 2 to be int, object given in %s on line %d
-NULL
===Done===
diff --git a/ext/zlib/tests/gzencode_error1.phpt b/ext/zlib/tests/gzencode_error1.phpt
index ac846866c5..15b70afb8a 100644
--- a/ext/zlib/tests/gzencode_error1.phpt
+++ b/ext/zlib/tests/gzencode_error1.phpt
@@ -20,17 +20,9 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzencode() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzencode() function with Zero arguments --\n";
-var_dump( gzencode() );
-
-//Test gzencode with one more than the expected number of arguments
-echo "\n-- Testing gzencode() function with more than expected no. of arguments --\n";
$data = 'string_val';
$level = 2;
$encoding_mode = FORCE_DEFLATE;
-$extra_arg = 10;
-var_dump( gzencode($data, $level, $encoding_mode, $extra_arg) );
echo "\n-- Testing with incorrect compression level --\n";
$bad_level = 99;
@@ -40,35 +32,11 @@ echo "\n-- Testing with incorrect encoding_mode --\n";
$bad_mode = 99;
var_dump(gzencode($data, $level, $bad_mode));
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-echo "\n-- Testing with incorrect parameters --\n";
-$testclass = new Tester();
-var_dump(gzencode($testclass));
-var_dump(gzencode($data, $testclass));
-var_dump(gzencode($data, -1, 99.99));
-var_dump(gzencode($data, -1, $testclass));
-var_dump(gzencode($data, "a very none numeric string\n"));
-
?>
===Done===
--EXPECTF--
*** Testing gzencode() : error conditions ***
--- Testing gzencode() function with Zero arguments --
-
-Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzencode() function with more than expected no. of arguments --
-
-Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing with incorrect compression level --
Warning: gzencode(): compression level (99) must be within -1..9 in %s on line %d
@@ -78,21 +46,4 @@ bool(false)
Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzencode() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzencode() expects parameter 2 to be int, object given in %s on line %d
-NULL
-
-Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
-
-Warning: gzencode() expects parameter 3 to be int, object given in %s on line %d
-NULL
-
-Warning: gzencode() expects parameter 2 to be int, string given in %s on line %d
-NULL
===Done===
diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt
index 4a845917af..66d70ebd8b 100644
--- a/ext/zlib/tests/gzeof_variation1.phpt
+++ b/ext/zlib/tests/gzeof_variation1.phpt
@@ -18,14 +18,16 @@ var_dump(gzeof($h));
gzwrite( $h, $str, $length);
var_dump(gzeof($h));
gzclose($h);
-var_dump(gzeof($h));
+try {
+ var_dump(gzeof($h));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
unlink($filename);
?>
===DONE===
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
-
-Warning: gzeof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+gzeof(): supplied resource is not a valid stream resource
===DONE===
diff --git a/ext/zlib/tests/gzgetss.phpt b/ext/zlib/tests/gzgetss.phpt
deleted file mode 100644
index 58d13ab733..0000000000
--- a/ext/zlib/tests/gzgetss.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-gzgetss — Get line from gz-file pointer and strip HTML tags - function
---CREDITS--
-marcosptf - <marcosptf@yahoo.com.br>
---SKIPIF--
-<?php
-if(!extension_loaded("zlib")){die("skip - ZLIB extension not loaded");}
-?>
---FILE--
-<?php
-$handle = gzopen(__DIR__ . '/gzgetss.gz', 'r');
-
-while (!gzeof($handle)){
- $buffer = gzgetss($handle, 4096, "<code>");
- print($buffer);
-}
-gzclose($handle);
-?>
---EXPECTF--
-Deprecated: Function gzgetss() is deprecated in %s on line %d
-
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
-
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
- <code>stringgzgetss(resource $zp, int $length [, string $allowable_tags ]);<code/>
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
-
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
diff --git a/ext/zlib/tests/gzinflate_error1.phpt b/ext/zlib/tests/gzinflate_error1.phpt
index fd65f54e55..6de1349d61 100644
--- a/ext/zlib/tests/gzinflate_error1.phpt
+++ b/ext/zlib/tests/gzinflate_error1.phpt
@@ -18,58 +18,20 @@ include(__DIR__ . '/data.inc');
echo "*** Testing gzinflate() : error conditions ***\n";
-echo "\n-- Testing gzcompress() function with Zero arguments --\n";
-var_dump( gzinflate() );
-
-echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n";
-$data = 'string_val';
-$length = 10;
-$extra_arg = 10;
-var_dump( gzinflate($data, $length, $extra_arg) );
-
echo "\n-- Testing with a buffer that is too small --\n";
+$data = 'string_val';
$short_len = strlen($data) - 1;
$compressed = gzcompress($data);
var_dump(gzinflate($compressed, $short_len));
-echo "\n-- Testing with incorrect parameters --\n";
-
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-$testclass = new Tester();
-var_dump(gzinflate($testclass));
-var_dump(gzinflate($data, $testclass));
-
?>
===DONE===
--EXPECTF--
*** Testing gzinflate() : error conditions ***
--- Testing gzcompress() function with Zero arguments --
-
-Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzcompress() function with more than expected no. of arguments --
-
-Warning: gzinflate() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing with a buffer that is too small --
Warning: gzinflate(): data error in %s on line %d
bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzinflate() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzinflate() expects parameter 2 to be int, object given in %s on line %d
-NULL
===DONE===
diff --git a/ext/zlib/tests/gzopen_variation4.phpt b/ext/zlib/tests/gzopen_variation4.phpt
index 6a00c30670..909d003537 100644
--- a/ext/zlib/tests/gzopen_variation4.phpt
+++ b/ext/zlib/tests/gzopen_variation4.phpt
@@ -31,73 +31,82 @@ foreach($modes as $mode) {
chdir($baseDir);
rmdir($workingDir);
foreach($newdirs as $newdir) {
- rmdir($newdir);
+ rmdir($newdir);
}
chdir("..");
rmdir($thisTestDir);
function test_gzopen($mode) {
- global $scriptFile, $secondFile, $firstFile, $filename;
-
- // create a file in the middle directory
- $h = gzopen($secondFile, "w");
- gzwrite($h, "This is a file in dir2");
- gzclose($h);
-
- echo "\n** testing with mode=$mode **\n";
- // should read dir2 file
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- //create a file in dir1
- $h = gzopen($firstFile, "w");
- gzwrite($h, "This is a file in dir1");
- gzclose($h);
-
- //should now read dir1 file
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- // create a file in working directory
- $h = gzopen($filename, "w");
- gzwrite($h, "This is a file in working dir");
- gzclose($h);
-
- //should still read dir1 file
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- unlink($firstFile);
- unlink($secondFile);
-
- //should read the file in working dir
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- // create a file in the script directory
- $h = gzopen($scriptFile, "w");
- gzwrite($h, "This is a file in script dir");
- gzclose($h);
-
- //should read the file in script dir
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- //cleanup
- unlink($filename);
- unlink($scriptFile);
-
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = gzopen($secondFile, "w");
+ gzwrite($h, "This is a file in dir2");
+ gzclose($h);
+
+ echo "\n** testing with mode=$mode **\n";
+ // should read dir2 file
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ //create a file in dir1
+ $h = gzopen($firstFile, "w");
+ gzwrite($h, "This is a file in dir1");
+ gzclose($h);
+
+ //should now read dir1 file
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ // create a file in working directory
+ $h = gzopen($filename, "w");
+ gzwrite($h, "This is a file in working dir");
+ gzclose($h);
+
+ //should still read dir1 file
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the file in working dir
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ // create a file in the script directory
+ $h = gzopen($scriptFile, "w");
+ gzwrite($h, "This is a file in script dir");
+ gzclose($h);
+
+ //should read the file in script dir
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
}
?>
@@ -118,39 +127,14 @@ This is a file in script dir
Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
** testing with mode=rt **
This is a file in dir2
This is a file in dir1
diff --git a/ext/zlib/tests/gzuncompress_error1.phpt b/ext/zlib/tests/gzuncompress_error1.phpt
index f200951d4c..8683a6c829 100644
--- a/ext/zlib/tests/gzuncompress_error1.phpt
+++ b/ext/zlib/tests/gzuncompress_error1.phpt
@@ -16,18 +16,8 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzuncompress() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzuncompress() function with Zero arguments --\n";
-var_dump( gzuncompress() );
-
-//Test gzuncompress with one more than the expected number of arguments
-echo "\n-- Testing gzuncompress() function with more than expected no. of arguments --\n";
-$data = 'string_val';
-$length = 10;
-$extra_arg = 10;
-var_dump( gzuncompress($data, $length, $extra_arg) );
-
echo "\n-- Testing with a buffer that is too small --\n";
+$data = 'string_val';
$short_len = strlen($data) - 1;
$compressed = gzcompress($data);
@@ -36,32 +26,11 @@ var_dump(gzuncompress($compressed, $short_len));
echo "\n-- Testing with incorrect arguments --\n";
var_dump(gzuncompress(123));
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-$testclass = new Tester();
-var_dump(gzuncompress($testclass));
-
-var_dump(gzuncompress($compressed, "this is not a number\n"));
-
?>
===DONE===
--EXPECTF--
*** Testing gzuncompress() : error conditions ***
--- Testing gzuncompress() function with Zero arguments --
-
-Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzuncompress() function with more than expected no. of arguments --
-
-Warning: gzuncompress() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing with a buffer that is too small --
Warning: gzuncompress(): insufficient memory in %s on line %d
@@ -71,10 +40,4 @@ bool(false)
Warning: gzuncompress(): data error in %s on line %d
bool(false)
-
-Warning: gzuncompress() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzuncompress() expects parameter 2 to be int, string given in %s on line %d
-NULL
===DONE===
diff --git a/ext/zlib/tests/inflate_init_error.phpt b/ext/zlib/tests/inflate_init_error.phpt
index 58773e61d3..504f795aec 100644
--- a/ext/zlib/tests/inflate_init_error.phpt
+++ b/ext/zlib/tests/inflate_init_error.phpt
@@ -8,12 +8,8 @@ if (!extension_loaded("zlib")) {
?>
--FILE--
<?php
-var_dump(inflate_init());
var_dump(inflate_init(42));
?>
--EXPECTF--
-Warning: inflate_init() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: inflate_init(): encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
bool(false)
diff --git a/ext/zlib/tests/readgzfile_variation10.phpt b/ext/zlib/tests/readgzfile_variation10.phpt
deleted file mode 100644
index 731445dbf0..0000000000
--- a/ext/zlib/tests/readgzfile_variation10.phpt
+++ /dev/null
@@ -1,67 +0,0 @@
---TEST--
-Test function readgzfile() by substituting argument 2 with emptyUnsetUndefNull values.
---SKIPIF--
-<?php
-if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
-?>
---FILE--
-<?php
-
-
-$filename = __DIR__."/004.txt.gz";
-
-
-$unset_var = 10;
-unset($unset_var);
-
-$variation = array(
- 'unset var' => @$unset_var,
- 'undefined var' => @$undefined_var,
- 'empty string DQ' => "",
- 'empty string SQ' => '',
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
- );
-
-
-foreach ( $variation as $var ) {
- var_dump(readgzfile( $filename, $var ) );
-}
-?>
-===DONE===
---EXPECTF--
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-
-Warning: readgzfile() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
-Warning: readgzfile() expects parameter 2 to be int, string given in %s on line %d
-NULL
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-===DONE===
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 9060dcb2e2..e9fe6b0a8a 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.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, |
@@ -31,6 +29,7 @@
#include "ext/standard/file.h"
#include "ext/standard/php_string.h"
#include "php_zlib.h"
+#include "zlib_arginfo.h"
/*
* zlib include files can define the following preprocessor defines which rename
@@ -1252,154 +1251,20 @@ ZEND_TSRMLS_CACHE_DEFINE()
ZEND_GET_MODULE(php_zlib)
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_gzhandler, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_zlib_get_coding_type, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzopen, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readgzfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_encode, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzdeflate, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzencode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzcompress, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzinflate, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzdecode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzuncompress, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzputs, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gzpassthru, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzseek, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, whence)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gzread, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgetss, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgets, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_init, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_add, 0, 0, 2)
- ZEND_ARG_INFO(0, resource)
- ZEND_ARG_INFO(0, add)
- ZEND_ARG_INFO(0, flush_behavior)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_init, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_add, 0, 0, 2)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, encoded_data)
- ZEND_ARG_INFO(0, flush_mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_status, 0, 0, 1)
- ZEND_ARG_INFO(0, resource)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_read_len, 0, 0, 1)
- ZEND_ARG_INFO(0, resource)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ php_zlib_functions[] */
static const zend_function_entry php_zlib_functions[] = {
PHP_FE(readgzfile, arginfo_readgzfile)
- PHP_FALIAS(gzrewind, rewind, arginfo_gzpassthru)
- PHP_FALIAS(gzclose, fclose, arginfo_gzpassthru)
- PHP_FALIAS(gzeof, feof, arginfo_gzpassthru)
- PHP_FALIAS(gzgetc, fgetc, arginfo_gzpassthru)
+ PHP_FALIAS(gzrewind, rewind, arginfo_gzrewind)
+ PHP_FALIAS(gzclose, fclose, arginfo_gzclose)
+ PHP_FALIAS(gzeof, feof, arginfo_gzeof)
+ PHP_FALIAS(gzgetc, fgetc, arginfo_gzgetc)
PHP_FALIAS(gzgets, fgets, arginfo_gzgets)
- PHP_DEP_FALIAS(gzgetss, fgetss, arginfo_gzgetss)
PHP_FALIAS(gzread, fread, arginfo_gzread)
PHP_FE(gzopen, arginfo_gzopen)
PHP_FALIAS(gzpassthru, fpassthru, arginfo_gzpassthru)
PHP_FALIAS(gzseek, fseek, arginfo_gzseek)
- PHP_FALIAS(gztell, ftell, arginfo_gzpassthru)
- PHP_FALIAS(gzwrite, fwrite, arginfo_gzputs)
+ PHP_FALIAS(gztell, ftell, arginfo_gztell)
+ PHP_FALIAS(gzwrite, fwrite, arginfo_gzwrite)
PHP_FALIAS(gzputs, fwrite, arginfo_gzputs)
PHP_FE(gzfile, arginfo_gzfile)
PHP_FE(gzcompress, arginfo_gzcompress)
diff --git a/ext/zlib/zlib.stub.php b/ext/zlib/zlib.stub.php
new file mode 100644
index 0000000000..9b3fb04be4
--- /dev/null
+++ b/ext/zlib/zlib.stub.php
@@ -0,0 +1,131 @@
+<?php
+
+/** @return string|false */
+function ob_gzhandler(string $data, int $flags) {}
+
+/** @return string|false */
+function zlib_get_coding_type() {}
+
+/** @return array|false */
+function gzfile(string $filename, int $use_include_path = 0) {}
+
+/** @return resource|false */
+function gzopen(string $filename, string $mode, int $use_include_path = 0) {}
+
+/** @return int|false */
+function readgzfile(string $filename, int $use_include_path = 0) {}
+
+/** @return string|false */
+function zlib_encode(string $data, int $encoding, int $level = -1) {}
+
+/** @return string|false */
+function zlib_decode(string $data, int $max_decoded_len = 0) {}
+
+/** @return string|false */
+function gzdeflate(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_RAW) {}
+
+/** @return string|false */
+function gzencode(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_GZIP) {}
+
+/** @return string|false */
+function gzcompress(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_DEFLATE) {}
+
+/** @return string|false */
+function gzinflate(string $data, int $max_decoded_len = 0) {}
+
+/** @return string|false */
+function gzdecode(string $data, int $max_decoded_len = 0) {}
+
+/** @return string|false */
+function gzuncompress(string $data, int $max_decoded_len = 0) {}
+
+/**
+ * @param resource $fp
+ *
+ * @return int|false
+ */
+function gzwrite($fp, string $str, int $length = UNKNOWN) {};
+
+/**
+ * @param resource $fp
+ *
+ * @return int|false
+ */
+function gzputs($fp, string $str, int $length = UNKNOWN) {};
+
+/** @param resource $fp */
+function gzrewind($fp): bool {};
+
+/** @param resource $fp */
+function gzclose($fp): bool {};
+
+/** @param resource $fp */
+function gzeof($fp): bool {};
+
+/**
+ * @param resource $fp
+ *
+ * @return string|false
+ */
+function gzgetc($fp) {};
+
+/** @param resource $fp */
+function gzpassthru($fp): int {};
+
+/** @param resource $fp */
+function gzseek($fp, int $offset, int $whence = SEEK_SET): int {};
+
+/**
+ * @param resource $fp
+ *
+ * @return int|false
+ */
+function gztell($fp) {};
+
+/**
+ * @param resource $fp
+ *
+ * @return string|false
+ */
+function gzread($fp, int $length) {};
+
+/**
+ * @param resource $fp
+ *
+ * @return string|false
+ */
+function gzgets($fp, int $length = 1024) {};
+
+/** @return resource|false */
+function deflate_init(int $encoding, array $options = []) {};
+
+/**
+ * @param resource $resource
+ *
+ * @return string|false
+ */
+function deflate_add($resource, string $add, int $flush_behavior = ZLIB_SYNC_FLUSH) {};
+
+/** @return resource|false */
+function inflate_init(int $encoding, array $options = []) {};
+
+/**
+ * @param resource $context
+ *
+ * @return string|false
+ */
+function inflate_add($context, string $encoded_data, int $flush_mode = ZLIB_SYNC_FLUSH) {};
+
+/**
+ * @param resource $resource
+ *
+ * @return int|false
+ */
+function inflate_get_status($resource) {};
+
+/**
+ * @param resource $resource
+ *
+ * @return int|false
+ */
+function inflate_get_read_len($resource) {};
diff --git a/ext/zlib/zlib_arginfo.h b/ext/zlib/zlib_arginfo.h
new file mode 100644
index 0000000000..46b9e74608
--- /dev/null
+++ b/ext/zlib/zlib_arginfo.h
@@ -0,0 +1,116 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_gzhandler, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_get_coding_type, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzfile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzopen, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_readgzfile arginfo_gzfile
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_encode, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, max_decoded_len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzdeflate, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gzencode arginfo_gzdeflate
+
+#define arginfo_gzcompress arginfo_gzdeflate
+
+#define arginfo_gzinflate arginfo_zlib_decode
+
+#define arginfo_gzdecode arginfo_zlib_decode
+
+#define arginfo_gzuncompress arginfo_zlib_decode
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzwrite, 0, 0, 2)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gzputs arginfo_gzwrite
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gzrewind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gzclose arginfo_gzrewind
+
+#define arginfo_gzeof arginfo_gzrewind
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgetc, 0, 0, 1)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gzpassthru, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gzseek, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, whence, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gztell arginfo_gzgetc
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzread, 0, 0, 2)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgets, 0, 0, 1)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_init, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_add, 0, 0, 2)
+ ZEND_ARG_INFO(0, resource)
+ ZEND_ARG_TYPE_INFO(0, add, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flush_behavior, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_inflate_init arginfo_deflate_init
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_add, 0, 0, 2)
+ ZEND_ARG_INFO(0, context)
+ ZEND_ARG_TYPE_INFO(0, encoded_data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flush_mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_status, 0, 0, 1)
+ ZEND_ARG_INFO(0, resource)
+ZEND_END_ARG_INFO()
+
+#define arginfo_inflate_get_read_len arginfo_inflate_get_status
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 3654a140fd..9026fcfedf 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.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/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index 514773f2b0..316c121bff 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.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/main/SAPI.c b/main/SAPI.c
index a5a68f8c68..696cd9e249 100644
--- a/main/SAPI.c
+++ b/main/SAPI.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/main/SAPI.h b/main/SAPI.h
index fe8bfd6244..dcb4c13845 100644
--- a/main/SAPI.h
+++ b/main/SAPI.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/main/build-defs.h.in b/main/build-defs.h.in
index f007526846..374996c64a 100644
--- a/main/build-defs.h.in
+++ b/main/build-defs.h.in
@@ -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/main/explicit_bzero.c b/main/explicit_bzero.c
index 57d12080c6..b3c59813d7 100644
--- a/main/explicit_bzero.c
+++ b/main/explicit_bzero.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/main/fastcgi.c b/main/fastcgi.c
index f8044ffce3..dacb06bcfe 100644
--- a/main/fastcgi.c
+++ b/main/fastcgi.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/main/fastcgi.h b/main/fastcgi.h
index 95aae11e41..5e15c14d4b 100644
--- a/main/fastcgi.h
+++ b/main/fastcgi.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/main/fopen_wrappers.c b/main/fopen_wrappers.c
index b0bfa4feda..294926e7af 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.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/main/fopen_wrappers.h b/main/fopen_wrappers.h
index 17e15b7df0..0f70bb4231 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.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/main/getopt.c b/main/getopt.c
index c01a726e99..fc96ad7e08 100644
--- a/main/getopt.c
+++ b/main/getopt.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/main/http_status_codes.h b/main/http_status_codes.h
index 5d5cfb08c3..cf66eabad7 100644
--- a/main/http_status_codes.h
+++ b/main/http_status_codes.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/main/internal_functions.c.in b/main/internal_functions.c.in
index 59557c9651..41458fb366 100644
--- a/main/internal_functions.c.in
+++ b/main/internal_functions.c.in
@@ -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/main/internal_functions_win32.c b/main/internal_functions_win32.c
index 4a3301e49b..bbee5fd0e7 100644
--- a/main/internal_functions_win32.c
+++ b/main/internal_functions_win32.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/main/main.c b/main/main.c
index 5c81ea046d..d24021a1fd 100644
--- a/main/main.c
+++ b/main/main.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, |
@@ -731,7 +729,7 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode)
- STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
+ STD_PHP_INI_BOOLEAN("display_startup_errors", "1", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("docref_root", "", PHP_INI_ALL, OnUpdateString, docref_root, php_core_globals, core_globals)
@@ -753,7 +751,6 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("serialize_precision", "-1", PHP_INI_ALL, OnSetSerializePrecision, serialize_precision, php_core_globals, core_globals)
@@ -1117,18 +1114,6 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
efree(docref_buf);
}
- if (PG(track_errors) && module_initialized && EG(active) &&
- (Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
- zval tmp;
- ZVAL_STRINGL(&tmp, buffer, buffer_len);
- if (EG(current_execute_data)) {
- if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) {
- zval_ptr_dtor(&tmp);
- }
- } else {
- zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
- }
- }
if (replace_buffer) {
zend_string_free(replace_buffer);
} else {
@@ -1207,10 +1192,11 @@ PHPAPI void php_html_puts(const char *str, size_t size)
/* {{{ php_error_cb
extended error handling function */
-static ZEND_COLD void php_error_cb(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args)
+static ZEND_COLD void php_error_cb(int orig_type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args)
{
char *buffer;
int buffer_len, display;
+ int type = orig_type & E_ALL;
buffer_len = (int)vspprintf(&buffer, PG(log_errors_max_len), format, args);
@@ -1418,7 +1404,7 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u
sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
}
/* the parser would return 1 (failure), we can bail out nicely */
- if (type != E_PARSE) {
+ if (!(orig_type & E_DONT_BAIL)) {
/* restore memory limit */
zend_set_memory_limit(PG(memory_limit));
efree(buffer);
@@ -1430,25 +1416,6 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u
break;
}
- /* Log if necessary */
- if (!display) {
- efree(buffer);
- return;
- }
-
- if (PG(track_errors) && module_initialized && EG(active)) {
- zval tmp;
-
- ZVAL_STRINGL(&tmp, buffer, buffer_len);
- if (EG(current_execute_data)) {
- if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) {
- zval_ptr_dtor(&tmp);
- }
- } else {
- zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
- }
- }
-
efree(buffer);
}
/* }}} */
@@ -2365,13 +2332,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
struct {
const long error_level;
const char *phrase;
- const char *directives[17]; /* Remember to change this if the number of directives change */
+ const char *directives[18]; /* Remember to change this if the number of directives change */
} directives[2] = {
{
E_DEPRECATED,
"Directive '%s' is deprecated",
{
- "track_errors",
"allow_url_include",
NULL
}
@@ -2396,6 +2362,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
"safe_mode_allowed_env_vars",
"safe_mode_protected_env_vars",
"zend.ze1_compatibility_mode",
+ "track_errors",
NULL
}
}
diff --git a/main/network.c b/main/network.c
index 29b98ae69e..5f1957e0fd 100644
--- a/main/network.c
+++ b/main/network.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/main/output.c b/main/output.c
index 7751586dbc..6436a220e7 100644
--- a/main/output.c
+++ b/main/output.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, |
@@ -1392,7 +1390,7 @@ PHP_FUNCTION(ob_end_clean)
}
/* }}} */
-/* {{{ proto bool ob_get_flush(void)
+/* {{{ proto string|false ob_get_flush(void)
Get current buffer contents, flush (send) the output buffer, and delete current output buffer */
PHP_FUNCTION(ob_get_flush)
{
@@ -1411,7 +1409,7 @@ PHP_FUNCTION(ob_get_flush)
}
/* }}} */
-/* {{{ proto bool ob_get_clean(void)
+/* {{{ proto string|false ob_get_clean(void)
Get current buffer contents and delete current output buffer */
PHP_FUNCTION(ob_get_clean)
{
@@ -1434,7 +1432,7 @@ PHP_FUNCTION(ob_get_clean)
}
/* }}} */
-/* {{{ proto string ob_get_contents(void)
+/* {{{ proto string|false ob_get_contents(void)
Return the contents of the output buffer */
PHP_FUNCTION(ob_get_contents)
{
@@ -1460,7 +1458,7 @@ PHP_FUNCTION(ob_get_level)
}
/* }}} */
-/* {{{ proto int ob_get_length(void)
+/* {{{ proto int|false ob_get_length(void)
Return the length of the output buffer */
PHP_FUNCTION(ob_get_length)
{
@@ -1474,7 +1472,7 @@ PHP_FUNCTION(ob_get_length)
}
/* }}} */
-/* {{{ proto false|array ob_list_handlers()
+/* {{{ proto null|array ob_list_handlers()
List all output_buffers in an array */
PHP_FUNCTION(ob_list_handlers)
{
diff --git a/main/php.h b/main/php.h
index dbd7673643..b014379fda 100644
--- a/main/php.h
+++ b/main/php.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, |
@@ -24,7 +22,7 @@
#include <dmalloc.h>
#endif
-#define PHP_API_VERSION 20190902
+#define PHP_API_VERSION 20190128
#define PHP_HAVE_STREAMS
#define YYDEBUG 0
#define PHP_DEFAULT_CHARSET "UTF-8"
diff --git a/main/php_compat.h b/main/php_compat.h
index 01d3e326c5..4dcf39dc22 100644
--- a/main/php_compat.h
+++ b/main/php_compat.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/main/php_content_types.c b/main/php_content_types.c
index b53ee1ab84..d953afcec6 100644
--- a/main/php_content_types.c
+++ b/main/php_content_types.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/main/php_content_types.h b/main/php_content_types.h
index 145e8d4c5e..b1bae1dd0c 100644
--- a/main/php_content_types.h
+++ b/main/php_content_types.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/main/php_getopt.h b/main/php_getopt.h
index 20746517d4..960def30b5 100644
--- a/main/php_getopt.h
+++ b/main/php_getopt.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/main/php_globals.h b/main/php_globals.h
index 6b31d9eaa6..e5709ddc67 100644
--- a/main/php_globals.h
+++ b/main/php_globals.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, |
@@ -67,7 +65,6 @@ struct _php_core_globals {
zend_long memory_limit;
zend_long max_input_time;
- zend_bool track_errors;
zend_bool display_errors;
zend_bool display_startup_errors;
zend_bool log_errors;
diff --git a/main/php_ini.c b/main/php_ini.c
index cc2cf16cf8..ec847af409 100644
--- a/main/php_ini.c
+++ b/main/php_ini.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/main/php_ini.h b/main/php_ini.h
index a4fad6c689..9d977c1bac 100644
--- a/main/php_ini.h
+++ b/main/php_ini.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/main/php_main.h b/main/php_main.h
index 44eeb974d6..ee27209fbe 100644
--- a/main/php_main.h
+++ b/main/php_main.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/main/php_memory_streams.h b/main/php_memory_streams.h
index 7db25dd1dd..17bc509a19 100644
--- a/main/php_memory_streams.h
+++ b/main/php_memory_streams.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/main/php_network.h b/main/php_network.h
index 241ca94e27..e96cbd37d3 100644
--- a/main/php_network.h
+++ b/main/php_network.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/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index 6fca7e4cab..a65b91e84e 100644
--- a/main/php_open_temporary_file.c
+++ b/main/php_open_temporary_file.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/main/php_open_temporary_file.h b/main/php_open_temporary_file.h
index 0195056e31..deb8e240e5 100644
--- a/main/php_open_temporary_file.h
+++ b/main/php_open_temporary_file.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/main/php_output.h b/main/php_output.h
index f76d61d841..60f389b2b5 100644
--- a/main/php_output.h
+++ b/main/php_output.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/main/php_reentrancy.h b/main/php_reentrancy.h
index bbc772b5db..c7a7c2f92e 100644
--- a/main/php_reentrancy.h
+++ b/main/php_reentrancy.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/main/php_scandir.c b/main/php_scandir.c
index 7fdb49b77a..91bfabc73c 100644
--- a/main/php_scandir.c
+++ b/main/php_scandir.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/main/php_scandir.h b/main/php_scandir.h
index 04bf29f2c9..834d0b7f1e 100644
--- a/main/php_scandir.h
+++ b/main/php_scandir.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/main/php_stdint.h b/main/php_stdint.h
index 3e5fd0016c..f439b9f308 100644
--- a/main/php_stdint.h
+++ b/main/php_stdint.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/main/php_streams.h b/main/php_streams.h
index 11e7c2aae7..73740a7a79 100644
--- a/main/php_streams.h
+++ b/main/php_streams.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, |
@@ -260,13 +258,13 @@ END_EXTERN_C()
#define php_stream_from_zval(xstr, pzval) do { \
if (((xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), \
"stream", php_file_le_stream(), php_file_le_pstream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
} while (0)
#define php_stream_from_res(xstr, res) do { \
if (((xstr) = (php_stream*)zend_fetch_resource2((res), \
"stream", php_file_le_stream(), php_file_le_pstream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
} while (0)
#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2((res), "stream", php_file_le_stream(), php_file_le_pstream())
diff --git a/main/php_syslog.c b/main/php_syslog.c
index 987ef9cc0c..37bf5a7fb6 100644
--- a/main/php_syslog.c
+++ b/main/php_syslog.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/main/php_syslog.h b/main/php_syslog.h
index 2c499269a4..227baa8b16 100644
--- a/main/php_syslog.h
+++ b/main/php_syslog.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/main/php_ticks.c b/main/php_ticks.c
index f5b0dd0c58..0fd0dde6fe 100644
--- a/main/php_ticks.c
+++ b/main/php_ticks.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/main/php_ticks.h b/main/php_ticks.h
index 5b2bb057e6..cc92eae8fc 100644
--- a/main/php_ticks.h
+++ b/main/php_ticks.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/main/php_variables.c b/main/php_variables.c
index 4b30d84f2f..d540ff98ac 100644
--- a/main/php_variables.c
+++ b/main/php_variables.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/main/php_variables.h b/main/php_variables.h
index 7dc33d328a..dc052def89 100644
--- a/main/php_variables.h
+++ b/main/php_variables.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/main/php_version.h b/main/php_version.h
index 6f2f3c032d..24765617cb 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -1,8 +1,8 @@
/* automatically generated by configure */
/* edit configure.ac to change version number */
-#define PHP_MAJOR_VERSION 7
-#define PHP_MINOR_VERSION 4
+#define PHP_MAJOR_VERSION 8
+#define PHP_MINOR_VERSION 0
#define PHP_RELEASE_VERSION 0
#define PHP_EXTRA_VERSION "-dev"
-#define PHP_VERSION "7.4.0-dev"
-#define PHP_VERSION_ID 70400
+#define PHP_VERSION "8.0.0-dev"
+#define PHP_VERSION_ID 80000
diff --git a/main/reentrancy.c b/main/reentrancy.c
index 08f03e76dd..fa4e3e57ee 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.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/main/rfc1867.c b/main/rfc1867.c
index 1ee7b925a1..17fe68f941 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.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/main/rfc1867.h b/main/rfc1867.h
index bfb9bb51c6..2fb396b40c 100644
--- a/main/rfc1867.h
+++ b/main/rfc1867.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/main/snprintf.c b/main/snprintf.c
index 61a5dfffce..1acbf10dfb 100644
--- a/main/snprintf.c
+++ b/main/snprintf.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/main/snprintf.h b/main/snprintf.h
index 93d2034bb6..8a36562127 100644
--- a/main/snprintf.h
+++ b/main/snprintf.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/main/spprintf.c b/main/spprintf.c
index a20705016a..5b1bafccff 100644
--- a/main/spprintf.c
+++ b/main/spprintf.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/main/spprintf.h b/main/spprintf.h
index bbb7add25c..afb3b505b8 100644
--- a/main/spprintf.h
+++ b/main/spprintf.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/main/streams/cast.c b/main/streams/cast.c
index 262ec5e38f..7a217dc882 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.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/main/streams/filter.c b/main/streams/filter.c
index f536b92a02..38603b001d 100644
--- a/main/streams/filter.c
+++ b/main/streams/filter.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/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c
index 0e72558a2a..212d905e16 100644
--- a/main/streams/glob_wrapper.c
+++ b/main/streams/glob_wrapper.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/main/streams/memory.c b/main/streams/memory.c
index 4b92fc2ffd..6929ee480d 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.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/main/streams/mmap.c b/main/streams/mmap.c
index 8f3fcf97a6..445ee64951 100644
--- a/main/streams/mmap.c
+++ b/main/streams/mmap.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/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index c477dda4ac..98daa114a5 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.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/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
index 4d5760e2cf..9df312152a 100644
--- a/main/streams/php_stream_filter_api.h
+++ b/main/streams/php_stream_filter_api.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/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h
index 644e5ab7e4..f4c8e05b7e 100644
--- a/main/streams/php_stream_glob_wrapper.h
+++ b/main/streams/php_stream_glob_wrapper.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/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h
index 132f3214c1..aae9097b41 100644
--- a/main/streams/php_stream_mmap.h
+++ b/main/streams/php_stream_mmap.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/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h
index 4af8b86cdd..44910bf320 100644
--- a/main/streams/php_stream_plain_wrapper.h
+++ b/main/streams/php_stream_plain_wrapper.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/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index f49d9c787d..69d2b9a774 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.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/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h
index 389d591921..4171a0d953 100644
--- a/main/streams/php_stream_userspace.h
+++ b/main/streams/php_stream_userspace.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/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
index 1bc6fdc89c..ab00549a6e 100644
--- a/main/streams/php_streams_int.h
+++ b/main/streams/php_streams_int.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/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 61b19e48ad..224753306e 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.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/main/streams/streams.c b/main/streams/streams.c
index 495feab100..098d1be2f6 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.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, |
@@ -26,7 +24,7 @@
#include "php_network.h"
#include "php_open_temporary_file.h"
#include "ext/standard/file.h"
-#include "ext/standard/basic_functions.h" /* for BG(mmap_file) (not strictly required) */
+#include "ext/standard/basic_functions.h" /* for BG(CurrentStatFile) */
#include "ext/standard/php_string.h" /* for php_memnstr, used by php_stream_get_record() */
#include <stddef.h>
#include <fcntl.h>
diff --git a/main/streams/transports.c b/main/streams/transports.c
index 74fbef58d8..dd67c67bbf 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.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/main/streams/userspace.c b/main/streams/userspace.c
index 9cf1580a35..db3565a901 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.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/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 511e1570d1..853aa64e3f 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.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/main/strlcat.c b/main/strlcat.c
index 6ef5644568..3c18360e96 100644
--- a/main/strlcat.c
+++ b/main/strlcat.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/main/strlcpy.c b/main/strlcpy.c
index 31e13489d8..55959b2f3a 100644
--- a/main/strlcpy.c
+++ b/main/strlcpy.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/php.ini-development b/php.ini-development
index 5bd2740160..d03a3084a3 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -99,12 +99,12 @@
; Production Value: Off
; display_startup_errors
-; Default Value: Off
+; Default Value: On
; Development Value: On
; Production Value: Off
; error_reporting
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
@@ -456,7 +456,7 @@ memory_limit = 128M
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
@@ -480,11 +480,9 @@ error_reporting = E_ALL
display_errors = On
; The display of errors which occur during PHP's startup sequence are handled
-; separately from display_errors. PHP's default behavior is to suppress those
-; errors from clients. Turning the display of startup errors on can be useful in
-; debugging configuration problems. We strongly recommend you
-; set this to 'off' for production servers.
-; Default Value: Off
+; separately from display_errors. We strongly recommend you set this to 'off'
+; for production servers to avoid leaking configuration details.
+; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-startup-errors
@@ -525,14 +523,6 @@ report_memleaks = On
; This setting is on by default.
;report_zend_debug = 0
-; Store the last error/warning message in $php_errormsg (boolean).
-; This directive is DEPRECATED.
-; Default Value: Off
-; Development Value: Off
-; Production Value: Off
-; http://php.net/track-errors
-;track_errors = Off
-
; Turn off normal error reporting and emit XML-RPC error XML
; http://php.net/xmlrpc-errors
;xmlrpc_errors = 0
@@ -963,10 +953,10 @@ cli_server.color = On
;date.default_longitude = 35.2333
; http://php.net/date.sunrise-zenith
-;date.sunrise_zenith = 90.583333
+;date.sunrise_zenith = 90.833333
; http://php.net/date.sunset-zenith
-;date.sunset_zenith = 90.583333
+;date.sunset_zenith = 90.833333
[filter]
; http://php.net/filter.default
@@ -1043,8 +1033,6 @@ cli_server.color = On
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict
-;pdo_odbc.db2_instance_name
-
[Pdo_mysql]
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
@@ -1586,13 +1574,6 @@ zend.assertions = 1
; http://php.net/assert.callback
;assert.callback = 0
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-; http://php.net/assert.quiet-eval
-;assert.quiet_eval = 0
-
-
-
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
; http://php.net/com.typelib-file
@@ -1667,17 +1648,6 @@ zend.assertions = 1
; http://php.net/mbstring.substitute-character
;mbstring.substitute_character = none
-; overload(replace) single byte functions by mbstring functions.
-; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
-; etc. Possible values are 0,1,2,4 or combination of them.
-; For example, 7 for overload everything.
-; 0: No overload
-; 1: Overload mail() function
-; 2: Overload str*() functions
-; 4: Overload ereg*() functions
-; http://php.net/mbstring.func-overload
-;mbstring.func_overload = 0
-
; enable strict encoding detection.
; Default: Off
;mbstring.strict_detection = On
diff --git a/php.ini-production b/php.ini-production
index beea6b2650..2064a2622b 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -99,12 +99,12 @@
; Production Value: Off
; display_startup_errors
-; Default Value: Off
+; Default Value: On
; Development Value: On
; Production Value: Off
; error_reporting
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
@@ -458,7 +458,7 @@ memory_limit = 128M
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
@@ -482,11 +482,9 @@ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
; The display of errors which occur during PHP's startup sequence are handled
-; separately from display_errors. PHP's default behavior is to suppress those
-; errors from clients. Turning the display of startup errors on can be useful in
-; debugging configuration problems. We strongly recommend you
-; set this to 'off' for production servers.
-; Default Value: Off
+; separately from display_errors. We strongly recommend you set this to 'off'
+; for production servers to avoid leaking configuration details.
+; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-startup-errors
@@ -527,16 +525,6 @@ report_memleaks = On
; This setting is on by default.
;report_zend_debug = 0
-; Store the last error/warning message in $php_errormsg (boolean). Setting this value
-; to On can assist in debugging and is appropriate for development servers. It should
-; however be disabled on production servers.
-; This directive is DEPRECATED.
-; Default Value: Off
-; Development Value: Off
-; Production Value: Off
-; http://php.net/track-errors
-;track_errors = Off
-
; Turn off normal error reporting and emit XML-RPC error XML
; http://php.net/xmlrpc-errors
;xmlrpc_errors = 0
@@ -967,10 +955,10 @@ cli_server.color = On
;date.default_longitude = 35.2333
; http://php.net/date.sunrise-zenith
-;date.sunrise_zenith = 90.583333
+;date.sunrise_zenith = 90.833333
; http://php.net/date.sunset-zenith
-;date.sunset_zenith = 90.583333
+;date.sunset_zenith = 90.833333
[filter]
; http://php.net/filter.default
@@ -1047,8 +1035,6 @@ cli_server.color = On
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict
-;pdo_odbc.db2_instance_name
-
[Pdo_mysql]
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
@@ -1590,11 +1576,6 @@ zend.assertions = -1
; http://php.net/assert.callback
;assert.callback = 0
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-; http://php.net/assert.quiet-eval
-;assert.quiet_eval = 0
-
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
; http://php.net/com.typelib-file
@@ -1669,17 +1650,6 @@ zend.assertions = -1
; http://php.net/mbstring.substitute-character
;mbstring.substitute_character = none
-; overload(replace) single byte functions by mbstring functions.
-; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
-; etc. Possible values are 0,1,2,4 or combination of them.
-; For example, 7 for overload everything.
-; 0: No overload
-; 1: Overload mail() function
-; 2: Overload str*() functions
-; 4: Overload ereg*() functions
-; http://php.net/mbstring.func-overload
-;mbstring.func_overload = 0
-
; enable strict encoding detection.
; Default: Off
;mbstring.strict_detection = On
diff --git a/run-tests.php b/run-tests.php
index 5adfcd2991..9ee7299f9c 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -2137,7 +2135,8 @@ TEST $file
junit_start_timer($shortname);
- $output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache -d display_errors=0 \"$test_skipif\"", $env);
+ $output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache -d display_errors=1 -d display_startup_errors=0 \"$test_skipif\"", $env);
+ $output = trim($output);
junit_finish_timer($shortname);
@@ -2145,9 +2144,9 @@ TEST $file
@unlink($test_skipif);
}
- if (!strncasecmp('skip', ltrim($output), 4)) {
+ if (!strncasecmp('skip', $output, 4)) {
- if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) {
+ if (preg_match('/^skip\s*(.+)/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: $m[1]", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
@@ -2162,22 +2161,26 @@ TEST $file
return 'SKIPPED';
}
- if (!strncasecmp('info', ltrim($output), 4)) {
- if (preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) {
- $info = " (info: $m[1])";
- }
- }
-
- if (!strncasecmp('warn', ltrim($output), 4)) {
- if (preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) {
- $warn = true; /* only if there is a reason */
- $info = " (warn: $m[1])";
- }
- }
-
- if (!strncasecmp('xfail', ltrim($output), 5)) {
+ if (!strncasecmp('info', $output, 4) && preg_match('/^info\s*(.+)/i', $output, $m)) {
+ $info = " (info: $m[1])";
+ } elseif (!strncasecmp('warn', $output, 4) && preg_match('/^warn\s+(.+)/i', $output, $m)) {
+ $warn = true; /* only if there is a reason */
+ $info = " (warn: $m[1])";
+ } elseif (!strncasecmp('xfail', $output, 5)) {
// Pretend we have an XFAIL section
- $section_text['XFAIL'] = trim(substr(ltrim($output), 5));
+ $section_text['XFAIL'] = ltrim(substr($output, 5));
+ } elseif ($output !== '') {
+ show_result("BORK", $output, $tested_file, 'reason: invalid output from SKIPIF', $temp_filenames);
+ $PHP_FAILED_TESTS['BORKED'][] = array(
+ 'name' => $file,
+ 'test_name' => '',
+ 'output' => '',
+ 'diff' => '',
+ 'info' => "$output [$file]",
+ );
+
+ junit_mark_test_as('BORK', $shortname, $tested, null, $output);
+ return 'BORKED';
}
}
}
@@ -2234,7 +2237,7 @@ TEST $file
} else {
$bork_info = "Redirect info must contain exactly one TEST string to be used as redirect directory.";
- show_result("BORK", $bork_info, '', $temp_filenames);
+ show_result("BORK", $bork_info, '', '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array(
'name' => $file,
'test_name' => '',
@@ -2252,7 +2255,7 @@ TEST $file
}
$bork_info = "Redirected test did not contain redirection info";
- show_result("BORK", $bork_info, '', $temp_filenames);
+ show_result("BORK", $bork_info, '', '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array(
'name' => $file,
'test_name' => '',
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index d0913c250e..b7e0077d2d 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.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/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 55c16179b8..67c6d9beea 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -67,20 +67,20 @@ if test "$PHP_APXS2" != "no"; then
if test -z `$APXS -q SYSCONFDIR`; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php7"
+ -i -n php"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php7"
+ -i -a -n php"
fi
case $host_alias in
*aix*)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
*darwin*)
@@ -95,12 +95,12 @@ if test "$PHP_APXS2" != "no"; then
fi
MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2handler, bundle, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- SAPI_SHARED=libs/libphp7.so
+ PHP_SELECT_SAPI(apache2handler, bundle, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ SAPI_SHARED=libs/libphp.so
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
;;
*)
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
esac
diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32
index 45d6353d28..12dd50332a 100644
--- a/sapi/apache2handler/config.w32
+++ b/sapi/apache2handler/config.w32
@@ -10,7 +10,7 @@ if (PHP_APACHE2HANDLER != "no") {
CHECK_LIB("libapr.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
CHECK_LIB("libaprutil.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2")
) {
- SAPI('apache2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
} else {
@@ -28,7 +28,7 @@ if (PHP_APACHE2_2HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
CHECK_LIB("libaprutil-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2")
) {
- SAPI('apache2_2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_2.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
'sapi\\apache2_2handler');
@@ -46,7 +46,7 @@ if (PHP_APACHE2_4HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
CHECK_LIB("libaprutil-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
) {
- SAPI('apache2_4handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_4handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_4.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
'sapi\\apache2handler');
diff --git a/sapi/apache2handler/mod_php7.c b/sapi/apache2handler/mod_php.c
index 6c44dbaa2c..835c5f5c90 100644
--- a/sapi/apache2handler/mod_php7.c
+++ b/sapi/apache2handler/mod_php.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, |
@@ -23,7 +21,7 @@
#include "php.h"
#include "php_apache.h"
-AP_MODULE_DECLARE_DATA module php7_module = {
+AP_MODULE_DECLARE_DATA module php_module = {
STANDARD20_MODULE_STUFF,
create_php_config, /* create per-directory config structure */
merge_php_config, /* merge per-directory config structures */
diff --git a/sapi/apache2handler/php.sym b/sapi/apache2handler/php.sym
index 1469b0314d..571f27e01c 100644
--- a/sapi/apache2handler/php.sym
+++ b/sapi/apache2handler/php.sym
@@ -1 +1 @@
-php7_module
+php_module
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 423ada1f9b..d6c67c8a8d 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.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, |
@@ -29,11 +27,11 @@
/* Enable per-module logging in Apache 2.4+ */
#ifdef APLOG_USE_MODULE
-APLOG_USE_MODULE(php7);
+APLOG_USE_MODULE(php);
#endif
/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php7_module;
+extern module AP_MODULE_DECLARE_DATA php_module;
/* A way to specify the location of the php.ini dir in an apache directive */
extern char *apache2_php_ini_path_override;
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index c82b93f965..3066d0a772 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.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/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 1cc5670eaa..b2f32ce49a 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.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, |
@@ -55,7 +53,7 @@
#define PHP_MAGIC_TYPE "application/x-httpd-php"
#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
-#define PHP_SCRIPT "php7-script"
+#define PHP_SCRIPT "php-script"
/* A way to specify the location of the php.ini dir in an apache directive */
char *apache2_php_ini_path_override = NULL;
@@ -551,7 +549,7 @@ typedef struct {
HashTable config;
} php_conf_rec;
zend_string *str;
- php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php7_module);
+ php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php_module);
ZEND_HASH_FOREACH_STR_KEY(&c->config, str) {
zend_restore_ini_entry(str, ZEND_INI_STAGE_SHUTDOWN);
@@ -582,7 +580,7 @@ static int php_handler(request_rec *r)
#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req);
- conf = ap_get_module_config(r->per_dir_config, &php7_module);
+ conf = ap_get_module_config(r->per_dir_config, &php_module);
/* apply_config() needs r in some cases, so allocate server_context early */
ctx = SG(server_context);
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index c885f30677..e459cc47fb 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.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/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4
index ae927cd5f8..04bd70b269 100644
--- a/sapi/cgi/config9.m4
+++ b/sapi/cgi/config9.m4
@@ -55,7 +55,7 @@ if test "$PHP_CGI" != "no"; then
BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
;;
*)
- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+ BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
;;
esac
diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h
index b4c2851791..694de0d9e9 100644
--- a/sapi/cli/cli.h
+++ b/sapi/cli/cli.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/sapi/cli/config.m4 b/sapi/cli/config.m4
index 917d45fad1..d17d531683 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -42,7 +42,7 @@ if test "$PHP_CLI" != "no"; then
BUILD_CLI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
*)
- BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
+ BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
esac
diff --git a/sapi/cli/generate_mime_type_map.php b/sapi/cli/generate_mime_type_map.php
index b0176bb524..a4504500c0 100755
--- a/sapi/cli/generate_mime_type_map.php
+++ b/sapi/cli/generate_mime_type_map.php
@@ -43,8 +43,6 @@ foreach($additional_mime_maps as $ext => $mime) {
?>
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/mime_type_map.h b/sapi/cli/mime_type_map.h
index 0c559d635f..66d62dfa2b 100644
--- a/sapi/cli/mime_type_map.h
+++ b/sapi/cli/mime_type_map.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/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index a305c36ade..69f396c8d8 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.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, |
@@ -1073,7 +1071,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
memset(&execute_data, 0, sizeof(zend_execute_data));
EG(current_execute_data) = &execute_data;
- zend_call_method_with_1_params(&ref, pce, &pce->constructor, "__construct", NULL, &arg);
+ zend_call_method_with_1_params(Z_OBJ(ref), pce, &pce->constructor, "__construct", NULL, &arg);
if (EG(exception)) {
zval tmp, *msg, rv;
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
index 1b82104ca6..f417549ed2 100644
--- a/sapi/cli/php_cli_process_title.c
+++ b/sapi/cli/php_cli_process_title.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/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h
index c2fed7b817..74766491d7 100644
--- a/sapi/cli/php_cli_process_title.h
+++ b/sapi/cli/php_cli_process_title.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/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index f00d8dee54..c6943a5442 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.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, |
@@ -2204,8 +2202,6 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
decline = Z_TYPE(retval) == IS_FALSE;
zval_ptr_dtor(&retval);
}
- } else {
- decline = 1;
}
} zend_end_try();
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index 4d57f1b922..d78211a8fd 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.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/sapi/cli/ps_title.h b/sapi/cli/ps_title.h
index 540609c85d..e8da2a936b 100644
--- a/sapi/cli/ps_title.h
+++ b/sapi/cli/ps_title.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/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt
index 0a366b6975..d268104606 100644
--- a/sapi/cli/tests/005.phpt
+++ b/sapi/cli/tests/005.phpt
@@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] {
}
"
-string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
+string(1969) "Class [ <internal:Core> class Exception implements Throwable ] {
- Constants [0] {
}
@@ -60,42 +60,72 @@ string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
- Methods [11] {
Method [ <internal:Core> final private method __clone ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [3] {
- Parameter #0 [ <optional> $message ]
- Parameter #1 [ <optional> $code ]
- Parameter #2 [ <optional> $previous ]
+ Parameter #0 [ <optional> string $message ]
+ Parameter #1 [ <optional> int $code ]
+ Parameter #2 [ <optional> ?Throwable $previous ]
}
}
Method [ <internal:Core> public method __wakeup ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getCode ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getFile ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getLine ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTrace ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getPrevious ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> public method __toString ] {
+
+ - Parameters [0] {
+ }
}
}
}
diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt
index 54d1a96a88..4311d9b259 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -68,21 +68,21 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Function [ <internal:pcre> function preg_match ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #3 [ <optional> int $flags ]
+ Parameter #4 [ <optional> int $offset ]
}
}
Function [ <internal:pcre> function preg_match_all ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #3 [ <optional> int $flags ]
+ Parameter #4 [ <optional> int $offset ]
}
}
Function [ <internal:pcre> function preg_replace ] {
@@ -91,7 +91,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
}
}
@@ -101,19 +101,19 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $callback ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
- Parameter #5 [ <optional> $flags ]
+ Parameter #5 [ <optional> int $flags ]
}
}
Function [ <internal:pcre> function preg_replace_callback_array ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
+ Parameter #0 [ <required> array $pattern ]
Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
+ Parameter #2 [ <optional> int $limit ]
Parameter #3 [ <optional> &$count ]
- Parameter #4 [ <optional> $flags ]
+ Parameter #4 [ <optional> int $flags ]
}
}
Function [ <internal:pcre> function preg_filter ] {
@@ -122,38 +122,40 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
}
}
Function [ <internal:pcre> function preg_split ] {
- Parameters [4] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
- Parameter #3 [ <optional> $flags ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
+ Parameter #2 [ <optional> int $limit ]
+ Parameter #3 [ <optional> int $flags ]
}
}
Function [ <internal:pcre> function preg_quote ] {
- Parameters [2] {
- Parameter #0 [ <required> $str ]
- Parameter #1 [ <optional> $delim_char ]
+ Parameter #0 [ <required> string $str ]
+ Parameter #1 [ <optional> ?string $delim_char ]
}
+ - Return [ string ]
}
Function [ <internal:pcre> function preg_grep ] {
- Parameters [3] {
- Parameter #0 [ <required> $regex ]
- Parameter #1 [ <required> $input ]
- Parameter #2 [ <optional> $flags ]
+ Parameter #0 [ <required> string $regex ]
+ Parameter #1 [ <required> array $input ]
+ Parameter #2 [ <optional> int $flags ]
}
}
Function [ <internal:pcre> function preg_last_error ] {
- Parameters [0] {
}
+ - Return [ int ]
}
}
}
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 4c7dec6dd0..1713534a23 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.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/sapi/embed/php_embed.h b/sapi/embed/php_embed.h
index 855872fed8..6280e4e8f8 100644
--- a/sapi/embed/php_embed.h
+++ b/sapi/embed/php_embed.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/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index ad89c1bb52..f71fa710dd 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -660,7 +660,7 @@ if test "$PHP_FPM" != "no"; then
BUILD_FPM="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
;;
*)
- BUILD_FPM="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_FPM_OBJS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
+ BUILD_FPM="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
;;
esac
diff --git a/sapi/fpm/fpm/events/devpoll.c b/sapi/fpm/fpm/events/devpoll.c
index 68cc8dd615..15afb2beda 100644
--- a/sapi/fpm/fpm/events/devpoll.c
+++ b/sapi/fpm/fpm/events/devpoll.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/sapi/fpm/fpm/events/devpoll.h b/sapi/fpm/fpm/events/devpoll.h
index d8ff66bf95..b05a456924 100644
--- a/sapi/fpm/fpm/events/devpoll.h
+++ b/sapi/fpm/fpm/events/devpoll.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/sapi/fpm/fpm/events/epoll.c b/sapi/fpm/fpm/events/epoll.c
index 4701339e78..b81c7fa59c 100644
--- a/sapi/fpm/fpm/events/epoll.c
+++ b/sapi/fpm/fpm/events/epoll.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/sapi/fpm/fpm/events/epoll.h b/sapi/fpm/fpm/events/epoll.h
index 783a2d25af..2469cbeaee 100644
--- a/sapi/fpm/fpm/events/epoll.h
+++ b/sapi/fpm/fpm/events/epoll.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/sapi/fpm/fpm/events/kqueue.c b/sapi/fpm/fpm/events/kqueue.c
index c5d1b4f003..42d70ecd6c 100644
--- a/sapi/fpm/fpm/events/kqueue.c
+++ b/sapi/fpm/fpm/events/kqueue.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/sapi/fpm/fpm/events/kqueue.h b/sapi/fpm/fpm/events/kqueue.h
index a09651b3b3..93db17fd7c 100644
--- a/sapi/fpm/fpm/events/kqueue.h
+++ b/sapi/fpm/fpm/events/kqueue.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/sapi/fpm/fpm/events/poll.c b/sapi/fpm/fpm/events/poll.c
index ced32d0215..9ea0722698 100644
--- a/sapi/fpm/fpm/events/poll.c
+++ b/sapi/fpm/fpm/events/poll.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/sapi/fpm/fpm/events/poll.h b/sapi/fpm/fpm/events/poll.h
index 1a89f31102..371ecf1604 100644
--- a/sapi/fpm/fpm/events/poll.h
+++ b/sapi/fpm/fpm/events/poll.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/sapi/fpm/fpm/events/port.c b/sapi/fpm/fpm/events/port.c
index 1ffcd20a0d..7887c8e61a 100644
--- a/sapi/fpm/fpm/events/port.c
+++ b/sapi/fpm/fpm/events/port.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/sapi/fpm/fpm/events/port.h b/sapi/fpm/fpm/events/port.h
index 7329b2dff5..ced1d05c82 100644
--- a/sapi/fpm/fpm/events/port.h
+++ b/sapi/fpm/fpm/events/port.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/sapi/fpm/fpm/events/select.c b/sapi/fpm/fpm/events/select.c
index d69ac7f5dd..23a5bb6d28 100644
--- a/sapi/fpm/fpm/events/select.c
+++ b/sapi/fpm/fpm/events/select.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/sapi/fpm/fpm/events/select.h b/sapi/fpm/fpm/events/select.h
index 3b8445537f..7fc6d017a3 100644
--- a/sapi/fpm/fpm/events/select.h
+++ b/sapi/fpm/fpm/events/select.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/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 7d3f4d3640..60bce2078d 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.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, |
@@ -245,7 +243,7 @@ static inline size_t sapi_cgibin_single_write(const char *str, uint32_t str_leng
{
ssize_t ret;
- /* sapi has started which means everyhting must be send through fcgi */
+ /* sapi has started which means everything must be send through fcgi */
if (fpm_is_running) {
fcgi_request *request = (fcgi_request*) SG(server_context);
ret = fcgi_write(request, FCGI_STDOUT, str, str_length);
diff --git a/sapi/fpm/tests/response.inc b/sapi/fpm/tests/response.inc
index 54f85bcfb6..d6ee6c7afb 100644
--- a/sapi/fpm/tests/response.inc
+++ b/sapi/fpm/tests/response.inc
@@ -174,7 +174,7 @@ class Response
{
// check default headers
return (
- $this->checkHeader('X-Powered-By', '|^PHP/7|', true) &&
+ $this->checkHeader('X-Powered-By', '|^PHP/8|', true) &&
$this->checkHeader('Content-type', '|^' . $contentType . '(;\s?charset=\w+)?|', true)
);
}
diff --git a/sapi/fpm/www.conf.in b/sapi/fpm/www.conf.in
index 169d19568c..84b8e62526 100644
--- a/sapi/fpm/www.conf.in
+++ b/sapi/fpm/www.conf.in
@@ -374,7 +374,7 @@ pm.max_spare_servers = 3
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
-; Note: on highloaded environement, this can cause some delay in the page
+; Note: on highloaded environment, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
diff --git a/sapi/fuzzer/Makefile.frag b/sapi/fuzzer/Makefile.frag
new file mode 100644
index 0000000000..57952a8ff4
--- /dev/null
+++ b/sapi/fuzzer/Makefile.frag
@@ -0,0 +1,18 @@
+fuzzer: $(PHP_FUZZER_BINARIES)
+
+FUZZER_BUILD = $(LIBTOOL) --mode=link $(FUZZING_CC) -export-dynamic $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS_PROGRAM) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(FUZZING_LIB) -rpath /ORIGIN/lib
+
+$(SAPI_FUZZER_PATH)/php-fuzz-parser: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_PARSER_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_PARSER_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-unserialize: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_UNSERIALIZE_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_UNSERIALIZE_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-json: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_JSON_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_JSON_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-exif: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_EXIF_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_EXIF_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-mbstring: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_MBSTRING_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_MBSTRING_OBJS) -o $@
diff --git a/sapi/fuzzer/README.md b/sapi/fuzzer/README.md
new file mode 100644
index 0000000000..c753c23c30
--- /dev/null
+++ b/sapi/fuzzer/README.md
@@ -0,0 +1,66 @@
+Fuzzing SAPI for PHP
+--------------------
+
+The following `./configure` options can be used to enable the fuzzing SAPI, as well as all availablefuzzers. If you don't build the exif/json/mbstring extensions, fuzzers for these extensions will not be built.
+
+```sh
+./configure \
+ --enable-fuzzer \
+ --with-pic \
+ --enable-debug-assertions \
+ --enable-exif \
+ --enable-json \
+ --enable-mbstring
+```
+
+The `--with-pic` option is required to avoid a linking failure. The `--enable-debug-assertions` option can be used to enable debug assertions despite the use of a release build.
+
+You will need a recent version of clang that supports the `-fsanitize=fuzzer-no-link` option.
+
+When running `make` it creates these binaries in `sapi/fuzzer/`:
+
+* `php-fuzz-parser`: Fuzzing language parser and compiler
+* `php-fuzz-unserialize`: Fuzzing unserialize() function
+* `php-fuzz-json`: Fuzzing JSON parser (requires --enable-json)
+* `php-fuzz-exif`: Fuzzing `exif_read_data()` function (requires --enable-exif)
+* `php-fuzz-mbstring`: fuzzing `mb_ereg[i]()` (requires --enable-mbstring)
+
+Some fuzzers have a seed corpus in `sapi/fuzzer/corpus`. You can use it as follows:
+
+```sh
+cp -r sapi/fuzzer/corpus/exif ./my-exif-corpus
+sapi/fuzzer/php-fuzz-exif ./my-exif-corpus
+```
+
+For the unserialize fuzzer, a dictionary of internal classes should be generated first:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_unserialize_dict.php
+cp -r sapi/fuzzer/corpus/unserialize ./my-unserialize-corpus
+sapi/fuzzer/php-fuzz-unserialize -dict=$PWD/sapi/fuzzer/dict/unserialize ./my-unserialize-corpus
+```
+
+For the parser fuzzer, a corpus may be generated from Zend test files:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_parser_corpus.php
+mkdir ./my-parser-corpus
+sapi/fuzzer/php-fuzz-parser -merge=1 ./my-parser-corpus sapi/fuzzer/corpus/parser
+sapi/fuzzer/php-fuzz-parser -only_ascii=1 ./my-parser-corpus
+```
+
+For the mbstring fuzzer, you may want to build the libonig dependency with instrumentation. At this time, libonig is not clean under ubsan, so only the fuzzer and address sanitizers may be used.
+
+```sh
+git clone https://github.com/kkos/oniguruma.git
+pushd oniguruma
+autoreconf -vfi
+./configure CC=clang CFLAGS="-fsanitize=fuzzer-no-link,address -O2 -g"
+make
+popd
+
+export ONIG_CFLAGS="-I$PWD/oniguruma/src"
+export ONIG_LIBS="-L$PWD/oniguruma/src/.libs -l:libonig.a"
+```
+
+This will link an instrumented libonig statically into the PHP binary.
diff --git a/sapi/fuzzer/config.m4 b/sapi/fuzzer/config.m4
new file mode 100644
index 0000000000..37945b8e9e
--- /dev/null
+++ b/sapi/fuzzer/config.m4
@@ -0,0 +1,94 @@
+AC_MSG_CHECKING(for clang fuzzer SAPI)
+
+PHP_ARG_ENABLE([fuzzer],,
+ [AS_HELP_STRING([--enable-fuzzer],
+ [Build PHP as clang fuzzing test module (for developers)])],
+ [no],
+ [no])
+
+PHP_ARG_ENABLE([fuzzer-msan],,
+ [AS_HELP_STRING([--enable-fuzzer-msan],
+ [Enable msan instead of asan/ubsan when fuzzing])],
+ [no],
+ [no])
+
+dnl For newer clang versions see https://llvm.org/docs/LibFuzzer.html#fuzzer-usage
+dnl for relevant flags.
+
+dnl Macro to define fuzzing target
+dnl PHP_FUZZER_TARGET(name, target-var)
+dnl
+AC_DEFUN([PHP_FUZZER_TARGET], [
+ PHP_FUZZER_BINARIES="$PHP_FUZZER_BINARIES $SAPI_FUZZER_PATH/php-fuzz-$1"
+ PHP_SUBST($2)
+ PHP_ADD_SOURCES_X([sapi/fuzzer],[fuzzer-$1.c],[],$2)
+ $2="[$]$2 $FUZZER_COMMON_OBJS"
+])
+
+if test "$PHP_FUZZER" != "no"; then
+ AC_MSG_RESULT([yes])
+ dnl Don't use PHP_REQUIRE_CXX() to avoid unnecessarily pulling in -lstdc++
+ AC_PROG_CXX
+ AC_PROG_CXXCPP
+ PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/fuzzer/Makefile.frag)
+ SAPI_FUZZER_PATH=sapi/fuzzer
+ PHP_SUBST(SAPI_FUZZER_PATH)
+ if test -z "$LIB_FUZZING_ENGINE"; then
+ FUZZING_LIB="-fsanitize=fuzzer"
+ FUZZING_CC="$CC"
+ AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer-no-link], [
+ CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link"
+ CXXFLAGS="$CXXFLAGS -fsanitize=fuzzer-no-link"
+
+ if test "$PHP_FUZZER_MSAN" = "yes"; then
+ CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ else
+ CFLAGS="$CFLAGS -fsanitize=address"
+ CXXFLAGS="$CXXFLAGS -fsanitize=address"
+
+ dnl Don't include -fundefined in CXXFLAGS, because that would also require linking
+ dnl with a C++ compiler.
+ dnl Disable object-size sanitizer, because it is incompatible with our zend_function
+ dnl union, and this can't be easily fixed.
+ dnl We need to specify -fno-sanitize-recover=undefined here, otherwise ubsan warnings
+ dnl will not be considered failures by the fuzzer.
+ CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=object-size -fno-sanitize-recover=undefined"
+ fi
+ ],[
+ AC_MSG_ERROR(Compiler doesn't support -fsanitize=fuzzer-no-link)
+ ])
+ else
+ FUZZING_LIB="$LIB_FUZZING_ENGINE"
+ FUZZING_CC="$CXX -stdlib=libc++"
+ fi
+ PHP_SUBST(FUZZING_LIB)
+ PHP_SUBST(FUZZING_CC)
+
+ dnl PHP_SELECT_SAPI(fuzzer-parser, program, $FUZZER_SOURCES, , '$(SAPI_FUZZER_PATH)')
+
+ PHP_ADD_BUILD_DIR([sapi/fuzzer])
+ PHP_FUZZER_BINARIES=""
+ PHP_BINARIES="$PHP_BINARIES fuzzer"
+ PHP_INSTALLED_SAPIS="$PHP_INSTALLED_SAPIS fuzzer"
+
+ PHP_ADD_SOURCES_X([sapi/fuzzer], [fuzzer-sapi.c], [], FUZZER_COMMON_OBJS)
+
+ PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_OBJS)
+ PHP_FUZZER_TARGET([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS)
+
+ dnl json extension is enabled by default
+ if (test -n "$enable_json" && test "$enable_json" != "no") || test -z "$PHP_ENABLE_ALL"; then
+ PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS)
+ fi
+ if test -n "$enable_exif" && test "$enable_exif" != "no"; then
+ PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS)
+ fi
+ if test -n "$enable_mbstring" && test "$enable_mbstring" != "no"; then
+ PHP_FUZZER_TARGET([mbstring], PHP_FUZZER_MBSTRING_OBJS)
+ fi
+
+ PHP_SUBST(PHP_FUZZER_BINARIES)
+fi
+
+AC_MSG_RESULT($PHP_FUZZER)
diff --git a/sapi/fuzzer/corpus/exif/bug34704.jpg b/sapi/fuzzer/corpus/exif/bug34704.jpg
new file mode 100644
index 0000000000..42b14c1908
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug34704.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug34704_2.jpg b/sapi/fuzzer/corpus/exif/bug34704_2.jpg
new file mode 100644
index 0000000000..42b14c1908
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug34704_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug48378.jpeg b/sapi/fuzzer/corpus/exif/bug48378.jpeg
new file mode 100644
index 0000000000..759d805709
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug48378.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug54002_1.jpeg b/sapi/fuzzer/corpus/exif/bug54002_1.jpeg
new file mode 100644
index 0000000000..a622d6d213
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug54002_1.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug54002_2.jpeg b/sapi/fuzzer/corpus/exif/bug54002_2.jpeg
new file mode 100644
index 0000000000..a622d6d213
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug54002_2.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug62523_1.jpg b/sapi/fuzzer/corpus/exif/bug62523_1.jpg
new file mode 100644
index 0000000000..9a63d1e84d
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug62523_1.jpg
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
+<html><head>
+<title>301 Moved Permanently</title>
+</head><body>
+<h1>Moved Permanently</h1>
+<p>The document has moved <a href="http://www.getid3.org/temp/62523.jpg">here</a>.</p>
+<hr>
+<address>Apache Server at getid3.org Port 80</address>
+</body></html>
diff --git a/sapi/fuzzer/corpus/exif/bug62523_3.jpg b/sapi/fuzzer/corpus/exif/bug62523_3.jpg
new file mode 100644
index 0000000000..3ee91368ce
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug62523_3.jpg
@@ -0,0 +1,12 @@
+<html>
+ <head><title>Found</title></head>
+ <body>
+ <h1>Found</h1>
+ <p>The resource was found at <a href="http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg">http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg</a>;
+you should be redirected automatically.
+
+<!-- --></p>
+ <hr noshade>
+ <div align="right">WSGI Server</div>
+ </body>
+</html>
diff --git a/sapi/fuzzer/corpus/exif/bug68113.jpg b/sapi/fuzzer/corpus/exif/bug68113.jpg
new file mode 100644
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68113.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug68113_2.jpg b/sapi/fuzzer/corpus/exif/bug68113_2.jpg
new file mode 100644
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68113_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug68799.jpg b/sapi/fuzzer/corpus/exif/bug68799.jpg
new file mode 100644
index 0000000000..acc326dbbf
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68799.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_1.jpg b/sapi/fuzzer/corpus/exif/bug72094_1.jpg
new file mode 100644
index 0000000000..d21382b44b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_2.jpg b/sapi/fuzzer/corpus/exif/bug72094_2.jpg
new file mode 100644
index 0000000000..ec414ce02b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_3.jpg b/sapi/fuzzer/corpus/exif/bug72094_3.jpg
new file mode 100644
index 0000000000..8b05314b67
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_3.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_4.jpg b/sapi/fuzzer/corpus/exif/bug72094_4.jpg
new file mode 100644
index 0000000000..ca6d453c2c
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_4.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72603.jpeg b/sapi/fuzzer/corpus/exif/bug72603.jpeg
new file mode 100644
index 0000000000..1764c805fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72603.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72618.jpg b/sapi/fuzzer/corpus/exif/bug72618.jpg
new file mode 100644
index 0000000000..0a61ae2e02
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72618.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72627.tiff b/sapi/fuzzer/corpus/exif/bug72627.tiff
new file mode 100644
index 0000000000..229190a604
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72627.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug73737.tiff b/sapi/fuzzer/corpus/exif/bug73737.tiff
new file mode 100644
index 0000000000..2cb036fc47
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug73737.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76130_1.jpg b/sapi/fuzzer/corpus/exif/bug76130_1.jpg
new file mode 100644
index 0000000000..e063e46d22
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76130_1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76130_2.jpg b/sapi/fuzzer/corpus/exif/bug76130_2.jpg
new file mode 100644
index 0000000000..a9e79dca5c
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76130_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76423.jpg b/sapi/fuzzer/corpus/exif/bug76423.jpg
new file mode 100644
index 0000000000..08fe2bbc57
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76423.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76557.jpg b/sapi/fuzzer/corpus/exif/bug76557.jpg
new file mode 100644
index 0000000000..d678f07c0f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76557.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77540.jpg b/sapi/fuzzer/corpus/exif/bug77540.jpg
new file mode 100644
index 0000000000..559022db0e
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77540.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77563.jpg b/sapi/fuzzer/corpus/exif/bug77563.jpg
new file mode 100644
index 0000000000..d6280151f0
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77563.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77753.tiff b/sapi/fuzzer/corpus/exif/bug77753.tiff
new file mode 100644
index 0000000000..b237f39e2b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77753.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77831.tiff b/sapi/fuzzer/corpus/exif/bug77831.tiff
new file mode 100644
index 0000000000..c7e9f4472b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77831.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77950.tiff b/sapi/fuzzer/corpus/exif/bug77950.tiff
new file mode 100644
index 0000000000..5c8250ab04
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77950.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77988.jpg b/sapi/fuzzer/corpus/exif/bug77988.jpg
new file mode 100644
index 0000000000..120ff8565a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77988.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff b/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff
new file mode 100644
index 0000000000..48c7fe61ff
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg b/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg
new file mode 100644
index 0000000000..55138abe55
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image007.jpg b/sapi/fuzzer/corpus/exif/image007.jpg
new file mode 100644
index 0000000000..852654075a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image007.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image008.jpg b/sapi/fuzzer/corpus/exif/image008.jpg
new file mode 100644
index 0000000000..3e8bfe4512
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image008.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image009.jpg b/sapi/fuzzer/corpus/exif/image009.jpg
new file mode 100644
index 0000000000..8803ddccd4
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image009.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image010.jpg b/sapi/fuzzer/corpus/exif/image010.jpg
new file mode 100644
index 0000000000..31ed6d678d
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image010.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image011.jpg b/sapi/fuzzer/corpus/exif/image011.jpg
new file mode 100644
index 0000000000..fcd5783ec7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image011.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image012.jpg b/sapi/fuzzer/corpus/exif/image012.jpg
new file mode 100644
index 0000000000..dd25e06181
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image012.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image013.jpg b/sapi/fuzzer/corpus/exif/image013.jpg
new file mode 100644
index 0000000000..93ded26667
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image013.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image014.jpg b/sapi/fuzzer/corpus/exif/image014.jpg
new file mode 100644
index 0000000000..7657a0a4c7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image014.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image015.jpg b/sapi/fuzzer/corpus/exif/image015.jpg
new file mode 100644
index 0000000000..6f52dec4d7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image015.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image016.tiff b/sapi/fuzzer/corpus/exif/image016.tiff
new file mode 100644
index 0000000000..1712113933
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image016.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image017.tiff b/sapi/fuzzer/corpus/exif/image017.tiff
new file mode 100644
index 0000000000..89800d8796
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image017.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image018.tiff b/sapi/fuzzer/corpus/exif/image018.tiff
new file mode 100644
index 0000000000..6b4492f7cd
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image018.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image020.tiff b/sapi/fuzzer/corpus/exif/image020.tiff
new file mode 100644
index 0000000000..87f187821a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image020.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image021.tiff b/sapi/fuzzer/corpus/exif/image021.tiff
new file mode 100644
index 0000000000..190f30b93a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image021.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image022.tiff b/sapi/fuzzer/corpus/exif/image022.tiff
new file mode 100644
index 0000000000..88f4373341
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image022.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image023.tiff b/sapi/fuzzer/corpus/exif/image023.tiff
new file mode 100644
index 0000000000..dc33f6ed90
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image023.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image024.jpg b/sapi/fuzzer/corpus/exif/image024.jpg
new file mode 100644
index 0000000000..0b5a42e894
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image024.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image025.jpg b/sapi/fuzzer/corpus/exif/image025.jpg
new file mode 100644
index 0000000000..a5c0e17c7a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image025.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image026.tiff b/sapi/fuzzer/corpus/exif/image026.tiff
new file mode 100644
index 0000000000..8fdafc738f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image026.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image027.tiff b/sapi/fuzzer/corpus/exif/image027.tiff
new file mode 100644
index 0000000000..7c3a37a90a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image027.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg b/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg
new file mode 100644
index 0000000000..c000b938df
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg b/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg
new file mode 100644
index 0000000000..c9f7ce821f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test1.jpg b/sapi/fuzzer/corpus/exif/test1.jpg
new file mode 100644
index 0000000000..121decb65a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test2.jpg b/sapi/fuzzer/corpus/exif/test2.jpg
new file mode 100644
index 0000000000..f60ecded6f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test22.jpg b/sapi/fuzzer/corpus/exif/test22.jpg
new file mode 100644
index 0000000000..f60ecded6f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test22.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test3.jpg b/sapi/fuzzer/corpus/exif/test3.jpg
new file mode 100644
index 0000000000..7547a16630
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test3.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test4.jpg b/sapi/fuzzer/corpus/exif/test4.jpg
new file mode 100644
index 0000000000..8a23a7b658
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test4.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test5.jpg b/sapi/fuzzer/corpus/exif/test5.jpg
new file mode 100644
index 0000000000..d03cac18a3
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test5.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test6.jpg b/sapi/fuzzer/corpus/exif/test6.jpg
new file mode 100644
index 0000000000..073cefdfe0
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test6.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff b/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff
new file mode 100644
index 0000000000..f1541b39b6
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/json/1.json b/sapi/fuzzer/corpus/json/1.json
new file mode 100644
index 0000000000..8161287aab
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/1.json
@@ -0,0 +1 @@
+{"prop":{"prop":null}}
diff --git a/sapi/fuzzer/corpus/json/10.json b/sapi/fuzzer/corpus/json/10.json
new file mode 100644
index 0000000000..59483c2539
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/10.json
@@ -0,0 +1 @@
+{"a":100.1,"b":"foo"}
diff --git a/sapi/fuzzer/corpus/json/11.json b/sapi/fuzzer/corpus/json/11.json
new file mode 100644
index 0000000000..e3907a414c
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/11.json
@@ -0,0 +1 @@
+[100.1,"bar"]
diff --git a/sapi/fuzzer/corpus/json/12.json b/sapi/fuzzer/corpus/json/12.json
new file mode 100644
index 0000000000..222a6678f9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/12.json
@@ -0,0 +1,2 @@
+{"0":0,"\u0000ab":1,"1":"\u0000null-prefixed value"}
+
diff --git a/sapi/fuzzer/corpus/json/13.json b/sapi/fuzzer/corpus/json/13.json
new file mode 100644
index 0000000000..b9c504cdbe
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/13.json
@@ -0,0 +1 @@
+{ "test": { "foo": "bar" } }
diff --git a/sapi/fuzzer/corpus/json/14.json b/sapi/fuzzer/corpus/json/14.json
new file mode 100644
index 0000000000..0014681471
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/14.json
@@ -0,0 +1,2 @@
+"aa\udbff\udffdzz"
+
diff --git a/sapi/fuzzer/corpus/json/15.json b/sapi/fuzzer/corpus/json/15.json
new file mode 100644
index 0000000000..92591f81a3
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/15.json
@@ -0,0 +1 @@
+"latin 1234 -\/ russian мама мыла раму specialchars \u0002 \b \n U+1D11E >ð„ž<"
diff --git a/sapi/fuzzer/corpus/json/16.json b/sapi/fuzzer/corpus/json/16.json
new file mode 100644
index 0000000000..2129292029
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/16.json
@@ -0,0 +1 @@
+{"test":"123343e871700"}
diff --git a/sapi/fuzzer/corpus/json/17.json b/sapi/fuzzer/corpus/json/17.json
new file mode 100644
index 0000000000..4e4676b299
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/17.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
diff --git a/sapi/fuzzer/corpus/json/18.json b/sapi/fuzzer/corpus/json/18.json
new file mode 100644
index 0000000000..81873afdec
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/18.json
@@ -0,0 +1 @@
+{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}
diff --git a/sapi/fuzzer/corpus/json/19.json b/sapi/fuzzer/corpus/json/19.json
new file mode 100644
index 0000000000..cc33c95a71
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/19.json
@@ -0,0 +1 @@
+"\u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8\u3067\u3059\u300201234\uff15\uff16\uff17\uff18\uff19\u3002"
diff --git a/sapi/fuzzer/corpus/json/2.json b/sapi/fuzzer/corpus/json/2.json
new file mode 100644
index 0000000000..3a9a9722e2
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/2.json
@@ -0,0 +1 @@
+{"largenum":123456789012345678901234567890}
diff --git a/sapi/fuzzer/corpus/json/3.json b/sapi/fuzzer/corpus/json/3.json
new file mode 100644
index 0000000000..b004f2079d
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/3.json
@@ -0,0 +1 @@
+["<foo>","'bar'","\"baz\"","&blong&"]
diff --git a/sapi/fuzzer/corpus/json/4.json b/sapi/fuzzer/corpus/json/4.json
new file mode 100644
index 0000000000..8e73a26dab
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/4.json
@@ -0,0 +1 @@
+["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026"]
diff --git a/sapi/fuzzer/corpus/json/5.json b/sapi/fuzzer/corpus/json/5.json
new file mode 100644
index 0000000000..5c7912450d
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/5.json
@@ -0,0 +1,5 @@
+[
+{"":"value"},
+{"":"value", "key":"value"},
+{"key":"value", "":"value"}
+]
diff --git a/sapi/fuzzer/corpus/json/6.json b/sapi/fuzzer/corpus/json/6.json
new file mode 100644
index 0000000000..2d852843f1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/6.json
@@ -0,0 +1 @@
+[123,13452345,123.13452345]
diff --git a/sapi/fuzzer/corpus/json/7.json b/sapi/fuzzer/corpus/json/7.json
new file mode 100644
index 0000000000..6e74debaf0
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/7.json
@@ -0,0 +1,2 @@
+["\ud834\udd00"]
+
diff --git a/sapi/fuzzer/corpus/json/8.json b/sapi/fuzzer/corpus/json/8.json
new file mode 100644
index 0000000000..7ea60c3af9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/8.json
@@ -0,0 +1 @@
+{"zero": 0e0}
diff --git a/sapi/fuzzer/corpus/json/9.json b/sapi/fuzzer/corpus/json/9.json
new file mode 100644
index 0000000000..49e7327986
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/9.json
@@ -0,0 +1 @@
+[null,null,"abc"]
diff --git a/sapi/fuzzer/corpus/json/fail1.json b/sapi/fuzzer/corpus/json/fail1.json
new file mode 100644
index 0000000000..6216b865f1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail1.json
@@ -0,0 +1 @@
+"A JSON payload should be an object or array, not a string." \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail10.json b/sapi/fuzzer/corpus/json/fail10.json
new file mode 100644
index 0000000000..5d8c0047bd
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail10.json
@@ -0,0 +1 @@
+{"Extra value after close": true} "misplaced quoted value" \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail11.json b/sapi/fuzzer/corpus/json/fail11.json
new file mode 100644
index 0000000000..76eb95b458
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail11.json
@@ -0,0 +1 @@
+{"Illegal expression": 1 + 2} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail12.json b/sapi/fuzzer/corpus/json/fail12.json
new file mode 100644
index 0000000000..77580a4522
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail12.json
@@ -0,0 +1 @@
+{"Illegal invocation": alert()} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail13.json b/sapi/fuzzer/corpus/json/fail13.json
new file mode 100644
index 0000000000..379406b59b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail13.json
@@ -0,0 +1 @@
+{"Numbers cannot have leading zeroes": 013} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail14.json b/sapi/fuzzer/corpus/json/fail14.json
new file mode 100644
index 0000000000..0ed366b38a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail14.json
@@ -0,0 +1 @@
+{"Numbers cannot be hex": 0x14} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail15.json b/sapi/fuzzer/corpus/json/fail15.json
new file mode 100644
index 0000000000..fc8376b605
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail15.json
@@ -0,0 +1 @@
+["Illegal backslash escape: \x15"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail16.json b/sapi/fuzzer/corpus/json/fail16.json
new file mode 100644
index 0000000000..3fe21d4b53
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail16.json
@@ -0,0 +1 @@
+[\naked] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail17.json b/sapi/fuzzer/corpus/json/fail17.json
new file mode 100644
index 0000000000..62b9214aed
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail17.json
@@ -0,0 +1 @@
+["Illegal backslash escape: \017"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail18.json b/sapi/fuzzer/corpus/json/fail18.json
new file mode 100644
index 0000000000..edac92716f
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail18.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail19.json b/sapi/fuzzer/corpus/json/fail19.json
new file mode 100644
index 0000000000..3b9c46fa9a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail19.json
@@ -0,0 +1 @@
+{"Missing colon" null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail2.json b/sapi/fuzzer/corpus/json/fail2.json
new file mode 100644
index 0000000000..6b7c11e5a5
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail2.json
@@ -0,0 +1 @@
+["Unclosed array" \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail20.json b/sapi/fuzzer/corpus/json/fail20.json
new file mode 100644
index 0000000000..27c1af3e72
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail20.json
@@ -0,0 +1 @@
+{"Double colon":: null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail21.json b/sapi/fuzzer/corpus/json/fail21.json
new file mode 100644
index 0000000000..62474573b2
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail21.json
@@ -0,0 +1 @@
+{"Comma instead of colon", null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail22.json b/sapi/fuzzer/corpus/json/fail22.json
new file mode 100644
index 0000000000..a7752581bc
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail22.json
@@ -0,0 +1 @@
+["Colon instead of comma": false] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail23.json b/sapi/fuzzer/corpus/json/fail23.json
new file mode 100644
index 0000000000..494add1ca1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail23.json
@@ -0,0 +1 @@
+["Bad value", truth] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail24.json b/sapi/fuzzer/corpus/json/fail24.json
new file mode 100644
index 0000000000..caff239bfc
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail24.json
@@ -0,0 +1 @@
+['single quote'] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail25.json b/sapi/fuzzer/corpus/json/fail25.json
new file mode 100644
index 0000000000..8b7ad23e01
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail25.json
@@ -0,0 +1 @@
+[" tab character in string "] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail26.json b/sapi/fuzzer/corpus/json/fail26.json
new file mode 100644
index 0000000000..845d26a6a5
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail26.json
@@ -0,0 +1 @@
+["tab\ character\ in\ string\ "] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail27.json b/sapi/fuzzer/corpus/json/fail27.json
new file mode 100644
index 0000000000..6b01a2ca4a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail27.json
@@ -0,0 +1,2 @@
+["line
+break"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail28.json b/sapi/fuzzer/corpus/json/fail28.json
new file mode 100644
index 0000000000..621a0101c6
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail28.json
@@ -0,0 +1,2 @@
+["line\
+break"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail29.json b/sapi/fuzzer/corpus/json/fail29.json
new file mode 100644
index 0000000000..47ec421bb6
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail29.json
@@ -0,0 +1 @@
+[0e] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail3.json b/sapi/fuzzer/corpus/json/fail3.json
new file mode 100644
index 0000000000..168c81eb78
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail3.json
@@ -0,0 +1 @@
+{unquoted_key: "keys must be quoted"} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail30.json b/sapi/fuzzer/corpus/json/fail30.json
new file mode 100644
index 0000000000..8ab0bc4b8b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail30.json
@@ -0,0 +1 @@
+[0e+] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail31.json b/sapi/fuzzer/corpus/json/fail31.json
new file mode 100644
index 0000000000..1cce602b51
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail31.json
@@ -0,0 +1 @@
+[0e+-1] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail32.json b/sapi/fuzzer/corpus/json/fail32.json
new file mode 100644
index 0000000000..45cba7396f
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail32.json
@@ -0,0 +1 @@
+{"Comma instead if closing brace": true, \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail33.json b/sapi/fuzzer/corpus/json/fail33.json
new file mode 100644
index 0000000000..ca5eb19dc9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail33.json
@@ -0,0 +1 @@
+["mismatch"} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail4.json b/sapi/fuzzer/corpus/json/fail4.json
new file mode 100644
index 0000000000..9de168bf34
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail4.json
@@ -0,0 +1 @@
+["extra comma",] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail5.json b/sapi/fuzzer/corpus/json/fail5.json
new file mode 100644
index 0000000000..ddf3ce3d24
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail5.json
@@ -0,0 +1 @@
+["double extra comma",,] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail6.json b/sapi/fuzzer/corpus/json/fail6.json
new file mode 100644
index 0000000000..ed91580e1b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail6.json
@@ -0,0 +1 @@
+[ , "<-- missing value"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail7.json b/sapi/fuzzer/corpus/json/fail7.json
new file mode 100644
index 0000000000..8a96af3e4e
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail7.json
@@ -0,0 +1 @@
+["Comma after the close"], \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail8.json b/sapi/fuzzer/corpus/json/fail8.json
new file mode 100644
index 0000000000..b28479c6ec
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail8.json
@@ -0,0 +1 @@
+["Extra close"]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail9.json b/sapi/fuzzer/corpus/json/fail9.json
new file mode 100644
index 0000000000..5815574f36
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail9.json
@@ -0,0 +1 @@
+{"Extra comma": true,} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass1.json b/sapi/fuzzer/corpus/json/pass1.json
new file mode 100644
index 0000000000..70e2685436
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass1.json
@@ -0,0 +1,58 @@
+[
+ "JSON Test Pattern pass1",
+ {"object with 1 member":["array with 1 element"]},
+ {},
+ [],
+ -42,
+ true,
+ false,
+ null,
+ {
+ "integer": 1234567890,
+ "real": -9876.543210,
+ "e": 0.123456789e-12,
+ "E": 1.234567890E+34,
+ "": 23456789012E66,
+ "zero": 0,
+ "one": 1,
+ "space": " ",
+ "quote": "\"",
+ "backslash": "\\",
+ "controls": "\b\f\n\r\t",
+ "slash": "/ & \/",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "digit": "0123456789",
+ "0123456789": "digit",
+ "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
+ "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+ "true": true,
+ "false": false,
+ "null": null,
+ "array":[ ],
+ "object":{ },
+ "address": "50 St. James Street",
+ "url": "http://www.JSON.org/",
+ "comment": "// /* <!-- --",
+ "# -- --> */": " ",
+ " s p a c e d " :[1,2 , 3
+
+,
+
+4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
+ "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
+ "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
+ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
+: "A key can be any string"
+ },
+ 0.5 ,98.6
+,
+99.44
+,
+
+1066,
+1e1,
+0.1e1,
+1e-1,
+1e00,2e+00,2e-00
+,"rosebud"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass2.json b/sapi/fuzzer/corpus/json/pass2.json
new file mode 100644
index 0000000000..d3c63c7ad8
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass2.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass3.json b/sapi/fuzzer/corpus/json/pass3.json
new file mode 100644
index 0000000000..4528d51f1a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass3.json
@@ -0,0 +1,6 @@
+{
+ "JSON Test Pattern pass3": {
+ "The outermost value": "must be an object or array.",
+ "In this test": "It is an object."
+ }
+}
diff --git a/sapi/fuzzer/corpus/unserialize/__serialize_007 b/sapi/fuzzer/corpus/unserialize/__serialize_007
new file mode 100644
index 0000000000..6709aca303
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/__serialize_007
@@ -0,0 +1 @@
+O:13:"ArrayIterator":2:{i:0;i:0;s:1:"x";R:2;}
diff --git a/sapi/fuzzer/corpus/unserialize/bug7131 b/sapi/fuzzer/corpus/unserialize/bug7131
new file mode 100644
index 0000000000..1ba49d8da1
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug7131
@@ -0,0 +1 @@
+C:11:"ArrayObject":11:{x:i:0;r:3;X} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug71313 b/sapi/fuzzer/corpus/unserialize/bug71313
new file mode 100644
index 0000000000..4163b0350a
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug71313
@@ -0,0 +1 @@
+C:16:"SplObjectStorage":113:{x:i:2;O:8:"stdClass":0:{},a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}};r:7;,R:2;s:4:"next";;r:3;};m:a:0:{}} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug73144_1 b/sapi/fuzzer/corpus/unserialize/bug73144_1
new file mode 100644
index 0000000000..0d6d600520
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73144_1
@@ -0,0 +1 @@
+a:2:{i:0;O:1:"0":2:0s:1:"0";i:0;s:1:"0";a:1:{i:0;C:11:"ArrayObject":7:{x:i:0;r}
diff --git a/sapi/fuzzer/corpus/unserialize/bug73144_2 b/sapi/fuzzer/corpus/unserialize/bug73144_2
new file mode 100644
index 0000000000..d1145066c5
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73144_2
@@ -0,0 +1 @@
+C:11:"ArrayObject":34:{x:i:1;O:8:"stdClass":1:{};m:a:0:{}} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug73825 b/sapi/fuzzer/corpus/unserialize/bug73825
new file mode 100644
index 0000000000..dc9b0e4334
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73825
@@ -0,0 +1 @@
+O:8:"00000000":
diff --git a/sapi/fuzzer/corpus/unserialize/bug74101 b/sapi/fuzzer/corpus/unserialize/bug74101
new file mode 100644
index 0000000000..b8d2fd2308
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74101
@@ -0,0 +1 @@
+O:9:"Exception":799999999999999999999999999997:0i:0;a:0:{}i:2;i:0;i:0;R:2;
diff --git a/sapi/fuzzer/corpus/unserialize/bug74103 b/sapi/fuzzer/corpus/unserialize/bug74103
new file mode 100644
index 0000000000..ab2f70239c
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74103
@@ -0,0 +1 @@
+a:7:{i:0;i:04;s:1:"a";i:2;i:9617006;i:4;s:1:"a";i:4;s:1:"a";R:5;s:1:"7";R:3;s:1:"a";R:5;;s:18;}}
diff --git a/sapi/fuzzer/corpus/unserialize/bug74111 b/sapi/fuzzer/corpus/unserialize/bug74111
new file mode 100644
index 0000000000..c1196ee7de
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74111
@@ -0,0 +1 @@
+O:8:"stdClass":00000000
diff --git a/sapi/fuzzer/corpus/unserialize/bug74614 b/sapi/fuzzer/corpus/unserialize/bug74614
new file mode 100644
index 0000000000..c7174893fe
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74614
@@ -0,0 +1 @@
+a:3020000000000000000000000000000001:{i:0;a:0:{}i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:5;i:6;i:6;i:7;i:7;i:8;i:8;R:2;}
diff --git a/sapi/fuzzer/corpus/unserialize/bug75054 b/sapi/fuzzer/corpus/unserialize/bug75054
new file mode 100644
index 0000000000..866e5b8fca
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug75054
@@ -0,0 +1 @@
+a:9:{i:0;s:4:"0000";i:0;s:4:"0000";i:0;R:2;s:4:"5003";R:2;s:4:"0000";R:2;s:4:"0000";R:2;s:4:"000";R:2;s:4:"0000";d:0;s:4:"0000";a:9:{s:4:"0000"; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/int_min_iv b/sapi/fuzzer/corpus/unserialize/int_min_iv
new file mode 100644
index 0000000000..6900dce088
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/int_min_iv
@@ -0,0 +1 @@
+i:-9223372036854775808;
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17628 b/sapi/fuzzer/corpus/unserialize/leak_17628
new file mode 100644
index 0000000000..45fd8644db
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17628
@@ -0,0 +1 @@
+a:2:{i:0;O:19:"SplDoublyLinkedList":8:i:0;i:04;i:965556;a:6:{i:0;R:04;S:1:"a";i:2;i:961;a:8:{i:0;i:04;i:0;i:0026;i:0;a:2:{i:0;O:13:"RegexIterator":1: i:6176;a:8:{i:0;i:04;S:1:"a";i:2;i:96140012;s:1:"a";i:0;i:91755555500000016742;i:8;a:8:{i:0;i:048;i:2;d:0000800000001000000000000014000000000000000000000040400000004000000516742;i:9;a:8:{i:0;i:048;i:2;d:0000800000001000000000000000000000000000002;i:04;a:9:{i:5;R:11;s:4:"m000";O:9:"Eepictxon":85:{i:5;R:2;s:4:"m000";O:9:"Eepictxon":8:0i:-012;s:1:"a";i:0;i:96170026;i:0;i:04;S:1:"a";i:2;i:9617006;a:7:{i:6;a:7:{i:0;a:9:{i:5;R:1;s:4:"m000";O:9:"Eepictxon":86:{i:5;R:2;s:4:"m000";O:9:"Eepictxon":8:0i:-01400;a:8:{i:0;i:04;i:0;i:0026;i:0;a:2:{i:0;a:2:{i:0;O:19:"SplDoublyLinkedList":8:i:0;86:{i:5;R:2;on":8:0i:-0140012;s:1:"a";i:0;i:96170026;i:0;i:04;S:1:"a";i:2;i:9617006;a:7:{i:07006;a:7:{i:0;a:9:{i:5;R:1;s:4:"m000";O \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17639 b/sapi/fuzzer/corpus/unserialize/leak_17639
new file mode 100644
index 0000000000..fb8625a700
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17639
@@ -0,0 +1 @@
+a:7:{i:6;i:0;S:1:" ";i:1;i:6;a:8:{i:0;i:4;S:1:" ";i:2;i:9;R:4;S:1:" ";a:2:{i:5;O:13:"RegexIterator":1 i:7;a:8:{i:0;a:7:{i:0;R:10; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17646 b/sapi/fuzzer/corpus/unserialize/leak_17646
new file mode 100644
index 0000000000..ac7969e683
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17646
@@ -0,0 +1 @@
+O:13:"RegexIter\tor":3:{S:1:"x";a:9:{i:04;R:1;i:5312;O:13:"RegexIterator":53;¥i:08032617006;a:7:{i:0;R:04;S:1:"a";i:2;i:5312;O:13:"RegexIterator":53;¥i:080326170;O:1:"0":2:1s:1:"1";i:0;i:0;O:13:"Liþÿÿÿterator":2:{i:0;a:6:{i:0;O:1:"0":2:1s:1:"1";i:0;i:1;r:9;}s:1:"1";i:0;i:11111101111110;O:1:"0":4:1s:1:"0";a:6:{i:0;a:2:{i:0;O:10:"ValueError":4:{i:0;O:10:"ValueError":2:{i:0;O:10:"ValueError":4:{i:Error":4:a:7:{s:2:"c{i:0;";a:7:{S:O: \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count b/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count
new file mode 100644
index 0000000000..29a3ac47af
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count
@@ -0,0 +1 @@
+C:16:"SplObjectStorage":25:{x:i:-9223372036854775808;}
diff --git a/sapi/fuzzer/dict/parser b/sapi/fuzzer/dict/parser
new file mode 100644
index 0000000000..8b382afac9
--- /dev/null
+++ b/sapi/fuzzer/dict/parser
@@ -0,0 +1,85 @@
+"exit"
+"die"
+"fn"
+"function"
+"const"
+"return"
+"yield"
+"yield from"
+"try"
+"catch"
+"finally"
+"throw"
+"if"
+"elseif"
+"endif"
+"else"
+"while"
+"endwhile"
+"do"
+"for"
+"endfor"
+"foreach"
+"endforeach"
+"declare"
+"enddeclare"
+"instanceof"
+"as"
+"switch"
+"endswitch"
+"case"
+"default"
+"break"
+"continue"
+"goto"
+"echo"
+"print"
+"class"
+"interface"
+"trait"
+"extends"
+"implements"
+"new"
+"clone"
+"var"
+"int"
+"integer"
+"float"
+"double"
+"real"
+"string"
+"binary"
+"array"
+"object"
+"bool"
+"boolean"
+"unset"
+"eval"
+"include"
+"include_once"
+"require"
+"require_once"
+"namespace"
+"use"
+"insteadof"
+"global"
+"isset"
+"empty"
+"__halt_compiler"
+"static"
+"abstract"
+"final"
+"private"
+"protected"
+"public"
+"unset"
+"list"
+"callable"
+"__class__"
+"__trait__"
+"__function__"
+"__method__"
+"__line__"
+"__file__"
+"__dir__"
+"__namespace__"
diff --git a/sapi/fuzzer/fuzzer-exif.c b/sapi/fuzzer/fuzzer-exif.c
new file mode 100644
index 0000000000..230852bb61
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-exif.c
@@ -0,0 +1,72 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+#include "ext/standard/php_var.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#if HAVE_EXIF
+ php_stream *stream;
+ zval stream_zv;
+
+ if (Size > 256 * 1024) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ stream = php_stream_fopen_tmpfile();
+ php_stream_write(stream, (const char *) Data, Size);
+ php_stream_to_zval(stream, &stream_zv);
+
+ fuzzer_call_php_func_zval("exif_read_data", 1, &stream_zv);
+
+ zval_ptr_dtor(&stream_zv);
+
+ /* cleanup */
+ php_request_shutdown(NULL);
+
+ return 0;
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without EXIF, recompile with --enable-exif to use this fuzzer\n");
+ exit(1);
+#endif
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
+
diff --git a/sapi/fuzzer/fuzzer-json.c b/sapi/fuzzer/fuzzer-json.c
new file mode 100644
index 0000000000..45ec78ae4c
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-json.c
@@ -0,0 +1,70 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+#ifdef HAVE_JSON
+#include "ext/json/php_json_parser.h"
+#endif
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#ifdef HAVE_JSON
+ char *data = malloc(Size+1);
+ memcpy(data, Data, Size);
+ data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ for (int option = 0; option <=1; ++option) {
+ zval result;
+ php_json_parser parser;
+ php_json_parser_init(&parser, &result, data, Size, option, 10);
+ if (php_json_yyparse(&parser) == SUCCESS) {
+ zval_ptr_dtor(&result);
+ }
+ }
+
+ php_request_shutdown(NULL);
+
+ free(data);
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without JSON, recompile with --enable-json to use this fuzzer\n");
+ exit(1);
+#endif
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-mbstring.c b/sapi/fuzzer/fuzzer-mbstring.c
new file mode 100644
index 0000000000..3ec0c42c4e
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-mbstring.c
@@ -0,0 +1,72 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#ifdef HAVE_MBREGEX
+ char *args[2];
+ char *data = malloc(Size+1);
+ memcpy(data, Data, Size);
+ data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ args[0] = data;
+ args[1] = "test123";
+ fuzzer_call_php_func("mb_ereg", 2, args);
+
+ args[0] = data;
+ args[1] = "test123";
+ fuzzer_call_php_func("mb_eregi", 2, args);
+
+ args[0] = data;
+ args[1] = data;
+ fuzzer_call_php_func("mb_ereg", 2, args);
+
+ args[0] = data;
+ args[1] = data;
+ fuzzer_call_php_func("mb_eregi", 2, args);
+
+ php_request_shutdown(NULL);
+
+ free(data);
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without mbstring, recompile with --enable-mbstring to use this fuzzer\n");
+ exit(1);
+#endif
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-parser.c b/sapi/fuzzer/fuzzer-parser.c
new file mode 100644
index 0000000000..155bd991cc
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-parser.c
@@ -0,0 +1,55 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+#include <main/php_main.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <ext/standard/php_var.h>
+#include <main/php_variables.h>
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ char *s;
+ if (Size > 64 * 1024) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ s = malloc(Size+1);
+ memcpy(s, Data, Size);
+ s[Size] = '\0';
+
+ fuzzer_do_request_from_buffer("fuzzer.php", s, Size);
+
+ /* Do not free s: fuzzer_do_request_from_buffer() takes ownership of the allocation. */
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ /* Compilation will often trigger fatal errors.
+ * Use tracked allocation mode to avoid leaks in that case. */
+ putenv("USE_TRACKED_ALLOC=1");
+
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-sapi.c b/sapi/fuzzer/fuzzer-sapi.c
new file mode 100644
index 0000000000..fb552974e8
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.c
@@ -0,0 +1,273 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+#include <main/php_main.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <ext/standard/php_var.h>
+#include <main/php_variables.h>
+
+#ifdef __SANITIZE_ADDRESS__
+# include "sanitizer/lsan_interface.h"
+#endif
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+const char HARDCODED_INI[] =
+ "html_errors=0\n"
+ "implicit_flush=1\n"
+ "output_buffering=0\n"
+ "error_reporting=0\n"
+ /* Reduce oniguruma limits by a factor of 10 to speed up fuzzing */
+ "mbstring.regex_stack_limit=10000\n"
+ "mbstring.regex_retry_limit=100000";
+
+static int startup(sapi_module_struct *sapi_module)
+{
+ if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+ return FAILURE;
+ }
+ return SUCCESS;
+}
+
+static size_t ub_write(const char *str, size_t str_length)
+{
+ /* quiet */
+ return str_length;
+}
+
+static void fuzzer_flush(void *server_context)
+{
+ /* quiet */
+}
+
+static void send_header(sapi_header_struct *sapi_header, void *server_context)
+{
+}
+
+static char* read_cookies()
+{
+ /* TODO: fuzz these! */
+ return NULL;
+}
+
+static void register_variables(zval *track_vars_array)
+{
+ php_import_environment_variables(track_vars_array);
+}
+
+static void log_message(char *message, int level)
+{
+}
+
+
+static sapi_module_struct fuzzer_module = {
+ "fuzzer", /* name */
+ "clang fuzzer", /* pretty name */
+
+ startup, /* startup */
+ php_module_shutdown_wrapper, /* shutdown */
+
+ NULL, /* activate */
+ NULL, /* deactivate */
+
+ ub_write, /* unbuffered write */
+ fuzzer_flush, /* flush */
+ NULL, /* get uid */
+ NULL, /* getenv */
+
+ php_error, /* error handler */
+
+ NULL, /* header handler */
+ NULL, /* send headers handler */
+ send_header, /* send header handler */
+
+ NULL, /* read POST data */
+ read_cookies, /* read Cookies */
+
+ register_variables, /* register server variables */
+ log_message, /* Log message */
+ NULL, /* Get request time */
+ NULL, /* Child terminate */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
+};
+
+int fuzzer_init_php()
+{
+#ifdef __SANITIZE_ADDRESS__
+ /* We're going to leak all the memory allocated during startup,
+ * so disable lsan temporarily. */
+ __lsan_disable();
+#endif
+
+ sapi_startup(&fuzzer_module);
+ fuzzer_module.phpinfo_as_text = 1;
+
+ fuzzer_module.ini_entries = malloc(sizeof(HARDCODED_INI));
+ memcpy(fuzzer_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
+
+ /*
+ * TODO: we might want to test both Zend and malloc MM, but testing with malloc
+ * is more likely to find bugs, so use that for now.
+ */
+ putenv("USE_ZEND_ALLOC=0");
+
+ if (fuzzer_module.startup(&fuzzer_module)==FAILURE) {
+ return FAILURE;
+ }
+
+#ifdef __SANITIZE_ADDRESS__
+ __lsan_enable();
+#endif
+
+ return SUCCESS;
+}
+
+int fuzzer_request_startup()
+{
+ if (php_request_startup() == FAILURE) {
+ php_module_shutdown();
+ return FAILURE;
+ }
+
+#ifdef ZEND_SIGNALS
+ /* Some signal handlers will be overriden,
+ * don't complain about them during shutdown. */
+ SIGG(check) = 0;
+#endif
+
+ return SUCCESS;
+}
+
+void fuzzer_set_ini_file(const char *file)
+{
+ if (fuzzer_module.php_ini_path_override) {
+ free(fuzzer_module.php_ini_path_override);
+ }
+ fuzzer_module.php_ini_path_override = strdup(file);
+}
+
+
+int fuzzer_shutdown_php()
+{
+ php_module_shutdown();
+ sapi_shutdown();
+
+ free(fuzzer_module.ini_entries);
+ return SUCCESS;
+}
+
+int fuzzer_do_request(zend_file_handle *file_handle, char *filename)
+{
+ int retval = FAILURE; /* failure by default */
+
+ SG(options) |= SAPI_OPTION_NO_CHDIR;
+ SG(request_info).argc=0;
+ SG(request_info).argv=NULL;
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return FAILURE;
+ }
+
+ SG(headers_sent) = 1;
+ SG(request_info).no_headers = 1;
+ php_register_variable("PHP_SELF", filename, NULL);
+
+ zend_first_try {
+ zend_op_array *op_array = zend_compile_file(file_handle, ZEND_REQUIRE);
+ if (op_array) {
+ destroy_op_array(op_array);
+ efree(op_array);
+ }
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+ /*retval = php_execute_script(file_handle);*/
+ } zend_end_try();
+
+ php_request_shutdown((void *) 0);
+
+ return (retval == SUCCESS) ? SUCCESS : FAILURE;
+}
+
+
+int fuzzer_do_request_f(char *filename)
+{
+ zend_file_handle file_handle;
+ file_handle.type = ZEND_HANDLE_FILENAME;
+ file_handle.filename = filename;
+ file_handle.handle.fp = NULL;
+ file_handle.opened_path = NULL;
+
+ return fuzzer_do_request(&file_handle, filename);
+}
+
+int fuzzer_do_request_from_buffer(char *filename, char *data, size_t data_len)
+{
+ zend_file_handle file_handle;
+ file_handle.filename = filename;
+ file_handle.free_filename = 0;
+ file_handle.opened_path = NULL;
+ file_handle.handle.stream.handle = NULL;
+ file_handle.handle.stream.reader = (zend_stream_reader_t)_php_stream_read;
+ file_handle.handle.stream.fsizer = NULL;
+ file_handle.handle.stream.isatty = 0;
+ file_handle.handle.stream.closer = NULL;
+ file_handle.buf = data;
+ file_handle.len = data_len;
+ file_handle.type = ZEND_HANDLE_STREAM;
+
+ return fuzzer_do_request(&file_handle, filename);
+}
+
+// Call named PHP function with N zval arguments
+void fuzzer_call_php_func_zval(const char *func_name, int nargs, zval *args) {
+ zval retval, func;
+
+ ZVAL_STRING(&func, func_name);
+ ZVAL_UNDEF(&retval);
+ call_user_function(CG(function_table), NULL, &func, &retval, nargs, args);
+
+ // TODO: check result?
+ /* to ensure retval is not broken */
+ php_var_dump(&retval, 0);
+
+ /* cleanup */
+ zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&func);
+}
+
+// Call named PHP function with N string arguments
+void fuzzer_call_php_func(const char *func_name, int nargs, char **params) {
+ zval args[nargs];
+ int i;
+
+ for(i=0;i<nargs;i++) {
+ ZVAL_STRING(&args[i], params[i]);
+ }
+
+ fuzzer_call_php_func_zval(func_name, nargs, args);
+
+ for(i=0;i<nargs;i++) {
+ zval_ptr_dtor(&args[i]);
+ ZVAL_UNDEF(&args[i]);
+ }
+}
diff --git a/sapi/fuzzer/fuzzer-sapi.h b/sapi/fuzzer/fuzzer-sapi.h
new file mode 100644
index 0000000000..495ca32c3d
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.h
@@ -0,0 +1,22 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+int fuzzer_init_php();
+int fuzzer_request_startup();
+void fuzzer_call_php_func(const char *func_name, int nargs, char **params);
+void fuzzer_call_php_func_zval(const char *func_name, int nargs, zval *args);
+int fuzzer_do_request_from_buffer(char *filename, char *data, size_t data_len);
diff --git a/sapi/fuzzer/fuzzer-unserialize.c b/sapi/fuzzer/fuzzer-unserialize.c
new file mode 100644
index 0000000000..4b65197df9
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-unserialize.c
@@ -0,0 +1,90 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+#include "ext/standard/php_var.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ unsigned char *orig_data = malloc(Size+1);
+ zend_execute_data execute_data;
+ zend_function func;
+
+ memcpy(orig_data, Data, Size);
+ orig_data[Size] = '\0';
+
+ if (fuzzer_request_startup()==FAILURE) {
+ return 0;
+ }
+
+ /* Set up a dummy stack frame so that exceptions may be thrown. */
+ {
+ memset(&execute_data, 0, sizeof(zend_execute_data));
+ memset(&func, 0, sizeof(zend_function));
+
+ func.type = ZEND_INTERNAL_FUNCTION;
+ func.common.function_name = ZSTR_EMPTY_ALLOC();
+ execute_data.func = &func;
+ EG(current_execute_data) = &execute_data;
+ }
+
+ {
+ const unsigned char *data = orig_data;
+ zval result;
+ ZVAL_UNDEF(&result);
+
+ php_unserialize_data_t var_hash;
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ php_var_unserialize(&result, (const unsigned char **) &data, data + Size, &var_hash);
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ zval_ptr_dtor(&result);
+
+ /* Destroy any thrown exception. */
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+ }
+
+ /* Unserialize may create circular structure. Make sure we free them.
+ * Two calls are performed to handle objects with destructors. */
+ zend_gc_collect_cycles();
+ zend_gc_collect_cycles();
+ php_request_shutdown(NULL);
+
+ free(orig_data);
+
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer.h b/sapi/fuzzer/fuzzer.h
new file mode 100644
index 0000000000..644179f309
--- /dev/null
+++ b/sapi/fuzzer/fuzzer.h
@@ -0,0 +1,18 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "php_version.h"
+#define FUZZER_VERSION PHP_VERSION
diff --git a/sapi/fuzzer/generate_parser_corpus.php b/sapi/fuzzer/generate_parser_corpus.php
new file mode 100644
index 0000000000..39cd605438
--- /dev/null
+++ b/sapi/fuzzer/generate_parser_corpus.php
@@ -0,0 +1,22 @@
+<?php
+
+$testsDir = __DIR__ . '/../../Zend/tests/';
+$it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($testsDir),
+ RecursiveIteratorIterator::LEAVES_ONLY
+);
+
+$corpusDir = __DIR__ . '/corpus/parser';
+@mkdir($corpusDir);
+
+foreach ($it as $file) {
+ if (!preg_match('/\.phpt$/', $file)) continue;
+ $code = file_get_contents($file);
+ if (!preg_match('/--FILE--\R(.*?)\R--([_A-Z]+)--/s', $code, $matches)) continue;
+ $code = $matches[1];
+
+ $outFile = str_replace($testsDir, '', $file);
+ $outFile = str_replace('/', '_', $outFile);
+ $outFile = $corpusDir . '/' . $outFile;
+ file_put_contents($outFile, $code);
+}
diff --git a/sapi/fuzzer/generate_unserialize_dict.php b/sapi/fuzzer/generate_unserialize_dict.php
new file mode 100644
index 0000000000..cf270788d3
--- /dev/null
+++ b/sapi/fuzzer/generate_unserialize_dict.php
@@ -0,0 +1,9 @@
+<?php
+
+$dict = "";
+foreach (get_declared_classes() as $class) {
+ $len = strlen($class);
+ $dict .= "\"$len:\\\"$class\\\"\"\n";
+}
+
+file_put_contents(__DIR__ . "/dict/unserialize", $dict);
diff --git a/sapi/fuzzer/json.dict b/sapi/fuzzer/json.dict
new file mode 100644
index 0000000000..e08245a219
--- /dev/null
+++ b/sapi/fuzzer/json.dict
@@ -0,0 +1,52 @@
+#
+# AFL dictionary for JSON
+# -----------------------
+#
+# Just the very basics.
+#
+# Inspired by a dictionary by Jakub Wilk <jwilk@jwilk.net>
+#
+
+"0"
+",0"
+":0"
+"0:"
+"-1.2e+3"
+
+"true"
+"false"
+"null"
+
+"\"\""
+",\"\""
+":\"\""
+"\"\":"
+
+"{}"
+",{}"
+":{}"
+"{\"\":0}"
+"{{}}"
+
+"[]"
+",[]"
+":[]"
+"[0]"
+"[[]]"
+
+"''"
+"\\"
+"\\b"
+"\\f"
+"\\n"
+"\\r"
+"\\t"
+"\\u0000"
+"\\x00"
+"\\0"
+"\\uD800\\uDC00"
+"\\uDBFF\\uDFFF"
+
+"\"\":0"
+"//"
+"/**/"
diff --git a/sapi/litespeed/config.m4 b/sapi/litespeed/config.m4
index 3a816a19bf..8907405385 100644
--- a/sapi/litespeed/config.m4
+++ b/sapi/litespeed/config.m4
@@ -18,7 +18,7 @@ if test "$PHP_LITESPEED" != "no"; then
BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
*)
- BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
+ BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_LITESPEED_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
esac
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index f7d4b1a84c..54cd2893d1 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.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/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h
index c909b5f986..1374db0ab1 100644
--- a/sapi/litespeed/lsapidef.h
+++ b/sapi/litespeed/lsapidef.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/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index c0c486cb15..c398e41258 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.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/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index 76f936700d..2542fc8314 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.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/sapi/litespeed/lscriu.c b/sapi/litespeed/lscriu.c
index 7c5bda7e88..f9659b332a 100644
--- a/sapi/litespeed/lscriu.c
+++ b/sapi/litespeed/lscriu.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/sapi/litespeed/lscriu.h b/sapi/litespeed/lscriu.h
index e7618114cc..0b631aeaa7 100644
--- a/sapi/litespeed/lscriu.h
+++ b/sapi/litespeed/lscriu.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/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index d4bceed4f7..e78c012e88 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -63,9 +63,9 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
BUILD_PHPDBG="\$(LIBTOOL) --mode=link \
\$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
- \$(PHP_GLOBAL_OBJS) \
- \$(PHP_BINARY_OBJS) \
- \$(PHP_PHPDBG_OBJS) \
+ \$(PHP_GLOBAL_OBJS:.lo=.o) \
+ \$(PHP_BINARY_OBJS:.lo=.o) \
+ \$(PHP_PHPDBG_OBJS:.lo=.o) \
\$(EXTRA_LIBS) \
\$(PHPDBG_EXTRA_LIBS) \
\$(ZEND_EXTRA_LIBS) \
diff --git a/sapi/phpdbg/create-test.php b/sapi/phpdbg/create-test.php
index e5f7cfe2e9..3cba7d42b0 100755
--- a/sapi/phpdbg/create-test.php
+++ b/sapi/phpdbg/create-test.php
@@ -3,8 +3,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 8b01acdfe2..0e487b5e57 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.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/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index d0e316c78b..44b1273e25 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.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, |
@@ -277,7 +275,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
zend_op_array *(*compile_file)(zend_file_handle *file_handle, int type);
zend_op_array *(*init_compile_file)(zend_file_handle *file_handle, int type);
- zend_op_array *(*compile_string)(zval *source_string, char *filename);
+ zend_op_array *(*compile_string)(zval *source_string, const char *filename);
HashTable file_sources;
FILE *oplog; /* opline log */
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 3a47c78470..f3c453f7d3 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.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/sapi/phpdbg/phpdbg_bp.h b/sapi/phpdbg/phpdbg_bp.h
index 7e038bb10e..87c5388c94 100644
--- a/sapi/phpdbg/phpdbg_bp.h
+++ b/sapi/phpdbg/phpdbg_bp.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/sapi/phpdbg/phpdbg_break.c b/sapi/phpdbg/phpdbg_break.c
index 719d93d166..dd24a7994d 100644
--- a/sapi/phpdbg/phpdbg_break.c
+++ b/sapi/phpdbg/phpdbg_break.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/sapi/phpdbg/phpdbg_break.h b/sapi/phpdbg/phpdbg_break.h
index 0aafa592e9..de367a17c8 100644
--- a/sapi/phpdbg/phpdbg_break.h
+++ b/sapi/phpdbg/phpdbg_break.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/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c
index c174920836..4bd9787556 100644
--- a/sapi/phpdbg/phpdbg_btree.c
+++ b/sapi/phpdbg/phpdbg_btree.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/sapi/phpdbg/phpdbg_btree.h b/sapi/phpdbg/phpdbg_btree.h
index 4ffb72697a..bb0a4ef3fb 100644
--- a/sapi/phpdbg/phpdbg_btree.h
+++ b/sapi/phpdbg/phpdbg_btree.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/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index b736481089..b7578e3a86 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.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/sapi/phpdbg/phpdbg_cmd.h b/sapi/phpdbg/phpdbg_cmd.h
index b82ed9aceb..56c8681c59 100644
--- a/sapi/phpdbg/phpdbg_cmd.h
+++ b/sapi/phpdbg/phpdbg_cmd.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/sapi/phpdbg/phpdbg_eol.c b/sapi/phpdbg/phpdbg_eol.c
index 4115ea449b..51c58b0ad1 100644
--- a/sapi/phpdbg/phpdbg_eol.c
+++ b/sapi/phpdbg/phpdbg_eol.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/sapi/phpdbg/phpdbg_eol.h b/sapi/phpdbg/phpdbg_eol.h
index 46141c62cd..b59f0cd74e 100644
--- a/sapi/phpdbg/phpdbg_eol.h
+++ b/sapi/phpdbg/phpdbg_eol.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/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
index 912089ea23..d8c7d3941a 100644
--- a/sapi/phpdbg/phpdbg_frame.c
+++ b/sapi/phpdbg/phpdbg_frame.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/sapi/phpdbg/phpdbg_frame.h b/sapi/phpdbg/phpdbg_frame.h
index d7d9534b1f..6a5c25b53e 100644
--- a/sapi/phpdbg/phpdbg_frame.h
+++ b/sapi/phpdbg/phpdbg_frame.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/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index 32d2485ff9..e4a4997039 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.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/sapi/phpdbg/phpdbg_help.h b/sapi/phpdbg/phpdbg_help.h
index 420e6fb014..1e531cc91c 100644
--- a/sapi/phpdbg/phpdbg_help.h
+++ b/sapi/phpdbg/phpdbg_help.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/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index bcec3361fc..b576187c7a 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.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/sapi/phpdbg/phpdbg_info.h b/sapi/phpdbg/phpdbg_info.h
index faf0090bd3..16a814d097 100644
--- a/sapi/phpdbg/phpdbg_info.h
+++ b/sapi/phpdbg/phpdbg_info.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/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c
index 6917daa9d9..30857ac945 100644
--- a/sapi/phpdbg/phpdbg_io.c
+++ b/sapi/phpdbg/phpdbg_io.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/sapi/phpdbg/phpdbg_io.h b/sapi/phpdbg/phpdbg_io.h
index d875d276cb..4ae98dc289 100644
--- a/sapi/phpdbg/phpdbg_io.h
+++ b/sapi/phpdbg/phpdbg_io.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/sapi/phpdbg/phpdbg_lexer.h b/sapi/phpdbg/phpdbg_lexer.h
index e1cc55ccf3..5e87157cd7 100644
--- a/sapi/phpdbg/phpdbg_lexer.h
+++ b/sapi/phpdbg/phpdbg_lexer.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/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 03b4c3526e..5c1b950bf6 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.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, |
@@ -319,7 +317,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
return op_array;
}
-zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) {
+zend_op_array *phpdbg_compile_string(zval *source_string, const char *filename) {
zend_string *fake_name;
zend_op_array *op_array;
phpdbg_file_source *dataptr;
diff --git a/sapi/phpdbg/phpdbg_list.h b/sapi/phpdbg/phpdbg_list.h
index 68cbee8c16..38b4f6bbb6 100644
--- a/sapi/phpdbg/phpdbg_list.h
+++ b/sapi/phpdbg/phpdbg_list.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/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 2d6bcd4f78..4c0c2fbf7a 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.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/sapi/phpdbg/phpdbg_opcode.h b/sapi/phpdbg/phpdbg_opcode.h
index b9e2fa506c..68bdddf0b1 100644
--- a/sapi/phpdbg/phpdbg_opcode.h
+++ b/sapi/phpdbg/phpdbg_opcode.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/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c
index 665df6d08b..30dadfc11c 100644
--- a/sapi/phpdbg/phpdbg_out.c
+++ b/sapi/phpdbg/phpdbg_out.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/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h
index 09f4815d85..19e2b3766d 100644
--- a/sapi/phpdbg/phpdbg_out.h
+++ b/sapi/phpdbg/phpdbg_out.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/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c
index 5f48bd6a59..7cc84b72dc 100644
--- a/sapi/phpdbg/phpdbg_print.c
+++ b/sapi/phpdbg/phpdbg_print.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/sapi/phpdbg/phpdbg_print.h b/sapi/phpdbg/phpdbg_print.h
index 66eae7bceb..79a77ad2a6 100644
--- a/sapi/phpdbg/phpdbg_print.h
+++ b/sapi/phpdbg/phpdbg_print.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/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 24155a7860..a441d4d6ae 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.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, |
@@ -728,7 +726,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
EG(exception) = NULL;
ZVAL_OBJ(&zv, ex);
- zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
+ zend_call_method_with_0_params(ex, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
diff --git a/sapi/phpdbg/phpdbg_prompt.h b/sapi/phpdbg/phpdbg_prompt.h
index 142581783a..2c2c3d2047 100644
--- a/sapi/phpdbg/phpdbg_prompt.h
+++ b/sapi/phpdbg/phpdbg_prompt.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/sapi/phpdbg/phpdbg_rinit_hook.c b/sapi/phpdbg/phpdbg_rinit_hook.c
index 2bc1c59b90..92013f5499 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.c
+++ b/sapi/phpdbg/phpdbg_rinit_hook.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/sapi/phpdbg/phpdbg_rinit_hook.h b/sapi/phpdbg/phpdbg_rinit_hook.h
index a350ddec54..58b59d1947 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.h
+++ b/sapi/phpdbg/phpdbg_rinit_hook.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/sapi/phpdbg/phpdbg_set.c b/sapi/phpdbg/phpdbg_set.c
index da3ec4cf19..e994ee3fa4 100644
--- a/sapi/phpdbg/phpdbg_set.c
+++ b/sapi/phpdbg/phpdbg_set.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/sapi/phpdbg/phpdbg_set.h b/sapi/phpdbg/phpdbg_set.h
index 7f89d9182d..ffc55142ed 100644
--- a/sapi/phpdbg/phpdbg_set.h
+++ b/sapi/phpdbg/phpdbg_set.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/sapi/phpdbg/phpdbg_sigio_win32.c b/sapi/phpdbg/phpdbg_sigio_win32.c
index f3221d09cb..fb3254ac4b 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.c
+++ b/sapi/phpdbg/phpdbg_sigio_win32.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/sapi/phpdbg/phpdbg_sigio_win32.h b/sapi/phpdbg/phpdbg_sigio_win32.h
index af7b9f10cb..62c7dd606e 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.h
+++ b/sapi/phpdbg/phpdbg_sigio_win32.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/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 857b5e3311..136d546288 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.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/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index c212056670..508bb89c80 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.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/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c
index 69be24a953..593b795b66 100644
--- a/sapi/phpdbg/phpdbg_wait.c
+++ b/sapi/phpdbg/phpdbg_wait.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/sapi/phpdbg/phpdbg_wait.h b/sapi/phpdbg/phpdbg_wait.h
index b748e162bb..5d5ea0450c 100644
--- a/sapi/phpdbg/phpdbg_wait.h
+++ b/sapi/phpdbg/phpdbg_wait.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/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index d9f9f8673f..d0515cd14d 100644
--- a/sapi/phpdbg/phpdbg_watch.c
+++ b/sapi/phpdbg/phpdbg_watch.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/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h
index 313df624ea..f7b3fddcc2 100644
--- a/sapi/phpdbg/phpdbg_watch.h
+++ b/sapi/phpdbg/phpdbg_watch.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/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c
index 36d327f56f..85e4c25a61 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.c
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.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/sapi/phpdbg/phpdbg_webdata_transfer.h b/sapi/phpdbg/phpdbg_webdata_transfer.h
index c08c6e8f93..e840030eac 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.h
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.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/sapi/phpdbg/phpdbg_win.c b/sapi/phpdbg/phpdbg_win.c
index 6bf79981e0..1b1787526f 100644
--- a/sapi/phpdbg/phpdbg_win.c
+++ b/sapi/phpdbg/phpdbg_win.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/sapi/phpdbg/phpdbg_win.h b/sapi/phpdbg/phpdbg_win.h
index ba83062301..44874a50a5 100644
--- a/sapi/phpdbg/phpdbg_win.h
+++ b/sapi/phpdbg/phpdbg_win.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/scripts/dev/bless_tests.php b/scripts/dev/bless_tests.php
index fbbfe505c9..b772f00cc1 100755
--- a/scripts/dev/bless_tests.php
+++ b/scripts/dev/bless_tests.php
@@ -19,13 +19,26 @@ foreach ($files as $path) {
}
$phpt = file_get_contents($path);
+ $out = file_get_contents($outPath);
+
if (false !== strpos($phpt, '--XFAIL--')) {
// Don't modify expected output of XFAIL tests
continue;
}
- $out = file_get_contents($outPath);
- $out = normalizeOutput($out);
+ // Don't update EXPECTREGEX tests
+ if (!preg_match('/--EXPECT(F?)--(.*)$/s', $phpt, $matches)) {
+ continue;
+ }
+
+ $oldExpect = trim($matches[2]);
+ $isFormat = $matches[1] == 'F';
+ if ($isFormat) {
+ $out = generateMinimallyDifferingOutput($out, $oldExpect);
+ } else {
+ $out = normalizeOutput($out);
+ }
+
$phpt = insertOutput($phpt, $out);
file_put_contents($path, $phpt);
}
@@ -62,9 +75,160 @@ function normalizeOutput(string $out): string {
return $out;
}
+function formatToRegex(string $format): string {
+ $result = preg_quote($format, '/');
+ $result = str_replace('%d', '\d+', $result);
+ $result = str_replace('%s', '[^\r\n]+', $result);
+ return "/^$result$/s";
+}
+
+function generateMinimallyDifferingOutput(string $out, string $oldExpect) {
+ $outLines = explode("\n", $out);
+ $oldExpectLines = explode("\n", $oldExpect);
+ $differ = new Differ(function($oldExpect, $new) {
+ if (strpos($oldExpect, '%') === false) {
+ return $oldExpect === $new;
+ }
+ return preg_match(formatToRegex($oldExpect), $new);
+ });
+ $diff = $differ->diff($oldExpectLines, $outLines);
+
+ $result = [];
+ foreach ($diff as $elem) {
+ if ($elem->type == DiffElem::TYPE_KEEP) {
+ $result[] = $elem->old;
+ } else if ($elem->type == DiffElem::TYPE_ADD) {
+ $result[] = normalizeOutput($elem->new);
+ }
+ }
+ return implode("\n", $result);
+}
+
function insertOutput(string $phpt, string $out): string {
return preg_replace_callback('/--EXPECTF?--.*$/s', function($matches) use($out) {
$F = strpos($out, '%') !== false ? 'F' : '';
return "--EXPECT$F--\n" . $out . "\n";
}, $phpt);
}
+
+/**
+ * Implementation of the the Myers diff algorithm.
+ *
+ * Myers, Eugene W. "An O (ND) difference algorithm and its variations."
+ * Algorithmica 1.1 (1986): 251-266.
+ */
+
+class DiffElem
+{
+ const TYPE_KEEP = 0;
+ const TYPE_REMOVE = 1;
+ const TYPE_ADD = 2;
+
+ /** @var int One of the TYPE_* constants */
+ public $type;
+ /** @var mixed Is null for add operations */
+ public $old;
+ /** @var mixed Is null for remove operations */
+ public $new;
+
+ public function __construct(int $type, $old, $new) {
+ $this->type = $type;
+ $this->old = $old;
+ $this->new = $new;
+ }
+}
+
+class Differ
+{
+ private $isEqual;
+
+ /**
+ * Create differ over the given equality relation.
+ *
+ * @param callable $isEqual Equality relation with signature function($a, $b) : bool
+ */
+ public function __construct(callable $isEqual) {
+ $this->isEqual = $isEqual;
+ }
+
+ /**
+ * Calculate diff (edit script) from $old to $new.
+ *
+ * @param array $old Original array
+ * @param array $new New array
+ *
+ * @return DiffElem[] Diff (edit script)
+ */
+ public function diff(array $old, array $new) {
+ list($trace, $x, $y) = $this->calculateTrace($old, $new);
+ return $this->extractDiff($trace, $x, $y, $old, $new);
+ }
+
+ private function calculateTrace(array $a, array $b) {
+ $n = \count($a);
+ $m = \count($b);
+ $max = $n + $m;
+ $v = [1 => 0];
+ $trace = [];
+ for ($d = 0; $d <= $max; $d++) {
+ $trace[] = $v;
+ for ($k = -$d; $k <= $d; $k += 2) {
+ if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
+ $x = $v[$k+1];
+ } else {
+ $x = $v[$k-1] + 1;
+ }
+
+ $y = $x - $k;
+ while ($x < $n && $y < $m && ($this->isEqual)($a[$x], $b[$y])) {
+ $x++;
+ $y++;
+ }
+
+ $v[$k] = $x;
+ if ($x >= $n && $y >= $m) {
+ return [$trace, $x, $y];
+ }
+ }
+ }
+ throw new \Exception('Should not happen');
+ }
+
+ private function extractDiff(array $trace, int $x, int $y, array $a, array $b) {
+ $result = [];
+ for ($d = \count($trace) - 1; $d >= 0; $d--) {
+ $v = $trace[$d];
+ $k = $x - $y;
+
+ if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
+ $prevK = $k + 1;
+ } else {
+ $prevK = $k - 1;
+ }
+
+ $prevX = $v[$prevK];
+ $prevY = $prevX - $prevK;
+
+ while ($x > $prevX && $y > $prevY) {
+ $result[] = new DiffElem(DiffElem::TYPE_KEEP, $a[$x-1], $b[$y-1]);
+ $x--;
+ $y--;
+ }
+
+ if ($d === 0) {
+ break;
+ }
+
+ while ($x > $prevX) {
+ $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $a[$x-1], null);
+ $x--;
+ }
+
+ while ($y > $prevY) {
+ $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $b[$y-1]);
+ $y--;
+ }
+ }
+ return array_reverse($result);
+ }
+}
diff --git a/scripts/dev/check_parameters.php b/scripts/dev/check_parameters.php
index 8c8d6dff40..47b0affacf 100755
--- a/scripts/dev/check_parameters.php
+++ b/scripts/dev/check_parameters.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
new file mode 100755
index 0000000000..f03e4b82c2
--- /dev/null
+++ b/scripts/dev/gen_stub.php
@@ -0,0 +1,478 @@
+#!/usr/bin/env php
+<?php declare(strict_types=1);
+
+use PhpParser\Node;
+use PhpParser\Node\Expr;
+use PhpParser\Node\Stmt;
+
+error_reporting(E_ALL);
+
+try {
+ initPhpParser();
+} catch (Exception $e) {
+ echo "{$e->getMessage()}\n";
+ exit(1);
+}
+
+if ($argc >= 2) {
+ // Generate single file.
+ processStubFile($argv[1]);
+} else {
+ // Regenerate all stub files we can find.
+ $it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator('.'),
+ RecursiveIteratorIterator::LEAVES_ONLY
+ );
+ foreach ($it as $file) {
+ $pathName = $file->getPathName();
+ if (preg_match('/\.stub\.php$/', $pathName)) {
+ processStubFile($pathName);
+ }
+ }
+}
+
+function processStubFile(string $stubFile) {
+ $arginfoFile = str_replace('.stub.php', '', $stubFile) . '_arginfo.h';
+
+ try {
+ $funcInfos = parseStubFile($stubFile);
+ $arginfoCode = generateArgInfoCode($funcInfos);
+ file_put_contents($arginfoFile, $arginfoCode);
+ } catch (Exception $e) {
+ echo "In $stubFile:\n{$e->getMessage()}\n";
+ exit(1);
+ }
+}
+
+class Type {
+ /** @var string */
+ public $name;
+ /** @var bool */
+ public $isBuiltin;
+ /** @var bool */
+ public $isNullable;
+
+ public function __construct(string $name, bool $isBuiltin, bool $isNullable = false) {
+ $this->name = $name;
+ $this->isBuiltin = $isBuiltin;
+ $this->isNullable = $isNullable;
+ }
+
+ public static function fromNode(Node $node) {
+ if ($node instanceof Node\NullableType) {
+ $type = self::fromNode($node->type);
+ return new Type($type->name, $type->isBuiltin, true);
+ }
+ if ($node instanceof Node\Name) {
+ assert($node->isFullyQualified());
+ return new Type($node->toString(), false);
+ }
+ if ($node instanceof Node\Identifier) {
+ return new Type($node->toString(), true);
+ }
+ throw new Exception("Unexpected node type");
+ }
+
+ public function toTypeCode() {
+ assert($this->isBuiltin);
+ switch (strtolower($this->name)) {
+ case "bool":
+ return "_IS_BOOL";
+ case "int":
+ return "IS_LONG";
+ case "float":
+ return "IS_DOUBLE";
+ case "string":
+ return "IS_STRING";
+ case "array":
+ return "IS_ARRAY";
+ case "object":
+ return "IS_OBJECT";
+ case "void":
+ return "IS_VOID";
+ case "callable":
+ return "IS_CALLABLE";
+ default:
+ throw new Exception("Not implemented: $this->name");
+ }
+ }
+
+ public static function equals(?Type $a, ?Type $b): bool {
+ if ($a === null || $b === null) {
+ return $a === $b;
+ }
+
+ return $a->name === $b->name
+ && $a->isBuiltin === $b->isBuiltin
+ && $a->isNullable === $b->isNullable;
+ }
+}
+
+class ArgInfo {
+ const SEND_BY_VAL = 0;
+ const SEND_BY_REF = 1;
+ const SEND_PREFER_REF = 2;
+
+ /** @var string */
+ public $name;
+ /** @var int */
+ public $sendBy;
+ /** @var bool */
+ public $isVariadic;
+ /** @var Type|null */
+ public $type;
+
+ public function __construct(string $name, int $sendBy, bool $isVariadic, ?Type $type) {
+ $this->name = $name;
+ $this->sendBy = $sendBy;
+ $this->isVariadic = $isVariadic;
+ $this->type = $type;
+ }
+
+ public function equals(ArgInfo $other): bool {
+ return $this->name === $other->name
+ && $this->sendBy === $other->sendBy
+ && $this->isVariadic === $other->isVariadic
+ && Type::equals($this->type, $other->type);
+ }
+
+ public function getSendByString(): string {
+ switch ($this->sendBy) {
+ case self::SEND_BY_VAL:
+ return "0";
+ case self::SEND_BY_REF:
+ return "1";
+ case self::SEND_PREFER_REF:
+ return "ZEND_SEND_PREFER_REF";
+ }
+ throw new Exception("Invalid sendBy value");
+ }
+}
+
+class ReturnInfo {
+ /** @var bool */
+ public $byRef;
+ /** @var Type|null */
+ public $type;
+
+ public function __construct(bool $byRef, ?Type $type) {
+ $this->byRef = $byRef;
+ $this->type = $type;
+ }
+
+ public function equals(ReturnInfo $other): bool {
+ return $this->byRef === $other->byRef
+ && Type::equals($this->type, $other->type);
+ }
+}
+
+class FuncInfo {
+ /** @var string */
+ public $name;
+ /** @var ArgInfo[] */
+ public $args;
+ /** @var ReturnInfo */
+ public $return;
+ /** @var int */
+ public $numRequiredArgs;
+ /** @var string|null */
+ public $cond;
+
+ public function __construct(
+ string $name, array $args, ReturnInfo $return, int $numRequiredArgs, ?string $cond
+ ) {
+ $this->name = $name;
+ $this->args = $args;
+ $this->return = $return;
+ $this->numRequiredArgs = $numRequiredArgs;
+ $this->cond = $cond;
+ }
+
+ public function equalsApartFromName(FuncInfo $other): bool {
+ if (count($this->args) !== count($other->args)) {
+ return false;
+ }
+
+ for ($i = 0; $i < count($this->args); $i++) {
+ if (!$this->args[$i]->equals($other->args[$i])) {
+ return false;
+ }
+ }
+
+ return $this->return->equals($other->return)
+ && $this->numRequiredArgs === $other->numRequiredArgs
+ && $this->cond === $other->cond;
+ }
+}
+
+function parseFunctionLike(string $name, Node\FunctionLike $func, ?string $cond): FuncInfo {
+ $comment = $func->getDocComment();
+ $paramMeta = [];
+
+ if ($comment) {
+ $commentText = substr($comment->getText(), 2, -2);
+
+ foreach (explode("\n", $commentText) as $commentLine) {
+ if (preg_match('/^\*\s*@prefer-ref\s+\$(.+)$/', trim($commentLine), $matches)) {
+ $varName = $matches[1];
+ if (!isset($paramMeta[$varName])) {
+ $paramMeta[$varName] = [];
+ }
+ $paramMeta[$varName]['preferRef'] = true;
+ }
+ }
+ }
+
+ $args = [];
+ $numRequiredArgs = 0;
+ $foundVariadic = false;
+ foreach ($func->getParams() as $i => $param) {
+ $varName = $param->var->name;
+ $preferRef = !empty($paramMeta[$varName]['preferRef']);
+ unset($paramMeta[$varName]);
+
+ if ($preferRef) {
+ $sendBy = ArgInfo::SEND_PREFER_REF;
+ } else if ($param->byRef) {
+ $sendBy = ArgInfo::SEND_BY_REF;
+ } else {
+ $sendBy = ArgInfo::SEND_BY_VAL;
+ }
+
+ if ($foundVariadic) {
+ throw new Exception("Error in function $name: only the last parameter can be variadic");
+ }
+
+ if ($param->default instanceof Expr\ConstFetch &&
+ $param->default->name->toLowerString() === "null" &&
+ $param->type && !($param->type instanceof Node\NullableType)
+ ) {
+ throw new Exception(
+ "Parameter $varName of function $name has null default, but is not nullable");
+ }
+
+ $foundVariadic = $param->variadic;
+
+ $args[] = new ArgInfo(
+ $varName,
+ $sendBy,
+ $param->variadic,
+ $param->type ? Type::fromNode($param->type) : null
+ );
+ if (!$param->default && !$param->variadic) {
+ $numRequiredArgs = $i + 1;
+ }
+ }
+
+ foreach (array_keys($paramMeta) as $var) {
+ throw new Exception("Found metadata for invalid param $var of function $name");
+ }
+
+ $returnType = $func->getReturnType();
+ $return = new ReturnInfo(
+ $func->returnsByRef(),
+ $returnType ? Type::fromNode($returnType) : null);
+ return new FuncInfo($name, $args, $return, $numRequiredArgs, $cond);
+}
+
+function handlePreprocessorConditions(array &$conds, Stmt $stmt): ?string {
+ foreach ($stmt->getComments() as $comment) {
+ $text = trim($comment->getText());
+ if (preg_match('/^#\s*if\s+(.+)$/', $text, $matches)) {
+ $conds[] = $matches[1];
+ } else if (preg_match('/^#\s*ifdef\s+(.+)$/', $text, $matches)) {
+ $conds[] = "defined($matches[1])";
+ } else if (preg_match('/^#\s*ifndef\s+(.+)$/', $text, $matches)) {
+ $conds[] = "!defined($matches[1])";
+ } else if (preg_match('/^#\s*else$/', $text)) {
+ if (empty($conds)) {
+ throw new Exception("Encountered else without corresponding #if");
+ }
+ $cond = array_pop($conds);
+ $conds[] = "!($cond)";
+ } else if (preg_match('/^#\s*endif$/', $text)) {
+ if (empty($conds)) {
+ throw new Exception("Encountered #endif without corresponding #if");
+ }
+ array_pop($conds);
+ } else if ($text[0] === '#') {
+ throw new Exception("Unrecognized preprocessor directive \"$text\"");
+ }
+ }
+
+ return empty($conds) ? null : implode(' && ', $conds);
+}
+
+/** @return FuncInfo[] */
+function parseStubFile(string $fileName) {
+ if (!file_exists($fileName)) {
+ throw new Exception("File $fileName does not exist");
+ }
+
+ $code = file_get_contents($fileName);
+
+ $lexer = new PhpParser\Lexer();
+ $parser = new PhpParser\Parser\Php7($lexer);
+ $nodeTraverser = new PhpParser\NodeTraverser;
+ $nodeTraverser->addVisitor(new PhpParser\NodeVisitor\NameResolver);
+
+ $stmts = $parser->parse($code);
+ $nodeTraverser->traverse($stmts);
+
+ $funcInfos = [];
+ $conds = [];
+ foreach ($stmts as $stmt) {
+ $cond = handlePreprocessorConditions($conds, $stmt);
+ if ($stmt instanceof Stmt\Nop) {
+ continue;
+ }
+
+ if ($stmt instanceof Stmt\Function_) {
+ $funcInfos[] = parseFunctionLike($stmt->name->toString(), $stmt, $cond);
+ continue;
+ }
+
+ if ($stmt instanceof Stmt\ClassLike) {
+ $className = $stmt->name->toString();
+ foreach ($stmt->stmts as $classStmt) {
+ $cond = handlePreprocessorConditions($conds, $classStmt);
+ if ($classStmt instanceof Stmt\Nop) {
+ continue;
+ }
+
+ if (!$classStmt instanceof Stmt\ClassMethod) {
+ throw new Exception("Not implemented {$classStmt->getType()}");
+ }
+
+ $funcInfos[] = parseFunctionLike(
+ 'class_' . $className . '_' . $classStmt->name->toString(), $classStmt, $cond);
+ }
+ continue;
+ }
+
+ throw new Exception("Unexpected node {$stmt->getType()}");
+ }
+
+ return $funcInfos;
+}
+
+function funcInfoToCode(FuncInfo $funcInfo): string {
+ $code = '';
+ if ($funcInfo->return->type) {
+ $returnType = $funcInfo->return->type;
+ if ($returnType->isBuiltin) {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_%s, %d, %d, %s, %d)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
+ $returnType->toTypeCode(), $returnType->isNullable
+ );
+ } else {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_%s, %d, %d, %s, %d)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
+ str_replace('\\', '\\\\', $returnType->name), $returnType->isNullable
+ );
+ }
+ } else {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_INFO_EX(arginfo_%s, 0, %d, %d)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs
+ );
+ }
+
+ foreach ($funcInfo->args as $argInfo) {
+ $argKind = $argInfo->isVariadic ? "ARG_VARIADIC" : "ARG";
+ if ($argInfo->type) {
+ if ($argInfo->type->isBuiltin) {
+ $code .= sprintf(
+ "\tZEND_%s_TYPE_INFO(%s, %s, %s, %d)\n",
+ $argKind, $argInfo->getSendByString(), $argInfo->name,
+ $argInfo->type->toTypeCode(), $argInfo->type->isNullable
+ );
+ } else {
+ $code .= sprintf(
+ "\tZEND_%s_OBJ_INFO(%s, %s, %s, %d)\n",
+ $argKind, $argInfo->getSendByString(), $argInfo->name,
+ str_replace('\\', '\\\\', $argInfo->type->name), $argInfo->type->isNullable
+ );
+ }
+ } else {
+ $code .= sprintf(
+ "\tZEND_%s_INFO(%s, %s)\n", $argKind, $argInfo->getSendByString(), $argInfo->name);
+ }
+ }
+
+ $code .= "ZEND_END_ARG_INFO()";
+ return $code;
+}
+
+function findEquivalentFuncInfo(array $generatedFuncInfos, $funcInfo): ?FuncInfo {
+ foreach ($generatedFuncInfos as $generatedFuncInfo) {
+ if ($generatedFuncInfo->equalsApartFromName($funcInfo)) {
+ return $generatedFuncInfo;
+ }
+ }
+ return null;
+}
+
+/** @param FuncInfo[] $funcInfos */
+function generateArginfoCode(array $funcInfos): string {
+ $code = "/* This is a generated file, edit the .stub.php file instead. */";
+ $generatedFuncInfos = [];
+ foreach ($funcInfos as $funcInfo) {
+ $code .= "\n\n";
+ if ($funcInfo->cond) {
+ $code .= "#if {$funcInfo->cond}\n";
+ }
+
+ /* If there already is an equivalent arginfo structure, only emit a #define */
+ if ($generatedFuncInfo = findEquivalentFuncInfo($generatedFuncInfos, $funcInfo)) {
+ $code .= sprintf(
+ "#define arginfo_%s arginfo_%s",
+ $funcInfo->name, $generatedFuncInfo->name
+ );
+ } else {
+ $code .= funcInfoToCode($funcInfo);
+ }
+
+ if ($funcInfo->cond) {
+ $code .= "\n#endif";
+ }
+
+ $generatedFuncInfos[] = $funcInfo;
+ }
+ return $code . "\n";
+}
+
+function initPhpParser() {
+ $version = "4.2.2";
+ $phpParserDir = __DIR__ . "/PHP-Parser-$version";
+ if (!is_dir($phpParserDir)) {
+ $cwd = getcwd();
+ chdir(__DIR__);
+
+ passthru("wget https://github.com/nikic/PHP-Parser/archive/v$version.tar.gz", $exit);
+ if ($exit !== 0) {
+ passthru("curl -LO https://github.com/nikic/PHP-Parser/archive/v$version.tar.gz", $exit);
+ }
+ if ($exit !== 0) {
+ throw new Exception("Failed to download PHP-Parser tarball");
+ }
+ if (!mkdir($phpParserDir)) {
+ throw new Exception("Failed to create directory $phpParserDir");
+ }
+ passthru("tar xvzf v$version.tar.gz -C PHP-Parser-$version --strip-components 1", $exit);
+ if ($exit !== 0) {
+ throw new Exception("Failed to extract PHP-Parser tarball");
+ }
+ unlink(__DIR__ . "/v$version.tar.gz");
+ chdir($cwd);
+ }
+
+ spl_autoload_register(function(string $class) use($phpParserDir) {
+ if (strpos($class, "PhpParser\\") === 0) {
+ $fileName = $phpParserDir . "/lib/" . str_replace("\\", "/", $class) . ".php";
+ require $fileName;
+ }
+ });
+}
diff --git a/scripts/dev/genfiles b/scripts/dev/genfiles
index d29c0d778a..ffdfcdc3ca 100755
--- a/scripts/dev/genfiles
+++ b/scripts/dev/genfiles
@@ -1,8 +1,6 @@
#!/bin/sh
#
# +----------------------------------------------------------------------+
-# | PHP Version 7 |
-# +----------------------------------------------------------------------+
# | Copyright (c) The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
diff --git a/scripts/dev/search_underscores.php b/scripts/dev/search_underscores.php
index 5c2016e489..fd2a54c183 100755
--- a/scripts/dev/search_underscores.php
+++ b/scripts/dev/search_underscores.php
@@ -3,8 +3,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/tests/basic/012.phpt b/tests/basic/012.phpt
index 038d4beff9..50af0b49f6 100644
--- a/tests/basic/012.phpt
+++ b/tests/basic/012.phpt
@@ -1,7 +1,5 @@
--TEST--
Testing $argc and $argv handling (cli)
---SKIPIF--
-<?php if(php_sapi_name()!='cli') echo 'skip'; ?>
--INI--
register_argc_argv=1
variables_order=GPS
diff --git a/tests/basic/025.phpt b/tests/basic/025.phpt
index 37561a2a2e..30d50c805d 100644
--- a/tests/basic/025.phpt
+++ b/tests/basic/025.phpt
@@ -15,7 +15,7 @@ Warning: Unknown: POST Content-Length of 2050 bytes exceeds the limit of 1024 by
Warning: Cannot modify header information - headers already sent in Unknown on line 0
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
array(0) {
}
NULL
diff --git a/tests/basic/027.phpt b/tests/basic/027.phpt
deleted file mode 100644
index 0528e835a1..0000000000
--- a/tests/basic/027.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Handling of max_input_nesting_level being reached
---INI--
-always_populate_raw_post_data=0
-display_errors=0
-max_input_nesting_level=10
-max_input_vars=1000
-track_errors=1
-log_errors=0
---POST--
-a=1&b=ZYX&c[][][][][][][][][][][][][][][][][][][][][][]=123&d=123&e[][]][]=3
---FILE--
-<?php
-var_dump($_POST, $php_errormsg);
-?>
---EXPECT--
-array(4) {
- ["a"]=>
- string(1) "1"
- ["b"]=>
- string(3) "ZYX"
- ["d"]=>
- string(3) "123"
- ["e"]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "3"
- }
- }
-}
-string(115) "Unknown: Input variable nesting level exceeded 10. To increase the limit change max_input_nesting_level in php.ini."
diff --git a/tests/basic/bug71273.phpt b/tests/basic/bug71273.phpt
index 3db4454605..3e32b7a4b7 100644
--- a/tests/basic/bug71273.phpt
+++ b/tests/basic/bug71273.phpt
@@ -1,11 +1,5 @@
--TEST--
Bug #71273 A wrong ext directory setup in php.ini leads to crash
---SKIPIF--
-<?php
- if ("cli" != php_sapi_name()) {
- die("skip CLI only");
- }
-?>
--FILE--
<?php
/* NOTE this file is required to be encoded in iso-8859-1 */
diff --git a/tests/basic/enable_post_data_reading_01.phpt b/tests/basic/enable_post_data_reading_01.phpt
index 19ee5d583f..d717b2b0b0 100644
--- a/tests/basic/enable_post_data_reading_01.phpt
+++ b/tests/basic/enable_post_data_reading_01.phpt
@@ -18,7 +18,7 @@ array(0) {
array(0) {
}
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
NULL
string(9) "a=1&b=ZYX"
string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_03.phpt b/tests/basic/enable_post_data_reading_03.phpt
index 6a62282ea2..5982f61c91 100644
--- a/tests/basic/enable_post_data_reading_03.phpt
+++ b/tests/basic/enable_post_data_reading_03.phpt
@@ -19,7 +19,7 @@ array(0) {
array(0) {
}
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
NULL
string(9) "a=1&b=ZYX"
string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_04.phpt b/tests/basic/enable_post_data_reading_04.phpt
index a7c7e496d8..17432e9298 100644
--- a/tests/basic/enable_post_data_reading_04.phpt
+++ b/tests/basic/enable_post_data_reading_04.phpt
@@ -19,7 +19,7 @@ array(0) {
array(0) {
}
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
NULL
string(9) "a=1&b=ZYX"
string(9) "a=1&b=ZYX"
diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt
index 6ce810c836..c69eaa458c 100644
--- a/tests/classes/abstract_user_call.phpt
+++ b/tests/classes/abstract_user_call.phpt
@@ -20,12 +20,15 @@ $o = new test;
$o->func();
-call_user_func(array($o, 'test_base::func'));
+try {
+ call_user_func(array($o, 'test_base::func'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
---EXPECTF--
+--EXPECT--
test::func()
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func() in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func()
===DONE===
diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt
index 4fc41c85f5..c5b32debae 100644
--- a/tests/classes/autoload_012.phpt
+++ b/tests/classes/autoload_012.phpt
@@ -3,12 +3,15 @@ Ensure callback methods in unknown classes trigger autoload.
--FILE--
<?php
spl_autoload_register(function ($name) {
- echo "In autoload: ";
- var_dump($name);
+ echo "In autoload: ";
+ var_dump($name);
});
-call_user_func("UndefC::test");
+try {
+ call_user_func("UndefC::test");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
In autoload: string(6) "UndefC"
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found
diff --git a/tests/classes/bug27468.phpt b/tests/classes/bug27468.phpt
index 58a7b6cb16..1c54fa61ce 100644
--- a/tests/classes/bug27468.phpt
+++ b/tests/classes/bug27468.phpt
@@ -11,7 +11,7 @@ new foo();
echo 'OK';
?>
--EXPECTF--
-Notice: Undefined property: foo::$x in %sbug27468.php on line 4
+Warning: Undefined property: foo::$x in %s on line %d
Warning: Invalid argument supplied for foreach() in %sbug27468.php on line 4
OK
diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt
index ba44806bfe..4e227a1075 100644
--- a/tests/classes/bug27504.phpt
+++ b/tests/classes/bug27504.phpt
@@ -2,27 +2,30 @@
Bug #27504 (call_user_func_array allows calling of private/protected methods)
--FILE--
<?php
- class foo {
- function __construct () {
- $this->bar('1');
- }
- private function bar ( $param ) {
- echo 'Called function foo:bar('.$param.')'."\n";
- }
- }
+class foo {
+ function __construct () {
+ $this->bar('1');
+ }
+ private function bar ( $param ) {
+ echo 'Called function foo:bar('.$param.')'."\n";
+ }
+}
- $foo = new foo();
+$foo = new foo();
- call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
+try {
+ call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $foo->bar('3');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
- $foo->bar('3');
?>
---EXPECTF--
+--EXPECT--
Called function foo:bar(1)
-
-Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar() in %s on line %d
-
-Fatal error: Uncaught Error: Call to private method foo::bar() from context '' in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
+call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar()
+Call to private method foo::bar() from context ''
diff --git a/tests/classes/constants_basic_001.phpt b/tests/classes/constants_basic_001.phpt
index 6a281e7d32..af9915c277 100644
--- a/tests/classes/constants_basic_001.phpt
+++ b/tests/classes/constants_basic_001.phpt
@@ -9,8 +9,6 @@ Class constant declarations
class C
{
- const c0 = UNDEFINED;
-
const c1 = 1, c2 = 1.5;
const c3 = + 1, c4 = + 1.5;
const c5 = -1, c6 = -1.5;
@@ -32,7 +30,6 @@ Class constant declarations
}
echo "\nAttempt to access various kinds of class constants:\n";
- var_dump(C::c0);
var_dump(C::c1);
var_dump(C::c2);
var_dump(C::c3);
@@ -58,19 +55,16 @@ Class constant declarations
echo "\nYou should not see this.";
?>
--EXPECTF--
-Notice: Undefined variable: undef in %s on line 5
+Warning: Undefined variable: undef in %s on line %d
Attempt to access various kinds of class constants:
-
-Warning: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s on line %d
-string(9) "UNDEFINED"
int(1)
float(1.5)
int(1)
float(1.5)
int(-1)
float(-1.5)
-int(15)
+int(13)
string(%d) "%s"
string(1) "C"
string(0) ""
@@ -85,7 +79,7 @@ string(6) "hello2"
Expecting fatal error:
-Fatal error: Uncaught Error: Undefined class constant 'c19' in %s:53
+Fatal error: Uncaught Error: Undefined class constant 'c19' in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 53
+ thrown in %s on line %d
diff --git a/tests/classes/constants_basic_002.phpt b/tests/classes/constants_basic_002.phpt
index def661ec45..88c66aaee8 100644
--- a/tests/classes/constants_basic_002.phpt
+++ b/tests/classes/constants_basic_002.phpt
@@ -23,7 +23,7 @@ string(5) "hello"
Fail to read class constant from instance.
-Notice: Undefined property: aclass::$myConst in %s on line 12
+Warning: Undefined property: aclass::$myConst in %s on line %d
NULL
Class constant not visible in object var_dump.
diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt
index 7adf3f8681..e9635d8d23 100644
--- a/tests/classes/constants_scope_001.phpt
+++ b/tests/classes/constants_scope_001.phpt
@@ -9,7 +9,6 @@ class ErrorCodes {
const INFO = "Informational message\n";
static function print_fatal_error_codes() {
- echo "FATAL = " . FATAL . "\n";
echo "self::FATAL = " . self::FATAL;
}
}
@@ -27,9 +26,7 @@ ErrorCodes::print_fatal_error_codes();
ErrorCodesDerived::print_fatal_error_codes();
?>
---EXPECTF--
-Warning: Use of undefined constant FATAL - assumed 'FATAL' (this will throw an Error in a future version of PHP) in %sconstants_scope_001.php on line %d
-FATAL = FATAL
+--EXPECT--
self::FATAL = Fatal error
self::FATAL = Worst error
parent::FATAL = Fatal error
diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt
deleted file mode 100644
index e6518775ff..0000000000
--- a/tests/classes/ctor_name_clash.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ZE2 The child class can re-use the parent class name for a function member
---FILE--
-<?php
-class base {
- function base() {
- echo __CLASS__."::".__FUNCTION__."\n";
- }
-}
-
-class derived extends base {
- function base() {
- echo __CLASS__."::".__FUNCTION__."\n";
- }
-}
-
-$obj = new derived();
-$obj->base();
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d
-base::base
-derived::base
diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt
index acf20918fd..33fcbe6bd8 100644
--- a/tests/classes/final_ctor1.phpt
+++ b/tests/classes/final_ctor1.phpt
@@ -16,15 +16,11 @@ class Works extends Base
class Extended extends Base
{
- public function Extended()
+ public function __construct()
{
}
}
-ReflectionClass::export('Extended');
-
?>
--EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d
-
-Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d
+Fatal error: Cannot override final method Base::__construct() in %s on line %d
diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt
deleted file mode 100644
index 37fcac29a9..0000000000
--- a/tests/classes/final_ctor2.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-ZE2 cannot override final old style ctor
---FILE--
-<?php
-
-class Base
-{
- public final function Base()
- {
- }
-}
-
-class Works extends Base
-{
-}
-
-class Extended extends Base
-{
- public function __construct()
- {
- }
-}
-
-ReflectionClass::export('Extended');
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d
-
-Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d
diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt
deleted file mode 100644
index b0156ef294..0000000000
--- a/tests/classes/final_ctor3.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Ensure implicit final inherited old-style constructor cannot be overridden.
---FILE--
-<?php
- class A {
- final function A() { }
- }
- class B extends A {
- function A() { }
- }
-?>
---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
-
-Fatal error: Cannot override final method A::A() in %s on line 6
diff --git a/tests/classes/implicit_instantiation_001.phpt b/tests/classes/implicit_instantiation_001.phpt
deleted file mode 100644
index 495a8a1e35..0000000000
--- a/tests/classes/implicit_instantiation_001.phpt
+++ /dev/null
@@ -1,156 +0,0 @@
---TEST--
-Implicit object instantiation when accessing properties of non-object.
---FILE--
-<?php
-class C {
- // These values get implicitly converted to objects
- public $boolFalse = false;
- public $emptyString = '';
- public $null = null;
-
- // These values do not get implicitly converted to objects
- public $boolTrue = true;
- public $nonEmptyString = 'hello';
- public $intZero = 0;
-}
-
-$c = new C;
-foreach($c as $name => $value) {
- echo "\n\n---( \$c->$name )---";
- echo "\n --> Attempting implicit conversion to object using increment...\n";
- $c->$name->prop++;
- $c->$name = $value; // reset value in case implicit conversion was successful
-
- echo "\n --> Attempting implicit conversion to object using assignment...\n";
- $c->$name->prop = "Implicit instantiation!";
- $c->$name = $value; // reset value in case implicit conversion was successful
-
- echo "\n --> Attempting implicit conversion to object using combined assignment...\n";
- $c->$name->prop .= " Implicit instantiation!";
-}
-
-echo "\n\n\n --> Resulting object:";
-var_dump($c);
-
-?>
---EXPECTF--
----( $c->boolFalse )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Creating default object from empty value in %s on line 18
-
-Notice: Undefined property: stdClass::$prop in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Creating default object from empty value in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Creating default object from empty value in %s on line 26
-
-Notice: Undefined property: stdClass::$prop in %s on line 26
-
-
----( $c->emptyString )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Creating default object from empty value in %s on line 18
-
-Notice: Undefined property: stdClass::$prop in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Creating default object from empty value in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Creating default object from empty value in %s on line 26
-
-Notice: Undefined property: stdClass::$prop in %s on line 26
-
-
----( $c->null )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Creating default object from empty value in %s on line 18
-
-Notice: Undefined property: stdClass::$prop in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Creating default object from empty value in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Creating default object from empty value in %s on line 26
-
-Notice: Undefined property: stdClass::$prop in %s on line 26
-
-
----( $c->boolTrue )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Attempt to %s property 'prop' of non-object in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 26
-
-
----( $c->nonEmptyString )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Attempt to %s property 'prop' of non-object in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 26
-
-
----( $c->intZero )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Attempt to %s property 'prop' of non-object in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 26
-
-
-
- --> Resulting object:object(C)#%d (6) {
- ["boolFalse"]=>
- object(stdClass)#%d (1) {
- ["prop"]=>
- string(24) " Implicit instantiation!"
- }
- ["emptyString"]=>
- object(stdClass)#%d (1) {
- ["prop"]=>
- string(24) " Implicit instantiation!"
- }
- ["null"]=>
- object(stdClass)#%d (1) {
- ["prop"]=>
- string(24) " Implicit instantiation!"
- }
- ["boolTrue"]=>
- bool(true)
- ["nonEmptyString"]=>
- string(5) "hello"
- ["intZero"]=>
- int(0)
-}
diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt
deleted file mode 100644
index f88c0996bd..0000000000
--- a/tests/classes/inheritance_002.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-ZE2 Constructor precedence
---FILE--
-<?php
-class Base_php4 {
- function Base_php4() {
- var_dump('Base constructor');
- }
-}
-
-class Child_php4 extends Base_php4 {
- function Child_php4() {
- var_dump('Child constructor');
- parent::Base_php4();
- }
-}
-
-class Base_php5 {
- function __construct() {
- var_dump('Base constructor');
- }
- }
-
-class Child_php5 extends Base_php5 {
- function __construct() {
- var_dump('Child constructor');
- parent::__construct();
- }
- }
-
-class Child_mx1 extends Base_php4 {
- function __construct() {
- var_dump('Child constructor');
- parent::Base_php4();
- }
-}
-
-class Child_mx2 extends Base_php5 {
- function Child_mx2() {
- var_dump('Child constructor');
- parent::__construct();
- }
-}
-
-echo "### PHP 4 style\n";
-$c4= new Child_php4();
-
-echo "### PHP 5 style\n";
-$c5= new Child_php5();
-
-echo "### Mixed style 1\n";
-$cm= new Child_mx1();
-
-echo "### Mixed style 2\n";
-$cm= new Child_mx2();
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 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; Child_php4 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; Child_mx2 has a deprecated constructor in %s on line %d
-### PHP 4 style
-string(17) "Child constructor"
-string(16) "Base constructor"
-### PHP 5 style
-string(17) "Child constructor"
-string(16) "Base constructor"
-### Mixed style 1
-string(17) "Child constructor"
-string(16) "Base constructor"
-### Mixed style 2
-string(17) "Child constructor"
-string(16) "Base constructor"
diff --git a/tests/classes/inheritance_003.phpt b/tests/classes/inheritance_003.phpt
index bcbead1be7..925544e754 100644
--- a/tests/classes/inheritance_003.phpt
+++ b/tests/classes/inheritance_003.phpt
@@ -14,7 +14,5 @@ class B extends A
}
?>
-===DONE===
--EXPECTF--
-Warning: Declaration of B::f() should be compatible with A::f($x) in %sinheritance_003.php on line %d
-===DONE===
+Fatal error: Declaration of B::f() must be compatible with A::f($x) in %sinheritance_003.php on line %d
diff --git a/tests/classes/inheritance_004.phpt b/tests/classes/inheritance_004.phpt
index 7eb57b2770..682bee7a1b 100644
--- a/tests/classes/inheritance_004.phpt
+++ b/tests/classes/inheritance_004.phpt
@@ -5,7 +5,7 @@ ZE2 method inheritance without interfaces
class A
{
- function f() {}
+function f() {}
}
class B extends A
@@ -14,7 +14,5 @@ class B extends A
}
?>
-===DONE===
--EXPECTF--
-Warning: Declaration of B::f($x) should be compatible with A::f() in %sinheritance_004.php on line %d
-===DONE===
+Fatal error: Declaration of B::f($x) must be compatible with A::f() in %sinheritance_004.php on line %d
diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt
deleted file mode 100644
index 8c5167f4bf..0000000000
--- a/tests/classes/inheritance_005.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-Check for inherited old-style constructor.
---FILE--
-<?php
- class A
- {
- function A()
- {
- echo "In " . __METHOD__ . "\n";
- }
- }
-
- class B extends A
- {
- }
-
- class C extends B
- {
- }
-
-
- echo "About to construct new B: \n";
- $b = new B;
-
- echo "Is B::B() callable?\n";
- var_dump(is_callable(array($b, "B")));
-
- echo "Is B::A() callable?\n";
- var_dump(is_callable(array($b, "A")));
-
- echo "About to construct new C: \n";
- $c = new C;
-
- echo "Is C::A() callable?\n";
- var_dump(is_callable(array($c, "A")));
-
- echo "Is C::B() callable?\n";
- var_dump(is_callable(array($c, "B")));
-
- echo "Is C::C() callable?\n";
- var_dump(is_callable(array($c, "C")));
-?>
---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
-About to construct new B:
-In A::A
-Is B::B() callable?
-bool(false)
-Is B::A() callable?
-bool(true)
-About to construct new C:
-In A::A
-Is C::A() callable?
-bool(true)
-Is C::B() callable?
-bool(false)
-Is C::C() callable?
-bool(false)
diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt
deleted file mode 100644
index c87fbde344..0000000000
--- a/tests/classes/inheritance_007.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Ensure inherited old-style constructor doesn't block other methods
---FILE--
-<?php
-class A {
- public function B () { echo "In " . __METHOD__ . "\n"; }
- public function A () { echo "In " . __METHOD__ . "\n"; }
-}
-class B extends A { }
-
-$rc = new ReflectionClass('B');
-var_dump($rc->getMethods());
-
-
-$b = new B();
-$b->a();
-$b->b();
-
-?>
---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
-array(2) {
- [0]=>
- object(ReflectionMethod)#%d (2) {
- ["name"]=>
- string(1) "B"
- ["class"]=>
- string(1) "A"
- }
- [1]=>
- object(ReflectionMethod)#%d (2) {
- ["name"]=>
- string(1) "A"
- ["class"]=>
- string(1) "A"
- }
-}
-In A::A
-In A::A
-In A::B
diff --git a/tests/classes/method_override_optional_arg_001.phpt b/tests/classes/method_override_optional_arg_001.phpt
index 897a2c2b93..ac1a689238 100644
--- a/tests/classes/method_override_optional_arg_001.phpt
+++ b/tests/classes/method_override_optional_arg_001.phpt
@@ -26,6 +26,4 @@ $b->foo(1);
?>
--EXPECTF--
-Warning: Declaration of C::foo() should be compatible with A::foo($arg1 = 1) in %s on line %d
-int(1)
-int(3)
+Fatal error: Declaration of C::foo() must be compatible with A::foo($arg1 = 1) in %s on line %d
diff --git a/tests/classes/method_override_optional_arg_002.phpt b/tests/classes/method_override_optional_arg_002.phpt
index 254392718b..df12251e6c 100644
--- a/tests/classes/method_override_optional_arg_002.phpt
+++ b/tests/classes/method_override_optional_arg_002.phpt
@@ -18,5 +18,4 @@ $b->foo();
?>
--EXPECTF--
-Warning: Declaration of B::foo() should be compatible with A::foo($arg = 1) in %s on line %d
-foo
+Fatal error: Declaration of B::foo() must be compatible with A::foo($arg = 1) in %s on line %d
diff --git a/tests/classes/static_properties_003.phpt b/tests/classes/static_properties_003.phpt
index 89c26d3dd3..64641c47c5 100644
--- a/tests/classes/static_properties_003.phpt
+++ b/tests/classes/static_properties_003.phpt
@@ -34,7 +34,7 @@ Notice: Accessing static property C::$x as non static in %s on line 11
Notice: Accessing static property C::$x as non static in %s on line 12
-Notice: Undefined property: C::$x in %s on line 12
+Warning: Undefined property: C::$x in %s on line %d
Notice: Accessing static property C::$x as non static in %s on line 13
diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt
index 418aa1fc25..ba2bc3eb53 100644
--- a/tests/classes/tostring_001.phpt
+++ b/tests/classes/tostring_001.phpt
@@ -56,7 +56,11 @@ echo $o , $o;
echo "====test7====\n";
$ar = array();
$ar[$o->__toString()] = "ERROR";
-echo $ar[$o];
+try {
+ echo $ar[$o];
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "====test8====\n";
var_dump(trim($o));
@@ -76,7 +80,7 @@ try {
?>
====DONE====
---EXPECTF--
+--EXPECT--
====test1====
test1 Object
(
@@ -114,8 +118,7 @@ test2::__toString()
Converted
====test7====
test2::__toString()
-
-Warning: Illegal offset type in %s on line %d
+Illegal offset type
====test8====
test2::__toString()
string(9) "Converted"
@@ -125,7 +128,7 @@ string(9) "Converted"
test2::__toString()
Converted
====test10====
-object(test3)#1 (0) {
+object(test3)#2 (0) {
}
test3::__toString()
Method test3::__toString() must return a string value
diff --git a/tests/classes/tostring_004.phpt b/tests/classes/tostring_004.phpt
index 4134c702b6..997f2e2e7f 100644
--- a/tests/classes/tostring_004.phpt
+++ b/tests/classes/tostring_004.phpt
@@ -2,7 +2,7 @@
Object to string conversion: error cases and behaviour variations.
--FILE--
<?php
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
diff --git a/tests/classes/type_hinting_005a.phpt b/tests/classes/type_hinting_005a.phpt
index 54af0e8c96..065ba70e8a 100644
--- a/tests/classes/type_hinting_005a.phpt
+++ b/tests/classes/type_hinting_005a.phpt
@@ -4,15 +4,11 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f(array $a) {} }
-echo "Compatible hint.\n";
+// Compatible hint.
Class D1 extends C { function f(array $a) {} }
-echo "Class hint, should be array.\n";
+// Class hint, should be array.
Class D2 extends C { function f(SomeClass $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D2::f(SomeClass $a) should be compatible with C::f(array $a) in %s on line 8
-Compatible hint.
-Class hint, should be array.
-==DONE==
+Fatal error: Declaration of D2::f(SomeClass $a) must be compatible with C::f(array $a) in %s on line 8
diff --git a/tests/classes/type_hinting_005c.phpt b/tests/classes/type_hinting_005c.phpt
index 00048c3ef9..6cc3e3e369 100644
--- a/tests/classes/type_hinting_005c.phpt
+++ b/tests/classes/type_hinting_005c.phpt
@@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f(SomeClass $a) {} }
-echo "Array hint, should be class.\n";
+// Array hint, should be class.
Class D extends C { function f(array $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D::f(array $a) should be compatible with C::f(SomeClass $a) in %s on line 5
-Array hint, should be class.
-==DONE==
+Fatal error: Declaration of D::f(array $a) must be compatible with C::f(SomeClass $a) in %s on line 5
diff --git a/tests/classes/type_hinting_005d.phpt b/tests/classes/type_hinting_005d.phpt
index a1ce30950c..51c2a5a995 100644
--- a/tests/classes/type_hinting_005d.phpt
+++ b/tests/classes/type_hinting_005d.phpt
@@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f($a) {} }
-echo "Array hint, should be nothing.\n";
+// Array hint, should be nothing.
Class D extends C { function f(array $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D::f(array $a) should be compatible with C::f($a) in %s on line 5
-Array hint, should be nothing.
-==DONE==
+Fatal error: Declaration of D::f(array $a) must be compatible with C::f($a) in %s on line 5
diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt
deleted file mode 100644
index 134df03684..0000000000
--- a/tests/lang/031.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-Bug #16227 (Internal hash position bug on assignment)
---FILE--
-<?php
-// reported by php.net@alienbill.com
-$arrayOuter = array("key1","key2");
-$arrayInner = array("0","1");
-
-print "Correct - with inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
- reset($arrayInner);
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset but copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
- $placeholder = $arrayInner;
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens with inner loop reset over copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
- $placeholder = $arrayInner;
- while(list(,$i) = each($placeholder)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-?>
---EXPECTF--
-Correct - with inner loop reset.
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens without inner loop reset.
-inloop 0 for key1
-inloop 1 for key1
-What happens without inner loop reset but copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens with inner loop reset over copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
diff --git a/tests/lang/bison1.phpt b/tests/lang/bison1.phpt
index 3571576fb8..f77cce0055 100644
--- a/tests/lang/bison1.phpt
+++ b/tests/lang/bison1.phpt
@@ -2,8 +2,8 @@
Bison weirdness
--FILE--
<?php
-error_reporting(E_ALL & ~E_NOTICE);
echo "blah-$foo\n";
?>
---EXPECT--
+--EXPECTF--
+Warning: Undefined variable: foo in %s on line %d
blah-
diff --git a/tests/lang/bug17115.phpt b/tests/lang/bug17115.phpt
deleted file mode 100644
index 9500352799..0000000000
--- a/tests/lang/bug17115.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #17115 (lambda functions produce segfault with static vars)
---FILE--
-<?php
-$func = create_function('','
- static $foo = 0;
- return $foo++;
-');
-var_dump($func());
-var_dump($func());
-var_dump($func());
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(0)
-int(1)
-int(2)
diff --git a/tests/lang/bug22510.phpt b/tests/lang/bug22510.phpt
index dbf7756daa..842373c6c6 100644
--- a/tests/lang/bug22510.phpt
+++ b/tests/lang/bug22510.phpt
@@ -1,7 +1,5 @@
--TEST--
Bug #22510 (segfault among complex references)
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
class foo
diff --git a/tests/lang/bug22690.phpt b/tests/lang/bug22690.phpt
deleted file mode 100644
index 85ddcd3487..0000000000
--- a/tests/lang/bug22690.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #22690 (ob_start() is broken with create_function() callbacks)
---FILE--
-<?php
- $foo = create_function('$s', 'return strtoupper($s);');
- ob_start($foo);
- echo $foo("bar\n");
-?>
-bar
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-BAR
-BAR
diff --git a/tests/lang/bug23384.phpt b/tests/lang/bug23384.phpt
index 2dc3f2308b..220cf9f654 100644
--- a/tests/lang/bug23384.phpt
+++ b/tests/lang/bug23384.phpt
@@ -5,7 +5,7 @@ Bug #23384 (use of class constants in statics)
define('TEN', 10);
class Foo {
const HUN = 100;
- function test($x = Foo::HUN) {
+ static function test($x = Foo::HUN) {
static $arr2 = array(TEN => 'ten');
static $arr = array(Foo::HUN => 'ten');
@@ -18,8 +18,7 @@ class Foo {
Foo::test();
echo Foo::HUN."\n";
?>
---EXPECTF--
-Deprecated: Non-static method Foo::test() should not be called statically in %sbug23384.php on line %d
+--EXPECT--
Array
(
[100] => ten
diff --git a/tests/lang/bug23584.phpt b/tests/lang/bug23584.phpt
index 417cfb0856..b9dc10ac67 100644
--- a/tests/lang/bug23584.phpt
+++ b/tests/lang/bug23584.phpt
@@ -9,5 +9,5 @@ error_reporting(E_ALL);
echo $foo;
?>
---EXPECTREGEX--
-Notice: Undefined variable:.*foo in .* on line 6
+--EXPECTF--
+Warning: Undefined variable: foo in %s on line 6
diff --git a/tests/lang/bug23922.phpt b/tests/lang/bug23922.phpt
deleted file mode 100644
index 22c4aaa7d4..0000000000
--- a/tests/lang/bug23922.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #23922 (scope doesn't properly propagate into internal functions)
---FILE--
-<?php
- class foo
- {
- public $foo = 1;
-
- function as_string()
- { assert('$this->foo == 1'); }
-
- function as_expr()
- { assert($this->foo == 1); }
- }
-
- $foo = new foo();
- $foo->as_expr();
- $foo->as_string();
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
diff --git a/tests/lang/bug24499.phpt b/tests/lang/bug24499.phpt
index 6ce56dbad7..263293391f 100644
--- a/tests/lang/bug24499.phpt
+++ b/tests/lang/bug24499.phpt
@@ -12,7 +12,8 @@ class Id {
}
$id = new Id();
-@$obj->foo = "bar";
+$obj = new stdClass;
+$obj->foo = "bar";
$id->tester($obj);
print_r($obj);
?>
diff --git a/tests/lang/bug24926.phpt b/tests/lang/bug24926.phpt
deleted file mode 100644
index f73d265f38..0000000000
--- a/tests/lang/bug24926.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Bug #24926 (lambda function (create_function()) cannot be stored in a class property)
---FILE--
-<?php
-
-error_reporting (E_ALL);
-
-class foo {
-
- public $functions = array();
-
- function __construct()
- {
- $function = create_function('', 'return "FOO\n";');
- print($function());
-
- $this->functions['test'] = $function;
- print($this->functions['test']()); // werkt al niet meer
-
- }
-}
-
-$a = new foo ();
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-FOO
-FOO
diff --git a/tests/lang/bug25547.phpt b/tests/lang/bug25547.phpt
index b54f467ea8..eae32e7223 100644
--- a/tests/lang/bug25547.phpt
+++ b/tests/lang/bug25547.phpt
@@ -3,7 +3,7 @@ Bug #25547 (error_handler and array index with function call)
--FILE--
<?php
-function handler($errno, $errstr, $errfile, $errline, $context)
+function handler($errno, $errstr, $errfile, $errline)
{
echo __FUNCTION__ . "($errstr)\n";
}
diff --git a/tests/lang/bug27439.phpt b/tests/lang/bug27439.phpt
index 4bcadb78fd..de4bcd05a7 100644
--- a/tests/lang/bug27439.phpt
+++ b/tests/lang/bug27439.phpt
@@ -65,7 +65,7 @@ echo "===DONE===";
?>
--EXPECTF--
123
-Notice: Undefined property: test::$foobar in %s on line %d
+Warning: Undefined property: test::$foobar in %s on line %d
Warning: Invalid argument supplied for foreach() in %s on line %d
diff --git a/tests/lang/bug29893.phpt b/tests/lang/bug29893.phpt
index 25679893d2..d9af914191 100644
--- a/tests/lang/bug29893.phpt
+++ b/tests/lang/bug29893.phpt
@@ -3,9 +3,11 @@ Bug #29893 (segfault when using array as index)
--FILE--
<?php
$base = 50;
-$base[$base] -= 0;
+try {
+ $base[$base] -= 0;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: Cannot use a scalar value as an array in %sbug29893.php on line %d
-===DONE===
+--EXPECT--
+Cannot use a scalar value as an array
diff --git a/tests/lang/bug71897.phpt b/tests/lang/bug71897.phpt
index 5864b1dece..b2c41a359f 100644
--- a/tests/lang/bug71897.phpt
+++ b/tests/lang/bug71897.phpt
@@ -10,6 +10,4 @@ eval("
?>
--EXPECTF--
-Warning: Unexpected character in input: '%s' (ASCII=127) state=0 in %s(%d) : eval()'d code on line %d
-
-Parse error: syntax error, unexpected 'b' (T_STRING) in %s(%d) : eval()'d code on line %d
+Parse error: syntax error, unexpected '%s' (T_BAD_CHARACTER) in %s on line %d
diff --git a/tests/lang/bug7515.phpt b/tests/lang/bug7515.phpt
index 5c7756c6a1..8927c5df94 100644
--- a/tests/lang/bug7515.phpt
+++ b/tests/lang/bug7515.phpt
@@ -1,14 +1,13 @@
--TEST--
Bug #7515 (weird & invisible referencing of objects)
---INI--
-error_reporting=2039
--FILE--
<?php
class obj {
function method() {}
}
-$o->root=new obj();
+$o = new stdClass;
+$o->root = new obj();
ob_start();
var_dump($o);
@@ -30,6 +29,5 @@ y=$y
";
}
?>
---EXPECTF--
-Warning: Creating default object from empty value in %s on line %d
+--EXPECT--
success
diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt
deleted file mode 100644
index ce175495aa..0000000000
--- a/tests/lang/each_binary_safety.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Binary safety of each() for both keys and values
---FILE--
-<?php
-error_reporting(E_ALL);
-$arr = array ("foo\0bar" => "foo\0bar");
-while (list($key, $val) = each($arr)) {
- echo strlen($key), ': ';
- echo urlencode($key), ' => ', urlencode($val), "\n";
-}
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-7: foo%00bar => foo%00bar
diff --git a/tests/lang/engine_assignExecutionOrder_002.phpt b/tests/lang/engine_assignExecutionOrder_002.phpt
index dbb0c0aba4..a8ab0beb10 100644
--- a/tests/lang/engine_assignExecutionOrder_002.phpt
+++ b/tests/lang/engine_assignExecutionOrder_002.phpt
@@ -10,7 +10,11 @@ echo "A=$a B=$b\n";
// Warning: Cannot use a scalar value as an array in %s on line %d
-$c[$c=1] = 1;
+try {
+ $c[$c=1] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
// i++ evaluated first, so $d[0] is 10
$d = array(0,10);
@@ -90,8 +94,7 @@ print_r($ee);
?>
--EXPECTF--
A=hello B=bye
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
array(2) {
[0]=>
int(10)
diff --git a/tests/lang/engine_assignExecutionOrder_008.phpt b/tests/lang/engine_assignExecutionOrder_008.phpt
index 310e0d9964..76b0cb1a7c 100644
--- a/tests/lang/engine_assignExecutionOrder_008.phpt
+++ b/tests/lang/engine_assignExecutionOrder_008.phpt
@@ -29,18 +29,24 @@ echo $a[$i[0][0]=f()][++$i[0][0]];
unset($i);
echo "\n" . '$i->p=f(): ';
+$i = new stdClass;
echo $a[$i->p=f()][++$i->p];
unset($i);
echo "\n" . '$i->p->q=f(): ';
+$i = new stdClass;
+$i->p = new stdClass;
echo $a[$i->p->q=f()][++$i->p->q];
unset($i);
echo "\n" . '$i->p[0]=f(): ';
+$i = new stdClass;
echo $a[$i->p[0]=f()][++$i->p[0]];
unset($i);
echo "\n" . '$i->p[0]->p=f(): ';
+$i = new stdClass;
+$i->p[0] = new stdClass;
echo $a[$i->p[0]->p=f()][++$i->p[0]->p];
unset($i);
@@ -59,28 +65,16 @@ echo "\n" . 'C::$p->q=f(): ';
C::$p = new stdclass;
echo $a[C::$p->q=f()][++C::$p->q];
?>
---EXPECTF--
+--EXPECT--
$i=f(): good
$$x=f(): good
${'i'}=f(): good
$i[0]=f(): good
$i[0][0]=f(): good
-$i->p=f():
-Warning: Creating default object from empty value in %s on line %d
-good
-$i->p->q=f():
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-good
-$i->p[0]=f():
-Warning: Creating default object from empty value in %s on line %d
-good
-$i->p[0]->p=f():
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-good
+$i->p=f(): good
+$i->p->q=f(): good
+$i->p[0]=f(): good
+$i->p[0]->p=f(): good
C::$p=f(): good
C::$p[0]=f(): good
C::$p->q=f(): good
diff --git a/tests/lang/foreachLoop.016.phpt b/tests/lang/foreachLoop.016.phpt
index fa1267fa8d..0fc57147d9 100644
--- a/tests/lang/foreachLoop.016.phpt
+++ b/tests/lang/foreachLoop.016.phpt
@@ -46,6 +46,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b' . "\n";
+ $a = new stdClass;
$b = $a->b = array('original');
foreach($a->b as $k=>&$v) {
$v = 'changed';
@@ -54,6 +55,8 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b->c' . "\n";
+ $a = new stdClass;
+ $a->b = new stdClass;
$b = $a->b->c = array('original');
foreach($a->b as $k=>&$v) {
$v = 'changed';
@@ -62,6 +65,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b[0]' . "\n";
+ $a = new stdClass;
$b = $a->b[0] = array('original');
foreach($a->b[0] as $k=>&$v) {
$v = 'changed';
@@ -70,6 +74,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b[0][0]' . "\n";
+ $a = new stdClass;
$b = $a->b[0][0] = array('original');
foreach($a->b[0][0] as $k=>&$v) {
$v = 'changed';
@@ -78,6 +83,8 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b[0]->c' . "\n";
+ $a = new stdClass;
+ $a->b[0] = new stdClass;
$b = $a->b[0]->c = array('original');
foreach($a->b[0]->c as $k=>&$v) {
$v = 'changed';
@@ -108,6 +115,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset(C::$a[0], $b);
echo "\n" . 'C::$a[0]->b' . "\n";
+ C::$a[0] = new stdClass;
C::$a[0]->b = array('original');
$b = C::$a[0]->b;
foreach(C::$a[0]->b as $k=>&$v) {
@@ -116,7 +124,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
var_dump($b);
unset(C::$a[0]->b, $b);
?>
---EXPECTF--
+--EXPECT--
$a
array(1) {
[0]=>
@@ -148,44 +156,30 @@ array(1) {
}
$a->b
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b->c
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0]
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0][0]
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0]->c
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
@@ -204,8 +198,6 @@ array(1) {
}
C::$a[0]->b
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
diff --git a/tests/lang/foreachLoopObjects.004.phpt b/tests/lang/foreachLoopObjects.004.phpt
index 01e4e9fd9a..283e6be90c 100644
--- a/tests/lang/foreachLoopObjects.004.phpt
+++ b/tests/lang/foreachLoopObjects.004.phpt
@@ -34,13 +34,13 @@ Removing the current element from an iterated object.
string(10) "Original a"
string(10) "Original b"
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
string(10) "Original c"
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
string(10) "Original d"
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
string(10) "Original e"
object(C)#%d (4) {
["a"]=>
diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt
index 741b6604c0..bd1fa5b4c5 100644
--- a/tests/lang/func_get_arg_variation.phpt
+++ b/tests/lang/func_get_arg_variation.phpt
@@ -6,9 +6,6 @@ func_get_arg test
function foo($a)
{
$a=5;
- echo func_get_arg();
- echo func_get_arg(2,2);
- echo func_get_arg("hello");
echo func_get_arg(-1);
echo func_get_arg(2);
}
@@ -16,12 +13,6 @@ foo(2);
echo "\n";
?>
--EXPECTF--
-Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: func_get_arg() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: func_get_arg() expects parameter 1 to be int, string given in %s on line %d
-
Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
diff --git a/tests/lang/passByReference_003.phpt b/tests/lang/passByReference_003.phpt
index ad9e1e39de..de9ac09d8d 100644
--- a/tests/lang/passByReference_003.phpt
+++ b/tests/lang/passByReference_003.phpt
@@ -25,16 +25,16 @@ var_dump($undef2)
--EXPECTF--
Passing undefined by value
-Notice: Undefined variable: undef1 in %s on line %d
+Warning: Undefined variable: undef1 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
Inside passbyVal call:
NULL
After call
-Notice: Undefined variable: undef1 in %s on line %d
+Warning: Undefined variable: undef1 in %s on line %d
NULL
Passing undefined by reference
diff --git a/tests/lang/passByReference_005.phpt b/tests/lang/passByReference_005.phpt
index dc32962d67..82b79b684f 100644
--- a/tests/lang/passByReference_005.phpt
+++ b/tests/lang/passByReference_005.phpt
@@ -4,70 +4,95 @@ Pass uninitialised variables by reference and by value to test implicit initiali
<?php
function v($val) {
- $val = "Val changed";
+ $val = "Val changed";
}
function r(&$ref) {
- $ref = "Ref changed";
+ $ref = "Ref changed";
}
-
function vv($val1, $val2) {
- $val1 = "Val1 changed";
- $val2 = "Val2 changed";
+ $val1 = "Val1 changed";
+ $val2 = "Val2 changed";
}
function vr($val, &$ref) {
- $val = "Val changed";
- $ref = "Ref changed";
+ $val = "Val changed";
+ $ref = "Ref changed";
}
function rv(&$ref, $val) {
- $val = "Val changed";
- $ref = "Ref changed";
+ $val = "Val changed";
+ $ref = "Ref changed";
}
function rr(&$ref1, &$ref2) {
- $ref1 = "Ref1 changed";
- $ref2 = "Ref2 changed";
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
}
class C {
-
- function __construct($val, &$ref) {
- $val = "Val changed";
- $ref = "Ref changed";
- }
-
- function v($val) {
- $val = "Val changed";
- }
-
- function r(&$ref) {
- $ref = "Ref changed";
- }
-
- function vv($val1, $val2) {
- $val1 = "Val1 changed";
- $val2 = "Val2 changed";
- }
-
- function vr($val, &$ref) {
- $val = "Val changed";
- $ref = "Ref changed";
- }
-
- function rv(&$ref, $val) {
- $val = "Val changed";
- $ref = "Ref changed";
- }
-
- function rr(&$ref1, &$ref2) {
- $ref1 = "Ref1 changed";
- $ref2 = "Ref2 changed";
- }
-
+ function __construct($val, &$ref) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ function v($val) {
+ $val = "Val changed";
+ }
+
+ function r(&$ref) {
+ $ref = "Ref changed";
+ }
+
+ function vv($val1, $val2) {
+ $val1 = "Val1 changed";
+ $val2 = "Val2 changed";
+ }
+
+ function vr($val, &$ref) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ function rv(&$ref, $val) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ function rr(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
+
+ static function static_v($val) {
+ $val = "Val changed";
+ }
+
+ static function static_r(&$ref) {
+ $ref = "Ref changed";
+ }
+
+ static function static_vv($val1, $val2) {
+ $val1 = "Val1 changed";
+ $val2 = "Val2 changed";
+ }
+
+ static function static_vr($val, &$ref) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ static function static_rv(&$ref, $val) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ static function static_rr(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
}
echo "\n ---- Pass by ref / pass by val: functions ----\n";
@@ -95,24 +120,24 @@ var_dump($u1, $u2);
echo "\n\n ---- Pass by ref / pass by val: static method calls ----\n";
unset($u1, $u2);
-C::v($u1);
-C::r($u2);
+C::static_v($u1);
+C::static_r($u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::vv($u1, $u2);
+C::static_vv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::vr($u1, $u2);
+C::static_vr($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::rv($u1, $u2);
+C::static_rv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::rr($u1, $u2);
+C::static_rr($u1, $u2);
var_dump($u1, $u2);
echo "\n\n ---- Pass by ref / pass by val: instance method calls ----\n";
@@ -145,31 +170,31 @@ var_dump($u1, $u2);
--EXPECTF--
---- Pass by ref / pass by val: functions ----
-Notice: Undefined variable: u1 in %s on line 72
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 74
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u1 in %s on line 77
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 77
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 78
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 78
+Warning: Undefined variable: u2 in %s on line %d
NULL
NULL
-Notice: Undefined variable: u1 in %s on line 81
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 82
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u2 in %s on line 85
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 86
+Warning: Undefined variable: u2 in %s on line %d
string(11) "Ref changed"
NULL
string(12) "Ref1 changed"
@@ -178,82 +203,70 @@ string(12) "Ref2 changed"
---- Pass by ref / pass by val: static method calls ----
-Deprecated: Non-static method C::v() should not be called statically in %s on line 95
-
-Notice: Undefined variable: u1 in %s on line 95
+Warning: Undefined variable: u1 in %s on line %d
-Deprecated: Non-static method C::r() should not be called statically in %s on line 96
-
-Notice: Undefined variable: u1 in %s on line 97
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Deprecated: Non-static method C::vv() should not be called statically in %s on line 100
-
-Notice: Undefined variable: u1 in %s on line 100
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 100
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 101
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 101
+Warning: Undefined variable: u2 in %s on line %d
NULL
NULL
-Deprecated: Non-static method C::vr() should not be called statically in %s on line 104
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 104
-
-Notice: Undefined variable: u1 in %s on line 105
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Deprecated: Non-static method C::rv() should not be called statically in %s on line 108
-
-Notice: Undefined variable: u2 in %s on line 108
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 109
+Warning: Undefined variable: u2 in %s on line %d
string(11) "Ref changed"
NULL
-
-Deprecated: Non-static method C::rr() should not be called statically in %s on line 112
string(12) "Ref1 changed"
string(12) "Ref2 changed"
---- Pass by ref / pass by val: instance method calls ----
-Notice: Undefined variable: u1 in %s on line 117
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 118
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u1 in %s on line 121
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 123
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u1 in %s on line 126
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 126
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 127
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 127
+Warning: Undefined variable: u2 in %s on line %d
NULL
NULL
-Notice: Undefined variable: u1 in %s on line 130
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 131
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u2 in %s on line 134
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 135
+Warning: Undefined variable: u2 in %s on line %d
string(11) "Ref changed"
NULL
string(12) "Ref1 changed"
diff --git a/tests/lang/passByReference_006.phpt b/tests/lang/passByReference_006.phpt
index c1478663ca..ce5d5ca2af 100644
--- a/tests/lang/passByReference_006.phpt
+++ b/tests/lang/passByReference_006.phpt
@@ -3,70 +3,54 @@ Pass uninitialised objects and arrays by reference to test implicit initialisati
--FILE--
<?php
-function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
+function refs(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
- $ref3 = "Ref3 changed";
- $ref4 = "Ref4 changed";
- $ref5 = "Ref5 changed";
}
class C {
- function __construct(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
+ function __construct(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
- $ref3 = "Ref3 changed";
- $ref4 = "Ref4 changed";
- $ref5 = "Ref5 changed";
}
- function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
+ function refs(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
+
+ static function static_refs(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
- $ref3 = "Ref3 changed";
- $ref4 = "Ref4 changed";
- $ref5 = "Ref5 changed";
}
}
echo "\n ---- Pass uninitialised array & object by ref: function call ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+refs($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
echo "\n ---- Pass uninitialised arrays & objects by ref: static method call ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-C::refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+C::static_refs($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
echo "\n\n---- Pass uninitialised arrays & objects by ref: constructor ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-$c = new C($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+$c = new C($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
echo "\n ---- Pass uninitialised arrays & objects by ref: instance method call ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-$c->refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+$c->refs($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
?>
---EXPECTF--
- ---- Pass uninitialised array & object by ref: function call ---
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
+--EXPECT--
+---- Pass uninitialised array & object by ref: function call ---
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -78,43 +62,8 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
---- Pass uninitialised arrays & objects by ref: static method call ---
-
-Deprecated: Non-static method C::refs() should not be called statically in %s on line 39
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -126,42 +75,9 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
---- Pass uninitialised arrays & objects by ref: constructor ---
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -173,41 +89,8 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
---- Pass uninitialised arrays & objects by ref: instance method call ---
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -219,24 +102,3 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
diff --git a/tests/lang/short_tags.004.phpt b/tests/lang/short_tags.004.phpt
index 6df8af1c2a..9bf73b064b 100644
--- a/tests/lang/short_tags.004.phpt
+++ b/tests/lang/short_tags.004.phpt
@@ -29,6 +29,6 @@ This gets echoed twice
<? $b=3; ?>
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
diff --git a/tests/lang/type_hints_003.phpt b/tests/lang/type_hints_003.phpt
index f6b04dabff..00471b9448 100644
--- a/tests/lang/type_hints_003.phpt
+++ b/tests/lang/type_hints_003.phpt
@@ -8,4 +8,4 @@ class T {
}
?>
--EXPECTF--
-Fatal error: Default value for parameters with a class type can only be NULL in %stype_hints_003.php on line 3
+Fatal error: Cannot use int as default value for parameter $p of type P in %s on line %d
diff --git a/tests/output/bug74815.phpt b/tests/output/bug74815.phpt
deleted file mode 100644
index 1d9c825999..0000000000
--- a/tests/output/bug74815.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #74815 crash with a combination of INI entries at startup
---FILE--
-<?php
-
-$php = getenv("TEST_PHP_EXECUTABLE");
-
-echo shell_exec("$php -n -d error_log=".__DIR__."/error_log.tmp -d error_reporting=E_ALL -d log_errors=On -d track_errors=On -v");
-
-?>
-==DONE==
---CLEAN--
-<?php
-unlink(__DIR__.'/error_log.tmp');
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-%A
-==DONE==
diff --git a/tests/output/ob_014.phpt b/tests/output/ob_014.phpt
index 09534270f3..bc46f2ae58 100644
--- a/tests/output/ob_014.phpt
+++ b/tests/output/ob_014.phpt
@@ -4,19 +4,12 @@ output buffering - failure
<?php
ob_start("str_rot13");
echo "foo\n";
-// str_rot13 expects 1 param and returns NULL when passed 2 params.
-// It is invoked with 2 params when used as an OB callback.
-// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
-ob_end_flush();
-
-// Show the error.
-print_r(error_get_last());
+try {
+ ob_end_flush();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Array
-(
- [type] => 2
- [message] => str_rot13() expects exactly 1 parameter, 2 given
- [file] => %s
- [line] => 7
-)
+--EXPECT--
+foo
+str_rot13() expects exactly 1 parameter, 2 given
diff --git a/tests/output/ob_015.phpt b/tests/output/ob_015.phpt
index 2acdb40d0a..2bc08687d7 100644
--- a/tests/output/ob_015.phpt
+++ b/tests/output/ob_015.phpt
@@ -3,20 +3,13 @@ output buffering - failure
--FILE--
<?php
ob_start("str_rot13", 1);
-echo "foo\n";
-// str_rot13 expects 1 param and returns NULL when passed 2 params.
-// It is invoked with 2 params when used as an OB callback.
-// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
+try {
+ echo "foo\n";
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ob_end_flush();
-
-// Show the error.
-print_r(error_get_last());
?>
---EXPECTF--
-Array
-(
- [type] => 2
- [message] => str_rot13() expects exactly 1 parameter, 2 given
- [file] => %s
- [line] => 7
-)
+--EXPECT--
+foo
+str_rot13() expects exactly 1 parameter, 2 given
diff --git a/tests/output/ob_start_basic_005.phpt b/tests/output/ob_start_basic_005.phpt
index 7cab6ed35f..dda6587614 100644
--- a/tests/output/ob_start_basic_005.phpt
+++ b/tests/output/ob_start_basic_005.phpt
@@ -25,9 +25,10 @@ checkAndClean();
?>
--EXPECTF--
-Warning: ob_start(): non-static method C::h() should not be called statically in %s on line 20
-bool(true)
+Warning: ob_start(): non-static method C::h() cannot be called statically in %s on line %d
+
+Notice: ob_start(): failed to create buffer in %s on line %d
+bool(false)
Array
(
- [0] => C::h
)
diff --git a/tests/output/ob_start_error_001.phpt b/tests/output/ob_start_error_001.phpt
index 29288e2028..83b3a4186d 100644
--- a/tests/output/ob_start_error_001.phpt
+++ b/tests/output/ob_start_error_001.phpt
@@ -16,38 +16,14 @@ $arg_2 = 0;
$arg_3 = false;
$extra_arg = 1;
-echo "\n- Too many arguments\n";
-var_dump(ob_start($arg_1, $arg_2, $arg_3, $extra_arg));
-
-echo "\n- Arg 1 wrong type\n";
+echo "\nArg 1 wrong type\n";
var_dump(ob_start(1.5));
-echo "\n- Arg 2 wrong type\n";
-var_dump(ob_start("justPrint", "this should be an int"));
-
-echo "\n- Arg 3 wrong type\n";
-var_dump(ob_start("justPrint", 0, "this should be a bool"));
-
?>
--EXPECTF--
-- Too many arguments
-
-Warning: ob_start() expects at most 3 parameters, 4 given in %s on line 17
-NULL
-
-- Arg 1 wrong type
+Arg 1 wrong type
-Warning: ob_start(): no array or string given in %s on line 20
+Warning: ob_start(): no array or string given in %s on line 17
-Notice: ob_start(): failed to create buffer in %s on line 20
+Notice: ob_start(): failed to create buffer in %s on line 17
bool(false)
-
-- Arg 2 wrong type
-
-Warning: ob_start() expects parameter 2 to be int, string given in %s on line 23
-NULL
-
-- Arg 3 wrong type
-
-Warning: ob_start() expects parameter 3 to be int, string given in %s on line 26
-NULL
diff --git a/tests/output/stream_isatty.inc b/tests/output/stream_isatty.inc
index 4b7f39986f..9700fd98f1 100644
--- a/tests/output/stream_isatty.inc
+++ b/tests/output/stream_isatty.inc
@@ -12,7 +12,6 @@ function testToStdOut()
'STDERR (constant)' => STDERR,
'STDERR (fopen)' => fopen('php://stderr', 'wb'),
'STDERR (php://fd/2)' => fopen('php://fd/2', 'wb'),
- 'Not a stream' => 'foo',
'Invalid stream (php://temp)' => fopen('php://temp', 'wb'),
'Invalid stream (php://input)' => fopen('php://input', 'wb'),
'Invalid stream (php://memory)' => fopen('php://memory', 'wb'),
diff --git a/tests/output/stream_isatty_err.phpt b/tests/output/stream_isatty_err.phpt
index 5513781a09..55a25f1c9f 100644
--- a/tests/output/stream_isatty_err.phpt
+++ b/tests/output/stream_isatty_err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(true)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-err.phpt b/tests/output/stream_isatty_in-err.phpt
index de2348a5b5..2554eb4689 100644
--- a/tests/output/stream_isatty_in-err.phpt
+++ b/tests/output/stream_isatty_in-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(true)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-out-err.phpt b/tests/output/stream_isatty_in-out-err.phpt
index fea7bc64d7..496bdd100e 100644
--- a/tests/output/stream_isatty_in-out-err.phpt
+++ b/tests/output/stream_isatty_in-out-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-out.phpt b/tests/output/stream_isatty_in-out.phpt
index 6ad7a03fc3..d58e9aa05c 100644
--- a/tests/output/stream_isatty_in-out.phpt
+++ b/tests/output/stream_isatty_in-out.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(true)
STDERR (fopen): bool(true)
STDERR (php://fd/2): bool(true)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_out-err.phpt b/tests/output/stream_isatty_out-err.phpt
index ae3af3a300..e3ec1237bc 100644
--- a/tests/output/stream_isatty_out-err.phpt
+++ b/tests/output/stream_isatty_out-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_out.phpt b/tests/output/stream_isatty_out.phpt
index dc81577446..3ea4996ac4 100644
--- a/tests/output/stream_isatty_out.phpt
+++ b/tests/output/stream_isatty_out.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(true)
STDERR (fopen): bool(true)
STDERR (php://fd/2): bool(true)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt
deleted file mode 100644
index a95281fc13..0000000000
--- a/tests/run-test/test005.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Error message handling (with ZendOpcache)
---SKIPIF--
-<?php
-extension_loaded("Zend Opcache") or die("skip Zend Opcache is not loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$zero = 0;
-$error = 1 / $zero;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-string(1) "1"
-string(5) "32767"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-NULL
-string(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt
deleted file mode 100644
index c289e7a696..0000000000
--- a/tests/run-test/test008.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Error message handling (without ZendOpcache)
---SKIPIF--
-<?php
-!extension_loaded("Zend Opcache") or die("skip Zend Opcache is loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', "0");
-var_dump(ini_get('display_errors'));
-$error = 1 / 0;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-string(1) "1"
-string(5) "32767"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-string(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt
deleted file mode 100644
index d247eb36c2..0000000000
--- a/tests/run-test/test008a.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Error message handling (with ZendOpcache)
---SKIPIF--
-<?php
-if (!extension_loaded("Zend Opcache")) die("skip Zend Opcache is not loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$zero = 0;
-$error = 1 / $zero;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-string(1) "1"
-string(5) "32767"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-NULL
-string(%d) "%sivision by zer%s"
diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt
index bf1fb67711..6d0a9d12b9 100644
--- a/tests/strings/001.phpt
+++ b/tests/strings/001.phpt
@@ -3,8 +3,6 @@ String functions
--FILE--
<?php
-error_reporting(0);
-
echo "Testing strtok: ";
$str = "testing 1/2\\3";
@@ -26,7 +24,7 @@ if ($tok1 != "testing") {
echo "Testing strstr: ";
$test = "This is a test";
-$found1 = strstr($test, 32);
+$found1 = strstr($test, chr(32));
$found2 = strstr($test, "a ");
if ($found1 != " is a test") {
echo("failed 1\n");
@@ -39,7 +37,7 @@ if ($found1 != " is a test") {
echo "Testing strrchr: ";
$test = "fola fola blakken";
$found1 = strrchr($test, "b");
-$found2 = strrchr($test, 102);
+$found2 = strrchr($test, chr(102));
if ($found1 != "blakken") {
echo("failed 1\n");
} elseif ($found2 != "fola blakken") {
diff --git a/tests/strings/offsets_chaining_1.phpt b/tests/strings/offsets_chaining_1.phpt
index 0c3c0074b1..18b6fa2f9d 100644
--- a/tests/strings/offsets_chaining_1.phpt
+++ b/tests/strings/offsets_chaining_1.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_2.phpt b/tests/strings/offsets_chaining_2.phpt
index 0c3c0074b1..18b6fa2f9d 100644
--- a/tests/strings/offsets_chaining_2.phpt
+++ b/tests/strings/offsets_chaining_2.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_3.phpt b/tests/strings/offsets_chaining_3.phpt
index fc11b8d797..12cac5917f 100644
--- a/tests/strings/offsets_chaining_3.phpt
+++ b/tests/strings/offsets_chaining_3.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_4.phpt b/tests/strings/offsets_chaining_4.phpt
index fc11b8d797..12cac5917f 100644
--- a/tests/strings/offsets_chaining_4.phpt
+++ b/tests/strings/offsets_chaining_4.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_5.phpt b/tests/strings/offsets_chaining_5.phpt
index efcf2f3074..1c9da47af3 100644
--- a/tests/strings/offsets_chaining_5.phpt
+++ b/tests/strings/offsets_chaining_5.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$array = array('expected_array' => "foobar");
diff --git a/travis/compile.sh b/travis/compile.sh
index e373d9b90c..e4706e0f96 100755
--- a/travis/compile.sh
+++ b/travis/compile.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-if [[ "$ENABLE_MAINTAINER_ZTS" == 1 ]]; then
- TS="--enable-maintainer-zts";
+if [[ "$ENABLE_ZTS" == 1 ]]; then
+ TS="--enable-zts";
else
TS="";
fi
diff --git a/win32/build/Makefile b/win32/build/Makefile
index 9435df5c46..a6b54c07ff 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -1,6 +1,4 @@
# +----------------------------------------------------------------------+
-# | PHP Version 7 |
-# +----------------------------------------------------------------------+
# | Copyright (c) The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
index 7bbb800249..7678ac7b4a 100644
--- a/win32/build/buildconf.js
+++ b/win32/build/buildconf.js
@@ -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/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
index 864bc882ff..bfe57ed488 100644
--- a/win32/build/config.w32.h.in
+++ b/win32/build/config.w32.h.in
@@ -67,7 +67,6 @@
#define HAVE_GETLOGIN 1
#define HAVE_MEMMOVE 1
#define HAVE_REGCOMP 1
-#define HAVE_LOCALE_H 1
#define HAVE_SHUTDOWN 1
#define HAVE_STRCASECMP 1
#define HAVE_UTIME 1
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index 83d5907a4f..e5c0ccd2d4 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -1,8 +1,6 @@
// Utils for configure script
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -95,11 +93,11 @@ if (typeof(CWD) == "undefined") {
}
/* defaults; we pick up the precise versions from configure.ac */
-var PHP_VERSION = 7;
-var PHP_MINOR_VERSION = 4;
+var PHP_VERSION = 8;
+var PHP_MINOR_VERSION = 0;
var PHP_RELEASE_VERSION = 0;
var PHP_EXTRA_VERSION = "";
-var PHP_VERSION_STRING = "7.4.0";
+var PHP_VERSION_STRING = "8.0.0";
/* Get version numbers and DEFINE as a string */
function get_version_numbers()
diff --git a/win32/build/deplister.c b/win32/build/deplister.c
index b5dd059c98..f211f8add9 100644
--- a/win32/build/deplister.c
+++ b/win32/build/deplister.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/win32/build/phpize.js.in b/win32/build/phpize.js.in
index 032559b371..11a653f05e 100644
--- a/win32/build/phpize.js.in
+++ b/win32/build/phpize.js.in
@@ -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/win32/codepage.c b/win32/codepage.c
index 48f60595b4..e069030cba 100644
--- a/win32/codepage.c
+++ b/win32/codepage.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, |
@@ -179,16 +177,12 @@ PW32CP wchar_t *php_win32_cp_conv_ascii_to_w(const char* in, size_t in_len, size
while (end - idx > 15) {
const __m128i block = _mm_load_si128((__m128i *)idx);
- {
- const __m128i lo = _mm_unpacklo_epi8(block, mask);
- _mm_storeu_si128((__m128i *)ret_idx, lo);
- }
+ const __m128i lo = _mm_unpacklo_epi8(block, mask);
+ _mm_storeu_si128((__m128i *)ret_idx, lo);
ret_idx += 8;
- {
- const __m128i hi = _mm_unpackhi_epi8(block, mask);
- _mm_storeu_si128((__m128i *)ret_idx, hi);
- }
+ const __m128i hi = _mm_unpackhi_epi8(block, mask);
+ _mm_storeu_si128((__m128i *)ret_idx, hi);
idx += 16;
ret_idx += 8;
diff --git a/win32/codepage.h b/win32/codepage.h
index 0dd72562b6..8f8fbcbaa1 100644
--- a/win32/codepage.h
+++ b/win32/codepage.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/win32/console.c b/win32/console.c
index 0b1bb0eff9..7833dd97d3 100644
--- a/win32/console.c
+++ b/win32/console.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/win32/console.h b/win32/console.h
index 2d36d85508..47336a0a7b 100644
--- a/win32/console.h
+++ b/win32/console.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/win32/dllmain.c b/win32/dllmain.c
index 4743f732e9..7850a79699 100644
--- a/win32/dllmain.c
+++ b/win32/dllmain.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/win32/ftok.c b/win32/ftok.c
index db789f8b70..3e379e82ef 100644
--- a/win32/ftok.c
+++ b/win32/ftok.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/win32/getrusage.c b/win32/getrusage.c
index de67f7f8d2..c956613c69 100644
--- a/win32/getrusage.c
+++ b/win32/getrusage.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/win32/getrusage.h b/win32/getrusage.h
index c41c026aa2..c5a95c436b 100644
--- a/win32/getrusage.h
+++ b/win32/getrusage.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/win32/globals.c b/win32/globals.c
index 9bb392f42a..e9ba61761a 100644
--- a/win32/globals.c
+++ b/win32/globals.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/win32/grp.h b/win32/grp.h
index 301babed4e..f8cc8fe206 100644
--- a/win32/grp.h
+++ b/win32/grp.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/win32/inet.c b/win32/inet.c
index 7361b89bc2..4a835ca7a3 100644
--- a/win32/inet.c
+++ b/win32/inet.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/win32/inet.h b/win32/inet.h
index b57d78903d..06b646bd57 100644
--- a/win32/inet.h
+++ b/win32/inet.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/win32/ioutil.c b/win32/ioutil.c
index f7db410dd2..459fc7a62e 100644
--- a/win32/ioutil.c
+++ b/win32/ioutil.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/win32/ioutil.h b/win32/ioutil.h
index 34104a3f45..71a7b79943 100644
--- a/win32/ioutil.h
+++ b/win32/ioutil.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/win32/ipc.h b/win32/ipc.h
index c7cb476353..bbefb48703 100644
--- a/win32/ipc.h
+++ b/win32/ipc.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/win32/nice.c b/win32/nice.c
index 05aae465ed..181f6856d2 100644
--- a/win32/nice.c
+++ b/win32/nice.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/win32/nice.h b/win32/nice.h
index 385855c2ea..dc082035d9 100644
--- a/win32/nice.h
+++ b/win32/nice.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/win32/php_registry.h b/win32/php_registry.h
index f46c482085..9effd01d4e 100644
--- a/win32/php_registry.h
+++ b/win32/php_registry.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/win32/php_win32_globals.h b/win32/php_win32_globals.h
index bb91f08c50..05da08104b 100644
--- a/win32/php_win32_globals.h
+++ b/win32/php_win32_globals.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/win32/registry.c b/win32/registry.c
index 99c3ce365f..09d9c98868 100644
--- a/win32/registry.c
+++ b/win32/registry.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/win32/select.c b/win32/select.c
index b02766e4f3..865c3e44b9 100644
--- a/win32/select.c
+++ b/win32/select.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/win32/select.h b/win32/select.h
index c23eb87ddb..f6f9af99c1 100644
--- a/win32/select.h
+++ b/win32/select.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/win32/signal.c b/win32/signal.c
index bdfd7033f3..34bc9a8bab 100644
--- a/win32/signal.c
+++ b/win32/signal.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/win32/sockets.c b/win32/sockets.c
index 461ce69888..c38d2bccbc 100644
--- a/win32/sockets.c
+++ b/win32/sockets.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/win32/sockets.h b/win32/sockets.h
index 2e693f8840..f254133cc8 100644
--- a/win32/sockets.h
+++ b/win32/sockets.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/win32/syslog.h b/win32/syslog.h
index 5ea75d8486..560e8864fd 100644
--- a/win32/syslog.h
+++ b/win32/syslog.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/win32/winutil.c b/win32/winutil.c
index 578e66c074..a431025db8 100644
--- a/win32/winutil.c
+++ b/win32/winutil.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/win32/winutil.h b/win32/winutil.h
index f2faa95fa8..8acf87e671 100644
--- a/win32/winutil.h
+++ b/win32/winutil.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, |